mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 06:26:23 +00:00
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4188>
This commit is contained in:
parent
c975f0d26f
commit
00bb3a171e
2 changed files with 1 additions and 26 deletions
|
@ -560,9 +560,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
|
||||||
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;
|
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;
|
||||||
gboolean hdr10_aware = FALSE;
|
gboolean hdr10_aware = FALSE;
|
||||||
gboolean have_hdr10_meta = FALSE;
|
gboolean have_hdr10_meta = FALSE;
|
||||||
ComPtr < IDXGIFactory5 > factory5;
|
|
||||||
IDXGIFactory1 *factory_handle;
|
|
||||||
BOOL allow_tearing = FALSE;
|
|
||||||
GstVideoMasteringDisplayInfo mdcv;
|
GstVideoMasteringDisplayInfo mdcv;
|
||||||
GstVideoContentLightLevel cll;
|
GstVideoContentLightLevel cll;
|
||||||
ComPtr < IDXGISwapChain3 > swapchain3;
|
ComPtr < IDXGISwapChain3 > swapchain3;
|
||||||
|
@ -663,23 +660,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
|
||||||
|
|
||||||
/* Step 3: Create swapchain
|
/* Step 3: Create swapchain
|
||||||
* (or reuse old swapchain if the format is not changed) */
|
* (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);
|
GstD3D11DeviceLockGuard lk (device);
|
||||||
window->dxgi_format = chosen_format->dxgi_format;
|
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);
|
GstD3D11WindowClass *klass = GST_D3D11_WINDOW_GET_CLASS (self);
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
guint present_flags = 0;
|
|
||||||
GstVideoCropMeta *crop_meta;
|
GstVideoCropMeta *crop_meta;
|
||||||
RECT input_rect = self->input_rect;
|
RECT input_rect = self->input_rect;
|
||||||
RECT *prev_rect = &self->prev_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_upload (self->compositor, buffer);
|
||||||
gst_d3d11_overlay_compositor_draw_unlocked (self->compositor, &rtv);
|
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 (klass->present) {
|
||||||
if (self->emit_present) {
|
if (self->emit_present) {
|
||||||
g_signal_emit (self, d3d11_window_signals[SIGNAL_PRESENT], 0,
|
g_signal_emit (self, d3d11_window_signals[SIGNAL_PRESENT], 0,
|
||||||
self->device, rtv, nullptr);
|
self->device, rtv, nullptr);
|
||||||
}
|
}
|
||||||
ret = klass->present (self, present_flags);
|
ret = klass->present (self, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
self->first_present = FALSE;
|
self->first_present = FALSE;
|
||||||
|
|
|
@ -112,7 +112,6 @@ struct _GstD3D11Window
|
||||||
|
|
||||||
GstBuffer *cached_buffer;
|
GstBuffer *cached_buffer;
|
||||||
gboolean first_present;
|
gboolean first_present;
|
||||||
gboolean allow_tearing;
|
|
||||||
|
|
||||||
GstVideoOrientationMethod method;
|
GstVideoOrientationMethod method;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue