d3d12device: Use HRESULT return code if possible

Make function signature consistent with that of command queue

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7057>
This commit is contained in:
Seungha Yang 2024-06-18 21:48:11 +09:00 committed by GStreamer Marge Bot
parent a4c976dd20
commit 713ea313f8
6 changed files with 28 additions and 28 deletions

View file

@ -1352,16 +1352,16 @@ gst_d3d12_device_get_command_queue (GstD3D12Device * device,
* Exectues gst_d3d12_command_queue_execute_command_lists ()
* using a #GstD3D12CommandQueue corresponding to @queue_type
*
* Returns: %TRUE if successful
* Returns: HRESULT code
*
* Since: 1.26
*/
gboolean
HRESULT
gst_d3d12_device_execute_command_lists (GstD3D12Device * device,
D3D12_COMMAND_LIST_TYPE queue_type, guint num_command_lists,
ID3D12CommandList ** command_lists, guint64 * fence_value)
{
g_return_val_if_fail (GST_IS_D3D12_DEVICE (device), FALSE);
g_return_val_if_fail (GST_IS_D3D12_DEVICE (device), E_INVALIDARG);
auto priv = device->priv->inner;
GstD3D12CommandQueue *queue;
@ -1375,13 +1375,11 @@ gst_d3d12_device_execute_command_lists (GstD3D12Device * device,
break;
default:
GST_ERROR_OBJECT (device, "Not supported queue type %d", queue_type);
return FALSE;
return E_INVALIDARG;
}
auto hr = gst_d3d12_command_queue_execute_command_lists (queue,
return gst_d3d12_command_queue_execute_command_lists (queue,
num_command_lists, command_lists, fence_value);
return gst_d3d12_result (hr, device);
}
/**
@ -1474,16 +1472,16 @@ gst_d3d12_device_set_fence_notify (GstD3D12Device * device,
* Exectues gst_d3d12_command_queue_fence_wait ()
* using a #GstD3D12CommandQueue corresponding to @queue_type
*
* Returns: %TRUE if successful
* Returns: HRESULT code
*
* Since: 1.26
*/
gboolean
HRESULT
gst_d3d12_device_fence_wait (GstD3D12Device * device,
D3D12_COMMAND_LIST_TYPE queue_type, guint64 fence_value,
HANDLE event_handle)
{
g_return_val_if_fail (GST_IS_D3D12_DEVICE (device), FALSE);
g_return_val_if_fail (GST_IS_D3D12_DEVICE (device), E_INVALIDARG);
auto priv = device->priv->inner;
GstD3D12CommandQueue *queue;
@ -1497,13 +1495,10 @@ gst_d3d12_device_fence_wait (GstD3D12Device * device,
break;
default:
GST_ERROR_OBJECT (device, "Not supported queue type %d", queue_type);
return FALSE;
return E_INVALIDARG;
}
auto hr = gst_d3d12_command_queue_fence_wait (queue,
fence_value, event_handle);
return gst_d3d12_result (hr, device);
return gst_d3d12_command_queue_fence_wait (queue, fence_value, event_handle);
}
gboolean

View file

@ -94,7 +94,7 @@ GstD3D12CommandQueue * gst_d3d12_device_get_command_queue (GstD3D12Devic
D3D12_COMMAND_LIST_TYPE queue_type);
GST_D3D12_API
gboolean gst_d3d12_device_execute_command_lists (GstD3D12Device * device,
HRESULT gst_d3d12_device_execute_command_lists (GstD3D12Device * device,
D3D12_COMMAND_LIST_TYPE queue_type,
guint num_command_lists,
ID3D12CommandList ** command_lists,
@ -111,7 +111,7 @@ gboolean gst_d3d12_device_set_fence_notify (GstD3D12Devic
GstD3D12FenceData * fence_data);
GST_D3D12_API
gboolean gst_d3d12_device_fence_wait (GstD3D12Device * device,
HRESULT gst_d3d12_device_fence_wait (GstD3D12Device * device,
D3D12_COMMAND_LIST_TYPE queue_type,
guint64 fence_value,
HANDLE event_handle);

View file

@ -2321,9 +2321,9 @@ gst_d3d12_compositor_draw_background (GstD3D12Compositor * self)
ID3D12CommandList *cmd_list[] = { cl.Get () };
if (!gst_d3d12_device_execute_command_lists (self->device,
D3D12_COMMAND_LIST_TYPE_DIRECT, 1, cmd_list,
&priv->bg_render->fence_val)) {
hr = gst_d3d12_device_execute_command_lists (self->device,
D3D12_COMMAND_LIST_TYPE_DIRECT, 1, cmd_list, &priv->bg_render->fence_val);
if (!gst_d3d12_result (hr, self->device)) {
GST_ERROR_OBJECT (self, "Couldn't execute command list");
gst_d3d12_fence_data_unref (fence_data);
return FALSE;
@ -2412,9 +2412,11 @@ gst_d3d12_compositor_aggregate_frames (GstVideoAggregator * vagg,
GST_LOG_OBJECT (cpad, "Command list prepared");
ID3D12CommandList *cmd_list[] = { pad_priv->ctx->cl.Get () };
if (!gst_d3d12_device_execute_command_lists (self->device,
D3D12_COMMAND_LIST_TYPE_DIRECT, 1, cmd_list,
&pad_priv->ctx->fence_val)) {
auto hr = gst_d3d12_device_execute_command_lists (self->device,
D3D12_COMMAND_LIST_TYPE_DIRECT, 1, cmd_list,
&pad_priv->ctx->fence_val);
if (!gst_d3d12_result (hr, self->device)) {
GST_ERROR_OBJECT (self, "Couldn't execute command list");
ret = GST_FLOW_ERROR;
break;

View file

@ -2030,8 +2030,9 @@ gst_d3d12_convert_transform (GstBaseTransform * trans, GstBuffer * inbuf,
ID3D12CommandList *cmd_list[] = { priv->ctx->cl.Get () };
if (!gst_d3d12_device_execute_command_lists (priv->ctx->device,
D3D12_COMMAND_LIST_TYPE_DIRECT, 1, cmd_list, &priv->ctx->fence_val)) {
hr = gst_d3d12_device_execute_command_lists (priv->ctx->device,
D3D12_COMMAND_LIST_TYPE_DIRECT, 1, cmd_list, &priv->ctx->fence_val);
if (!gst_d3d12_result (hr, priv->ctx->device)) {
GST_ERROR_OBJECT (self, "Couldn't execute command list");
gst_d3d12_fence_data_unref (fence_data);
return GST_FLOW_ERROR;

View file

@ -2222,8 +2222,9 @@ gst_d3d12_test_src_create (GstBaseSrc * bsrc, guint64 offset,
ID3D12CommandList *cmd_list[] = { priv->ctx->cl.Get () };
if (!gst_d3d12_device_execute_command_lists (self->device,
D3D12_COMMAND_LIST_TYPE_DIRECT, 1, cmd_list, &priv->ctx->fence_val)) {
hr = gst_d3d12_device_execute_command_lists (self->device,
D3D12_COMMAND_LIST_TYPE_DIRECT, 1, cmd_list, &priv->ctx->fence_val);
if (!gst_d3d12_result (hr, self->device)) {
GST_ERROR_OBJECT (self, "Couldn't execute command list");
gst_d3d12_fence_data_unref (fence_data);
return GST_FLOW_ERROR;

View file

@ -533,8 +533,9 @@ gst_dwrite_d3d12_render_blend (GstDWriteRender * render, GstBuffer * layout_buf,
if (ret) {
ID3D12CommandList *cl[] = { priv->cl.Get () };
ret = gst_d3d12_device_execute_command_lists (priv->device,
hr = gst_d3d12_device_execute_command_lists (priv->device,
D3D12_COMMAND_LIST_TYPE_DIRECT, 1, cl, &priv->fence_val);
ret = gst_d3d12_result (hr, priv->device);
}
if (ret) {