d3d12: Always allocate output texture using shared heap

... if downstream preference is unknown (e.g., no proposed
buffer pool by downstream), so that produced textures can be
shareable with other APIs such as d3d11 or vulkan, or other processes

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7193>
This commit is contained in:
Seungha Yang 2024-07-18 03:30:23 +09:00 committed by GStreamer Marge Bot
parent 9629d78b7c
commit 72895ed0fa
5 changed files with 13 additions and 6 deletions

View file

@ -2155,7 +2155,8 @@ gst_d3d12_compositor_decide_allocation (GstAggregator * agg, GstQuery * query)
params = gst_d3d12_allocation_params_new (self->device, &info,
GST_D3D12_ALLOCATION_FLAG_DEFAULT,
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET |
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS, D3D12_HEAP_FLAG_NONE);
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS,
D3D12_HEAP_FLAG_SHARED);
} else {
gst_d3d12_allocation_params_set_resource_flags (params,
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET |

View file

@ -1571,7 +1571,10 @@ gst_d3d12_convert_decide_allocation (GstBaseTransform * trans, GstQuery * query)
if ((device_format.format_flags & GST_D3D12_FORMAT_FLAG_OUTPUT_UAV)
== GST_D3D12_FORMAT_FLAG_OUTPUT_UAV) {
resource_flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
} else {
}
if ((device_format.support1 & D3D12_FORMAT_SUPPORT1_RENDER_TARGET) ==
D3D12_FORMAT_SUPPORT1_RENDER_TARGET) {
resource_flags |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
}
@ -1580,7 +1583,7 @@ gst_d3d12_convert_decide_allocation (GstBaseTransform * trans, GstQuery * query)
if (!d3d12_params) {
d3d12_params = gst_d3d12_allocation_params_new (filter->device, &info,
GST_D3D12_ALLOCATION_FLAG_DEFAULT, resource_flags,
D3D12_HEAP_FLAG_NONE);
D3D12_HEAP_FLAG_SHARED);
} else {
gst_d3d12_allocation_params_set_resource_flags (d3d12_params,
resource_flags);

View file

@ -1793,9 +1793,12 @@ gst_d3d12_decoder_decide_allocation (GstD3D12Decoder * decoder,
if (!params) {
params = gst_d3d12_allocation_params_new (decoder->device, &vinfo,
GST_D3D12_ALLOCATION_FLAG_DEFAULT,
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS, D3D12_HEAP_FLAG_NONE);
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET |
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS,
D3D12_HEAP_FLAG_SHARED);
} else {
gst_d3d12_allocation_params_set_resource_flags (params,
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET |
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS);
}

View file

@ -300,7 +300,7 @@ gst_d3d12_client_update_caps (GstD3D12IpcClient * self, GstCaps * caps)
auto params = gst_d3d12_allocation_params_new (priv->device, &priv->info,
GST_D3D12_ALLOCATION_FLAG_DEFAULT,
D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS |
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, D3D12_HEAP_FLAG_NONE);
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, D3D12_HEAP_FLAG_SHARED);
gst_buffer_pool_config_set_d3d12_allocation_params (config, params);
gst_d3d12_allocation_params_free (params);

View file

@ -1876,7 +1876,7 @@ gst_d3d12_test_src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
if (!params) {
params = gst_d3d12_allocation_params_new (self->device, &vinfo,
GST_D3D12_ALLOCATION_FLAG_DEFAULT, resource_flags,
D3D12_HEAP_FLAG_NONE);
D3D12_HEAP_FLAG_SHARED);
} else {
gst_d3d12_allocation_params_set_resource_flags (params, resource_flags);
gst_d3d12_allocation_params_unset_resource_flags (params,