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>
This commit is contained in:
Seungha Yang 2024-04-27 22:54:14 +09:00 committed by GStreamer Marge Bot
parent 19932cf178
commit 46131f0cb0

View file

@ -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];