diff --git a/patches/chimeraos.patch b/patches/chimeraos.patch index e893b52..b66051d 100644 --- a/patches/chimeraos.patch +++ b/patches/chimeraos.patch @@ -1,7 +1,7 @@ -From c06cdd847679c930ee6197514970bc21f523e853 Mon Sep 17 00:00:00 2001 +From be5ec6fbb52964bd5f2e9e3261d520e73b2b20ea Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Fri, 17 May 2024 19:43:49 -0500 -Subject: [PATCH 01/22] Add touch-gestures to open up Steam menus +Subject: [PATCH 01/18] Add touch-gestures to open up Steam menus --- src/main.cpp | 5 +++++ @@ -10,10 +10,10 @@ Subject: [PATCH 01/22] Add touch-gestures to open up Steam menus 3 files changed, 34 insertions(+) diff --git a/src/main.cpp b/src/main.cpp -index cd4aeca..4b91c97 100644 +index 9dff5c4..6912b50 100644 --- a/src/main.cpp +++ b/src/main.cpp -@@ -108,6 +108,8 @@ const struct option *gamescope_options = (struct option[]){ +@@ -110,6 +110,8 @@ const struct option *gamescope_options = (struct option[]){ // wlserver options { "xwayland-count", required_argument, nullptr, 0 }, @@ -22,7 +22,7 @@ index cd4aeca..4b91c97 100644 // steamcompmgr options { "cursor", required_argument, nullptr, 0 }, -@@ -185,6 +187,7 @@ const char usage[] = +@@ -187,6 +189,7 @@ const char usage[] = " -T, --stats-path write statistics to path\n" " -C, --hide-cursor-delay hide cursor image after delay\n" " -e, --steam enable Steam integration\n" @@ -30,7 +30,7 @@ index cd4aeca..4b91c97 100644 " --xwayland-count create N xwayland servers\n" " --prefer-vk-device prefer Vulkan device for compositing (ex: 1002:7300)\n" " --force-orientation rotate the internal display (left, right, normal, upsidedown)\n" -@@ -734,6 +737,8 @@ int main(int argc, char **argv) +@@ -733,6 +736,8 @@ int main(int argc, char **argv) g_bDebugLayers = true; } else if (strcmp(opt_name, "disable-color-management") == 0) { g_bForceDisableColorMgmt = true; @@ -40,18 +40,18 @@ index cd4aeca..4b91c97 100644 g_nXWaylandCount = atoi( optarg ); } else if (strcmp(opt_name, "composite-debug") == 0) { diff --git a/src/wlserver.cpp b/src/wlserver.cpp -index ee6891d..62da656 100644 +index 78a86ee..ceeef24 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp -@@ -73,6 +73,7 @@ - static LogScope wl_log("wlserver"); +@@ -82,6 +82,7 @@ using namespace std::literals; + extern gamescope::ConVar cv_drm_debug_disable_explicit_sync; //#define GAMESCOPE_SWAPCHAIN_DEBUG +gamescope::ConVar cv_touch_gestures( "enable_touch_gestures", false, "Enable/Disable the usage of touch gestures" ); struct wlserver_t wlserver = { .touch_down_ids = {} -@@ -2568,6 +2569,33 @@ void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time, bool +@@ -2537,6 +2538,33 @@ void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time, bool if ( bAlwaysWarpCursor ) wlserver_mousewarp( tx, ty, time, false ); @@ -86,10 +86,10 @@ index ee6891d..62da656 100644 else if ( eMode == gamescope::TouchClickModes::Disabled ) { diff --git a/src/wlserver.hpp b/src/wlserver.hpp -index db7d491..da67bf7 100644 +index 0569472..3304c18 100644 --- a/src/wlserver.hpp +++ b/src/wlserver.hpp -@@ -291,6 +291,7 @@ void wlserver_x11_surface_info_finish( struct wlserver_x11_surface_info *surf ); +@@ -272,6 +272,7 @@ void wlserver_x11_surface_info_finish( struct wlserver_x11_surface_info *surf ); void wlserver_set_xwayland_server_mode( size_t idx, int w, int h, int refresh ); extern std::atomic g_bPendingTouchMovement; @@ -98,85 +98,12 @@ index db7d491..da67bf7 100644 void wlserver_open_steam_menu( bool qam ); -- -2.45.2 +2.47.0 - -From 34f22c6a52dbed8662132e4bdfd8a29dd1b7825c Mon Sep 17 00:00:00 2001 -From: Matthew Anderson -Date: Fri, 17 May 2024 20:16:20 -0500 -Subject: [PATCH 02/22] Add bypass_steam_resolution to workaround the 720p/800p - restrictions Steam has for games - ---- - src/main.cpp | 3 +++ - src/steamcompmgr.cpp | 11 +++++++++++ - 2 files changed, 14 insertions(+) - -diff --git a/src/main.cpp b/src/main.cpp -index 4b91c97..3d1057a 100644 ---- a/src/main.cpp -+++ b/src/main.cpp -@@ -129,6 +129,8 @@ const struct option *gamescope_options = (struct option[]){ - { "fade-out-duration", required_argument, nullptr, 0 }, - { "force-orientation", required_argument, nullptr, 0 }, - { "force-windows-fullscreen", no_argument, nullptr, 0 }, -+ { "bypass-steam-resolution", no_argument, nullptr, 0 }, -+ - - { "disable-color-management", no_argument, nullptr, 0 }, - { "sdr-gamut-wideness", required_argument, nullptr, 0 }, -@@ -187,6 +189,7 @@ const char usage[] = - " -T, --stats-path write statistics to path\n" - " -C, --hide-cursor-delay hide cursor image after delay\n" - " -e, --steam enable Steam integration\n" -+ " --bypass-steam-resolution bypass Steam's default 720p/800p default resolution\n" - " --touch-gestures enable touch gestures for Steam menus\n" - " --xwayland-count create N xwayland servers\n" - " --prefer-vk-device prefer Vulkan device for compositing (ex: 1002:7300)\n" -diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp -index 9ee265d..bec4268 100644 ---- a/src/steamcompmgr.cpp -+++ b/src/steamcompmgr.cpp -@@ -349,6 +349,8 @@ bool g_bForceHDR10OutputDebug = false; - gamescope::ConVar cv_hdr_enabled{ "hdr_enabled", false, "Whether or not HDR is enabled if it is available." }; - bool g_bHDRItmEnable = false; - int g_nCurrentRefreshRate_CachedValue = 0; -+gamescope::ConVar cv_bypass_steam_resolution{ "bypass_steam_resolution", false, "Workaround the 720p/800p limits Steam uses for games" }; -+ - - static void - update_color_mgmt() -@@ -5320,6 +5322,13 @@ handle_property_notify(xwayland_ctx_t *ctx, XPropertyEvent *ev) - size_t server_idx = size_t{ xwayland_mode_ctl[ 0 ] }; - int width = xwayland_mode_ctl[ 1 ]; - int height = xwayland_mode_ctl[ 2 ]; -+ -+ if ( g_nOutputWidth != 1280 && width == 1280 && cv_bypass_steam_resolution ) -+ { -+ width = g_nOutputWidth; -+ height = g_nOutputHeight; -+ } -+ - bool allowSuperRes = !!xwayland_mode_ctl[ 3 ]; - - if ( !allowSuperRes ) -@@ -7166,6 +7175,8 @@ steamcompmgr_main(int argc, char **argv) - bForceWindowsFullscreen = true; - } else if (strcmp(opt_name, "hdr-enabled") == 0) { - cv_hdr_enabled = true; -+ } else if (strcmp(opt_name, "bypass_steam_resolution") == 0) { -+ cv_bypass_steam_resolution = true; - } else if (strcmp(opt_name, "hdr-debug-force-support") == 0) { - g_bForceHDRSupportDebug = true; - } else if (strcmp(opt_name, "hdr-debug-force-output") == 0) { --- -2.45.2 - - -From 4c5657cca9a37fee0eee1d86ef3c2a6e5acef09c Mon Sep 17 00:00:00 2001 +From a90799dbad065c6933796f1708b245b561924159 Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Wed, 26 Jul 2023 20:46:29 -0500 -Subject: [PATCH 03/22] Add force external orientation. +Subject: [PATCH 02/18] Add force external orientation. Co-authored-by: Bouke Sybren Haarsma --- @@ -187,10 +114,10 @@ Co-authored-by: Bouke Sybren Haarsma 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp -index 92f01ca..4c72dc1 100644 +index 3a996af..6bc64fa 100644 --- a/src/Backends/DRMBackend.cpp +++ b/src/Backends/DRMBackend.cpp -@@ -536,6 +536,7 @@ bool g_bSupportsSyncObjs = false; +@@ -532,6 +532,7 @@ bool g_bSupportsSyncObjs = false; extern gamescope::GamescopeModeGeneration g_eGamescopeModeGeneration; extern GamescopePanelOrientation g_DesiredInternalOrientation; @@ -198,7 +125,7 @@ index 92f01ca..4c72dc1 100644 extern bool g_bForceDisableColorMgmt; -@@ -2023,6 +2024,10 @@ namespace gamescope +@@ -2026,6 +2027,10 @@ namespace gamescope { m_ChosenOrientation = g_DesiredInternalOrientation; } @@ -210,18 +137,18 @@ index 92f01ca..4c72dc1 100644 { if ( this->GetProperties().panel_orientation ) diff --git a/src/main.cpp b/src/main.cpp -index 3d1057a..fac3df2 100644 +index 6912b50..0601469 100644 --- a/src/main.cpp +++ b/src/main.cpp -@@ -128,6 +128,7 @@ const struct option *gamescope_options = (struct option[]){ +@@ -130,6 +130,7 @@ const struct option *gamescope_options = (struct option[]){ { "disable-xres", no_argument, nullptr, 'x' }, { "fade-out-duration", required_argument, nullptr, 0 }, { "force-orientation", required_argument, nullptr, 0 }, + { "force-external-orientation", required_argument, nullptr, 0 }, { "force-windows-fullscreen", no_argument, nullptr, 0 }, - { "bypass-steam-resolution", no_argument, nullptr, 0 }, -@@ -194,6 +195,7 @@ const char usage[] = + { "disable-color-management", no_argument, nullptr, 0 }, +@@ -193,6 +194,7 @@ const char usage[] = " --xwayland-count create N xwayland servers\n" " --prefer-vk-device prefer Vulkan device for compositing (ex: 1002:7300)\n" " --force-orientation rotate the internal display (left, right, normal, upsidedown)\n" @@ -229,7 +156,7 @@ index 3d1057a..fac3df2 100644 " --force-windows-fullscreen force windows inside of gamescope to be the size of the nested display (fullscreen)\n" " --cursor-scale-height if specified, sets a base output height to linearly scale the cursor against.\n" " --hdr-enabled enable HDR output (needs Gamescope WSI layer enabled for support from clients)\n" -@@ -289,6 +291,8 @@ bool g_bOutputHDREnabled = false; +@@ -288,6 +290,8 @@ bool g_bOutputHDREnabled = false; bool g_bFullscreen = false; bool g_bForceRelativeMouse = false; @@ -238,7 +165,7 @@ index 3d1057a..fac3df2 100644 bool g_bGrabbed = false; float g_mouseSensitivity = 1.0; -@@ -362,7 +366,24 @@ static GamescopePanelOrientation force_orientation(const char *str) +@@ -361,7 +365,24 @@ static GamescopePanelOrientation force_orientation(const char *str) } else if (strcmp(str, "upsidedown") == 0) { return GAMESCOPE_PANEL_ORIENTATION_180; } else { @@ -264,7 +191,7 @@ index 3d1057a..fac3df2 100644 exit(1); } } -@@ -755,6 +776,8 @@ int main(int argc, char **argv) +@@ -751,6 +772,8 @@ int main(int argc, char **argv) g_eGamescopeModeGeneration = parse_gamescope_mode_generation( optarg ); } else if (strcmp(opt_name, "force-orientation") == 0) { g_DesiredInternalOrientation = force_orientation( optarg ); @@ -274,7 +201,7 @@ index 3d1057a..fac3df2 100644 strcmp(opt_name, "fsr-sharpness") == 0) { g_upscaleFilterSharpness = atoi( optarg ); diff --git a/src/main.hpp b/src/main.hpp -index 8cfe629..5492cae 100644 +index 2e6fb83..ebd018a 100644 --- a/src/main.hpp +++ b/src/main.hpp @@ -28,6 +28,7 @@ extern bool g_bGrabbed; @@ -286,10 +213,10 @@ index 8cfe629..5492cae 100644 enum class GamescopeUpscaleFilter : uint32_t { diff --git a/src/wlserver.cpp b/src/wlserver.cpp -index 62da656..2998aed 100644 +index ceeef24..62876c2 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp -@@ -2530,6 +2530,29 @@ static void apply_touchscreen_orientation(double *x, double *y ) +@@ -2499,6 +2499,29 @@ static void apply_touchscreen_orientation(double *x, double *y ) break; } @@ -320,13 +247,12 @@ index 62da656..2998aed 100644 *y = ty; } -- -2.45.2 +2.47.0 - -From 897032bb4b8d8d5c11d67f9844a09a604b2c4333 Mon Sep 17 00:00:00 2001 +From 52d9d35a13ae8bad66be47da89d00353c60a1638 Mon Sep 17 00:00:00 2001 From: Bouke Sybren Haarsma Date: Tue, 12 Mar 2024 00:07:57 +0100 -Subject: [PATCH 04/22] implement force-panel-type +Subject: [PATCH 03/18] implement force-panel-type --- src/backend.h | 3 +++ @@ -335,10 +261,10 @@ Subject: [PATCH 04/22] implement force-panel-type 3 files changed, 20 insertions(+) diff --git a/src/backend.h b/src/backend.h -index 9c2db15..046eb10 100644 +index dd295f4..71c41a7 100644 --- a/src/backend.h +++ b/src/backend.h -@@ -17,6 +17,7 @@ struct wlr_buffer; +@@ -20,6 +20,7 @@ struct wlr_buffer; struct wlr_dmabuf_attributes; struct FrameInfo_t; @@ -346,7 +272,7 @@ index 9c2db15..046eb10 100644 namespace gamescope { -@@ -213,6 +214,8 @@ namespace gamescope +@@ -228,6 +229,8 @@ namespace gamescope // Dumb helper we should remove to support multi display someday. gamescope::GamescopeScreenType GetScreenType() { @@ -356,10 +282,10 @@ index 9c2db15..046eb10 100644 return GetCurrentConnector()->GetScreenType(); diff --git a/src/gamescope_shared.h b/src/gamescope_shared.h -index f34174e..ed30d8c 100644 +index 1ff54bd..feffdc1 100644 --- a/src/gamescope_shared.h +++ b/src/gamescope_shared.h -@@ -22,6 +22,7 @@ namespace gamescope +@@ -16,6 +16,7 @@ namespace gamescope { GAMESCOPE_SCREEN_TYPE_INTERNAL, GAMESCOPE_SCREEN_TYPE_EXTERNAL, @@ -368,18 +294,18 @@ index f34174e..ed30d8c 100644 GAMESCOPE_SCREEN_TYPE_COUNT }; diff --git a/src/main.cpp b/src/main.cpp -index fac3df2..8bea38c 100644 +index 0601469..58e273f 100644 --- a/src/main.cpp +++ b/src/main.cpp -@@ -129,6 +129,7 @@ const struct option *gamescope_options = (struct option[]){ +@@ -131,6 +131,7 @@ const struct option *gamescope_options = (struct option[]){ { "fade-out-duration", required_argument, nullptr, 0 }, { "force-orientation", required_argument, nullptr, 0 }, { "force-external-orientation", required_argument, nullptr, 0 }, + { "force-panel-type", required_argument, nullptr, 0 }, { "force-windows-fullscreen", no_argument, nullptr, 0 }, - { "bypass-steam-resolution", no_argument, nullptr, 0 }, -@@ -196,6 +197,7 @@ const char usage[] = + { "disable-color-management", no_argument, nullptr, 0 }, +@@ -195,6 +196,7 @@ const char usage[] = " --prefer-vk-device prefer Vulkan device for compositing (ex: 1002:7300)\n" " --force-orientation rotate the internal display (left, right, normal, upsidedown)\n" " --force-external-orientation rotate the external display (left, right, normal, upsidedown)\n" @@ -387,7 +313,7 @@ index fac3df2..8bea38c 100644 " --force-windows-fullscreen force windows inside of gamescope to be the size of the nested display (fullscreen)\n" " --cursor-scale-height if specified, sets a base output height to linearly scale the cursor against.\n" " --hdr-enabled enable HDR output (needs Gamescope WSI layer enabled for support from clients)\n" -@@ -387,6 +389,18 @@ static GamescopePanelOrientation force_external_orientation(const char *str) +@@ -386,6 +388,18 @@ static GamescopePanelOrientation force_external_orientation(const char *str) exit(1); } } @@ -406,7 +332,7 @@ index fac3df2..8bea38c 100644 static enum GamescopeUpscaleScaler parse_upscaler_scaler(const char *str) { -@@ -778,6 +792,8 @@ int main(int argc, char **argv) +@@ -774,6 +788,8 @@ int main(int argc, char **argv) g_DesiredInternalOrientation = force_orientation( optarg ); } else if (strcmp(opt_name, "force-external-orientation") == 0) { g_DesiredExternalOrientation = force_external_orientation( optarg ); @@ -416,13 +342,12 @@ index fac3df2..8bea38c 100644 strcmp(opt_name, "fsr-sharpness") == 0) { g_upscaleFilterSharpness = atoi( optarg ); -- -2.45.2 +2.47.0 - -From 2178f85676ba25434e8c39adc3848e3f7355acec Mon Sep 17 00:00:00 2001 +From 1aaf1a1ed46195d564c80c7d56251f09fde53aef Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Fri, 17 May 2024 21:11:34 -0500 -Subject: [PATCH 05/22] wlserver: Fix an issue that would cause gamescope to +Subject: [PATCH 04/18] wlserver: Fix an issue that would cause gamescope to crash when the touchscreen was used --- @@ -430,10 +355,10 @@ Subject: [PATCH 05/22] wlserver: Fix an issue that would cause gamescope to 1 file changed, 23 deletions(-) diff --git a/src/wlserver.cpp b/src/wlserver.cpp -index 2998aed..62da656 100644 +index 62876c2..ceeef24 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp -@@ -2530,29 +2530,6 @@ static void apply_touchscreen_orientation(double *x, double *y ) +@@ -2499,29 +2499,6 @@ static void apply_touchscreen_orientation(double *x, double *y ) break; } @@ -464,48 +389,50 @@ index 2998aed..62da656 100644 *y = ty; } -- -2.45.2 +2.47.0 - -From 261124a5a85ad80b0d7b15926f230bacbca21b22 Mon Sep 17 00:00:00 2001 +From 94e77c7f51ba1fd84d9f4fcccefefe6ad9fc8ae5 Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Fri, 17 May 2024 21:56:55 -0500 -Subject: [PATCH 06/22] Add --custom-refresh-rates +Subject: [PATCH 05/18] Add --custom-refresh-rates --- - src/Backends/DRMBackend.cpp | 4 ++++ - src/main.cpp | 30 ++++++++++++++++++++++++++++++ + src/Backends/DRMBackend.cpp | 6 ++++++ + src/main.cpp | 31 ++++++++++++++++++++++++++++++- src/main.hpp | 2 ++ - 3 files changed, 36 insertions(+) + 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp -index 4c72dc1..e4caebb 100644 +index 6bc64fa..5341bbf 100644 --- a/src/Backends/DRMBackend.cpp +++ b/src/Backends/DRMBackend.cpp -@@ -2125,6 +2125,10 @@ namespace gamescope - ( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Jupiter"sv ) || - ( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Galileo"sv ); - -+ if ( g_customRefreshRates.size() > 0 ) { -+ m_Mutable.ValidDynamicRefreshRates = std::span(g_customRefreshRates); -+ return; +@@ -2339,6 +2339,12 @@ namespace gamescope + m_Mutable.HDR.bExposeHDRSupport = false; + } + } ++ ++ // Apply command line overrides ++ if ( g_customRefreshRates.size() > 0 && ( GetScreenType() == GAMESCOPE_SCREEN_TYPE_INTERNAL || g_bExternalForced ) ) { ++ m_Mutable.ValidDynamicRefreshRates.clear(); ++ m_Mutable.ValidDynamicRefreshRates = std::vector(g_customRefreshRates); + } - if ( bSteamDeckDisplay ) - { - static constexpr uint32_t kPIDGalileoSDC = 0x3003; + } + + ///////////////////////// diff --git a/src/main.cpp b/src/main.cpp -index 8bea38c..a9e1969 100644 +index 58e273f..e6782e0 100644 --- a/src/main.cpp +++ b/src/main.cpp -@@ -132,6 +132,7 @@ const struct option *gamescope_options = (struct option[]){ +@@ -133,7 +133,7 @@ const struct option *gamescope_options = (struct option[]){ + { "force-external-orientation", required_argument, nullptr, 0 }, { "force-panel-type", required_argument, nullptr, 0 }, { "force-windows-fullscreen", no_argument, nullptr, 0 }, - { "bypass-steam-resolution", no_argument, nullptr, 0 }, +- + { "custom-refresh-rates", required_argument, nullptr, 0 }, - - { "disable-color-management", no_argument, nullptr, 0 }, -@@ -210,6 +211,7 @@ const char usage[] = + { "sdr-gamut-wideness", required_argument, nullptr, 0 }, + { "hdr-enabled", no_argument, nullptr, 0 }, +@@ -209,6 +209,7 @@ const char usage[] = " --hdr-itm-target-nits set the target luminace of the inverse tone mapping process.\n" " Default: 1000 nits, Max: 10000 nits\n" " --framerate-limit Set a simple framerate limit. Used as a divisor of the refresh rate, rounds down eg 60 / 59 -> 60fps, 60 / 25 -> 30fps. Default: 0, disabled.\n" @@ -513,7 +440,7 @@ index 8bea38c..a9e1969 100644 " --mangoapp Launch with the mangoapp (mangohud) performance overlay enabled. You should use this instead of using mangohud on the game or gamescope.\n" "\n" "Nested mode options:\n" -@@ -462,6 +464,32 @@ static enum gamescope::GamescopeBackend parse_backend_name(const char *str) +@@ -461,6 +462,32 @@ static enum gamescope::GamescopeBackend parse_backend_name(const char *str) fprintf( stderr, "gamescope: invalid value for --backend\n" ); exit(1); } @@ -546,7 +473,7 @@ index 8bea38c..a9e1969 100644 } struct sigaction handle_signal_action = {}; -@@ -794,6 +822,8 @@ int main(int argc, char **argv) +@@ -790,6 +817,8 @@ int main(int argc, char **argv) g_DesiredExternalOrientation = force_external_orientation( optarg ); } else if (strcmp(opt_name, "force-panel-type") == 0) { g_ForcedScreenType = force_panel_type( optarg ); @@ -556,7 +483,7 @@ index 8bea38c..a9e1969 100644 strcmp(opt_name, "fsr-sharpness") == 0) { g_upscaleFilterSharpness = atoi( optarg ); diff --git a/src/main.hpp b/src/main.hpp -index 5492cae..0207a51 100644 +index ebd018a..4e09e3b 100644 --- a/src/main.hpp +++ b/src/main.hpp @@ -3,6 +3,7 @@ @@ -576,21 +503,20 @@ index 5492cae..0207a51 100644 enum class GamescopeUpscaleFilter : uint32_t { -- -2.45.2 +2.47.0 - -From db4804880ea0fdf810979aea3153e2f45dc97bfe Mon Sep 17 00:00:00 2001 +From bf90ce80d7130c7dd23da5eb6086ca3452a33b6e Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Sat, 18 May 2024 08:44:38 -0500 -Subject: [PATCH 07/22] Add rotation gamescope_control command +Subject: [PATCH 06/18] Add rotation gamescope_control command --- protocol/gamescope-control.xml | 18 ++++++++++++ - src/Backends/DRMBackend.cpp | 23 +++++++++++++++- + src/Backends/DRMBackend.cpp | 24 ++++++++++++++-- src/gamescope_shared.h | 10 +++++++ src/main.cpp | 1 + src/wlserver.cpp | 50 ++++++++++++++++++++++++++++++++++ - 5 files changed, 101 insertions(+), 1 deletion(-) + 5 files changed, 101 insertions(+), 2 deletions(-) diff --git a/protocol/gamescope-control.xml b/protocol/gamescope-control.xml index 012c48c..eab8a84 100644 @@ -621,10 +547,10 @@ index 012c48c..eab8a84 100644 diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp -index e4caebb..70d5cdf 100644 +index 5341bbf..06200ae 100644 --- a/src/Backends/DRMBackend.cpp +++ b/src/Backends/DRMBackend.cpp -@@ -2020,7 +2020,9 @@ namespace gamescope +@@ -2023,7 +2023,9 @@ namespace gamescope void CDRMConnector::UpdateEffectiveOrientation( const drmModeModeInfo *pMode ) { @@ -635,10 +561,11 @@ index e4caebb..70d5cdf 100644 { m_ChosenOrientation = g_DesiredInternalOrientation; } -@@ -2935,6 +2937,25 @@ bool drm_update_color_mgmt(struct drm_t *drm) +@@ -2962,8 +2964,26 @@ bool drm_update_color_mgmt(struct drm_t *drm) return true; } +-int g_nDynamicRefreshHz = 0; +void drm_set_orientation( struct drm_t *drm, bool isRotated) +{ + int width = g_nOutputWidth; @@ -649,7 +576,7 @@ index e4caebb..70d5cdf 100644 + width = height; + height = tmp; + } -+ + + if (!drm->pConnector || !drm->pConnector->GetModeConnector()) + return; + @@ -658,14 +585,15 @@ index e4caebb..70d5cdf 100644 + update_drm_effective_orientations(drm, mode); +} + ++int g_nDynamicRefreshHz = 0; static void drm_unset_mode( struct drm_t *drm ) { drm->pending.mode_id = 0; diff --git a/src/gamescope_shared.h b/src/gamescope_shared.h -index ed30d8c..d04a907 100644 +index feffdc1..6e6b7db 100644 --- a/src/gamescope_shared.h +++ b/src/gamescope_shared.h -@@ -62,6 +62,16 @@ enum GamescopePanelOrientation +@@ -56,6 +56,16 @@ enum GamescopePanelOrientation GAMESCOPE_PANEL_ORIENTATION_AUTO, }; @@ -683,10 +611,10 @@ index ed30d8c..d04a907 100644 // composite priorities working in libliftoff + also // use the proper libliftoff composite plane system. diff --git a/src/main.cpp b/src/main.cpp -index a9e1969..4469ac1 100644 +index e6782e0..14eb513 100644 --- a/src/main.cpp +++ b/src/main.cpp -@@ -397,6 +397,7 @@ static gamescope::GamescopeScreenType force_panel_type(const char *str) +@@ -395,6 +395,7 @@ static gamescope::GamescopeScreenType force_panel_type(const char *str) if (strcmp(str, "internal") == 0) { return gamescope::GAMESCOPE_SCREEN_TYPE_INTERNAL; } else if (strcmp(str, "external") == 0) { @@ -695,10 +623,10 @@ index a9e1969..4469ac1 100644 } else { fprintf( stderr, "gamescope: invalid value for --force-panel-type\n" ); diff --git a/src/wlserver.cpp b/src/wlserver.cpp -index 62da656..96bb7fc 100644 +index ceeef24..e386765 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp -@@ -1101,6 +1101,55 @@ static void gamescope_control_take_screenshot( struct wl_client *client, struct +@@ -1043,6 +1043,55 @@ static void gamescope_control_take_screenshot( struct wl_client *client, struct } ); } @@ -754,7 +682,7 @@ index 62da656..96bb7fc 100644 static void gamescope_control_handle_destroy( struct wl_client *client, struct wl_resource *resource ) { wl_resource_destroy( resource ); -@@ -1110,6 +1159,7 @@ static const struct gamescope_control_interface gamescope_control_impl = { +@@ -1052,6 +1101,7 @@ static const struct gamescope_control_interface gamescope_control_impl = { .destroy = gamescope_control_handle_destroy, .set_app_target_refresh_cycle = gamescope_control_set_app_target_refresh_cycle, .take_screenshot = gamescope_control_take_screenshot, @@ -763,20 +691,18 @@ index 62da656..96bb7fc 100644 static uint32_t get_conn_display_info_flags() -- -2.45.2 +2.47.0 - -From ef9f07b932c8be1d391b9688b1b31edbb73e86ce Mon Sep 17 00:00:00 2001 +From ae730c5a1607c35c7283722f018811387c35b130 Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Sat, 18 May 2024 11:54:50 -0500 -Subject: [PATCH 08/22] Fix an issue that caused force-panel to not work +Subject: [PATCH 07/18] Fix an issue that caused force-panel to not work --- protocol/gamescope-control.xml | 1 - src/Backends/DRMBackend.cpp | 3 + - src/gamescope_shared.h | 10 --- src/wlserver.cpp | 145 ++++++++++++++++++++------------- - 4 files changed, 90 insertions(+), 69 deletions(-) + 3 files changed, 90 insertions(+), 59 deletions(-) diff --git a/protocol/gamescope-control.xml b/protocol/gamescope-control.xml index eab8a84..7f5578b 100644 @@ -791,10 +717,10 @@ index eab8a84..7f5578b 100644 diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp -index 70d5cdf..7af994e 100644 +index 06200ae..7c88818 100644 --- a/src/Backends/DRMBackend.cpp +++ b/src/Backends/DRMBackend.cpp -@@ -318,6 +318,9 @@ namespace gamescope +@@ -309,6 +309,9 @@ namespace gamescope GamescopeScreenType GetScreenType() const override { @@ -804,32 +730,11 @@ index 70d5cdf..7af994e 100644 if ( m_pConnector->connector_type == DRM_MODE_CONNECTOR_eDP || m_pConnector->connector_type == DRM_MODE_CONNECTOR_LVDS || m_pConnector->connector_type == DRM_MODE_CONNECTOR_DSI ) -diff --git a/src/gamescope_shared.h b/src/gamescope_shared.h -index d04a907..ed30d8c 100644 ---- a/src/gamescope_shared.h -+++ b/src/gamescope_shared.h -@@ -62,16 +62,6 @@ enum GamescopePanelOrientation - GAMESCOPE_PANEL_ORIENTATION_AUTO, - }; - --enum GamescopePanelExternalOrientation --{ -- GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_0, // normal -- GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_270, // right -- GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_90, // left -- GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_180, // upside down -- -- GAMESCOPE_PANEL_EXTERNAL_ORIENTATION_AUTO, --}; -- - // Disable partial composition for now until we get - // composite priorities working in libliftoff + also - // use the proper libliftoff composite plane system. diff --git a/src/wlserver.cpp b/src/wlserver.cpp -index 96bb7fc..959f63b 100644 +index e386765..a3af652 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp -@@ -74,6 +74,8 @@ static LogScope wl_log("wlserver"); +@@ -83,6 +83,8 @@ extern gamescope::ConVar cv_drm_debug_disable_explicit_sync; //#define GAMESCOPE_SWAPCHAIN_DEBUG gamescope::ConVar cv_touch_gestures( "enable_touch_gestures", false, "Enable/Disable the usage of touch gestures" ); @@ -838,7 +743,7 @@ index 96bb7fc..959f63b 100644 struct wlserver_t wlserver = { .touch_down_ids = {} -@@ -1107,43 +1109,43 @@ static void gamescope_control_rotate_display( struct wl_client *client, struct w +@@ -1049,43 +1051,43 @@ static void gamescope_control_rotate_display( struct wl_client *client, struct w if (target_type == GAMESCOPE_CONTROL_DISPLAY_TARGET_TYPE_INTERNAL ) { switch (orientation) { @@ -914,7 +819,7 @@ index 96bb7fc..959f63b 100644 } } //drm_set_orientation(&g_DRM, isRotated); -@@ -2554,34 +2556,61 @@ const std::shared_ptr& wlserver_surface_swapchai +@@ -2523,34 +2525,61 @@ const std::shared_ptr& wlserver_surface_swapchai /* Handle the orientation of the touch inputs */ static void apply_touchscreen_orientation(double *x, double *y ) { @@ -1003,23 +908,22 @@ index 96bb7fc..959f63b 100644 void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time, bool bAlwaysWarpCursor ) -- -2.45.2 +2.47.0 - -From 8950969d8c62982f03bf8452a503276960f2fa33 Mon Sep 17 00:00:00 2001 +From 8963506cccfa1f3ed21ac53def17cf7402be4d45 Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Sat, 18 May 2024 13:50:57 -0500 -Subject: [PATCH 09/22] Fix an arithmetic error +Subject: [PATCH 08/18] Fix an arithmetic error --- src/Backends/DRMBackend.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp -index 7af994e..30150fb 100644 +index 7c88818..477d141 100644 --- a/src/Backends/DRMBackend.cpp +++ b/src/Backends/DRMBackend.cpp -@@ -2023,9 +2023,9 @@ namespace gamescope +@@ -2026,9 +2026,9 @@ namespace gamescope void CDRMConnector::UpdateEffectiveOrientation( const drmModeModeInfo *pMode ) { @@ -1033,33 +937,31 @@ index 7af994e..30150fb 100644 m_ChosenOrientation = g_DesiredInternalOrientation; } -- -2.45.2 +2.47.0 - -From 3e51d6f0ae7603e322024783143329dc46835901 Mon Sep 17 00:00:00 2001 +From c32a4db47878b61298384771d9cbace8e1562c36 Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Sat, 18 May 2024 19:04:48 -0500 -Subject: [PATCH 10/22] Rework the touch gestures to be more smooth +Subject: [PATCH 09/18] Rework the touch gestures to be more smooth --- - src/wlserver.cpp | 90 +++++++++++++++++++++++++++++++++++++----------- - 1 file changed, 69 insertions(+), 21 deletions(-) + src/wlserver.cpp | 89 +++++++++++++++++++++++++++++++++++++----------- + 1 file changed, 69 insertions(+), 20 deletions(-) diff --git a/src/wlserver.cpp b/src/wlserver.cpp -index 959f63b..131cd72 100644 +index a3af652..a240871 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp -@@ -71,7 +71,8 @@ - #include +@@ -81,6 +81,8 @@ using namespace std::literals; + + extern gamescope::ConVar cv_drm_debug_disable_explicit_sync; - static LogScope wl_log("wlserver"); -- +bool pending_gesture = false; +bool pending_osk = false; //#define GAMESCOPE_SWAPCHAIN_DEBUG gamescope::ConVar cv_touch_gestures( "enable_touch_gestures", false, "Enable/Disable the usage of touch gestures" ); extern GamescopePanelOrientation g_DesiredInternalOrientation; -@@ -421,6 +422,39 @@ void wlserver_open_steam_menu( bool qam ) +@@ -363,6 +365,39 @@ void wlserver_open_steam_menu( bool qam ) XTestFakeKeyEvent(server->get_xdisplay(), XKeysymToKeycode( server->get_xdisplay(), XK_Control_L ), False, CurrentTime); } @@ -1099,7 +1001,7 @@ index 959f63b..131cd72 100644 static void wlserver_handle_pointer_button(struct wl_listener *listener, void *data) { struct wlserver_pointer *pointer = wl_container_of( listener, pointer, button ); -@@ -2649,32 +2683,46 @@ void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time, bool +@@ -2618,32 +2653,46 @@ void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time, bool if ( bAlwaysWarpCursor ) wlserver_mousewarp( tx, ty, time, false ); @@ -1167,39 +1069,12 @@ index 959f63b..131cd72 100644 else if ( eMode == gamescope::TouchClickModes::Disabled ) { -- -2.45.2 +2.47.0 - -From d25a36dabc8e1d8144413980d915d0e71d313434 Mon Sep 17 00:00:00 2001 -From: Matthew Anderson -Date: Sun, 19 May 2024 08:55:28 -0500 -Subject: [PATCH 11/22] Fix a typo for --bypass-steam-resolution - ---- - src/steamcompmgr.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp -index bec4268..10c0a75 100644 ---- a/src/steamcompmgr.cpp -+++ b/src/steamcompmgr.cpp -@@ -7175,7 +7175,7 @@ steamcompmgr_main(int argc, char **argv) - bForceWindowsFullscreen = true; - } else if (strcmp(opt_name, "hdr-enabled") == 0) { - cv_hdr_enabled = true; -- } else if (strcmp(opt_name, "bypass_steam_resolution") == 0) { -+ } else if (strcmp(opt_name, "bypass-steam-resolution") == 0) { - cv_bypass_steam_resolution = true; - } else if (strcmp(opt_name, "hdr-debug-force-support") == 0) { - g_bForceHDRSupportDebug = true; --- -2.45.2 - - -From 6d6afedd56a3f7b578cac1af7eaf93af931e0500 Mon Sep 17 00:00:00 2001 +From 068d28042c1f768f53cd0dc64d091b8342024d1f Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Sun, 19 May 2024 11:48:52 -0500 -Subject: [PATCH 12/22] Handle gesture cases better to prevent unexpected +Subject: [PATCH 10/18] Handle gesture cases better to prevent unexpected behavior --- @@ -1207,20 +1082,20 @@ Subject: [PATCH 12/22] Handle gesture cases better to prevent unexpected 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/src/wlserver.cpp b/src/wlserver.cpp -index 131cd72..9afe488 100644 +index a240871..3837c84 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp -@@ -71,7 +71,8 @@ - #include +@@ -81,7 +81,8 @@ using namespace std::literals; + + extern gamescope::ConVar cv_drm_debug_disable_explicit_sync; - static LogScope wl_log("wlserver"); -bool pending_gesture = false; +bool pending_gesture_x = false; +bool pending_gesture_y = false; bool pending_osk = false; //#define GAMESCOPE_SWAPCHAIN_DEBUG gamescope::ConVar cv_touch_gestures( "enable_touch_gestures", false, "Enable/Disable the usage of touch gestures" ); -@@ -2647,6 +2648,16 @@ static void apply_touchscreen_orientation(double *x, double *y ) +@@ -2617,6 +2618,16 @@ static void apply_touchscreen_orientation(double *x, double *y ) *y = ty; } @@ -1237,7 +1112,7 @@ index 131cd72..9afe488 100644 void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time, bool bAlwaysWarpCursor ) { assert( wlserver_is_lock_held() ); -@@ -2685,43 +2696,55 @@ void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time, bool +@@ -2655,43 +2666,55 @@ void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time, bool if ( cv_touch_gestures ) { @@ -1313,13 +1188,12 @@ index 131cd72..9afe488 100644 } else if ( eMode == gamescope::TouchClickModes::Disabled ) -- -2.45.2 +2.47.0 - -From 58e24b2f2ac33eb2388ef734835c6b02e437e563 Mon Sep 17 00:00:00 2001 +From 880d048fd51ddbe8d4d6bae750640385792adcba Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Sun, 19 May 2024 18:14:23 -0500 -Subject: [PATCH 13/22] Add references to drm_set_orientation() and g_drm in +Subject: [PATCH 11/18] Add references to drm_set_orientation() and g_drm in wlserver for rotation gamescope-control --- @@ -1328,10 +1202,10 @@ Subject: [PATCH 13/22] Add references to drm_set_orientation() and g_drm in 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wlserver.cpp b/src/wlserver.cpp -index 9afe488..e963bea 100644 +index 3837c84..13ea8b5 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp -@@ -1183,8 +1183,9 @@ static void gamescope_control_rotate_display( struct wl_client *client, struct w +@@ -1126,8 +1126,9 @@ static void gamescope_control_rotate_display( struct wl_client *client, struct w wl_log.errorf("Invalid target orientation selected"); } } @@ -1344,10 +1218,10 @@ index 9afe488..e963bea 100644 static void gamescope_control_handle_destroy( struct wl_client *client, struct wl_resource *resource ) diff --git a/src/wlserver.hpp b/src/wlserver.hpp -index da67bf7..688d05c 100644 +index 3304c18..0754ee5 100644 --- a/src/wlserver.hpp +++ b/src/wlserver.hpp -@@ -294,7 +294,8 @@ extern std::atomic g_bPendingTouchMovement; +@@ -275,7 +275,8 @@ extern std::atomic g_bPendingTouchMovement; extern gamescope::ConVar cv_touch_gestures; void wlserver_open_steam_menu( bool qam ); @@ -1358,13 +1232,12 @@ index da67bf7..688d05c 100644 void wlserver_destroy_xwayland_server(gamescope_xwayland_server_t *server); -- -2.45.2 +2.47.0 - -From 768e5689e12c2f57766d27d72b4fad03d54fc01c Mon Sep 17 00:00:00 2001 +From bbf77117ca4d866cf745334630c6d6d3c44d892a Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Mon, 20 May 2024 07:02:52 -0500 -Subject: [PATCH 14/22] Fix an issue where forced panel type orientations +Subject: [PATCH 12/18] Fix an issue where forced panel type orientations weren't being applied --- @@ -1372,10 +1245,10 @@ Subject: [PATCH 14/22] Fix an issue where forced panel type orientations 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp -index 30150fb..1a2668f 100644 +index 477d141..5967794 100644 --- a/src/Backends/DRMBackend.cpp +++ b/src/Backends/DRMBackend.cpp -@@ -2023,20 +2023,19 @@ namespace gamescope +@@ -2026,20 +2026,19 @@ namespace gamescope void CDRMConnector::UpdateEffectiveOrientation( const drmModeModeInfo *pMode ) { @@ -1402,7 +1275,7 @@ index 30150fb..1a2668f 100644 switch ( this->GetProperties().panel_orientation->GetCurrentValue() ) { case DRM_MODE_PANEL_ORIENTATION_NORMAL: -@@ -2058,6 +2057,7 @@ namespace gamescope +@@ -2061,6 +2060,7 @@ namespace gamescope if ( this->GetScreenType() == gamescope::GAMESCOPE_SCREEN_TYPE_INTERNAL && pMode ) { @@ -1410,7 +1283,7 @@ index 30150fb..1a2668f 100644 // Auto-detect portait mode for internal displays m_ChosenOrientation = pMode->hdisplay < pMode->vdisplay ? GAMESCOPE_PANEL_ORIENTATION_270 -@@ -2065,6 +2065,7 @@ namespace gamescope +@@ -2068,6 +2068,7 @@ namespace gamescope } else { @@ -1419,23 +1292,22 @@ index 30150fb..1a2668f 100644 } } -- -2.45.2 +2.47.0 - -From d6e4cf239f0f2113d1f3071a8d4766a810497617 Mon Sep 17 00:00:00 2001 +From 9ebad0d78422611b5fdb7270f9128ea620668da2 Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Mon, 20 May 2024 07:25:29 -0500 -Subject: [PATCH 15/22] add missing curly bracket... +Subject: [PATCH 13/18] add missing curly bracket... --- src/Backends/DRMBackend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp -index 1a2668f..825812e 100644 +index 5967794..3bf69dc 100644 --- a/src/Backends/DRMBackend.cpp +++ b/src/Backends/DRMBackend.cpp -@@ -2025,7 +2025,7 @@ namespace gamescope +@@ -2028,7 +2028,7 @@ namespace gamescope { if ((this->GetScreenType() == GAMESCOPE_SCREEN_TYPE_INTERNAL && g_DesiredInternalOrientation != GAMESCOPE_PANEL_ORIENTATION_AUTO) || (this->GetScreenType() == GAMESCOPE_SCREEN_TYPE_EXTERNAL && g_DesiredInternalOrientation != GAMESCOPE_PANEL_ORIENTATION_AUTO && g_bExternalForced)) { @@ -1445,13 +1317,12 @@ index 1a2668f..825812e 100644 } else if (this->GetScreenType() == GAMESCOPE_SCREEN_TYPE_EXTERNAL && g_DesiredExternalOrientation != GAMESCOPE_PANEL_ORIENTATION_AUTO) { drm_log.infof("We are rotating the orientation of an external display"); -- -2.45.2 +2.47.0 - -From 8983b3621dd81d4633a50a798b7794c6ae9d693b Mon Sep 17 00:00:00 2001 +From 73f8184fc7a2ed01683d624c0202cdd1ede89a8f Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Mon, 20 May 2024 10:17:55 -0500 -Subject: [PATCH 16/22] Fix case where real externals were rotated with faked +Subject: [PATCH 14/18] Fix case where real externals were rotated with faked external panels --- @@ -1460,10 +1331,10 @@ Subject: [PATCH 16/22] Fix case where real externals were rotated with faked 2 files changed, 64 insertions(+), 29 deletions(-) diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp -index 825812e..2668ad7 100644 +index 3bf69dc..c6bbfee 100644 --- a/src/Backends/DRMBackend.cpp +++ b/src/Backends/DRMBackend.cpp -@@ -318,13 +318,20 @@ namespace gamescope +@@ -309,13 +309,20 @@ namespace gamescope GamescopeScreenType GetScreenType() const override { @@ -1488,7 +1359,7 @@ index 825812e..2668ad7 100644 return GAMESCOPE_SCREEN_TYPE_EXTERNAL; } -@@ -2023,11 +2030,11 @@ namespace gamescope +@@ -2026,11 +2033,11 @@ namespace gamescope void CDRMConnector::UpdateEffectiveOrientation( const drmModeModeInfo *pMode ) { @@ -1504,10 +1375,10 @@ index 825812e..2668ad7 100644 m_ChosenOrientation = g_DesiredExternalOrientation; } diff --git a/src/wlserver.cpp b/src/wlserver.cpp -index e963bea..74d8209 100644 +index 13ea8b5..8b9201c 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp -@@ -2596,29 +2596,57 @@ static void apply_touchscreen_orientation(double *x, double *y ) +@@ -2566,29 +2566,57 @@ static void apply_touchscreen_orientation(double *x, double *y ) double ty = 0; // Use internal screen always for orientation purposes. @@ -1588,13 +1459,12 @@ index e963bea..74d8209 100644 else if (g_ForcedScreenType == gamescope::GAMESCOPE_SCREEN_TYPE_AUTO) { -- -2.45.2 +2.47.0 - -From 57057c9e5dc4ac026259726145d5b6e480368699 Mon Sep 17 00:00:00 2001 +From e0edcdb13d81fb822b748b4d6ac03183c828059d Mon Sep 17 00:00:00 2001 From: Matthew Anderson Date: Mon, 20 May 2024 16:30:47 -0500 -Subject: [PATCH 17/22] Add verbose panel logs and attempt to address all +Subject: [PATCH 15/18] Add verbose panel logs and attempt to address all orientation issues --- @@ -1604,10 +1474,10 @@ Subject: [PATCH 17/22] Add verbose panel logs and attempt to address all 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp -index 2668ad7..9df20ae 100644 +index c6bbfee..89b2802 100644 --- a/src/Backends/DRMBackend.cpp +++ b/src/Backends/DRMBackend.cpp -@@ -56,6 +56,7 @@ static constexpr bool k_bUseCursorPlane = false; +@@ -58,6 +58,7 @@ static constexpr bool k_bUseCursorPlane = false; extern int g_nPreferredOutputWidth; extern int g_nPreferredOutputHeight; @@ -1615,7 +1485,7 @@ index 2668ad7..9df20ae 100644 gamescope::ConVar cv_drm_single_plane_optimizations( "drm_single_plane_optimizations", true, "Whether or not to enable optimizations for single plane usage." ); -@@ -324,6 +325,7 @@ namespace gamescope +@@ -315,6 +316,7 @@ namespace gamescope { if ( g_bExternalForced ) { @@ -1623,7 +1493,7 @@ index 2668ad7..9df20ae 100644 return g_ForcedScreenType; } else -@@ -332,7 +334,7 @@ namespace gamescope +@@ -323,7 +325,7 @@ namespace gamescope } } @@ -1632,7 +1502,7 @@ index 2668ad7..9df20ae 100644 return GAMESCOPE_SCREEN_TYPE_EXTERNAL; } -@@ -2030,7 +2032,19 @@ namespace gamescope +@@ -2033,7 +2035,19 @@ namespace gamescope void CDRMConnector::UpdateEffectiveOrientation( const drmModeModeInfo *pMode ) { @@ -1654,10 +1524,10 @@ index 2668ad7..9df20ae 100644 m_ChosenOrientation = g_DesiredInternalOrientation; } diff --git a/src/wlserver.cpp b/src/wlserver.cpp -index 74d8209..3d4b239 100644 +index 8b9201c..7adf7db 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp -@@ -2600,26 +2600,29 @@ static void apply_touchscreen_orientation(double *x, double *y ) +@@ -2570,26 +2570,29 @@ static void apply_touchscreen_orientation(double *x, double *y ) { if ( g_ForcedScreenType == gamescope::GAMESCOPE_SCREEN_TYPE_EXTERNAL ) { @@ -1707,10 +1577,10 @@ index 74d8209..3d4b239 100644 } else diff --git a/src/wlserver.hpp b/src/wlserver.hpp -index 688d05c..ae55963 100644 +index 0754ee5..bdf3b0b 100644 --- a/src/wlserver.hpp +++ b/src/wlserver.hpp -@@ -296,6 +296,7 @@ extern gamescope::ConVar cv_touch_gestures; +@@ -277,6 +277,7 @@ extern gamescope::ConVar cv_touch_gestures; void wlserver_open_steam_menu( bool qam ); extern void drm_set_orientation( struct drm_t *drm, bool isRotated); extern drm_t g_DRM; @@ -1719,23 +1589,22 @@ index 688d05c..ae55963 100644 void wlserver_destroy_xwayland_server(gamescope_xwayland_server_t *server); -- -2.45.2 +2.47.0 - -From 41242b5ee7fa33cae22f30f5bcf5e27169bd8145 Mon Sep 17 00:00:00 2001 +From 85c2c680332247440c74080af69a02ea6fda7675 Mon Sep 17 00:00:00 2001 From: Bouke Sybren Haarsma Date: Tue, 28 May 2024 21:56:47 +0200 -Subject: [PATCH 18/22] add closing bracket +Subject: [PATCH 16/18] add closing bracket --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.cpp b/src/main.cpp -index 4469ac1..e455225 100644 +index 14eb513..4493b92 100644 --- a/src/main.cpp +++ b/src/main.cpp -@@ -465,6 +465,7 @@ static enum gamescope::GamescopeBackend parse_backend_name(const char *str) +@@ -463,6 +463,7 @@ static enum gamescope::GamescopeBackend parse_backend_name(const char *str) fprintf( stderr, "gamescope: invalid value for --backend\n" ); exit(1); } @@ -1744,13 +1613,12 @@ index 4469ac1..e455225 100644 std::vector g_customRefreshRates; // eg: 60,60,90,110-120 -- -2.45.2 +2.47.0 - -From e528844eb590f8183fdfffaf9a7af39f33dc2213 Mon Sep 17 00:00:00 2001 +From da32b357fc0b580fcefcd8453979df739cd86390 Mon Sep 17 00:00:00 2001 From: Bouke Sybren Haarsma Date: Wed, 3 Jan 2024 17:03:04 +0100 -Subject: [PATCH 19/22] remove hacky texture +Subject: [PATCH 17/18] remove hacky texture This will use more hardware planes, causing some devices to composite yeilding lower framerates --- @@ -1758,10 +1626,10 @@ This will use more hardware planes, causing some devices to composite yeilding l 1 file changed, 17 insertions(+), 45 deletions(-) diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp -index 10c0a75..1bc9008 100644 +index 11a7cad..0b0d17f 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp -@@ -1579,7 +1579,7 @@ bool MouseCursor::getTexture() +@@ -1621,7 +1621,7 @@ bool MouseCursor::getTexture() { pixels[i * image->width + j] = image->pixels[i * image->width + j]; } @@ -1770,7 +1638,7 @@ index 10c0a75..1bc9008 100644 std::vector resizeBuffer( nDesiredWidth * nDesiredHeight ); stbir_resize_uint8_srgb( (unsigned char *)pixels.data(), image->width, image->height, 0, (unsigned char *)resizeBuffer.data(), nDesiredWidth, nDesiredHeight, 0, -@@ -2257,7 +2257,7 @@ paint_all(bool async) +@@ -2316,7 +2316,7 @@ paint_all(bool async) } } } @@ -1779,7 +1647,7 @@ index 10c0a75..1bc9008 100644 int nOldLayerCount = frameInfo.layerCount; uint32_t flags = 0; -@@ -2265,7 +2265,7 @@ paint_all(bool async) +@@ -2324,7 +2324,7 @@ paint_all(bool async) flags |= PaintWindowFlag::BasePlane; paint_window(w, w, &frameInfo, global_focus.cursor, flags); update_touch_scaling( &frameInfo ); @@ -1788,7 +1656,7 @@ index 10c0a75..1bc9008 100644 // paint UI unless it's fully hidden, which it communicates to us through opacity=0 // we paint it to extract scaling coefficients above, then remove the layer if one was added if ( w->opacity == TRANSLUCENT && bHasVideoUnderlay && nOldLayerCount < frameInfo.layerCount ) -@@ -2278,7 +2278,7 @@ paint_all(bool async) +@@ -2337,7 +2337,7 @@ paint_all(bool async) float opacityScale = g_bPendingFade ? 0.0f : ((currentTime - fadeOutStartTime) / (float)g_FadeOutDuration); @@ -1797,7 +1665,7 @@ index 10c0a75..1bc9008 100644 paint_cached_base_layer(g_HeldCommits[HELD_COMMIT_FADE], g_CachedPlanes[HELD_COMMIT_FADE], &frameInfo, 1.0f - opacityScale, false); paint_window(w, w, &frameInfo, global_focus.cursor, PaintWindowFlag::BasePlane | PaintWindowFlag::FadeTarget | PaintWindowFlag::DrawBorders, opacityScale, override); } -@@ -2352,34 +2352,6 @@ paint_all(bool async) +@@ -2411,34 +2411,6 @@ paint_all(bool async) if ( overlay == global_focus.inputFocusWindow ) update_touch_scaling( &frameInfo ); } @@ -1832,7 +1700,7 @@ index 10c0a75..1bc9008 100644 if (notification) { -@@ -2957,7 +2929,7 @@ win_maybe_a_dropdown( steamcompmgr_win_t *w ) +@@ -3043,7 +3015,7 @@ win_maybe_a_dropdown( steamcompmgr_win_t *w ) // // TODO: Come back to me for original Age of Empires HD launcher. // Does that use it? It wants blending! @@ -1841,7 +1709,7 @@ index 10c0a75..1bc9008 100644 // Only do this if we have CONTROLPARENT right now. Some other apps, such as the // Street Fighter V (310950) Splash Screen also use LAYERED and TOOLWINDOW, and we don't // want that to be overlayed. -@@ -2972,12 +2944,12 @@ win_maybe_a_dropdown( steamcompmgr_win_t *w ) +@@ -3058,12 +3030,12 @@ win_maybe_a_dropdown( steamcompmgr_win_t *w ) // Josh: // The logic here is as follows. The window will be treated as a dropdown if: @@ -1856,7 +1724,7 @@ index 10c0a75..1bc9008 100644 // - If the window has transient for, disregard it, as it is trying to redirecting us elsewhere // ie. a settings menu dialog popup or something. // - If the window has both skip taskbar and pager, treat it as a dialog. -@@ -3069,7 +3041,7 @@ static bool is_good_override_candidate( steamcompmgr_win_t *override, steamcompm +@@ -3155,7 +3127,7 @@ static bool is_good_override_candidate( steamcompmgr_win_t *override, steamcompm return false; return override != focus && override->GetGeometry().nX >= 0 && override->GetGeometry().nY >= 0; @@ -1865,7 +1733,7 @@ index 10c0a75..1bc9008 100644 static bool pick_primary_focus_and_override(focus_t *out, Window focusControlWindow, const std::vector& vecPossibleFocusWindows, bool globalFocus, const std::vector& ctxFocusControlAppIDs) -@@ -3210,7 +3182,7 @@ found:; +@@ -3296,7 +3268,7 @@ found:; if ( focus ) { @@ -1874,7 +1742,7 @@ index 10c0a75..1bc9008 100644 out->focusWindow = focus; else focus->outdatedInteractiveFocus = true; -@@ -3253,9 +3225,9 @@ found:; +@@ -3339,9 +3311,9 @@ found:; override_focus = fake_override; goto found2; } @@ -1886,7 +1754,7 @@ index 10c0a75..1bc9008 100644 found2:; resolveTransientOverrides( true ); } -@@ -4514,7 +4486,7 @@ finish_destroy_win(xwayland_ctx_t *ctx, Window id, bool gone) +@@ -4603,7 +4575,7 @@ finish_destroy_win(xwayland_ctx_t *ctx, Window id, bool gone) { if (gone) finish_unmap_win (ctx, w); @@ -1895,7 +1763,7 @@ index 10c0a75..1bc9008 100644 { std::unique_lock lock( ctx->list_mutex ); *prev = w->xwayland().next; -@@ -4571,7 +4543,7 @@ destroy_win(xwayland_ctx_t *ctx, Window id, bool gone, bool fade) +@@ -4660,7 +4632,7 @@ destroy_win(xwayland_ctx_t *ctx, Window id, bool gone, bool fade) global_focus.overrideWindow = nullptr; if (x11_win(global_focus.fadeWindow) == id && gone) global_focus.fadeWindow = nullptr; @@ -1904,7 +1772,7 @@ index 10c0a75..1bc9008 100644 MakeFocusDirty(); finish_destroy_win(ctx, id, gone); -@@ -5176,7 +5148,7 @@ handle_property_notify(xwayland_ctx_t *ctx, XPropertyEvent *ev) +@@ -5284,7 +5256,7 @@ handle_property_notify(xwayland_ctx_t *ctx, XPropertyEvent *ev) { get_win_type(ctx, w); MakeFocusDirty(); @@ -1913,7 +1781,7 @@ index 10c0a75..1bc9008 100644 } if (ev->atom == ctx->atoms.sizeHintsAtom) { -@@ -6084,7 +6056,7 @@ void handle_done_commits_xdg( bool vblank, uint64_t vblank_idx ) +@@ -6187,7 +6159,7 @@ void handle_done_commits_xdg( bool vblank, uint64_t vblank_idx ) commits_before_their_time.push_back( entry ); continue; } @@ -1922,7 +1790,7 @@ index 10c0a75..1bc9008 100644 if (!entry.earliestPresentTime) { entry.earliestPresentTime = next_refresh_time; -@@ -6938,7 +6910,7 @@ void update_mode_atoms(xwayland_ctx_t *root_ctx, bool* needs_flush = nullptr) +@@ -7209,7 +7181,7 @@ void update_mode_atoms(xwayland_ctx_t *root_ctx, bool* needs_flush = nullptr) } XChangeProperty(root_ctx->dpy, root_ctx->root, root_ctx->atoms.gamescopeDisplayModeListExternal, XA_STRING, 8, PropModeReplace, (unsigned char *)modes, strlen(modes) + 1 ); @@ -1931,7 +1799,7 @@ index 10c0a75..1bc9008 100644 uint32_t one = 1; XChangeProperty(root_ctx->dpy, root_ctx->root, root_ctx->atoms.gamescopeDisplayIsExternal, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&one, 1 ); -@@ -7696,7 +7668,7 @@ void steamcompmgr_send_frame_done_to_focus_window() +@@ -8054,7 +8026,7 @@ void steamcompmgr_send_frame_done_to_focus_window() { wlserver_lock(); wlserver_send_frame_done( global_focus.focusWindow->xwayland().surface.main_surface , &now ); @@ -1941,87 +1809,96 @@ index 10c0a75..1bc9008 100644 } -- -2.45.2 +2.47.0 +From 426fc5865a5a00339ab17bf006fddcca8a68675f Mon Sep 17 00:00:00 2001 +From: Alesh Slovak +Date: Thu, 26 Sep 2024 07:13:24 -0400 +Subject: [PATCH 18/18] Revert "steamcompmgr: Move outdatedInteractiveFocus to + window" -From 7865b34c5cd61fa5cc5428ace614e4551fabb6ec Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Joaqu=C3=ADn=20Ignacio=20Aramend=C3=ADa?= - -Date: Tue, 9 Jul 2024 18:29:16 -0300 -Subject: [PATCH 20/22] disable explicit sync to avoid graphical artifacts - +This reverts commit 299bc3410dcfd46da5e3c988354b60ed3a356900. --- - src/Backends/DRMBackend.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + src/steamcompmgr.cpp | 39 +++++++++++++++++++++++-------------- + src/steamcompmgr_shared.hpp | 1 - + 2 files changed, 24 insertions(+), 16 deletions(-) -diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp -index 9df20ae..ff1858b 100644 ---- a/src/Backends/DRMBackend.cpp -+++ b/src/Backends/DRMBackend.cpp -@@ -68,7 +68,7 @@ gamescope::ConVar cv_drm_debug_disable_blend_tf( "drm_debug_disable_blend_ - gamescope::ConVar cv_drm_debug_disable_ctm( "drm_debug_disable_ctm", false, "CTM chicken bit. (Forces CTM off, does not affect other logic)" ); - gamescope::ConVar cv_drm_debug_disable_color_encoding( "drm_debug_disable_color_encoding", false, "YUV Color Encoding chicken bit. (Forces COLOR_ENCODING to DEFAULT, does not affect other logic)" ); - gamescope::ConVar cv_drm_debug_disable_color_range( "drm_debug_disable_color_range", false, "YUV Color Range chicken bit. (Forces COLOR_RANGE to DEFAULT, does not affect other logic)" ); --gamescope::ConVar cv_drm_debug_disable_explicit_sync( "drm_debug_disable_explicit_sync", false, "Force disable explicit sync on the DRM backend." ); -+gamescope::ConVar cv_drm_debug_disable_explicit_sync( "drm_debug_disable_explicit_sync", true, "Force disable explicit sync on the DRM backend." ); - gamescope::ConVar cv_drm_debug_disable_in_fence_fd( "drm_debug_disable_in_fence_fd", false, "Force disable IN_FENCE_FD being set to avoid over-synchronization on the DRM backend." ); +diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp +index 0b0d17f..d6aecec 100644 +--- a/src/steamcompmgr.cpp ++++ b/src/steamcompmgr.cpp +@@ -3271,7 +3271,7 @@ found:; + if ( window_has_commits( focus ) ) + out->focusWindow = focus; + else +- focus->outdatedInteractiveFocus = true; ++ out->outdatedInteractiveFocus = true; - // HACK: --- -2.45.2 - - -From 1dbcfed76f4b80d8a9f6570819b5af7917c786fc Mon Sep 17 00:00:00 2001 -From: Kyle Gospodnetich -Date: Tue, 2 Jul 2024 14:12:47 -0700 -Subject: [PATCH 21/22] Only change refresh rates on internal displays - ---- - src/Backends/DRMBackend.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp -index ff1858b..f5a452e 100644 ---- a/src/Backends/DRMBackend.cpp -+++ b/src/Backends/DRMBackend.cpp -@@ -2152,7 +2152,7 @@ namespace gamescope - ( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Jupiter"sv ) || - ( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Galileo"sv ); + // Always update X's idea of focus, but still dirty + // the it being outdated so we can resolve that globally later. +@@ -6016,28 +6016,37 @@ bool handle_done_commit( steamcompmgr_win_t *w, xwayland_ctx_t *ctx, uint64_t co + // Window just got a new available commit, determine if that's worth a repaint -- if ( g_customRefreshRates.size() > 0 ) { -+ if ( g_customRefreshRates.size() > 0 && GetScreenType() == GAMESCOPE_SCREEN_TYPE_INTERNAL ) { - m_Mutable.ValidDynamicRefreshRates = std::span(g_customRefreshRates); - return; - } --- -2.45.2 - - -From 3b0408f6ec7307e7a38f2c795b932d0dc05f2d72 Mon Sep 17 00:00:00 2001 -From: Kyle Gospodnetich -Date: Tue, 2 Jul 2024 15:14:23 -0700 -Subject: [PATCH 22/22] Also check g_bExternalForced - ---- - src/Backends/DRMBackend.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp -index f5a452e..d7f935d 100644 ---- a/src/Backends/DRMBackend.cpp -+++ b/src/Backends/DRMBackend.cpp -@@ -2152,9 +2152,9 @@ namespace gamescope - ( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Jupiter"sv ) || - ( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Galileo"sv ); + // If this is an overlay that we're presenting, repaint +- if ( w == global_focus.overlayWindow && w->opacity != TRANSLUCENT ) ++ if ( gameFocused ) + { +- hasRepaintNonBasePlane = true; +- } ++ if ( w == global_focus.overlayWindow && w->opacity != TRANSLUCENT ) ++ { ++ hasRepaintNonBasePlane = true; ++ } -- if ( g_customRefreshRates.size() > 0 && GetScreenType() == GAMESCOPE_SCREEN_TYPE_INTERNAL ) { -- m_Mutable.ValidDynamicRefreshRates = std::span(g_customRefreshRates); -- return; -+ if ( g_customRefreshRates.size() > 0 && ( GetScreenType() == GAMESCOPE_SCREEN_TYPE_INTERNAL || g_bExternalForced ) ) { -+ m_Mutable.ValidDynamicRefreshRates = std::span(g_customRefreshRates); -+ return; - } - if ( bSteamDeckDisplay ) - { +- if ( w == global_focus.notificationWindow && w->opacity != TRANSLUCENT ) +- { +- hasRepaintNonBasePlane = true; ++ if ( w == global_focus.notificationWindow && w->opacity != TRANSLUCENT ) ++ { ++ hasRepaintNonBasePlane = true; ++ } + } +- +- // If this is an external overlay, repaint +- if ( w == global_focus.externalOverlayWindow && w->opacity != TRANSLUCENT ) ++ if ( ctx ) + { +- hasRepaintNonBasePlane = true; ++ if ( ctx->focus.outdatedInteractiveFocus ) ++ { ++ MakeFocusDirty(); ++ ctx->focus.outdatedInteractiveFocus = false; ++ } + } +- +- if ( w->outdatedInteractiveFocus ) ++ if ( global_focus.outdatedInteractiveFocus ) + { + MakeFocusDirty(); +- w->outdatedInteractiveFocus = false; +- } ++ global_focus.outdatedInteractiveFocus = false; + ++ // If this is an external overlay, repaint ++ if ( w == global_focus.externalOverlayWindow && w->opacity != TRANSLUCENT ) ++ { ++ hasRepaintNonBasePlane = true; ++ } ++ } + // If this is the main plane, repaint + if ( w == global_focus.focusWindow && !w->isSteamStreamingClient ) + { +diff --git a/src/steamcompmgr_shared.hpp b/src/steamcompmgr_shared.hpp +index 095694e..e41fad9 100644 +--- a/src/steamcompmgr_shared.hpp ++++ b/src/steamcompmgr_shared.hpp +@@ -125,7 +125,6 @@ struct steamcompmgr_win_t { + unsigned int requestedHeight = 0; + bool is_dialog = false; + bool maybe_a_dropdown = false; +- bool outdatedInteractiveFocus = false; + + bool hasHwndStyle = false; + uint32_t hwndStyle = 0; -- -2.45.2 +2.47.0