You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wayland: call pl_color_space_infer before comparing target_params
Calling `pl_color_space_infer` on `wl->target_param` can cause the
`pl_color_space_equal` check to fail on every frame if any values were
changed by `pl_color_space_infer`. This will cause us to believe
target_params get changed on every frame, and we'll end up in a state
where wayland events happen in the following order indefinitely:
-> wp_color_management_surface_v1#45.set_image_description(...)
-> wp_color_management_surface_v1#45.unset_image_description()
-> wl_surface#9.commit()
-> wp_color_management_surface_v1#45.set_image_description(...)
-> wp_color_management_surface_v1#45.unset_image_description()
-> wl_surface#9.commit()
Since image_description is double buffered, we always queue an unset to
the pending state before each commit. As a result, no commit ever
carries a valid image_description.
Taking the sample file in the issue as an example, we end up in this
state because the file has `min_luma == 0` but `pl_color_space_infer`
normalizes this value to `min_luma == 0.000001`. This makes it so that
we store a different `target_param` to `vo_wayland_state` on every frame
than the one received from `vo_get_target_params`. So we end up setting
image description on every frame in this case.
The key problem here is that `set_color_management` isn't blocking the
thread until `set_image_description is called`, so vo->driver->flip_page
is called before this finishes.
This commit fixes the problem by doing any operations that could change
`wl->target_param` first before doing any equality checks to skip
changing to image description pointlessly.
This fixes the problem in the issue that image_description is never set
on such files. The synchronization problem is fixed in a later commit,
because otherwise setting image_description on every frame could have
adverse frame time effects
Fixes: #16825
0 commit comments