mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
d3d12device: Add helper method for getting fence handle
Add get_fence_handle() method so that caller can get command queue's dedicated fence handle from device Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7057>
This commit is contained in:
parent
289bc1d440
commit
49c4247cb3
5 changed files with 43 additions and 8 deletions
|
@ -1278,6 +1278,41 @@ gst_d3d12_device_get_factory_handle (GstD3D12Device * device)
|
|||
return device->priv->inner->factory.Get ();
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_device_get_fence_handle:
|
||||
* @device: a #GstD3D12Device
|
||||
* @queue_type: a D3D12_COMMAND_LIST_TYPE
|
||||
*
|
||||
* Gets fence handle of command queue
|
||||
*
|
||||
* Returns: (transfer none): ID3D12Fence handle
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
ID3D12Fence *
|
||||
gst_d3d12_device_get_fence_handle (GstD3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE queue_type)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_DEVICE (device), nullptr);
|
||||
|
||||
auto priv = device->priv->inner;
|
||||
GstD3D12CommandQueue *queue;
|
||||
|
||||
switch (queue_type) {
|
||||
case D3D12_COMMAND_LIST_TYPE_DIRECT:
|
||||
queue = priv->direct_queue;
|
||||
break;
|
||||
case D3D12_COMMAND_LIST_TYPE_COPY:
|
||||
queue = priv->copy_queue;
|
||||
break;
|
||||
default:
|
||||
GST_ERROR_OBJECT (device, "Not supported queue type %d", queue_type);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return gst_d3d12_command_queue_get_fence_handle (queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_device_get_format:
|
||||
* @device: a #GstD3D12Device
|
||||
|
|
|
@ -84,6 +84,10 @@ IDXGIAdapter1 * gst_d3d12_device_get_adapter_handle (GstD3D12Devic
|
|||
GST_D3D12_API
|
||||
IDXGIFactory2 * gst_d3d12_device_get_factory_handle (GstD3D12Device * device);
|
||||
|
||||
GST_D3D12_API
|
||||
ID3D12Fence * gst_d3d12_device_get_fence_handle (GstD3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE queue_type);
|
||||
|
||||
GST_D3D12_API
|
||||
gboolean gst_d3d12_device_get_format (GstD3D12Device * device,
|
||||
GstVideoFormat format,
|
||||
|
|
|
@ -486,10 +486,9 @@ gst_d3d12_memory_download (GstD3D12Memory * dmem)
|
|||
priv->external_fence_val);
|
||||
}
|
||||
|
||||
auto cq = gst_d3d12_device_get_command_queue (dmem->device,
|
||||
auto fence = gst_d3d12_device_get_fence_handle (dmem->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
ID3D12Fence *direct_fence[] =
|
||||
{ gst_d3d12_command_queue_get_fence_handle (cq) };
|
||||
ID3D12Fence *direct_fence[] = { fence };
|
||||
guint64 fence_value_to_wait[] = { dmem->fence_value };
|
||||
|
||||
guint64 fence_val = 0;
|
||||
|
|
|
@ -1450,9 +1450,8 @@ gst_d3d12_encoder_handle_frame (GstVideoEncoder * encoder,
|
|||
auto completed = gst_d3d12_device_get_completed_value (self->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
if (completed < mem->fence_value) {
|
||||
auto queue = gst_d3d12_device_get_command_queue (self->device,
|
||||
auto fence = gst_d3d12_device_get_fence_handle (self->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
auto fence = gst_d3d12_command_queue_get_fence_handle (queue);
|
||||
gst_d3d12_command_queue_execute_wait (priv->cmd->queue, fence,
|
||||
mem->fence_value);
|
||||
}
|
||||
|
|
|
@ -582,10 +582,8 @@ gst_d3d12_ipc_sink_ensure_server (GstD3D12IpcSink * self, GstBuffer * buffer)
|
|||
}
|
||||
}
|
||||
|
||||
auto queue = gst_d3d12_device_get_command_queue (priv->device,
|
||||
auto fence = gst_d3d12_device_get_fence_handle (priv->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
auto fence = gst_d3d12_command_queue_get_fence_handle (queue);
|
||||
|
||||
priv->server = gst_d3d12_ipc_server_new (priv->pipe_name, adapter_luid,
|
||||
fence);
|
||||
if (!priv->server) {
|
||||
|
|
Loading…
Reference in a new issue