d3d11: d3d11device: Remove "allow-tearing" property

Plugin can query DXGI_FEATURE_PRESENT_ALLOW_TEARING without d3d11device
help

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1098>
This commit is contained in:
Seungha Yang 2021-10-08 17:16:02 +09:00
parent 3011fa7ddd
commit d8eff2623d
2 changed files with 19 additions and 25 deletions

View file

@ -87,7 +87,6 @@ enum
PROP_VENDOR_ID,
PROP_HARDWARE,
PROP_DESCRIPTION,
PROP_ALLOW_TEARING,
PROP_CREATE_FLAGS,
PROP_ADAPTER_LUID,
};
@ -104,7 +103,6 @@ struct _GstD3D11DevicePrivate
guint vendor_id;
gboolean hardware;
gchar *description;
gboolean allow_tearing;
guint create_flags;
gint64 adapter_luid;
@ -398,11 +396,6 @@ gst_d3d11_device_class_init (GstD3D11DeviceClass * klass)
g_param_spec_string ("description", "Description",
"Human readable device description", NULL, readable_flags));
g_object_class_install_property (gobject_class, PROP_ALLOW_TEARING,
g_param_spec_boolean ("allow-tearing", "Allow tearing",
"Whether dxgi device supports allow-tearing feature or not", FALSE,
readable_flags));
g_object_class_install_property (gobject_class, PROP_CREATE_FLAGS,
g_param_spec_uint ("create-flags", "Create flags",
"D3D11_CREATE_DEVICE_FLAG flags used for D3D11CreateDevice",
@ -810,20 +803,6 @@ gst_d3d11_device_constructed (GObject * object)
GST_ERROR_OBJECT (self, "cannot create dxgi factory, hr: 0x%x", (guint) hr);
goto out;
}
#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
{
ComPtr < IDXGIFactory5 > factory5;
BOOL allow_tearing;
hr = factory.As (&factory5);
if (SUCCEEDED (hr)) {
hr = factory5->CheckFeatureSupport (DXGI_FEATURE_PRESENT_ALLOW_TEARING,
(void *) &allow_tearing, sizeof (allow_tearing));
priv->allow_tearing = SUCCEEDED (hr) && allow_tearing;
}
}
#endif
if (factory->EnumAdapters1 (priv->adapter, &adapter) == DXGI_ERROR_NOT_FOUND) {
GST_DEBUG_OBJECT (self, "No adapter for index %d", priv->adapter);
@ -997,9 +976,6 @@ gst_d3d11_device_get_property (GObject * object, guint prop_id,
case PROP_DESCRIPTION:
g_value_set_string (value, priv->description);
break;
case PROP_ALLOW_TEARING:
g_value_set_boolean (value, priv->allow_tearing);
break;
case PROP_CREATE_FLAGS:
g_value_set_uint (value, priv->create_flags);
break;

View file

@ -533,7 +533,25 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
/* Step 3: Create swapchain
* (or reuse old swapchain if the format is not changed) */
window->allow_tearing = FALSE;
g_object_get (window->device, "allow-tearing", &window->allow_tearing, NULL);
#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
{
ComPtr < IDXGIFactory5 > factory5;
IDXGIFactory1 *factory_handle;
BOOL allow_tearing = FALSE;
factory_handle = gst_d3d11_device_get_dxgi_factory_handle (window->device);
hr = factory_handle->QueryInterface (IID_PPV_ARGS (&factory5));
if (SUCCEEDED (hr)) {
hr = factory5->CheckFeatureSupport (DXGI_FEATURE_PRESENT_ALLOW_TEARING,
(void *) &allow_tearing, sizeof (allow_tearing));
}
if (SUCCEEDED (hr) && allow_tearing)
window->allow_tearing = allow_tearing;
}
#endif
if (window->allow_tearing) {
GST_DEBUG_OBJECT (window, "device support tearning");
swapchain_flags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;