From f47a19897743ce2986ce6824101f6526c472b75a Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 23 May 2024 17:29:54 +0900 Subject: [PATCH] Revert "d3d11device: protect device_lock vs device_new" This reverts commit 926d5366b99b3498632a45147cfa329dbbf2cc30. AcquireSRWLockExclusive seems to be acquiring lock in exclusive mode when the same lock is combined with write lock access. Reverting the commit because of this is unexpected behavior and unavoidable OS bug. Part-of: --- .../gst-libs/gst/d3d11/gstd3d11device.cpp | 10 ---------- .../tests/check/libs/d3d11device.cpp | 15 --------------- 2 files changed, 25 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.cpp b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.cpp index 95f4114acd..43d5d23e78 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11device.cpp @@ -748,8 +748,6 @@ gst_d3d11_device_log_live_objects (GstD3D11Device * device, #endif } -static SRWLOCK _device_creation_rwlock = SRWLOCK_INIT; - static void gst_d3d11_device_dispose (GObject * object) { @@ -764,8 +762,6 @@ gst_d3d11_device_dispose (GObject * object) g_clear_pointer (&priv->device_removed_monitor_thread, g_thread_join); } - AcquireSRWLockExclusive (&_device_creation_rwlock); - priv->ps_cache.clear (); priv->vs_cache.clear (); priv->sampler_cache.clear (); @@ -792,7 +788,6 @@ gst_d3d11_device_dispose (GObject * object) GST_D3D11_CLEAR_COM (priv->dxgi_info_queue); #endif - ReleaseSRWLockExclusive (&_device_creation_rwlock); G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -1060,7 +1055,6 @@ gst_d3d11_device_new_internal (const GstD3D11DeviceConstructData * data) debug_init_once (); - GstD3D11SRWLockGuard lk (&_device_creation_rwlock); hr = CreateDXGIFactory1 (IID_PPV_ARGS (&factory)); if (!gst_d3d11_result (hr, NULL)) { GST_WARNING ("cannot create dxgi factory, hr: 0x%x", (guint) hr); @@ -1434,8 +1428,6 @@ gst_d3d11_device_lock (GstD3D11Device * device) priv = device->priv; - AcquireSRWLockShared (&_device_creation_rwlock); - GST_TRACE_OBJECT (device, "device locking"); priv->extern_lock.lock (); GST_TRACE_OBJECT (device, "device locked"); @@ -1461,8 +1453,6 @@ gst_d3d11_device_unlock (GstD3D11Device * device) priv->extern_lock.unlock (); GST_TRACE_OBJECT (device, "device unlocked"); - - ReleaseSRWLockShared (&_device_creation_rwlock); } /** diff --git a/subprojects/gst-plugins-bad/tests/check/libs/d3d11device.cpp b/subprojects/gst-plugins-bad/tests/check/libs/d3d11device.cpp index 62f4356ec5..30b89f9adf 100644 --- a/subprojects/gst-plugins-bad/tests/check/libs/d3d11device.cpp +++ b/subprojects/gst-plugins-bad/tests/check/libs/d3d11device.cpp @@ -241,20 +241,6 @@ GST_START_TEST (test_device_new_concurrency) GST_END_TEST; -GST_START_TEST (test_device_lock_recursiveness) -{ - GstD3D11Device *device = gst_d3d11_device_new (0, 0); - - gst_d3d11_device_lock (device); - gst_d3d11_device_lock (device); - gst_d3d11_device_unlock (device); - gst_d3d11_device_unlock (device); - - gst_object_unref (device); -} - -GST_END_TEST; - static Suite * d3d11device_suite (void) { @@ -270,7 +256,6 @@ d3d11device_suite (void) tcase_add_test (tc_basic, test_device_for_adapter_luid); tcase_add_test (tc_basic, test_device_new_wrapped); tcase_add_test (tc_basic, test_device_new_concurrency); - tcase_add_test (tc_basic, test_device_lock_recursiveness); out: return s;