diff options
author | Jan Schmidt <jan@centricular.com> | 2020-11-03 02:22:23 +1100 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-11-04 11:16:52 +0000 |
commit | 9e97f2cf65f9963f7af956428362d9c8599e5b4d (patch) | |
tree | 0d636d9ae9cd012ccebe98c06f7d68dfa69d044f /ext | |
parent | 892f00d310e3fa2909a7d21e7a56c22a71dcfbef (diff) | |
download | gstreamer-plugins-bad-9e97f2cf65f9963f7af956428362d9c8599e5b4d.tar.gz |
vkdeviceprovider: Avoid deadlock on physical device
Don't hold the object lock on the vk physical device while
constructing a GstVulkanDevice around it, as
GstVulkanDevice can make calls on the physical device that
require the object lock.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1759>
Diffstat (limited to 'ext')
-rw-r--r-- | ext/vulkan/vkdeviceprovider.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/vulkan/vkdeviceprovider.c b/ext/vulkan/vkdeviceprovider.c index 7432e0836..1f8888d99 100644 --- a/ext/vulkan/vkdeviceprovider.c +++ b/ext/vulkan/vkdeviceprovider.c @@ -397,17 +397,20 @@ device_context_probe (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) device = g_object_dup_data (G_OBJECT (physical), "vkdeviceprovider.physical.device", (GDuplicateFunc) _ref_if_set, NULL); + GST_OBJECT_UNLOCK (physical); if (!device || !GST_IS_VULKAN_DEVICE (device)) { GWeakRef *ref = g_new0 (GWeakRef, 1); if (device) gst_object_unref (device); device = gst_vulkan_device_new (physical); g_weak_ref_init (ref, device); + + GST_OBJECT_LOCK (physical); g_object_set_data_full (G_OBJECT (physical), "vkdeviceprovider.physical.device", ref, (GDestroyNotify) _ref_free); + GST_OBJECT_UNLOCK (physical); } - GST_OBJECT_UNLOCK (physical); if (gst_vulkan_device_handle_context_query (element, query, device)) { ret = GST_PAD_PROBE_HANDLED; |