[client] wayland: use nominal refresh for frame demand
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
build / client-tests (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client-tests (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client-tests (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client-tests (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client-tests (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client-tests (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client-tests (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client-tests (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled

Use the current wl_output mode for the requested producer cadence.
Presentation feedback can follow a slower VRR cadence, feeding that low
update rate back into the IDD. Select the fastest nominal mode when a
window spans multiple outputs.
This commit is contained in:
Geoffrey McRae
2026-08-05 10:51:48 +10:00
parent d815ef87d5
commit bca59df783
3 changed files with 35 additions and 2 deletions

View File

@@ -316,8 +316,9 @@ static void outputModeHandler(void * opaque, struct wl_output * wl_output, uint3
return; return;
struct WaylandOutput * node = opaque; struct WaylandOutput * node = opaque;
node->modeWidth = width; node->modeWidth = width;
node->modeHeight = height; node->modeHeight = height;
node->modeRefresh = refresh;
} }
static void outputDoneHandler(void * opaque, struct wl_output * output) static void outputDoneHandler(void * opaque, struct wl_output * output)
@@ -483,3 +484,27 @@ struct WaylandScale waylandOutputGetScale(struct wl_output * output)
return node->scale; return node->scale;
return waylandScaleFromInt(0); return waylandScaleFromInt(0);
} }
bool waylandOutputGetFramePeriod(uint64_t * period)
{
uint64_t fastest = 0;
struct SurfaceOutput * surfaceOutput;
wl_list_for_each(surfaceOutput, &wlWm.surfaceOutputs, link)
{
const struct WaylandOutput * output =
outputFind(surfaceOutput->output);
if (!output || output->modeRefresh <= 0)
continue;
const uint64_t candidate =
1000000000000ULL / (uint64_t)output->modeRefresh;
if (!fastest || candidate < fastest)
fastest = candidate;
}
if (!fastest)
return false;
*period = fastest;
return true;
}

View File

@@ -73,6 +73,12 @@ static void presentationFeedbackPresented(void * opaque,
bool waylandGetFramePeriod(uint64_t * period) bool waylandGetFramePeriod(uint64_t * period)
{ {
/* Frame demand must use the output's nominal rate. Basing demand on the
* observed presentation interval can lock a VRR session at its current,
* slower cadence. */
if (waylandOutputGetFramePeriod(period))
return true;
const uint64_t value = atomic_load(&wlWm.presentationPeriod); const uint64_t value = atomic_load(&wlWm.presentationPeriod);
if (!value) if (!value)
return false; return false;

View File

@@ -78,6 +78,7 @@ struct WaylandOutput
int32_t logicalHeight; int32_t logicalHeight;
int32_t modeWidth; int32_t modeWidth;
int32_t modeHeight; int32_t modeHeight;
int32_t modeRefresh;
bool modeRotate; bool modeRotate;
struct wl_output * output; struct wl_output * output;
struct zxdg_output_v1 * xdgOutput; struct zxdg_output_v1 * xdgOutput;
@@ -386,6 +387,7 @@ void waylandOutputFree(void);
void waylandOutputBind(uint32_t name, uint32_t version); void waylandOutputBind(uint32_t name, uint32_t version);
void waylandOutputTryUnbind(uint32_t name); void waylandOutputTryUnbind(uint32_t name);
struct WaylandScale waylandOutputGetScale(struct wl_output * output); struct WaylandScale waylandOutputGetScale(struct wl_output * output);
bool waylandOutputGetFramePeriod(uint64_t * period);
void waylandOutputColorMgmtInit(struct WaylandOutput * output); void waylandOutputColorMgmtInit(struct WaylandOutput * output);
void waylandOutputColorMgmtInitAll(void); void waylandOutputColorMgmtInitAll(void);
void waylandOutputUpdateHDRWhiteLevel(void); void waylandOutputUpdateHDRWhiteLevel(void);