mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 01:31:03 +00:00
d3d12: Add gst_d3d12_flush_all_devices() method
... and removing implicit flushing behavior on GstD3D12Device::finalize Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7929>
This commit is contained in:
parent
8a88cd541d
commit
44cb3025ff
3 changed files with 28 additions and 21 deletions
|
@ -367,20 +367,6 @@ public:
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReleaseDevice (gint64 luid)
|
|
||||||
{
|
|
||||||
std::lock_guard <std::recursive_mutex> lk (lock_);
|
|
||||||
for (const auto & it : list_) {
|
|
||||||
if (it->adapter_luid == luid) {
|
|
||||||
if (it.use_count () == 1) {
|
|
||||||
it->Drain ();
|
|
||||||
it->ReportLiveObjects ();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnDeviceRemoved (gint64 luid)
|
void OnDeviceRemoved (gint64 luid)
|
||||||
{
|
{
|
||||||
std::lock_guard <std::recursive_mutex> lk (lock_);
|
std::lock_guard <std::recursive_mutex> lk (lock_);
|
||||||
|
@ -498,6 +484,15 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FlushAll ()
|
||||||
|
{
|
||||||
|
std::lock_guard <std::recursive_mutex> lk (lock_);
|
||||||
|
for (const auto & it : list_) {
|
||||||
|
it->Drain ();
|
||||||
|
it->ReportLiveObjects ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceCacheManager () {}
|
DeviceCacheManager () {}
|
||||||
~DeviceCacheManager () {}
|
~DeviceCacheManager () {}
|
||||||
|
@ -729,15 +724,8 @@ gst_d3d12_device_finalize (GObject * object)
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "Finalize");
|
GST_DEBUG_OBJECT (self, "Finalize");
|
||||||
|
|
||||||
gint64 luid = 0;
|
|
||||||
if (self->priv->inner)
|
|
||||||
luid = self->priv->inner->adapter_luid;
|
|
||||||
|
|
||||||
delete self->priv;
|
delete self->priv;
|
||||||
|
|
||||||
auto manager = DeviceCacheManager::GetInstance ();
|
|
||||||
manager->ReleaseDevice (luid);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2241,3 +2229,17 @@ gst_d3d12_device_non_zeroed_supported (GstD3D12Device * device)
|
||||||
|
|
||||||
return device->priv->inner->non_zeroed_supported;
|
return device->priv->inner->non_zeroed_supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_d3d12_flush_all_devices:
|
||||||
|
*
|
||||||
|
* Flushes all devices and waits for completion of all scheduled GPU tasks
|
||||||
|
*
|
||||||
|
* Since: 1.26
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_d3d12_flush_all_devices (void)
|
||||||
|
{
|
||||||
|
auto manager = DeviceCacheManager::GetInstance ();
|
||||||
|
manager->FlushAll ();
|
||||||
|
}
|
||||||
|
|
|
@ -78,6 +78,10 @@ gboolean gst_d3d12_get_copyable_footprints (GstD3D12Device * device,
|
||||||
D3D12_PLACED_SUBRESOURCE_FOOTPRINT layout[GST_VIDEO_MAX_PLANES],
|
D3D12_PLACED_SUBRESOURCE_FOOTPRINT layout[GST_VIDEO_MAX_PLANES],
|
||||||
guint64 * size);
|
guint64 * size);
|
||||||
|
|
||||||
|
|
||||||
|
GST_D3D12_API
|
||||||
|
void gst_d3d12_flush_all_devices (void);
|
||||||
|
|
||||||
GST_D3D12_API
|
GST_D3D12_API
|
||||||
gboolean _gst_d3d12_result (HRESULT hr,
|
gboolean _gst_d3d12_result (HRESULT hr,
|
||||||
GstD3D12Device * device,
|
GstD3D12Device * device,
|
||||||
|
|
|
@ -73,6 +73,7 @@ static void
|
||||||
plugin_deinit (gpointer data)
|
plugin_deinit (gpointer data)
|
||||||
{
|
{
|
||||||
gst_d3d12_ipc_client_deinit ();
|
gst_d3d12_ipc_client_deinit ();
|
||||||
|
gst_d3d12_flush_all_devices ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue