mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
d3d12: Make primary fence sharable
Create primary fence with D3D12_FENCE_FLAG_SHARED flag so that the fence can be shared with other APIs or processes Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6428>
This commit is contained in:
parent
71e879236f
commit
0d559bead9
6 changed files with 11 additions and 7 deletions
|
@ -144,7 +144,8 @@ gst_d3d12_command_queue_finalize (GObject * object)
|
||||||
|
|
||||||
GstD3D12CommandQueue *
|
GstD3D12CommandQueue *
|
||||||
gst_d3d12_command_queue_new (ID3D12Device * device,
|
gst_d3d12_command_queue_new (ID3D12Device * device,
|
||||||
const D3D12_COMMAND_QUEUE_DESC * desc, guint queue_size)
|
const D3D12_COMMAND_QUEUE_DESC * desc, D3D12_FENCE_FLAGS fence_flags,
|
||||||
|
guint queue_size)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (device, nullptr);
|
g_return_val_if_fail (device, nullptr);
|
||||||
g_return_val_if_fail (desc, nullptr);
|
g_return_val_if_fail (desc, nullptr);
|
||||||
|
@ -162,7 +163,7 @@ gst_d3d12_command_queue_new (ID3D12Device * device,
|
||||||
}
|
}
|
||||||
|
|
||||||
ComPtr < ID3D12Fence > fence;
|
ComPtr < ID3D12Fence > fence;
|
||||||
hr = device->CreateFence (0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS (&fence));
|
hr = device->CreateFence (0, fence_flags, IID_PPV_ARGS (&fence));
|
||||||
if (FAILED (hr)) {
|
if (FAILED (hr)) {
|
||||||
GST_ERROR ("Couldn't create fence, hr: 0x%x", (guint) hr);
|
GST_ERROR ("Couldn't create fence, hr: 0x%x", (guint) hr);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -31,6 +31,7 @@ G_DECLARE_FINAL_TYPE (GstD3D12CommandQueue,
|
||||||
|
|
||||||
GstD3D12CommandQueue * gst_d3d12_command_queue_new (ID3D12Device * device,
|
GstD3D12CommandQueue * gst_d3d12_command_queue_new (ID3D12Device * device,
|
||||||
const D3D12_COMMAND_QUEUE_DESC * desc,
|
const D3D12_COMMAND_QUEUE_DESC * desc,
|
||||||
|
D3D12_FENCE_FLAGS fence_flags,
|
||||||
guint queue_size);
|
guint queue_size);
|
||||||
|
|
||||||
gboolean gst_d3d12_command_queue_get_handle (GstD3D12CommandQueue * queue,
|
gboolean gst_d3d12_command_queue_get_handle (GstD3D12CommandQueue * queue,
|
||||||
|
|
|
@ -442,7 +442,8 @@ gst_d3d12_decoder_open (GstD3D12Decoder * decoder, GstElement * element)
|
||||||
D3D12_COMMAND_QUEUE_DESC desc = { };
|
D3D12_COMMAND_QUEUE_DESC desc = { };
|
||||||
desc.Type = D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE;
|
desc.Type = D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE;
|
||||||
desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
||||||
cmd->queue = gst_d3d12_command_queue_new (cmd->device.Get (), &desc, 4);
|
cmd->queue = gst_d3d12_command_queue_new (cmd->device.Get (), &desc,
|
||||||
|
D3D12_FENCE_FLAG_NONE, 4);
|
||||||
if (!cmd->queue) {
|
if (!cmd->queue) {
|
||||||
GST_ERROR_OBJECT (element, "Couldn't create command queue");
|
GST_ERROR_OBJECT (element, "Couldn't create command queue");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -729,7 +729,7 @@ gst_d3d12_device_new_internal (const GstD3D12DeviceConstructData * data)
|
||||||
queue_desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
queue_desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
||||||
|
|
||||||
priv->direct_queue = gst_d3d12_command_queue_new (device.Get (),
|
priv->direct_queue = gst_d3d12_command_queue_new (device.Get (),
|
||||||
&queue_desc, 0);
|
&queue_desc, D3D12_FENCE_FLAG_SHARED, 0);
|
||||||
if (!priv->direct_queue)
|
if (!priv->direct_queue)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
@ -745,7 +745,7 @@ gst_d3d12_device_new_internal (const GstD3D12DeviceConstructData * data)
|
||||||
|
|
||||||
queue_desc.Type = D3D12_COMMAND_LIST_TYPE_COPY;
|
queue_desc.Type = D3D12_COMMAND_LIST_TYPE_COPY;
|
||||||
priv->copy_queue = gst_d3d12_command_queue_new (device.Get (),
|
priv->copy_queue = gst_d3d12_command_queue_new (device.Get (),
|
||||||
&queue_desc, 0);
|
&queue_desc, D3D12_FENCE_FLAG_NONE, 0);
|
||||||
if (!priv->copy_queue)
|
if (!priv->copy_queue)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
|
@ -304,7 +304,8 @@ gst_d3d12_encoder_open (GstVideoEncoder * encoder)
|
||||||
queue_desc.Type = D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE;
|
queue_desc.Type = D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE;
|
||||||
|
|
||||||
auto cmd = std::make_unique < EncoderCmdData > ();
|
auto cmd = std::make_unique < EncoderCmdData > ();
|
||||||
cmd->queue = gst_d3d12_command_queue_new (device, &queue_desc, ASYNC_DEPTH);
|
cmd->queue = gst_d3d12_command_queue_new (device, &queue_desc,
|
||||||
|
D3D12_FENCE_FLAG_NONE, ASYNC_DEPTH);
|
||||||
if (!cmd->queue) {
|
if (!cmd->queue) {
|
||||||
GST_ERROR_OBJECT (self, "Couldn't create command queue");
|
GST_ERROR_OBJECT (self, "Couldn't create command queue");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -91,7 +91,7 @@ struct DeviceContext
|
||||||
|
|
||||||
auto device_handle = gst_d3d12_device_get_device_handle (device);
|
auto device_handle = gst_d3d12_device_get_device_handle (device);
|
||||||
queue = gst_d3d12_command_queue_new (device_handle,
|
queue = gst_d3d12_command_queue_new (device_handle,
|
||||||
&queue_desc, BACK_BUFFER_COUNT * 2);
|
&queue_desc, D3D12_FENCE_FLAG_NONE, BACK_BUFFER_COUNT * 2);
|
||||||
if (!queue) {
|
if (!queue) {
|
||||||
GST_ERROR_OBJECT (device, "Couldn't create command queue");
|
GST_ERROR_OBJECT (device, "Couldn't create command queue");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue