gl/dispmanx: fix deadlock triggered by `set_render_rectangle`
authorAlexander Vandenbulcke <av@telecom-it.be>
Fri, 8 Jan 2021 10:51:36 +0000 (11:51 +0100)
committerAlexander Vandenbulcke <av@telecom-it.be>
Wed, 10 Feb 2021 08:30:27 +0000 (09:30 +0100)
commit57029ba098fcd2c26df6cc116ffb02171ac36917
treeb51b451091aee64bc57fcc8d486be0dc915243d0
parent278b10dd2e3678439961910584f46975aa045420
gl/dispmanx: fix deadlock triggered by `set_render_rectangle`

When the gstglimagesink is started with the option `glimagesink
render-rectangle="<0,0,1920,1080>"`, the pipeline reaches a deadlock.
The reason the deadlock occurs is that the
`gst_gl_window_set_render_rectangle` takes locks on the window, in
addition it calls `window_class->set_render_rectangle(...)` which
executes the `_on_resize` function. Since the `_on_resize` function also
takes locks on the window the deadlock is achieved.

By scheduling the adjustment of the render rectangle through an async
message for `gst_gl_window_dispmanx_set_render_rectangle`, the actual
resize happens in another context and therefore doesn't suffers from the
lock taken in `gst_gl_window_set_render_rectangle`.

This solution follows the same approach as gl/wayland. The problem was
introduced by b887db1. For the full discussion check #849.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1030>
gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c