d3d12screencapturesrc: Performance improvement

Process captured frame using d3d11 instead of d3d12, and use shared
fence when copying processed d3d11 texture to d3d12 resource.
In this way, capture CPU thread does not need to wait for fence signal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6733>
This commit is contained in:
Seungha Yang 2024-04-26 00:35:54 +09:00 committed by GStreamer Marge Bot
parent 364d0ff45d
commit 4ac46ce82b
2 changed files with 574 additions and 853 deletions

File diff suppressed because it is too large Load diff

View file

@ -777,11 +777,13 @@ gst_d3d12_screen_capture_src_decide_allocation (GstBaseSrc * bsrc,
if (!params) { if (!params) {
params = gst_d3d12_allocation_params_new (self->device, &vinfo, params = gst_d3d12_allocation_params_new (self->device, &vinfo,
GST_D3D12_ALLOCATION_FLAG_DEFAULT, resource_flags, GST_D3D12_ALLOCATION_FLAG_DEFAULT, resource_flags,
D3D12_HEAP_FLAG_NONE); D3D12_HEAP_FLAG_SHARED);
} else { } else {
gst_d3d12_allocation_params_set_resource_flags (params, resource_flags); gst_d3d12_allocation_params_set_resource_flags (params, resource_flags);
gst_d3d12_allocation_params_unset_resource_flags (params, gst_d3d12_allocation_params_unset_resource_flags (params,
D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE); D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE);
gst_d3d12_allocation_params_set_heap_flags (params,
D3D12_HEAP_FLAG_SHARED);
} }
gst_buffer_pool_config_set_d3d12_allocation_params (config, params); gst_buffer_pool_config_set_d3d12_allocation_params (config, params);
@ -815,7 +817,7 @@ gst_d3d12_screen_capture_src_decide_allocation (GstBaseSrc * bsrc,
auto params = gst_d3d12_allocation_params_new (self->device, &vinfo, auto params = gst_d3d12_allocation_params_new (self->device, &vinfo,
GST_D3D12_ALLOCATION_FLAG_DEFAULT, resource_flags, GST_D3D12_ALLOCATION_FLAG_DEFAULT, resource_flags,
D3D12_HEAP_FLAG_NONE); D3D12_HEAP_FLAG_SHARED);
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);