libs: wayland: update the opaque region in set_render_rect
authorMichael Olbrich <m.olbrich@pengutronix.de>
Fri, 19 Jun 2020 19:26:52 +0000 (21:26 +0200)
committerMichael Olbrich <m.olbrich@pengutronix.de>
Fri, 31 Jul 2020 12:02:33 +0000 (14:02 +0200)
commit9eb25ab849a83ba248915e901e398c03b585d726
treef50a4e0c342bc92b58fce25300b58b70322a3fcb
parenta362d99e9e3bb705f4c4fd1e1e3aa869d86ec342
libs: wayland: update the opaque region in set_render_rect

gst_vaapi_window_wayland_set_render_rect() may be called from an arbitrary
thread. That thread may be responsible for making the window visible.

At that point another thread will block in gst_vaapi_window_wayland_sync()
because the frame callback will not be called until the window is visible.

If that happens, then acquiring the display lock in
gst_vaapi_window_wayland_set_render_rect() would result in a deadlock.

Cache the size of the opaque rectangle separately and create the opaque
region right before applying it to the surface.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
gst-libs/gst/vaapi/gstvaapiwindow_wayland.c