diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12bufferpool.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12bufferpool.cpp index c8875d95f2..2d9635d8f2 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12bufferpool.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12bufferpool.cpp @@ -190,7 +190,7 @@ gst_d3d12_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config) auto alloc = (GstD3D12Allocator *) 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); auto num_planes = D3D12GetFormatPlaneCount (device, params->d3d12_format.dxgi_format); @@ -218,7 +218,7 @@ gst_d3d12_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config) auto alloc = (GstD3D12Allocator *) 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); UINT64 mem_size; diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.cpp index c3ae03eb03..c00ba10886 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.cpp @@ -717,6 +717,8 @@ gst_d3d12_decoder_configure (GstD3D12Decoder * decoder, auto params = gst_d3d12_allocation_params_new (decoder->device, info, GST_D3D12_ALLOCATION_FLAG_DEFAULT, resource_flags); 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) 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, D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS); 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_d3d12_allocation_params_free (params); gst_buffer_pool_config_set_params (config, caps, info->size, 0, 0); diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12memory-private.h b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12memory-private.h index f3fd764d29..417a97547f 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12memory-private.h +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12memory-private.h @@ -33,6 +33,7 @@ struct _GstD3D12AllocationParams GstVideoInfo aligned_info; GstD3D12Format d3d12_format; GstD3D12AllocationFlags flags; + D3D12_HEAP_FLAGS heap_flags; D3D12_RESOURCE_FLAGS resource_flags; guint array_size; }; diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12memory.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12memory.cpp index 03f226783b..972cd31fcd 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12memory.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12memory.cpp @@ -97,6 +97,7 @@ gst_d3d12_allocation_params_new (GstD3D12Device * device, ret->d3d12_format = d3d12_format; ret->array_size = 1; ret->flags = flags; + ret->heap_flags = D3D12_HEAP_FLAG_NONE; ret->resource_flags = resource_flags; return ret; @@ -172,6 +173,17 @@ gst_d3d12_allocation_params_unset_resource_flags (GstD3D12AllocationParams * 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 gst_d3d12_allocation_params_set_array_size (GstD3D12AllocationParams * params, guint size) diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12memory.h b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12memory.h index 7cbe746b1b..ced3e7b1e1 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12memory.h +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12memory.h @@ -104,6 +104,9 @@ gboolean gst_d3d12_allocation_params_set_resource_flags (GstD3 gboolean gst_d3d12_allocation_params_unset_resource_flags (GstD3D12AllocationParams * params, 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, guint size);