mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-02-04 10:13:07 +00:00
fix: let wlroots determine frame_done timestamp for PRIME offload
When using PRIME GPU offload (e.g., NVIDIA renders, AMD displays), capturing the timestamp via clock_gettime in rendermon() causes frame timing issues. The timestamp is captured from the display GPU's clock, but rendering occurs on the offload GPU with different timing. This clock divergence causes stuttering that appears as "frames going backward in time" when the mouse is moved. By passing NULL to wlr_scene_output_send_frame_done(), we let wlroots determine the appropriate timestamp, which handles the PRIME offload case correctly.
This commit is contained in:
parent
6cd26568d5
commit
dd163a8ec4
8
dwl.c
8
dwl.c
@ -2154,7 +2154,6 @@ rendermon(struct wl_listener *listener, void *data)
|
|||||||
Monitor *m = wl_container_of(listener, m, frame);
|
Monitor *m = wl_container_of(listener, m, frame);
|
||||||
Client *c;
|
Client *c;
|
||||||
struct wlr_output_state pending = {0};
|
struct wlr_output_state pending = {0};
|
||||||
struct timespec now;
|
|
||||||
|
|
||||||
/* Render if no XDG clients have an outstanding resize and are visible on
|
/* Render if no XDG clients have an outstanding resize and are visible on
|
||||||
* this monitor. */
|
* this monitor. */
|
||||||
@ -2166,9 +2165,10 @@ rendermon(struct wl_listener *listener, void *data)
|
|||||||
wlr_scene_output_commit(m->scene_output, NULL);
|
wlr_scene_output_commit(m->scene_output, NULL);
|
||||||
|
|
||||||
skip:
|
skip:
|
||||||
/* Let clients know a frame has been rendered */
|
/* Let clients know a frame has been rendered. Pass NULL to let wlroots
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
* determine the timestamp, which is required for correct timing when
|
||||||
wlr_scene_output_send_frame_done(m->scene_output, &now);
|
* input and output clocks may diverge (e.g., PRIME GPU offload). */
|
||||||
|
wlr_scene_output_send_frame_done(m->scene_output, NULL);
|
||||||
wlr_output_state_finish(&pending);
|
wlr_output_state_finish(&pending);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user