Skip to content

Commit

Permalink
vo_gpu: win: remove exclusive-fullscreen detection hack
Browse files Browse the repository at this point in the history
This hack was part of a solution to VSync judder in desktop OpenGL on
Windows. Rather than using blocking-SwapBuffers(), mpv could use
DwmFlush() to wait for the image to be presented by the compositor.
Since this would only work while the compositor was running, and the
compositor was silently disabled when OpenGL entered exclusive
fullscreen mode, mpv needed a way to detect exclusive fullscreen mode.

The code that is being removed could detect exclusive fullscreen mode by
checking the state of an undocumented mutex using undocumented native
API functions, but because of how fragile it was, it was always meant to
be removed when a better solution for accurate VSync in OpenGL was
found. Since then, mpv got the dxinterop backend, which uses desktop
OpenGL but has accurate VSync. It also got a native Direct3D 11 backend,
which is a viable alternative to OpenGL on Windows.

For people who are still using desktop OpenGL with WGL, there shouldn't
be much of a difference, since mpv can use other API functions to detect
exclusive fullscreen.
  • Loading branch information
rossy committed Dec 20, 2017
1 parent d13f9d0 commit 3d8ca93
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 130 deletions.
6 changes: 0 additions & 6 deletions video/out/opengl/context_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include "options/m_config.h"
#include "video/out/w32_common.h"
#include "video/out/win32/exclusive_hack.h"
#include "context.h"
#include "utils.h"

Expand Down Expand Up @@ -237,11 +236,6 @@ static bool compositor_active(struct ra_ctx *ctx)
if (FAILED(DwmGetCompositionTimingInfo(0, &info)))
return false;

// Test if a program is running in exclusive fullscreen mode. If so, it's
// probably this one, so it's not getting redirected by the compositor.
if (mp_w32_is_in_exclusive_mode())
return false;

return true;
}

Expand Down
97 changes: 0 additions & 97 deletions video/out/win32/exclusive_hack.c

This file was deleted.

26 changes: 0 additions & 26 deletions video/out/win32/exclusive_hack.h

This file was deleted.

1 change: 0 additions & 1 deletion wscript_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ def build(ctx):
( "video/out/vulkan/context_wayland.c", "vulkan && wayland" ),
( "video/out/vulkan/context_win.c", "vulkan && win32-desktop" ),
( "video/out/vulkan/spirv_nvidia.c", "vulkan" ),
( "video/out/win32/exclusive_hack.c", "gl-win32" ),
( "video/out/wayland_common.c", "wayland" ),
( "video/out/wayland/xdg-shell-v6.c", "wayland" ),
( "video/out/wayland/idle-inhibit-v1.c", "wayland" ),
Expand Down

0 comments on commit 3d8ca93

Please sign in to comment.