Work around ABBA deadlock between vaapisink and vaapipostproc
Work around ABBA deadlock between vaapisink and vaapipostproc

vaapisink takes the display lock, then does a gst_buffer_replace which can
take the lock on the gst_vaapi_video_pool.

vaapipostproc asks the gst_vaapi_video_pool for a new surface. This takes
the lock on the gst_vaapi_video_pool; if you're unlucky, there are no free
surfaces, which means that gst_vaapi_surface_create is
called. gst_vaapi_surface_create takes the display lock.

If vaapisink and vaapipostproc are in different threads, and this happens,
you get a deadlock. vaapisink holds the display lock, and wants the
gst_vaapi_video_pool lock. vaapipostproc holds the gst_vaapi_video_pool lock
and wants the display lock.

Work around this by releasing the display lock in vaapisink around the
gst_buffer_replace.

https://bugzilla.gnome.org/show_bug.cgi?id=738249

Signed-off-by: Simon Farnsworth <20871d6e2bc9386118bca8a660f80e632ec37194@onelan.co.uk>
Signed-off-by: Sreerenj Balachandran <8526e100bdc7a12d85af109c9f42b86756e50e67@intel.com>

CapOM/gstreamer-vaapi,CapOM/gstreamer-vaapi,01org/iotg-lin-gfx-gstreamer-vaapi,GStreamer/gstreamer-vaapi,01org/iotg-lin-gfx-gstreamer-vaapi,CapOM/gstreamer-vaapi,ceyusa/gstreamer-vaapi,ceyusa/gstreamer-vaapi,01org/iotg-lin-gfx-gstreamer-vaapi,GStreamer/gstreamer-vaapi