Skip to content

Commit 2e61ffe

Browse files
committed
wayland: switch to separate queue for wp_image_description_v1
f0883cd fixed the issue that `set_color_management` would be called on every frame, however it didn't fix the problem that the first frame would have no image description set. Due to a lack of blocking here, events would end up happening in the following order: -> wl_surface.commit() -> wp_color_management_surface_v1.set_image_description(...) -> wl_surface.commit() -> wp_color_management_surface_v1.set_image_description(...) This would mean setting image description would always lag behind by 1 surface commit. This would effectively result in the first frame never having any image description set. Fix this by blocking until the compositor processes what's in the queue and responds with the ready event so we can set the image description.
1 parent 7037ff4 commit 2e61ffe

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

video/out/wayland_common.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3452,6 +3452,7 @@ static void set_color_management(struct vo_wayland_state *wl)
34523452
return;
34533453

34543454
struct pl_color_space color = wl->target_params.color;
3455+
struct wl_event_queue *cm_queue = NULL;
34553456
int primaries = wl->primaries_map[color.primaries];
34563457
int transfer = wl->transfer_map[color.transfer];
34573458
if (!primaries)
@@ -3489,8 +3490,15 @@ static void set_color_management(struct vo_wayland_state *wl)
34893490
wp_image_description_creator_params_v1_set_max_cll(image_creator_params, lrintf(hdr.max_cll));
34903491
wp_image_description_creator_params_v1_set_max_fall(image_creator_params, lrintf(hdr.max_fall));
34913492
}
3493+
34923494
struct wp_image_description_v1 *image_description = wp_image_description_creator_params_v1_create(image_creator_params);
3495+
cm_queue = wl_display_create_queue(wl->display);
3496+
wl_proxy_set_queue((struct wl_proxy *)image_description, cm_queue);
34933497
wp_image_description_v1_add_listener(image_description, &image_description_listener, wl);
3498+
/* Block here to ensure the compositor is ready to receive the
3499+
* image_description before we do anything else. */
3500+
wl_display_roundtrip_queue(wl->display, cm_queue);
3501+
wl_event_queue_destroy(cm_queue);
34943502
#endif
34953503
}
34963504

0 commit comments

Comments
 (0)