mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 08:17:01 +00:00
d3d12: Make resource getter methods consistent
Returns COM pointer directly everywhere Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6494>
This commit is contained in:
parent
706d5402fa
commit
abeccdd6bc
21 changed files with 98 additions and 162 deletions
|
@ -246,17 +246,12 @@ gst_d3d12_command_allocator_get_command_type (GstD3D12CommandAllocator * cmd)
|
|||
return cmd->type;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d12_command_allocator_get_handle (GstD3D12CommandAllocator * cmd,
|
||||
ID3D12CommandAllocator ** ca)
|
||||
ID3D12CommandAllocator *
|
||||
gst_d3d12_command_allocator_get_handle (GstD3D12CommandAllocator * cmd)
|
||||
{
|
||||
g_return_val_if_fail (cmd, FALSE);
|
||||
g_return_val_if_fail (ca, FALSE);
|
||||
g_return_val_if_fail (cmd, nullptr);
|
||||
|
||||
*ca = cmd->ca.Get ();
|
||||
(*ca)->AddRef ();
|
||||
|
||||
return TRUE;
|
||||
return cmd->ca.Get ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -47,8 +47,7 @@ void gst_clear_d3d12_command_allocator (GstD3D12Comman
|
|||
|
||||
D3D12_COMMAND_LIST_TYPE gst_d3d12_command_allocator_get_command_type (GstD3D12CommandAllocator * cmd);
|
||||
|
||||
gboolean gst_d3d12_command_allocator_get_handle (GstD3D12CommandAllocator * cmd,
|
||||
ID3D12CommandAllocator ** ca);
|
||||
ID3D12CommandAllocator * gst_d3d12_command_allocator_get_handle (GstD3D12CommandAllocator * cmd);
|
||||
|
||||
void gst_d3d12_command_allocator_set_user_data (GstD3D12CommandAllocator * cmd,
|
||||
gpointer user_data,
|
||||
|
|
|
@ -257,15 +257,10 @@ gst_d3d12_command_list_get_command_type (GstD3D12CommandList * cmd)
|
|||
return cmd->type;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d12_command_list_get_handle (GstD3D12CommandList * cmd,
|
||||
ID3D12CommandList ** cl)
|
||||
ID3D12CommandList *
|
||||
gst_d3d12_command_list_get_handle (GstD3D12CommandList * cmd)
|
||||
{
|
||||
g_return_val_if_fail (cmd, FALSE);
|
||||
g_return_val_if_fail (cl, FALSE);
|
||||
g_return_val_if_fail (cmd, nullptr);
|
||||
|
||||
*cl = cmd->cl.Get ();
|
||||
(*cl)->AddRef ();
|
||||
|
||||
return TRUE;
|
||||
return cmd->cl.Get ();
|
||||
}
|
||||
|
|
|
@ -48,8 +48,7 @@ void gst_clear_d3d12_command_list (GstD3D12CommandList ** c
|
|||
|
||||
D3D12_COMMAND_LIST_TYPE gst_d3d12_command_list_get_command_type (GstD3D12CommandList * cmd);
|
||||
|
||||
gboolean gst_d3d12_command_list_get_handle (GstD3D12CommandList * cmd,
|
||||
ID3D12CommandList ** cl);
|
||||
ID3D12CommandList * gst_d3d12_command_list_get_handle (GstD3D12CommandList * cmd);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -182,34 +182,20 @@ gst_d3d12_command_queue_new (ID3D12Device * device,
|
|||
return self;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d12_command_queue_get_handle (GstD3D12CommandQueue * queue,
|
||||
ID3D12CommandQueue ** handle)
|
||||
ID3D12CommandQueue *
|
||||
gst_d3d12_command_queue_get_handle (GstD3D12CommandQueue * queue)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), FALSE);
|
||||
g_return_val_if_fail (handle, FALSE);
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), nullptr);
|
||||
|
||||
auto priv = queue->priv;
|
||||
|
||||
*handle = priv->cq.Get ();
|
||||
(*handle)->AddRef ();
|
||||
|
||||
return TRUE;
|
||||
return queue->priv->cq.Get ();
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d12_command_queue_get_fence (GstD3D12CommandQueue * queue,
|
||||
ID3D12Fence ** handle)
|
||||
ID3D12Fence *
|
||||
gst_d3d12_command_queue_get_fence_handle (GstD3D12CommandQueue * queue)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), FALSE);
|
||||
g_return_val_if_fail (handle, FALSE);
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), nullptr);
|
||||
|
||||
auto priv = queue->priv;
|
||||
|
||||
*handle = priv->fence.Get ();
|
||||
(*handle)->AddRef ();
|
||||
|
||||
return TRUE;
|
||||
return queue->priv->fence.Get ();
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
|
|
@ -34,11 +34,9 @@ GstD3D12CommandQueue * gst_d3d12_command_queue_new (ID3D12Device * device,
|
|||
D3D12_FENCE_FLAGS fence_flags,
|
||||
guint queue_size);
|
||||
|
||||
gboolean gst_d3d12_command_queue_get_handle (GstD3D12CommandQueue * queue,
|
||||
ID3D12CommandQueue ** handle);
|
||||
ID3D12CommandQueue * gst_d3d12_command_queue_get_handle (GstD3D12CommandQueue * queue);
|
||||
|
||||
gboolean gst_d3d12_command_queue_get_fence (GstD3D12CommandQueue * queue,
|
||||
ID3D12Fence ** handle);
|
||||
ID3D12Fence * gst_d3d12_command_queue_get_fence_handle (GstD3D12CommandQueue * queue);
|
||||
|
||||
HRESULT gst_d3d12_command_queue_execute_command_lists (GstD3D12CommandQueue * queue,
|
||||
guint num_command_lists,
|
||||
|
|
|
@ -1129,8 +1129,7 @@ gst_d3d12_compositor_preprare_func (GstVideoAggregatorPad * pad,
|
|||
gst_d3d12_fence_data_pool_acquire (self->priv->fence_data_pool, &fence_data);
|
||||
gst_d3d12_fence_data_add_notify_mini_object (fence_data, gst_ca);
|
||||
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
gst_d3d12_command_allocator_get_handle (gst_ca, &ca);
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
|
@ -1142,14 +1141,14 @@ gst_d3d12_compositor_preprare_func (GstVideoAggregatorPad * pad,
|
|||
if (!priv->ctx->cl) {
|
||||
auto device = gst_d3d12_device_get_device_handle (priv->ctx->device);
|
||||
hr = device->CreateCommandList (0, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
||||
ca.Get (), nullptr, IID_PPV_ARGS (&priv->ctx->cl));
|
||||
ca, nullptr, IID_PPV_ARGS (&priv->ctx->cl));
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (cpad, "Couldn't create command list");
|
||||
gst_d3d12_fence_data_unref (fence_data);
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
hr = priv->ctx->cl->Reset (ca.Get (), nullptr);
|
||||
hr = priv->ctx->cl->Reset (ca, nullptr);
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_fence_data_unref (fence_data);
|
||||
|
@ -2203,9 +2202,9 @@ gst_d3d12_compositor_draw_background (GstD3D12Compositor * self)
|
|||
auto mem = (GstD3D12Memory *)
|
||||
gst_buffer_peek_memory (priv->generated_output_buf, i);
|
||||
auto num_planes = gst_d3d12_memory_get_plane_count (mem);
|
||||
ComPtr < ID3D12DescriptorHeap > rtv_heap;
|
||||
auto rtv_heap = gst_d3d12_memory_get_render_target_view_heap (mem);
|
||||
|
||||
if (!gst_d3d12_memory_get_render_target_view_heap (mem, &rtv_heap)) {
|
||||
if (!rtv_heap) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't get rtv heap");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2233,8 +2232,7 @@ gst_d3d12_compositor_draw_background (GstD3D12Compositor * self)
|
|||
gst_d3d12_fence_data_pool_acquire (priv->fence_data_pool, &fence_data);
|
||||
gst_d3d12_fence_data_add_notify_mini_object (fence_data, gst_ca);
|
||||
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
gst_d3d12_command_allocator_get_handle (gst_ca, &ca);
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -2246,14 +2244,14 @@ gst_d3d12_compositor_draw_background (GstD3D12Compositor * self)
|
|||
if (!bg_render->cl) {
|
||||
auto device = gst_d3d12_device_get_device_handle (self->device);
|
||||
hr = device->CreateCommandList (0, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
||||
ca.Get (), bg_render->pso.Get (), IID_PPV_ARGS (&bg_render->cl));
|
||||
ca, bg_render->pso.Get (), IID_PPV_ARGS (&bg_render->cl));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create command list");
|
||||
gst_d3d12_fence_data_unref (fence_data);
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
hr = bg_render->cl->Reset (ca.Get (), bg_render->pso.Get ());
|
||||
hr = bg_render->cl->Reset (ca, bg_render->pso.Get ());
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_fence_data_unref (fence_data);
|
||||
|
|
|
@ -1979,8 +1979,7 @@ gst_d3d12_convert_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
gst_d3d12_command_allocator_get_handle (gst_ca, &ca);
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
|
@ -1992,14 +1991,14 @@ gst_d3d12_convert_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
if (!priv->ctx->cl) {
|
||||
auto device = gst_d3d12_device_get_device_handle (priv->ctx->device);
|
||||
hr = device->CreateCommandList (0, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
||||
ca.Get (), nullptr, IID_PPV_ARGS (&priv->ctx->cl));
|
||||
ca, nullptr, IID_PPV_ARGS (&priv->ctx->cl));
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
} else {
|
||||
hr = priv->ctx->cl->Reset (ca.Get (), nullptr);
|
||||
hr = priv->ctx->cl->Reset (ca, nullptr);
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
|
|
|
@ -1944,14 +1944,13 @@ gst_d3d12_converter_execute (GstD3D12Converter * self,
|
|||
|
||||
auto device = gst_d3d12_device_get_device_handle (self->device);
|
||||
|
||||
ComPtr < ID3D12DescriptorHeap > srv_heap;
|
||||
GstD3D12Descriptor *descriptor;
|
||||
if (!gst_d3d12_descriptor_pool_acquire (priv->srv_heap_pool, &descriptor)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire srv heap");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gst_d3d12_descriptor_get_handle (descriptor, &srv_heap);
|
||||
auto srv_heap = gst_d3d12_descriptor_get_handle (descriptor);
|
||||
gst_d3d12_fence_data_add_notify_mini_object (fence_data, descriptor);
|
||||
|
||||
auto cpu_handle =
|
||||
|
@ -1961,9 +1960,9 @@ gst_d3d12_converter_execute (GstD3D12Converter * self,
|
|||
for (guint i = 0; i < gst_buffer_n_memory (in_buf); i++) {
|
||||
auto mem = (GstD3D12Memory *) gst_buffer_peek_memory (in_buf, i);
|
||||
auto num_planes = gst_d3d12_memory_get_plane_count (mem);
|
||||
ComPtr < ID3D12DescriptorHeap > mem_srv_heap;
|
||||
auto mem_srv_heap = gst_d3d12_memory_get_shader_resource_view_heap (mem);
|
||||
|
||||
if (!gst_d3d12_memory_get_shader_resource_view_heap (mem, &mem_srv_heap)) {
|
||||
if (!mem_srv_heap) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't get SRV");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1983,9 +1982,9 @@ gst_d3d12_converter_execute (GstD3D12Converter * self,
|
|||
for (guint i = 0; i < gst_buffer_n_memory (out_buf); i++) {
|
||||
auto mem = (GstD3D12Memory *) gst_buffer_peek_memory (out_buf, i);
|
||||
auto num_planes = gst_d3d12_memory_get_plane_count (mem);
|
||||
ComPtr < ID3D12DescriptorHeap > rtv_heap;
|
||||
auto rtv_heap = gst_d3d12_memory_get_render_target_view_heap (mem);
|
||||
|
||||
if (!gst_d3d12_memory_get_render_target_view_heap (mem, &rtv_heap)) {
|
||||
if (!rtv_heap) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't get rtv heap");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2018,7 +2017,7 @@ gst_d3d12_converter_execute (GstD3D12Converter * self,
|
|||
cl->SetGraphicsRootSignature (priv->rs.Get ());
|
||||
cl->SetPipelineState (pso);
|
||||
|
||||
ID3D12DescriptorHeap *heaps[] = { srv_heap.Get () };
|
||||
ID3D12DescriptorHeap *heaps[] = { srv_heap };
|
||||
cl->SetDescriptorHeaps (1, heaps);
|
||||
cl->SetGraphicsRootDescriptorTable (priv->crs->GetPsSrvIdx (),
|
||||
GetGPUDescriptorHandleForHeapStart (srv_heap));
|
||||
|
|
|
@ -1078,8 +1078,7 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
|||
memset (&in_args, 0, sizeof (D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS));
|
||||
memset (&out_args, 0, sizeof (D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS));
|
||||
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
gst_d3d12_command_allocator_get_handle (gst_ca, &ca);
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
|
||||
hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, decoder->device)) {
|
||||
|
@ -1091,9 +1090,9 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
|||
if (!priv->cmd->cl) {
|
||||
hr = priv->cmd->device->CreateCommandList (0,
|
||||
D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE,
|
||||
ca.Get (), nullptr, IID_PPV_ARGS (&priv->cmd->cl));
|
||||
ca, nullptr, IID_PPV_ARGS (&priv->cmd->cl));
|
||||
} else {
|
||||
hr = priv->cmd->cl->Reset (ca.Get ());
|
||||
hr = priv->cmd->cl->Reset (ca);
|
||||
}
|
||||
|
||||
if (!gst_d3d12_result (hr, decoder->device)) {
|
||||
|
|
|
@ -223,15 +223,10 @@ gst_clear_d3d12_descriptor (GstD3D12Descriptor ** desc)
|
|||
gst_clear_mini_object (desc);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d12_descriptor_get_handle (GstD3D12Descriptor * desc,
|
||||
ID3D12DescriptorHeap ** heap)
|
||||
ID3D12DescriptorHeap *
|
||||
gst_d3d12_descriptor_get_handle (GstD3D12Descriptor * desc)
|
||||
{
|
||||
g_return_val_if_fail (desc, FALSE);
|
||||
g_return_val_if_fail (heap, FALSE);
|
||||
g_return_val_if_fail (desc, nullptr);
|
||||
|
||||
*heap = desc->heap.Get ();
|
||||
(*heap)->AddRef ();
|
||||
|
||||
return TRUE;
|
||||
return desc->heap.Get ();
|
||||
}
|
||||
|
|
|
@ -45,8 +45,7 @@ void gst_d3d12_descriptor_unref (GstD3D12Descriptor * desc)
|
|||
|
||||
void gst_clear_d3d12_descriptor (GstD3D12Descriptor ** desc);
|
||||
|
||||
gboolean gst_d3d12_descriptor_get_handle (GstD3D12Descriptor * desc,
|
||||
ID3D12DescriptorHeap ** heap);
|
||||
ID3D12DescriptorHeap * gst_d3d12_descriptor_get_handle (GstD3D12Descriptor * desc);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -1009,10 +1009,8 @@ gst_d3d12_device_copy_texture_region (GstD3D12Device * device,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
gst_d3d12_command_allocator_get_handle (gst_ca, &ca);
|
||||
|
||||
gst_d3d12_command_list_pool_acquire (cl_pool, ca.Get (), &gst_cl);
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
gst_d3d12_command_list_pool_acquire (cl_pool, ca, &gst_cl);
|
||||
|
||||
if (!gst_cl) {
|
||||
GST_ERROR_OBJECT (device, "Couldn't acquire command list");
|
||||
|
@ -1023,7 +1021,7 @@ gst_d3d12_device_copy_texture_region (GstD3D12Device * device,
|
|||
ComPtr < ID3D12CommandList > cl_base;
|
||||
ComPtr < ID3D12GraphicsCommandList > cl;
|
||||
|
||||
gst_d3d12_command_list_get_handle (gst_cl, &cl_base);
|
||||
cl_base = gst_d3d12_command_list_get_handle (gst_cl);
|
||||
cl_base.As (&cl);
|
||||
|
||||
for (guint i = 0; i < num_args; i++) {
|
||||
|
@ -1135,7 +1133,6 @@ gst_d3d12_device_clear_yuv_texture (GstD3D12Device * device, GstMemory * mem)
|
|||
{
|
||||
auto priv = device->priv->inner;
|
||||
auto dmem = GST_D3D12_MEMORY_CAST (mem);
|
||||
ComPtr < ID3D12DescriptorHeap > heap;
|
||||
|
||||
auto resource = gst_d3d12_memory_get_resource_handle (dmem);
|
||||
auto desc = GetDesc (resource);
|
||||
|
@ -1145,7 +1142,7 @@ gst_d3d12_device_clear_yuv_texture (GstD3D12Device * device, GstMemory * mem)
|
|||
return;
|
||||
}
|
||||
|
||||
gst_d3d12_memory_get_render_target_view_heap (dmem, &heap);
|
||||
auto heap = gst_d3d12_memory_get_render_target_view_heap (dmem);
|
||||
if (!heap)
|
||||
return;
|
||||
|
||||
|
@ -1158,12 +1155,10 @@ gst_d3d12_device_clear_yuv_texture (GstD3D12Device * device, GstMemory * mem)
|
|||
if (!gst_ca)
|
||||
return;
|
||||
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
gst_d3d12_command_allocator_get_handle (gst_ca, &ca);
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
|
||||
GstD3D12CommandList *gst_cl = nullptr;
|
||||
gst_d3d12_command_list_pool_acquire (priv->direct_cl_pool,
|
||||
ca.Get (), &gst_cl);
|
||||
gst_d3d12_command_list_pool_acquire (priv->direct_cl_pool, ca, &gst_cl);
|
||||
if (!gst_cl) {
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
return;
|
||||
|
@ -1172,7 +1167,7 @@ gst_d3d12_device_clear_yuv_texture (GstD3D12Device * device, GstMemory * mem)
|
|||
ComPtr < ID3D12CommandList > cl_base;
|
||||
ComPtr < ID3D12GraphicsCommandList > cl;
|
||||
|
||||
gst_d3d12_command_list_get_handle (gst_cl, &cl_base);
|
||||
cl_base = gst_d3d12_command_list_get_handle (gst_cl);
|
||||
cl_base.As (&cl);
|
||||
|
||||
auto rtv_handle =
|
||||
|
|
|
@ -1505,7 +1505,6 @@ gst_d3d12_dxgi_capture_draw_mouse (GstD3D12DxgiCapture * self,
|
|||
auto fence_data = priv->mouse_fence_data;
|
||||
|
||||
GstD3D12CommandAllocator *gst_ca = nullptr;
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
|
||||
if (!gst_d3d12_command_allocator_pool_acquire (priv->ca_pool, &gst_ca)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire command allocator");
|
||||
|
@ -1514,7 +1513,7 @@ gst_d3d12_dxgi_capture_draw_mouse (GstD3D12DxgiCapture * self,
|
|||
|
||||
gst_d3d12_fence_data_add_notify_mini_object (fence_data, gst_ca);
|
||||
|
||||
gst_d3d12_command_allocator_get_handle (gst_ca, &ca);
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command allocator");
|
||||
|
@ -1523,9 +1522,9 @@ gst_d3d12_dxgi_capture_draw_mouse (GstD3D12DxgiCapture * self,
|
|||
|
||||
if (!priv->mouse_cl) {
|
||||
hr = device->CreateCommandList (0, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
||||
ca.Get (), nullptr, IID_PPV_ARGS (&priv->mouse_cl));
|
||||
ca, nullptr, IID_PPV_ARGS (&priv->mouse_cl));
|
||||
} else {
|
||||
hr = priv->mouse_cl->Reset (ca.Get (), nullptr);
|
||||
hr = priv->mouse_cl->Reset (ca, nullptr);
|
||||
}
|
||||
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -1584,7 +1583,7 @@ gst_d3d12_dxgi_capture_do_capture (GstD3D12DxgiCapture * capture,
|
|||
ID3D12CommandList *cmd_list[1];
|
||||
GstD3D12FenceData *fence_data = nullptr;
|
||||
GstD3D12CommandAllocator *gst_ca = nullptr;
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
ID3D12CommandAllocator *ca = nullptr;
|
||||
HRESULT hr;
|
||||
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
|
@ -1654,7 +1653,7 @@ gst_d3d12_dxgi_capture_do_capture (GstD3D12DxgiCapture * capture,
|
|||
gst_d3d12_fence_data_pool_acquire (priv->fence_data_pool, &fence_data);
|
||||
gst_d3d12_fence_data_add_notify_mini_object (fence_data, gst_ca);
|
||||
|
||||
gst_d3d12_command_allocator_get_handle (gst_ca, &ca);
|
||||
ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
|
||||
hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -1664,9 +1663,9 @@ gst_d3d12_dxgi_capture_do_capture (GstD3D12DxgiCapture * capture,
|
|||
|
||||
if (!priv->cl) {
|
||||
hr = device->CreateCommandList (0, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
||||
ca.Get (), priv->pso.Get (), IID_PPV_ARGS (&priv->cl));
|
||||
ca, priv->pso.Get (), IID_PPV_ARGS (&priv->cl));
|
||||
} else {
|
||||
hr = priv->cl->Reset (ca.Get (), priv->pso.Get ());
|
||||
hr = priv->cl->Reset (ca, priv->pso.Get ());
|
||||
}
|
||||
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
|
|
@ -1252,8 +1252,7 @@ gst_d3d12_encoder_handle_frame (GstVideoEncoder * encoder,
|
|||
|
||||
gst_d3d12_fence_data_add_notify_mini_object (fence_data, gst_ca);
|
||||
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
gst_d3d12_command_allocator_get_handle (gst_ca, &ca);
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command allocator");
|
||||
|
@ -1265,9 +1264,9 @@ gst_d3d12_encoder_handle_frame (GstVideoEncoder * encoder,
|
|||
if (!priv->cmd->cl) {
|
||||
auto device = gst_d3d12_device_get_device_handle (self->device);
|
||||
hr = device->CreateCommandList (0, D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE,
|
||||
ca.Get (), nullptr, IID_PPV_ARGS (&priv->cmd->cl));
|
||||
ca, nullptr, IID_PPV_ARGS (&priv->cmd->cl));
|
||||
} else {
|
||||
hr = priv->cmd->cl->Reset (ca.Get ());
|
||||
hr = priv->cmd->cl->Reset (ca);
|
||||
}
|
||||
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -1428,9 +1427,8 @@ gst_d3d12_encoder_handle_frame (GstVideoEncoder * encoder,
|
|||
if (completed < mem->fence_value) {
|
||||
auto queue = gst_d3d12_device_get_command_queue (self->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
ComPtr < ID3D12Fence > fence;
|
||||
gst_d3d12_command_queue_get_fence (queue, &fence);
|
||||
gst_d3d12_command_queue_execute_wait (priv->cmd->queue, fence.Get (),
|
||||
auto fence = gst_d3d12_command_queue_get_fence_handle (queue);
|
||||
gst_d3d12_command_queue_execute_wait (priv->cmd->queue, fence,
|
||||
mem->fence_value);
|
||||
}
|
||||
|
||||
|
|
|
@ -584,11 +584,10 @@ gst_d3d12_ipc_sink_ensure_server (GstD3D12IpcSink * self, GstBuffer * buffer)
|
|||
|
||||
auto queue = gst_d3d12_device_get_command_queue (priv->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
ComPtr < ID3D12Fence > fence;
|
||||
gst_d3d12_command_queue_get_fence (queue, &fence);
|
||||
auto fence = gst_d3d12_command_queue_get_fence_handle (queue);
|
||||
|
||||
priv->server = gst_d3d12_ipc_server_new (priv->pipe_name, adapter_luid,
|
||||
fence.Get ());
|
||||
fence);
|
||||
if (!priv->server) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create server");
|
||||
return FALSE;
|
||||
|
|
|
@ -578,9 +578,8 @@ gst_d3d12_memory_get_plane_rectangle (GstD3D12Memory * mem, guint plane,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d12_memory_get_shader_resource_view_heap (GstD3D12Memory * mem,
|
||||
ID3D12DescriptorHeap ** heap)
|
||||
ID3D12DescriptorHeap *
|
||||
gst_d3d12_memory_get_shader_resource_view_heap (GstD3D12Memory * mem)
|
||||
{
|
||||
auto priv = mem->priv;
|
||||
auto allocator = GST_MEMORY_CAST (mem)->allocator;
|
||||
|
@ -588,7 +587,7 @@ gst_d3d12_memory_get_shader_resource_view_heap (GstD3D12Memory * mem,
|
|||
GST_LOG_OBJECT (allocator,
|
||||
"Shader resource was denied, configured flags 0x%x",
|
||||
(guint) priv->desc.Flags);
|
||||
return FALSE;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
|
@ -604,7 +603,7 @@ gst_d3d12_memory_get_shader_resource_view_heap (GstD3D12Memory * mem,
|
|||
auto hr = device->CreateDescriptorHeap (&desc, IID_PPV_ARGS (&srv_heap));
|
||||
if (!gst_d3d12_result (hr, mem->device)) {
|
||||
GST_ERROR_OBJECT (allocator, "Couldn't create descriptor heap");
|
||||
return FALSE;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
priv->srv_heap = srv_heap;
|
||||
|
@ -627,15 +626,11 @@ gst_d3d12_memory_get_shader_resource_view_heap (GstD3D12Memory * mem,
|
|||
}
|
||||
}
|
||||
|
||||
*heap = priv->srv_heap.Get ();
|
||||
(*heap)->AddRef ();
|
||||
|
||||
return TRUE;
|
||||
return priv->srv_heap.Get ();
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d12_memory_get_render_target_view_heap (GstD3D12Memory * mem,
|
||||
ID3D12DescriptorHeap ** heap)
|
||||
ID3D12DescriptorHeap *
|
||||
gst_d3d12_memory_get_render_target_view_heap (GstD3D12Memory * mem)
|
||||
{
|
||||
auto priv = mem->priv;
|
||||
auto allocator = GST_MEMORY_CAST (mem)->allocator;
|
||||
|
@ -643,7 +638,7 @@ gst_d3d12_memory_get_render_target_view_heap (GstD3D12Memory * mem,
|
|||
GST_LOG_OBJECT (allocator,
|
||||
"Render target is not allowed, configured flags 0x%x",
|
||||
(guint) priv->desc.Flags);
|
||||
return FALSE;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
|
@ -659,7 +654,7 @@ gst_d3d12_memory_get_render_target_view_heap (GstD3D12Memory * mem,
|
|||
auto hr = device->CreateDescriptorHeap (&desc, IID_PPV_ARGS (&rtv_heap));
|
||||
if (!gst_d3d12_result (hr, mem->device)) {
|
||||
GST_ERROR_OBJECT (allocator, "Couldn't create descriptor heap");
|
||||
return FALSE;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
priv->rtv_heap = rtv_heap;
|
||||
|
@ -683,10 +678,7 @@ gst_d3d12_memory_get_render_target_view_heap (GstD3D12Memory * mem,
|
|||
}
|
||||
}
|
||||
|
||||
*heap = priv->rtv_heap.Get ();
|
||||
(*heap)->AddRef ();
|
||||
|
||||
return TRUE;
|
||||
return priv->rtv_heap.Get ();
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -144,11 +144,9 @@ gboolean gst_d3d12_memory_get_plane_rectangle (GstD3D12Memory * mem,
|
|||
guint plane,
|
||||
D3D12_RECT * rect);
|
||||
|
||||
gboolean gst_d3d12_memory_get_shader_resource_view_heap (GstD3D12Memory * mem,
|
||||
ID3D12DescriptorHeap ** heap);
|
||||
ID3D12DescriptorHeap * gst_d3d12_memory_get_shader_resource_view_heap (GstD3D12Memory * mem);
|
||||
|
||||
gboolean gst_d3d12_memory_get_render_target_view_heap (GstD3D12Memory * mem,
|
||||
ID3D12DescriptorHeap ** heap);
|
||||
ID3D12DescriptorHeap * gst_d3d12_memory_get_render_target_view_heap (GstD3D12Memory * mem);
|
||||
|
||||
gboolean gst_d3d12_memory_get_nt_handle (GstD3D12Memory * mem,
|
||||
HANDLE * handle);
|
||||
|
|
|
@ -338,8 +338,7 @@ gst_d3d12_overlay_rect_new (GstD3D12OverlayCompositor * self,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ComPtr < ID3D12DescriptorHeap > srv_heap_handle;
|
||||
gst_d3d12_descriptor_get_handle (srv_heap, &srv_heap_handle);
|
||||
auto srv_heap_handle = gst_d3d12_descriptor_get_handle (srv_heap);
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC srv_desc = { };
|
||||
srv_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
||||
srv_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
||||
|
@ -718,8 +717,8 @@ gst_d3d12_overlay_compositor_execute (GstD3D12OverlayCompositor * self,
|
|||
auto priv = self->priv;
|
||||
|
||||
auto mem = (GstD3D12Memory *) gst_buffer_peek_memory (buf, 0);
|
||||
ComPtr < ID3D12DescriptorHeap > rtv_heap;
|
||||
if (!gst_d3d12_memory_get_render_target_view_heap (mem, &rtv_heap)) {
|
||||
auto rtv_heap = gst_d3d12_memory_get_render_target_view_heap (mem);
|
||||
if (!rtv_heap) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't get rtv heap");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -765,9 +764,8 @@ gst_d3d12_overlay_compositor_execute (GstD3D12OverlayCompositor * self,
|
|||
cl->SetPipelineState (pso.Get ());
|
||||
}
|
||||
|
||||
ComPtr < ID3D12DescriptorHeap > srv_heap;
|
||||
gst_d3d12_descriptor_get_handle (rect->srv_heap, &srv_heap);
|
||||
ID3D12DescriptorHeap *heaps[] = { srv_heap.Get () };
|
||||
auto srv_heap = gst_d3d12_descriptor_get_handle (rect->srv_heap);
|
||||
ID3D12DescriptorHeap *heaps[] = { srv_heap };
|
||||
cl->SetDescriptorHeaps (1, heaps);
|
||||
cl->SetGraphicsRootDescriptorTable (0,
|
||||
GetGPUDescriptorHandleForHeapStart (srv_heap));
|
||||
|
|
|
@ -1204,9 +1204,8 @@ setup_d2d_render (GstD3D12TestSrc * self, RenderContext * ctx)
|
|||
auto device = gst_d3d12_device_get_device_handle (self->device);
|
||||
auto cq = gst_d3d12_device_get_command_queue (self->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
ComPtr < ID3D12CommandQueue > cq_handle;
|
||||
gst_d3d12_command_queue_get_handle (cq, &cq_handle);
|
||||
IUnknown *cq_list[] = { cq_handle.Get () };
|
||||
auto cq_handle = gst_d3d12_command_queue_get_handle (cq);
|
||||
IUnknown *cq_list[] = { cq_handle };
|
||||
|
||||
hr = D3D11On12CreateDevice (device, D3D11_CREATE_DEVICE_BGRA_SUPPORT,
|
||||
feature_levels, G_N_ELEMENTS (feature_levels), cq_list, 1, 0,
|
||||
|
@ -1647,8 +1646,9 @@ gst_d3d12_test_src_setup_context (GstD3D12TestSrc * self, GstCaps * caps)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gst_d3d12_memory_get_render_target_view_heap ((GstD3D12Memory *) mem,
|
||||
&ctx->rtv_heap)) {
|
||||
ctx->rtv_heap =
|
||||
gst_d3d12_memory_get_render_target_view_heap ((GstD3D12Memory *) mem);
|
||||
if (!ctx->rtv_heap) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't get rtv heap");
|
||||
gst_memory_unref (mem);
|
||||
return FALSE;
|
||||
|
@ -2167,8 +2167,7 @@ gst_d3d12_test_src_create (GstBaseSrc * bsrc, guint64 offset,
|
|||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
gst_d3d12_command_allocator_get_handle (gst_ca, &ca);
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -2181,7 +2180,7 @@ gst_d3d12_test_src_create (GstBaseSrc * bsrc, guint64 offset,
|
|||
if (!priv->ctx->cl) {
|
||||
auto device = gst_d3d12_device_get_device_handle (self->device);
|
||||
hr = device->CreateCommandList (0, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
||||
ca.Get (), nullptr, IID_PPV_ARGS (&priv->ctx->cl));
|
||||
ca, nullptr, IID_PPV_ARGS (&priv->ctx->cl));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
|
@ -2189,7 +2188,7 @@ gst_d3d12_test_src_create (GstBaseSrc * bsrc, guint64 offset,
|
|||
return GST_FLOW_ERROR;
|
||||
}
|
||||
} else {
|
||||
hr = priv->ctx->cl->Reset (ca.Get (), nullptr);
|
||||
hr = priv->ctx->cl->Reset (ca, nullptr);
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
|
|
|
@ -1257,11 +1257,10 @@ gst_d3d12_window_prepare (GstD3D12Window * window, GstD3D12Device * device,
|
|||
|
||||
auto factory = gst_d3d12_device_get_factory_handle (device);
|
||||
|
||||
ComPtr < ID3D12CommandQueue > cq;
|
||||
gst_d3d12_command_queue_get_handle (ctx->queue, &cq);
|
||||
auto cq = gst_d3d12_command_queue_get_handle (ctx->queue);
|
||||
|
||||
ComPtr < IDXGISwapChain1 > swapchain;
|
||||
hr = factory->CreateSwapChainForHwnd (cq.Get (), priv->hwnd,
|
||||
hr = factory->CreateSwapChainForHwnd (cq, priv->hwnd,
|
||||
&desc, nullptr, nullptr, &swapchain);
|
||||
if (!gst_d3d12_result (hr, window->device)) {
|
||||
GST_ERROR_OBJECT (window, "Couldn't create swapchain");
|
||||
|
@ -1452,8 +1451,7 @@ gst_d3d12_window_set_buffer (GstD3D12Window * window, GstBuffer * buffer)
|
|||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
gst_d3d12_command_allocator_get_handle (gst_ca, &ca);
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, window->device)) {
|
||||
GST_ERROR_OBJECT (window, "Couldn't reset command list");
|
||||
|
@ -1465,7 +1463,7 @@ gst_d3d12_window_set_buffer (GstD3D12Window * window, GstBuffer * buffer)
|
|||
if (!priv->ctx->cl) {
|
||||
auto device = gst_d3d12_device_get_device_handle (priv->ctx->device);
|
||||
hr = device->CreateCommandList (0, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
||||
ca.Get (), nullptr, IID_PPV_ARGS (&cl));
|
||||
ca, nullptr, IID_PPV_ARGS (&cl));
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (window, "Couldn't create command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
|
@ -1475,7 +1473,7 @@ gst_d3d12_window_set_buffer (GstD3D12Window * window, GstBuffer * buffer)
|
|||
priv->ctx->cl = cl;
|
||||
} else {
|
||||
cl = priv->ctx->cl;
|
||||
hr = cl->Reset (ca.Get (), nullptr);
|
||||
hr = cl->Reset (ca, nullptr);
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (window, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
|
@ -1566,9 +1564,8 @@ gst_d3d12_window_set_buffer (GstD3D12Window * window, GstBuffer * buffer)
|
|||
if (completed < max_fence_val) {
|
||||
auto device_queue = gst_d3d12_device_get_command_queue (priv->ctx->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
ComPtr < ID3D12Fence > fence;
|
||||
gst_d3d12_command_queue_get_fence (device_queue, &fence);
|
||||
gst_d3d12_command_queue_execute_wait (priv->ctx->queue, fence.Get (),
|
||||
auto fence = gst_d3d12_command_queue_get_fence_handle (device_queue);
|
||||
gst_d3d12_command_queue_execute_wait (priv->ctx->queue, fence,
|
||||
max_fence_val);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue