mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
qsv: Check d3d shared resource tier using D3D11 API
We can check the tier using d3d11 API. Thus, don't need to create d3d12 device Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7099>
This commit is contained in:
parent
73480e60d0
commit
76fd732d42
4 changed files with 56 additions and 20 deletions
|
@ -67,5 +67,8 @@ HRESULT gst_d3d11_device_get_rasterizer_msaa (GstD3D11Device * device,
|
|||
GST_D3D11_API
|
||||
void gst_d3d11_device_check_device_removed (GstD3D11Device * device);
|
||||
|
||||
GST_D3D11_API
|
||||
gboolean gst_d3d11_device_d3d12_import_supported (GstD3D11Device * device);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -1962,3 +1962,34 @@ gst_d3d11_device_get_rasterizer_msaa (GstD3D11Device * device,
|
|||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d11_device_d3d12_import_supported (GstD3D11Device * device)
|
||||
{
|
||||
#ifdef HAVE_D3D11_FEATURE_DATA_D3D11_OPTIONS5
|
||||
auto priv = device->priv;
|
||||
auto dev = priv->device;
|
||||
|
||||
D3D11_FEATURE_DATA_D3D11_OPTIONS options = { };
|
||||
D3D11_FEATURE_DATA_D3D11_OPTIONS4 options4 = { };
|
||||
D3D11_FEATURE_DATA_D3D11_OPTIONS5 options5 = { };
|
||||
auto hr = dev->CheckFeatureSupport (D3D11_FEATURE_D3D11_OPTIONS5,
|
||||
&options5, sizeof (options5));
|
||||
if (FAILED (hr) || options5.SharedResourceTier < D3D11_SHARED_RESOURCE_TIER_2)
|
||||
return FALSE;
|
||||
|
||||
hr = dev->CheckFeatureSupport (D3D11_FEATURE_D3D11_OPTIONS,
|
||||
&options, sizeof (options));
|
||||
if (FAILED (hr) || !options.ExtendedResourceSharing)
|
||||
return FALSE;
|
||||
|
||||
hr = dev->CheckFeatureSupport (D3D11_FEATURE_D3D11_OPTIONS4,
|
||||
&options4, sizeof (options4));
|
||||
if (FAILED (hr) || !options4.ExtendedNV12SharedTextureSupported)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -227,6 +227,23 @@ if host_machine.cpu_family() != 'x86'
|
|||
endif
|
||||
endif
|
||||
|
||||
if cxx.compiles('''
|
||||
#include <d3d11_4.h>
|
||||
#include <d3d11.h>
|
||||
int main(int argc, char ** argv) {
|
||||
D3D11_FEATURE_DATA_D3D11_OPTIONS options;
|
||||
D3D11_FEATURE_DATA_D3D11_OPTIONS4 options4;
|
||||
D3D11_FEATURE_DATA_D3D11_OPTIONS5 options5;
|
||||
D3D11_FEATURE fo = D3D11_FEATURE_D3D11_OPTIONS;
|
||||
D3D11_FEATURE fo4 = D3D11_FEATURE_D3D11_OPTIONS4;
|
||||
D3D11_FEATURE fo5 = D3D11_FEATURE_D3D11_OPTIONS5;
|
||||
return 0;
|
||||
}
|
||||
''',
|
||||
name: 'D3D11_FEATURE_DATA_* symbols in d3d11 header')
|
||||
extra_comm_args += ['-DHAVE_D3D11_FEATURE_DATA_D3D11_OPTIONS5']
|
||||
endif
|
||||
|
||||
configure_file(
|
||||
input : 'gstd3d11config.h.meson',
|
||||
output : 'gstd3d11config.h',
|
||||
|
|
|
@ -57,12 +57,14 @@
|
|||
#include <windows.h>
|
||||
#include <versionhelpers.h>
|
||||
#include <gst/d3d11/gstd3d11.h>
|
||||
#include <gst/d3d11/gstd3d11device-private.h>
|
||||
#else
|
||||
#include <gst/va/gstva.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GST_D3D12
|
||||
#include <gst/d3d12/gstd3d12.h>
|
||||
#include <d3d11_4.h>
|
||||
#endif
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
@ -274,26 +276,9 @@ plugin_init (GstPlugin * plugin)
|
|||
goto next;
|
||||
|
||||
#ifdef HAVE_GST_D3D12
|
||||
{
|
||||
gint64 luid;
|
||||
g_object_get (device, "adapter-luid", &luid, nullptr);
|
||||
auto device12 = gst_d3d12_device_new_for_adapter_luid (luid);
|
||||
if (device12) {
|
||||
auto handle12 = gst_d3d12_device_get_device_handle (device12);
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS4 feature_data = { };
|
||||
auto hr = handle12->CheckFeatureSupport (D3D12_FEATURE_D3D12_OPTIONS4,
|
||||
&feature_data, sizeof (feature_data));
|
||||
if (SUCCEEDED (hr) && feature_data.SharedResourceCompatibilityTier >=
|
||||
D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2) {
|
||||
if (gst_d3d11_device_d3d12_import_supported (GST_D3D11_DEVICE (device))) {
|
||||
GST_INFO_OBJECT (device, "Device supports D3D12 resource share");
|
||||
d3d12_interop = TRUE;
|
||||
} else {
|
||||
GST_INFO_OBJECT (device,
|
||||
"Device does not support D3D12 resource share");
|
||||
}
|
||||
|
||||
gst_object_unref (device12);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue