summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungha Yang <seungha@centricular.com>2024-04-27 22:54:14 +0900
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2024-04-28 12:49:07 +0000
commit46131f0cb022202fd4411aebdb8aa26c85ca93c3 (patch)
tree4a49b8bd7772631e12bb1010fb27cba4718df1c5
parent19932cf178a13d784af4a370e4d7576f1cc72f6d (diff)
d3d12ipcclient: Fix deadlock when copying texture
Fixing deadlock in below case * GC lock is taken by background thread, and the background thread calls gst_d3d12_ipc_client_release_imported_data() which takes ipc lock * ipc lock is already taken in ipc thread and trying to pushing GC data via gst_d3d12_command_queue_set_notify() * gst_d3d12_command_queue_set_notify() is trying to take GC lock but it's already taken by background thread Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6749>
-rw-r--r--subprojects/gst-plugins-bad/sys/d3d12/gstd3d12ipcclient.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12ipcclient.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12ipcclient.cpp
index d5efe97cf5..34010abc84 100644
--- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12ipcclient.cpp
+++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12ipcclient.cpp
@@ -511,6 +511,8 @@ gst_d3d12_ipc_client_have_data (GstD3D12IpcClient * self)
fence_val);
}
+ lk.unlock ();
+
guint64 copy_fence_val;
gst_d3d12_device_copy_texture_region (priv->device, copy_args.size (),
copy_args.data (), nullptr, nullptr, 0, D3D12_COMMAND_LIST_TYPE_DIRECT,
@@ -524,6 +526,8 @@ gst_d3d12_ipc_client_have_data (GstD3D12IpcClient * self)
(GDestroyNotify) gst_d3d12_ipc_client_release_imported_data);
gst_d3d12_buffer_after_write (buffer, copy_fence_val);
+
+ lk.lock ();
} else {
gint stride[GST_VIDEO_MAX_PLANES];
gsize offset[GST_VIDEO_MAX_PLANES];