@@ -2107,6 +2107,7 @@ static void image_description_failed(void *data, struct wp_image_description_v1
21072107 uint32_t cause , const char * msg )
21082108{
21092109 struct vo_wayland_state * wl = data ;
2110+ wl -> image_desc_done = true;
21102111 MP_VERBOSE (wl , "Image description failed: %d, %s\n" , cause , msg );
21112112 wp_color_management_surface_v1_unset_image_description (wl -> color_surface );
21122113 wp_image_description_v1_destroy (image_description );
@@ -2116,8 +2117,9 @@ static void image_description_ready(void *data, struct wp_image_description_v1 *
21162117 uint32_t identity )
21172118{
21182119 struct vo_wayland_state * wl = data ;
2119- wp_color_management_surface_v1_set_image_description ( wl -> color_surface , image_description , 0 ) ;
2120+ wl -> image_desc_done = true ;
21202121 MP_VERBOSE (wl , "Image description set on color surface.\n" );
2122+ wp_color_management_surface_v1_set_image_description (wl -> color_surface , image_description , 0 );
21212123 wp_image_description_v1_destroy (image_description );
21222124}
21232125
@@ -3452,6 +3454,7 @@ static void set_color_management(struct vo_wayland_state *wl)
34523454 return ;
34533455
34543456 struct pl_color_space color = wl -> target_params .color ;
3457+ struct wl_event_queue * cm_queue = NULL ;
34553458 int primaries = wl -> primaries_map [color .primaries ];
34563459 int transfer = wl -> transfer_map [color .transfer ];
34573460 if (!primaries )
@@ -3489,12 +3492,23 @@ static void set_color_management(struct vo_wayland_state *wl)
34893492 wp_image_description_creator_params_v1_set_max_cll (image_creator_params , lrintf (hdr .max_cll ));
34903493 wp_image_description_creator_params_v1_set_max_fall (image_creator_params , lrintf (hdr .max_fall ));
34913494 }
3495+
34923496 struct wp_image_description_v1 * image_description = wp_image_description_creator_params_v1_create (image_creator_params );
3497+ #if HAVE_WL_DISPLAY_CREATE_QUEUE_WITH_NAME
3498+ cm_queue = wl_display_create_queue_with_name (wl -> display , "mpv color management" );
3499+ #else
3500+ cm_queue = wl_display_create_queue (wl -> display );
3501+ #endif
3502+ wl_proxy_set_queue ((struct wl_proxy * )image_description , cm_queue );
3503+ wl -> image_desc_done = false;
34933504 wp_image_description_v1_add_listener (image_description , & image_description_listener , wl );
34943505
3495- /* Do a round trip to ensure the image description gets set before
3496- * vo->driver->flip_page calls wl_surface_commit on us */
3497- wl_display_roundtrip_queue (wl -> display , wl -> queue );
3506+ /* Block here to ensure the compositor is ready to receive the
3507+ * image_description before we do anything else. */
3508+ while (wl -> image_desc_done == false)
3509+ wl_display_dispatch_queue (wl -> display , cm_queue );
3510+
3511+ wl_event_queue_destroy (cm_queue );
34983512#endif
34993513}
35003514
0 commit comments