d3d12decoder: Always output sharable texture

Because shared heap's additional costs is not significant,
use D3D12_HEAP_FLAG_SHARED for resource can be shared over process
boundary. And enables render target for d3d11 interop in the process.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6513>
This commit is contained in:
Seungha Yang 2024-04-02 22:09:57 +09:00 committed by GStreamer Marge Bot
parent 2a02107c8d
commit ad6670ba81

View file

@ -722,7 +722,8 @@ gst_d3d12_decoder_configure (GstD3D12Decoder * decoder,
D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE;
session->reference_only = true;
} else {
resource_flags = D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS;
resource_flags = D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS |
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
session->reference_only = false;
}
@ -734,9 +735,12 @@ gst_d3d12_decoder_configure (GstD3D12Decoder * decoder,
align.padding_right = session->aligned_width - info->width;
align.padding_bottom = session->aligned_height - info->height;
D3D12_HEAP_FLAGS heap_flags = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
if (!session->reference_only)
heap_flags |= D3D12_HEAP_FLAG_SHARED;
auto params = gst_d3d12_allocation_params_new (decoder->device, info,
GST_D3D12_ALLOCATION_FLAG_DEFAULT, resource_flags,
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED);
GST_D3D12_ALLOCATION_FLAG_DEFAULT, resource_flags, heap_flags);
gst_d3d12_allocation_params_alignment (params, &align);
if (!session->array_of_textures)
gst_d3d12_allocation_params_set_array_size (params, session->dpb_size);
@ -767,8 +771,9 @@ gst_d3d12_decoder_configure (GstD3D12Decoder * decoder,
params = gst_d3d12_allocation_params_new (decoder->device, info,
GST_D3D12_ALLOCATION_FLAG_DEFAULT,
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS,
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED);
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS |
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET,
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED | D3D12_HEAP_FLAG_SHARED);
gst_d3d12_allocation_params_alignment (params, &align);
gst_buffer_pool_config_set_d3d12_allocation_params (config, params);
gst_d3d12_allocation_params_free (params);