mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
d3d12device: Set debugging friendly object name
Build object name with DXGI adapter index Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6395>
This commit is contained in:
parent
6de5eab1e4
commit
b417c62940
1 changed files with 26 additions and 2 deletions
|
@ -226,11 +226,16 @@ public:
|
||||||
});
|
});
|
||||||
|
|
||||||
if (it != list_.end ()) {
|
if (it != list_.end ()) {
|
||||||
GST_DEBUG ("Reusing created device");
|
|
||||||
auto device = (GstD3D12Device *)
|
auto device = (GstD3D12Device *)
|
||||||
g_object_new (GST_TYPE_D3D12_DEVICE, nullptr);
|
g_object_new (GST_TYPE_D3D12_DEVICE, nullptr);
|
||||||
gst_object_ref_sink (device);
|
gst_object_ref_sink (device);
|
||||||
device->priv->inner = *it;
|
device->priv->inner = *it;
|
||||||
|
|
||||||
|
auto name = buildObjectName ((*it)->adapter_index);
|
||||||
|
gst_object_set_name (GST_OBJECT (device), name.c_str ());
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (device, "Reusing created device");
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +243,10 @@ public:
|
||||||
if (!device)
|
if (!device)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
GST_DEBUG ("Created new device");
|
auto name = buildObjectName (device->priv->inner->adapter_index);
|
||||||
|
gst_object_set_name (GST_OBJECT (device), name.c_str ());
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (device, "Created new device");
|
||||||
|
|
||||||
list_.push_back (device->priv->inner);
|
list_.push_back (device->priv->inner);
|
||||||
|
|
||||||
|
@ -263,9 +271,25 @@ private:
|
||||||
DeviceCacheManager () {}
|
DeviceCacheManager () {}
|
||||||
~DeviceCacheManager () {}
|
~DeviceCacheManager () {}
|
||||||
|
|
||||||
|
std::string buildObjectName (UINT adapter_index)
|
||||||
|
{
|
||||||
|
auto name_it = name_map_.find (adapter_index);
|
||||||
|
UINT idx = 0;
|
||||||
|
if (name_it == name_map_.end ()) {
|
||||||
|
name_map_.insert ({adapter_index, 0});
|
||||||
|
} else {
|
||||||
|
name_it->second++;
|
||||||
|
idx = name_it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::string ("d3d11device") + std::to_string (adapter_index) + "-" +
|
||||||
|
std::to_string (idx);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::mutex lock_;
|
std::mutex lock_;
|
||||||
std::vector<DeviceInnerPtr> list_;
|
std::vector<DeviceInnerPtr> list_;
|
||||||
|
std::unordered_map<UINT,UINT> name_map_;
|
||||||
};
|
};
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue