dotfiles/pkgs/osu-wine/patches/ps0071-p0002-winex11.drv-Bypass-compositor-in-fullscreen-.patch
2024-05-15 08:35:49 +07:00

71 lines
2.5 KiB
Diff

From 138916577787bbdf19cf9523b15603f73b4f4472 Mon Sep 17 00:00:00 2001
From: Kai Krakow <kai@kaishome.de>
Date: Thu, 4 Oct 2018 05:51:20 +0200
Subject: [PATCH 2/2] winex11.drv: Bypass compositor in fullscreen mode.
Bypass the compositor in fullscreen mode. This reduces stutter
introduced by window updates in the background and also allows for maybe
a few more FPS. To not change the visual appearance of the desktop for
windowed games, this hack only enables itself when the game was switched
to fullscreen mode, and returns to default WM setting when the game
leaves fullscreen mode.
Compositors tend to cause severe stutter if the game is GPU-bound.
---
dlls/winex11.drv/window.c | 7 +++++++
dlls/winex11.drv/x11drv.h | 1 +
dlls/winex11.drv/x11drv_main.c | 1 +
3 files changed, 9 insertions(+)
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1036,6 +1036,7 @@
void update_net_wm_states( struct x11drv_win_data *data )
{
UINT i, style, ex_style, new_state = 0;
+ unsigned long net_wm_bypass_compositor = 0;
if (!data->managed) return;
if (data->whole_window == root_window) return;
@@ -1048,7 +1049,10 @@
if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION)
new_state |= (1 << NET_WM_STATE_MAXIMIZED);
else if (!(style & WS_MINIMIZE))
+ {
+ net_wm_bypass_compositor = 1;
new_state |= (1 << NET_WM_STATE_FULLSCREEN);
+ }
}
else if (style & WS_MAXIMIZE)
new_state |= (1 << NET_WM_STATE_MAXIMIZED);
@@ -1112,6 +1116,9 @@
}
data->net_wm_state = new_state;
update_net_wm_fullscreen_monitors( data );
+
+ XChangeProperty( data->display, data->whole_window, x11drv_atom(_NET_WM_BYPASS_COMPOSITOR), XA_CARDINAL,
+ 32, PropModeReplace, (unsigned char *)&net_wm_bypass_compositor, 1 );
}
/***********************************************************************
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -501,6 +501,7 @@
XATOM__NET_SYSTEM_TRAY_OPCODE,
XATOM__NET_SYSTEM_TRAY_S0,
XATOM__NET_SYSTEM_TRAY_VISUAL,
+ XATOM__NET_WM_BYPASS_COMPOSITOR,
XATOM__NET_WM_FULLSCREEN_MONITORS,
XATOM__NET_WM_ICON,
XATOM__NET_WM_MOVERESIZE,
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -159,6 +159,7 @@
"_NET_SYSTEM_TRAY_OPCODE",
"_NET_SYSTEM_TRAY_S0",
"_NET_SYSTEM_TRAY_VISUAL",
+ "_NET_WM_BYPASS_COMPOSITOR",
"_NET_WM_FULLSCREEN_MONITORS",
"_NET_WM_ICON",
"_NET_WM_MOVERESIZE",