mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
d3d12decoder: Use D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag
Since the first access to a texture is always write, zero initialization is unnecessary Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5919>
This commit is contained in:
parent
b1ac114ca5
commit
077470913d
5 changed files with 22 additions and 2 deletions
|
@ -190,7 +190,7 @@ gst_d3d12_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
|
|
||||||
auto alloc = (GstD3D12Allocator *)
|
auto alloc = (GstD3D12Allocator *)
|
||||||
gst_d3d12_pool_allocator_new (self->device,
|
gst_d3d12_pool_allocator_new (self->device,
|
||||||
&heap_props, D3D12_HEAP_FLAG_NONE, &desc[0],
|
&heap_props, params->heap_flags, &desc[0],
|
||||||
D3D12_RESOURCE_STATE_COMMON, nullptr);
|
D3D12_RESOURCE_STATE_COMMON, nullptr);
|
||||||
auto num_planes = D3D12GetFormatPlaneCount (device,
|
auto num_planes = D3D12GetFormatPlaneCount (device,
|
||||||
params->d3d12_format.dxgi_format);
|
params->d3d12_format.dxgi_format);
|
||||||
|
@ -218,7 +218,7 @@ gst_d3d12_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
|
|
||||||
auto alloc = (GstD3D12Allocator *)
|
auto alloc = (GstD3D12Allocator *)
|
||||||
gst_d3d12_pool_allocator_new (self->device,
|
gst_d3d12_pool_allocator_new (self->device,
|
||||||
&heap_props, D3D12_HEAP_FLAG_NONE, &desc[i],
|
&heap_props, params->heap_flags, &desc[i],
|
||||||
D3D12_RESOURCE_STATE_COMMON, nullptr);
|
D3D12_RESOURCE_STATE_COMMON, nullptr);
|
||||||
|
|
||||||
UINT64 mem_size;
|
UINT64 mem_size;
|
||||||
|
|
|
@ -717,6 +717,8 @@ gst_d3d12_decoder_configure (GstD3D12Decoder * decoder,
|
||||||
auto params = gst_d3d12_allocation_params_new (decoder->device, info,
|
auto params = gst_d3d12_allocation_params_new (decoder->device, info,
|
||||||
GST_D3D12_ALLOCATION_FLAG_DEFAULT, resource_flags);
|
GST_D3D12_ALLOCATION_FLAG_DEFAULT, resource_flags);
|
||||||
gst_d3d12_allocation_params_alignment (params, &align);
|
gst_d3d12_allocation_params_alignment (params, &align);
|
||||||
|
gst_d3d12_allocation_params_set_heap_flags (params,
|
||||||
|
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED);
|
||||||
if (!session->array_of_textures)
|
if (!session->array_of_textures)
|
||||||
gst_d3d12_allocation_params_set_array_size (params, session->dpb_size);
|
gst_d3d12_allocation_params_set_array_size (params, session->dpb_size);
|
||||||
|
|
||||||
|
@ -748,6 +750,8 @@ gst_d3d12_decoder_configure (GstD3D12Decoder * decoder,
|
||||||
GST_D3D12_ALLOCATION_FLAG_DEFAULT,
|
GST_D3D12_ALLOCATION_FLAG_DEFAULT,
|
||||||
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS);
|
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS);
|
||||||
gst_d3d12_allocation_params_alignment (params, &align);
|
gst_d3d12_allocation_params_alignment (params, &align);
|
||||||
|
gst_d3d12_allocation_params_set_heap_flags (params,
|
||||||
|
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED);
|
||||||
gst_buffer_pool_config_set_d3d12_allocation_params (config, params);
|
gst_buffer_pool_config_set_d3d12_allocation_params (config, params);
|
||||||
gst_d3d12_allocation_params_free (params);
|
gst_d3d12_allocation_params_free (params);
|
||||||
gst_buffer_pool_config_set_params (config, caps, info->size, 0, 0);
|
gst_buffer_pool_config_set_params (config, caps, info->size, 0, 0);
|
||||||
|
|
|
@ -33,6 +33,7 @@ struct _GstD3D12AllocationParams
|
||||||
GstVideoInfo aligned_info;
|
GstVideoInfo aligned_info;
|
||||||
GstD3D12Format d3d12_format;
|
GstD3D12Format d3d12_format;
|
||||||
GstD3D12AllocationFlags flags;
|
GstD3D12AllocationFlags flags;
|
||||||
|
D3D12_HEAP_FLAGS heap_flags;
|
||||||
D3D12_RESOURCE_FLAGS resource_flags;
|
D3D12_RESOURCE_FLAGS resource_flags;
|
||||||
guint array_size;
|
guint array_size;
|
||||||
};
|
};
|
||||||
|
|
|
@ -97,6 +97,7 @@ gst_d3d12_allocation_params_new (GstD3D12Device * device,
|
||||||
ret->d3d12_format = d3d12_format;
|
ret->d3d12_format = d3d12_format;
|
||||||
ret->array_size = 1;
|
ret->array_size = 1;
|
||||||
ret->flags = flags;
|
ret->flags = flags;
|
||||||
|
ret->heap_flags = D3D12_HEAP_FLAG_NONE;
|
||||||
ret->resource_flags = resource_flags;
|
ret->resource_flags = resource_flags;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -172,6 +173,17 @@ gst_d3d12_allocation_params_unset_resource_flags (GstD3D12AllocationParams *
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gst_d3d12_allocation_params_set_heap_flags (GstD3D12AllocationParams *
|
||||||
|
params, D3D12_HEAP_FLAGS heap_flags)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (params, FALSE);
|
||||||
|
|
||||||
|
params->heap_flags |= heap_flags;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_d3d12_allocation_params_set_array_size (GstD3D12AllocationParams * params,
|
gst_d3d12_allocation_params_set_array_size (GstD3D12AllocationParams * params,
|
||||||
guint size)
|
guint size)
|
||||||
|
|
|
@ -104,6 +104,9 @@ gboolean gst_d3d12_allocation_params_set_resource_flags (GstD3
|
||||||
gboolean gst_d3d12_allocation_params_unset_resource_flags (GstD3D12AllocationParams * params,
|
gboolean gst_d3d12_allocation_params_unset_resource_flags (GstD3D12AllocationParams * params,
|
||||||
D3D12_RESOURCE_FLAGS resource_flags);
|
D3D12_RESOURCE_FLAGS resource_flags);
|
||||||
|
|
||||||
|
gboolean gst_d3d12_allocation_params_set_heap_flags (GstD3D12AllocationParams * params,
|
||||||
|
D3D12_HEAP_FLAGS heap_flags);
|
||||||
|
|
||||||
gboolean gst_d3d12_allocation_params_set_array_size (GstD3D12AllocationParams * params,
|
gboolean gst_d3d12_allocation_params_set_array_size (GstD3D12AllocationParams * params,
|
||||||
guint size);
|
guint size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue