From: Seungha Yang Date: Wed, 15 Mar 2023 13:05:33 +0000 (+0900) Subject: d3d11videosink: Fix tearing in case of fullscreen mode X-Git-Tag: 1.22.7~415 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00bb3a171ea284a4ba1b17d51f835c036b09480c;p=platform%2Fupstream%2Fgstreamer.git d3d11videosink: Fix tearing in case of fullscreen mode DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING and DXGI_PRESENT_ALLOW_TEARING should be used only if required, when user wants Vsync off for example. Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2376 Part-of: --- diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp index 85be423..52835e0 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp @@ -560,9 +560,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width, DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; gboolean hdr10_aware = FALSE; gboolean have_hdr10_meta = FALSE; - ComPtr < IDXGIFactory5 > factory5; - IDXGIFactory1 *factory_handle; - BOOL allow_tearing = FALSE; GstVideoMasteringDisplayInfo mdcv; GstVideoContentLightLevel cll; ComPtr < IDXGISwapChain3 > swapchain3; @@ -663,23 +660,6 @@ 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; - - factory_handle = gst_d3d11_device_get_dxgi_factory_handle (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; - - if (window->allow_tearing) { - GST_DEBUG_OBJECT (window, "device supports tearing"); - swapchain_flags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; - } - GstD3D11DeviceLockGuard lk (device); window->dxgi_format = chosen_format->dxgi_format; @@ -860,7 +840,6 @@ gst_d3d111_window_present (GstD3D11Window * self, GstBuffer * buffer, { GstD3D11WindowClass *klass = GST_D3D11_WINDOW_GET_CLASS (self); GstFlowReturn ret = GST_FLOW_OK; - guint present_flags = 0; GstVideoCropMeta *crop_meta; RECT input_rect = self->input_rect; RECT *prev_rect = &self->prev_input_rect; @@ -948,15 +927,12 @@ gst_d3d111_window_present (GstD3D11Window * self, GstBuffer * buffer, gst_d3d11_overlay_compositor_upload (self->compositor, buffer); gst_d3d11_overlay_compositor_draw_unlocked (self->compositor, &rtv); - if (self->allow_tearing && self->fullscreen) - present_flags |= DXGI_PRESENT_ALLOW_TEARING; - if (klass->present) { if (self->emit_present) { g_signal_emit (self, d3d11_window_signals[SIGNAL_PRESENT], 0, self->device, rtv, nullptr); } - ret = klass->present (self, present_flags); + ret = klass->present (self, 0); } self->first_present = FALSE; diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.h b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.h index 5a836ec..74dde52 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.h +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.h @@ -112,7 +112,6 @@ struct _GstD3D11Window GstBuffer *cached_buffer; gboolean first_present; - gboolean allow_tearing; GstVideoOrientationMethod method; };