chore: Update gamescope to 3.14.22

This commit is contained in:
Kyle Gospodnetich 2024-06-27 13:19:16 -07:00
parent a2f1ea078f
commit 53aeff4d57
11 changed files with 174 additions and 586 deletions

View File

@ -1,18 +0,0 @@
diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp
index 52dd8d1..05337c1 100644
--- a/src/steamcompmgr.cpp
+++ b/src/steamcompmgr.cpp
@@ -5202,6 +5202,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 && !env_to_bool(getenv("GAMESCOPE_ENABLE_720P_RESTRICT")) )
+ {
+ width = g_nOutputWidth;
+ height = g_nOutputHeight;
+ }
+
bool allowSuperRes = !!xwayland_mode_ctl[ 3 ];
if ( !allowSuperRes )

View File

@ -0,0 +1,88 @@
diff --git a/src/main.cpp b/src/main.cpp
index 59dec4f..037a22f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -107,6 +107,8 @@ const struct option *gamescope_options = (struct option[]){
// wlserver options
{ "xwayland-count", required_argument, nullptr, 0 },
+ { "touch-gestures", no_argument, nullptr, 0 },
+
// steamcompmgr options
{ "cursor", required_argument, nullptr, 0 },
@@ -184,6 +186,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"
+ " --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"
" --force-orientation rotate the internal display (left, right, normal, upsidedown)\n"
@@ -766,6 +769,8 @@ int main(int argc, char **argv)
g_bDebugLayers = true;
} else if (strcmp(opt_name, "disable-color-management") == 0) {
g_bForceDisableColorMgmt = true;
+ } else if (strcmp(opt_name, "touch-gestures") == 0) {
+ cv_touch_gestures = true;
} else if (strcmp(opt_name, "xwayland-count") == 0) {
g_nXWaylandCount = atoi( optarg );
} else if (strcmp(opt_name, "composite-debug") == 0) {
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index d9182aa..e4ea445 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -73,6 +73,7 @@
static LogScope wl_log("wlserver");
//#define GAMESCOPE_SWAPCHAIN_DEBUG
+gamescope::ConVar<bool> cv_touch_gestures( "enable_touch_gestures", false, "Enable/Disable the usage of touch gestures" );
struct wlserver_t wlserver = {
.touch_down_ids = {}
@@ -2534,6 +2535,33 @@ void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time, bool
if ( bAlwaysWarpCursor )
wlserver_mousewarp( tx, ty, time, false );
+
+ if (cv_touch_gestures) {
+ bool start_gesture = false;
+
+ // Round the x-coordinate to the nearest whole number
+ uint32_t roundedCursorX = static_cast<int>(std::round(tx));
+ // Grab 2% of the display to be used for the edge range
+ uint32_t edge_range = static_cast<uint32_t>(g_nOutputWidth * 0.02);
+
+ // Determine if the gesture should start
+ if (roundedCursorX <= edge_range || roundedCursorX >= g_nOutputWidth - edge_range) {
+ start_gesture = true;
+ }
+
+ // Handle Home gesture
+ if (start_gesture && roundedCursorX >= edge_range) {
+ wlserver_open_steam_menu(0);
+ start_gesture = false;
+ }
+
+ // Handle QAM gesture
+ if (start_gesture && roundedCursorX >= g_nOutputWidth - edge_range && roundedCursorX <= g_nOutputWidth) {
+ wlserver_open_steam_menu(1);
+ start_gesture = false;
+ }
+ }
+
}
else if ( eMode == gamescope::TouchClickModes::Disabled )
{
diff --git a/src/wlserver.hpp b/src/wlserver.hpp
index 0d8f3ac..0d7759e 100644
--- a/src/wlserver.hpp
+++ b/src/wlserver.hpp
@@ -287,6 +287,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<bool> g_bPendingTouchMovement;
+extern gamescope::ConVar<bool> cv_touch_gestures;
void wlserver_open_steam_menu( bool qam );

View File

@ -1,35 +1,24 @@
From 90f972dfb4de9c8245f6fc5370a294653de828cc Mon Sep 17 00:00:00 2001
From: Marco Rodolfi <marco.rodolfi@tuta.io>
Date: Thu, 2 May 2024 14:16:40 +0200
Subject: [PATCH 1/2] Rebase DHD on latest gamescope master
---
src/drm.cpp | 11 +++++++++--
src/gamescope_shared.h | 1 +
src/modegen.cpp | 34 ++++++++++++++++++++++++++++++----
3 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/src/drm.cpp b/src/drm.cpp
index 511a571..6ee3bd3 100644
--- a/src/drm.cpp
+++ b/src/drm.cpp
@@ -2121,6 +2121,7 @@ namespace gamescope
diff --git a/src/Backends/DRMBackend.cpp b/src/Backends/DRMBackend.cpp
index 85e5126..be418b4 100644
--- a/src/Backends/DRMBackend.cpp
+++ b/src/Backends/DRMBackend.cpp
@@ -2149,6 +2149,7 @@ namespace gamescope
( m_Mutable.szMakePNP == "WLC"sv && m_Mutable.szModel == "ANX7530 U"sv ) ||
( m_Mutable.szMakePNP == "ANX"sv && m_Mutable.szModel == "ANX7530 U"sv ) ||
( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "ANX7530 U"sv ) ||
+ ( m_Mutable.szMakePNP == "DHD"sv && m_Mutable.szModel == "DeckHD-1200p"sv ) ||
( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Jupiter"sv ) ||
( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Galileo"sv );
const bool bLegionGoDisplay =
@@ -2132,6 +2133,7 @@ namespace gamescope
@@ -2160,6 +2161,7 @@ namespace gamescope
{
static constexpr uint32_t kPIDGalileoSDC = 0x3003;
static constexpr uint32_t kPIDGalileoBOE = 0x3004;
+ static constexpr uint32_t kPIDJupiterDHD = 0x4001;
if ( pProduct->product == kPIDGalileoSDC )
{
@@ -2120,6 +2122,10 @@ namespace gamescope
@@ -2171,6 +2173,10 @@ namespace gamescope
m_Mutable.eKnownDisplay = GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_OLED_BOE;
m_Mutable.ValidDynamicRefreshRates = std::span( s_kSteamDeckOLEDRates );
}
@ -40,7 +29,7 @@ index 511a571..6ee3bd3 100644
else
{
m_Mutable.eKnownDisplay = GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD;
@@ -2149,7 +2155,8 @@ namespace gamescope
@@ -2200,7 +2206,8 @@ namespace gamescope
drm_log.infof( "[colorimetry]: Steam Deck LCD detected. Using known colorimetry" );
m_Mutable.DisplayColorimetry = displaycolorimetry_steamdeck_measured;
}
@ -50,7 +39,7 @@ index 511a571..6ee3bd3 100644
{
// Steam Deck OLED has calibrated chromaticity coordinates in the EDID
// for each unit.
@@ -2279,7 +2286,7 @@ namespace gamescope
@@ -2330,7 +2337,7 @@ namespace gamescope
.uMinContentLightLevel = nits_to_u16_dark( 0 ),
};
}
@ -60,33 +49,36 @@ index 511a571..6ee3bd3 100644
// Set up some HDR fallbacks for undocking
return BackendConnectorHDRInfo
diff --git a/src/gamescope_shared.h b/src/gamescope_shared.h
index f34174e59..3b11e82f6 100644
index ed30d8c..3b60774 100644
--- a/src/gamescope_shared.h
+++ b/src/gamescope_shared.h
@@ -8,6 +8,7 @@ namespace gamescope
{
GAMESCOPE_KNOWN_DISPLAY_UNKNOWN,
GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD, // Jupiter
+ GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD, // Jupiter Deck HD
+ GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD, // Jupiter Deck HD
GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_OLED_SDC, // Galileo SDC
GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_OLED_BOE, // Galileo BOE
};
diff --git a/src/modegen.cpp b/src/modegen.cpp
index d174c2d21..d08622555 100644
index d174c2d..5dd1136 100644
--- a/src/modegen.cpp
+++ b/src/modegen.cpp
@@ -293,6 +293,21 @@ unsigned int galileo_boe_vfp[] =
@@ -293,13 +293,32 @@ unsigned int galileo_boe_vfp[] =
172,152,136,120,100,84,68,52,36,20,8
};
-#define GALILEO_MIN_REFRESH 45
+//SD LCD Stock Timings
+#define JUPITER_BOE_PID 0x3001
+#define JUPITER_B_PID 0x3002
+#define JUPITER_HFP 40
+#define JUPITER_HSYNC 4
+#define JUPITER_HBP 0
+#define JUPITER_HBP 40
+#define JUPITER_VFP 30
+#define JUPITER_VSYNC 4
+#define JUPITER_VBP 8
+//SD LCD DeckHD Timings
+#define JUPITER_DHD_PID 0x4001
+#define JUPITER_DHD_HFP 40
+#define JUPITER_DHD_HSYNC 20
@ -94,15 +86,24 @@ index d174c2d21..d08622555 100644
+#define JUPITER_DHD_VFP 18
+#define JUPITER_DHD_VSYNC 2
+#define JUPITER_DHD_VBP 20
#define GALILEO_MIN_REFRESH 45
+//SD OLED SDC Timings
#define GALILEO_SDC_PID 0x3003
#define GALILEO_SDC_VSYNC 1
@@ -344,7 +359,18 @@ void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base, int
#define GALILEO_SDC_VBP 22
+//SD OLED BOE Timings
#define GALILEO_BOE_PID 0x3004
#define GALILEO_BOE_VSYNC 2
#define GALILEO_BOE_VBP 30
+#define GALILEO_MIN_REFRESH 45
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
unsigned int get_galileo_vfp( int vrefresh, unsigned int * vfp_array, unsigned int num_rates )
@@ -344,17 +363,28 @@ void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base, int
mode->vsync_end = mode->vsync_start + vsync;
mode->vtotal = mode->vsync_end + vbp;
} else {
- if ( eKnownDisplay == gamescope::GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD )
+ if ( eKnownDisplay == gamescope:: GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD ) {
+ if ( eKnownDisplay == gamescope::GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD ) {
+ mode->hdisplay = 1200;
+ mode->hsync_start = mode->hdisplay + JUPITER_DHD_HFP;
+ mode->hsync_end = mode->hsync_start + JUPITER_DHD_HSYNC;
@ -116,10 +117,13 @@ index d174c2d21..d08622555 100644
+ else if ( eKnownDisplay == gamescope::GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD )
{
mode->hdisplay = 800;
mode->hsync_start = 840;
@@ -352,9 +378,9 @@ void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base, int
mode->htotal = 884;
- mode->hsync_start = 840;
- mode->hsync_end = 844;
- mode->htotal = 884;
+ mode->hsync_start = mode->hdisplay + JUPITER_HFP;
+ mode->hsync_end = mode->hsync_start + JUPITER_HSYNC;
+ mode->htotal = mode->hsync_end + JUPITER_HBP;
mode->vdisplay = 1280;
- mode->vsync_start = 1310;
- mode->vsync_end = 1314;
@ -128,91 +132,5 @@ index d174c2d21..d08622555 100644
+ mode->vsync_end = mode->vsync_start + JUPITER_VSYNC;
+ mode->vtotal = mode->vsync_end + JUPITER_VBP;
}
mode->clock = ( ( mode->htotal * mode->vtotal * vrefresh ) + 999 ) / 1000;
From a01b1937fe2f898d3aa8628ca6a38465da29e78b Mon Sep 17 00:00:00 2001
From: Marco Rodolfi <marco.rodolfi@tuta.io>
Date: Fri, 3 May 2024 10:23:30 +0200
Subject: [PATCH 2/2] Couple of stylistic fixes and corrected a timing typo
from the original patch
---
src/gamescope_shared.h | 2 +-
src/modegen.cpp | 16 ++++++++++------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/gamescope_shared.h b/src/gamescope_shared.h
index 3b11e82f6..60e38293c 100644
--- a/src/gamescope_shared.h
+++ b/src/gamescope_shared.h
@@ -8,7 +8,7 @@ namespace gamescope
{
GAMESCOPE_KNOWN_DISPLAY_UNKNOWN,
GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD, // Jupiter
- GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD, // Jupiter Deck HD
+ GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD, // Jupiter Deck HD
GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_OLED_SDC, // Galileo SDC
GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_OLED_BOE, // Galileo BOE
};
diff --git a/src/modegen.cpp b/src/modegen.cpp
index d08622555..5dd113697 100644
--- a/src/modegen.cpp
+++ b/src/modegen.cpp
@@ -293,14 +293,16 @@ unsigned int galileo_boe_vfp[] =
172,152,136,120,100,84,68,52,36,20,8
};
+//SD LCD Stock Timings
#define JUPITER_BOE_PID 0x3001
#define JUPITER_B_PID 0x3002
#define JUPITER_HFP 40
#define JUPITER_HSYNC 4
-#define JUPITER_HBP 0
+#define JUPITER_HBP 40
#define JUPITER_VFP 30
#define JUPITER_VSYNC 4
#define JUPITER_VBP 8
+//SD LCD DeckHD Timings
#define JUPITER_DHD_PID 0x4001
#define JUPITER_DHD_HFP 40
#define JUPITER_DHD_HSYNC 20
@@ -308,13 +310,15 @@ unsigned int galileo_boe_vfp[] =
#define JUPITER_DHD_VFP 18
#define JUPITER_DHD_VSYNC 2
#define JUPITER_DHD_VBP 20
-#define GALILEO_MIN_REFRESH 45
+//SD OLED SDC Timings
#define GALILEO_SDC_PID 0x3003
#define GALILEO_SDC_VSYNC 1
#define GALILEO_SDC_VBP 22
+//SD OLED BOE Timings
#define GALILEO_BOE_PID 0x3004
#define GALILEO_BOE_VSYNC 2
#define GALILEO_BOE_VBP 30
+#define GALILEO_MIN_REFRESH 45
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
unsigned int get_galileo_vfp( int vrefresh, unsigned int * vfp_array, unsigned int num_rates )
@@ -359,7 +363,7 @@ void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base, int
mode->vsync_end = mode->vsync_start + vsync;
mode->vtotal = mode->vsync_end + vbp;
} else {
- if ( eKnownDisplay == gamescope:: GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD ) {
+ if ( eKnownDisplay == gamescope::GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD ) {
mode->hdisplay = 1200;
mode->hsync_start = mode->hdisplay + JUPITER_DHD_HFP;
mode->hsync_end = mode->hsync_start + JUPITER_DHD_HSYNC;
@@ -373,9 +377,9 @@ void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base, int
else if ( eKnownDisplay == gamescope::GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD )
{
mode->hdisplay = 800;
- mode->hsync_start = 840;
- mode->hsync_end = 844;
- mode->htotal = 884;
+ mode->hsync_start = mode->hdisplay + JUPITER_HFP;
+ mode->hsync_end = mode->hsync_start + JUPITER_HSYNC;
+ mode->htotal = mode->hsync_end + JUPITER_HBP;
mode->vdisplay = 1280;
mode->vsync_start = mode->vdisplay + JUPITER_VFP;

View File

@ -1,13 +1,51 @@
diff --git a/src/main.cpp b/src/main.cpp
index 119e043..6c46d97 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -148,6 +148,8 @@ const struct option *gamescope_options = (struct option[]){
{ "reshade-effect", required_argument, nullptr, 0 },
{ "reshade-technique-idx", required_argument, nullptr, 0 },
+ { "disable-touch-click", no_argument, nullptr, 0 },
+
// Steam Deck options
{ "mura-map", required_argument, nullptr, 0 },
@@ -193,6 +195,7 @@ const char usage[] =
" -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"
+ " --disable-touch-click disable touchscreen tap acting as a click\n"
" --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"
diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp
index 05337c1..d6d883b 100644
index 92bf617..d7498e5 100644
--- a/src/steamcompmgr.cpp
+++ b/src/steamcompmgr.cpp
@@ -4949,7 +4949,7 @@ handle_property_notify(xwayland_ctx_t *ctx, XPropertyEvent *ev)
focusDirty = true;
@@ -347,6 +347,7 @@ bool g_bHDRItmEnable = false;
int g_nCurrentRefreshRate_CachedValue = 0;
gamescope::ConVar<bool> cv_bypass_steam_resolution{ "bypass_steam_resolution", false, "Workaround the 720p/800p limits Steam uses for games" };
+gamescope::ConVar<bool> cv_disable_touch_click{ "disable_touch_click", false, "Prevents touchscreen taps acting as clicks" };
static void
update_color_mgmt()
@@ -5128,7 +5129,7 @@ handle_property_notify(xwayland_ctx_t *ctx, XPropertyEvent *ev)
MakeFocusDirty();
}
}
- if (ev->atom == ctx->atoms.steamTouchClickModeAtom )
+ if (ev->atom == ctx->atoms.steamTouchClickModeAtom && !env_to_bool(getenv("GAMESCOPE_DISABLE_TOUCH_CLICK_MODE")))
+ if (ev->atom == ctx->atoms.steamTouchClickModeAtom && !cv_disable_touch_click)
{
gamescope::cv_touch_click_mode = (gamescope::TouchClickMode) get_prop(ctx, ctx->root, ctx->atoms.steamTouchClickModeAtom, 0u );
}
@@ -7301,6 +7302,8 @@ steamcompmgr_main(int argc, char **argv)
g_reshade_technique_idx = atoi(optarg);
} else if (strcmp(opt_name, "mura-map") == 0) {
set_mura_overlay(optarg);
+ } else if (strcmp(opt_name, "disable-touch-click") == 0) {
+ cv_disable_touch_click = true;
}
break;
case '?':

View File

@ -1,11 +0,0 @@
--- a/src/drm.cpp
+++ b/src/drm.cpp
@@ -63,7 +63,7 @@
gamescope::ConVar<bool> cv_drm_debug_disable_regamma_tf( "drm_debug_disable_regamma_tf", false, "Regamma chicken bit. (Forces REGAMMA_TF to DEFAULT, does not affect other logic)" );
gamescope::ConVar<bool> cv_drm_debug_disable_output_tf( "drm_debug_disable_output_tf", false, "Force default (identity) output TF, affects other logic. Not a property directly." );
gamescope::ConVar<bool> cv_drm_debug_disable_blend_tf( "drm_debug_disable_blend_tf", false, "Blending chicken bit. (Forces BLEND_TF to DEFAULT, does not affect other logic)" );
-gamescope::ConVar<bool> cv_drm_debug_disable_explicit_sync( "drm_debug_disable_explicit_sync", false, "Force disable explicit sync on the DRM backend." );
+gamescope::ConVar<bool> cv_drm_debug_disable_explicit_sync( "drm_debug_disable_explicit_sync", true, "Force disable explicit sync on the DRM backend." );
gamescope::ConVar<bool> 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." );
namespace gamescope

View File

@ -1,138 +0,0 @@
diff --git a/src/drm.cpp b/src/drm.cpp
index 42c67b9..628bfc9 100644
--- a/src/drm.cpp
+++ b/src/drm.cpp
@@ -521,6 +521,7 @@ bool g_bSupportsSyncObjs = false;
extern gamescope::GamescopeModeGeneration g_eGamescopeModeGeneration;
extern GamescopePanelOrientation g_DesiredInternalOrientation;
+extern GamescopePanelOrientation g_DesiredExternalOrientation;
extern bool g_bForceDisableColorMgmt;
@@ -2008,6 +2009,10 @@ namespace gamescope
{
m_ChosenOrientation = g_DesiredInternalOrientation;
}
+ else if ( this->GetScreenType() == GAMESCOPE_SCREEN_TYPE_EXTERNAL && g_DesiredExternalOrientation != GAMESCOPE_PANEL_ORIENTATION_AUTO )
+ {
+ m_ChosenOrientation = g_DesiredExternalOrientation;
+ }
else
{
if ( this->GetProperties().panel_orientation )
diff --git a/src/main.cpp b/src/main.cpp
index 88c4c7c..2f5fc0a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -121,6 +121,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 },
{ "disable-color-management", no_argument, nullptr, 0 },
@@ -171,6 +172,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"
+ " --force-external-orientation rotate the external display (left, right, normal, upsidedown)\n"
" --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"
@@ -267,6 +269,8 @@ bool g_bOutputHDREnabled = false;
bool g_bFullscreen = false;
bool g_bForceRelativeMouse = false;
+bool g_bExternalForced = false;
+
bool g_bGrabbed = false;
float g_mouseSensitivity = 1.0;
@@ -353,6 +357,27 @@ static GamescopePanelOrientation force_orientation(const char *str)
}
}
+GamescopePanelOrientation g_DesiredExternalOrientation = GAMESCOPE_PANEL_ORIENTATION_AUTO;
+static GamescopePanelOrientation force_external_orientation(const char *str)
+{
+ if (strcmp(str, "normal") == 0) {
+ g_bExternalForced = true;
+ return GAMESCOPE_PANEL_ORIENTATION_0;
+ } else if (strcmp(str, "right") == 0) {
+ g_bExternalForced = true;
+ return GAMESCOPE_PANEL_ORIENTATION_270;
+ } else if (strcmp(str, "left") == 0) {
+ g_bExternalForced = true;
+ return GAMESCOPE_PANEL_ORIENTATION_90;
+ } else if (strcmp(str, "upsidedown") == 0) {
+ g_bExternalForced = true;
+ return GAMESCOPE_PANEL_ORIENTATION_180;
+ } else {
+ fprintf( stderr, "gamescope: invalid value for --force-external-orientation\n" );
+ exit(1);
+ }
+}
+
static enum GamescopeUpscaleScaler parse_upscaler_scaler(const char *str)
{
if (strcmp(str, "auto") == 0) {
@@ -648,6 +673,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 );
+ } else if (strcmp(opt_name, "force-external-orientation") == 0) {
+ g_DesiredExternalOrientation = force_external_orientation( optarg );
} else if (strcmp(opt_name, "sharpness") == 0 ||
strcmp(opt_name, "fsr-sharpness") == 0) {
g_upscaleFilterSharpness = atoi( optarg );
diff --git a/src/main.hpp b/src/main.hpp
index 4e4e9a7..be9a9dd 100644
--- a/src/main.hpp
+++ b/src/main.hpp
@@ -28,6 +28,7 @@ extern bool g_bGrabbed;
extern float g_mouseSensitivity;
extern const char *g_sOutputName;
+extern bool g_bExternalForced;
enum class GamescopeUpscaleFilter : uint32_t
{
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index 9afaab7..b3f9f31 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -2130,6 +2130,32 @@ static void apply_touchscreen_orientation(double *x, double *y )
break;
}
+ // Rotate screen if it's forced with --force-external-orientation
+ if ( g_bExternalForced == true )
+ {
+ switch ( GetBackend()->GetConnector( gamescope::GAMESCOPE_SCREEN_TYPE_EXTERNAL )->GetCurrentOrientation() )
+ {
+ default:
+ case GAMESCOPE_PANEL_ORIENTATION_AUTO:
+ case GAMESCOPE_PANEL_ORIENTATION_0:
+ tx = *x;
+ ty = *y;
+ break;
+ case GAMESCOPE_PANEL_ORIENTATION_90:
+ tx = 1.0 - *y;
+ ty = *x;
+ break;
+ case GAMESCOPE_PANEL_ORIENTATION_180:
+ tx = 1.0 - *x;
+ ty = 1.0 - *y;
+ break;
+ case GAMESCOPE_PANEL_ORIENTATION_270:
+ tx = *y;
+ ty = 1.0 - *x;
+ break;
+ }
+ }
+
*x = tx;
*y = ty;
}

View File

@ -2,7 +2,7 @@
%global _default_patch_fuzz 2
%global build_timestamp %(date +"%Y%m%d")
%global gamescope_tag 3.14.18
%global gamescope_tag 3.14.22
Name: gamescope
Version: 100.%{gamescope_tag}
@ -15,13 +15,9 @@ URL: https://github.com/ValveSoftware/gamescope
# Create stb.pc to satisfy dependency('stb')
Source0: stb.pc
Patch0: hardware.patch
Patch1: 720p.patch
Patch2: disable-steam-touch-click-atom.patch
Patch3: external-rotation.patch
Patch4: panel-type.patch
Patch5: deckhd.patch
Patch6: explicit_sync.patch
Patch0: chimeraos.patch
Patch1: disable-steam-touch-click-atom.patch
Patch2: deckhd.patch
BuildRequires: meson >= 0.54.0
BuildRequires: ninja-build

View File

@ -1,50 +0,0 @@
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index b3f9f31..38a3365 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -70,6 +70,8 @@
static LogScope wl_log("wlserver");
+extern bool env_to_bool(const char *env);
+
struct wlserver_t wlserver = {
.touch_down_ids = {}
};
@@ -2192,6 +2194,36 @@ void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time )
if ( eMode == gamescope::TouchClickModes::Passthrough )
{
wlr_seat_touch_notify_motion( wlserver.wlr.seat, time, touch_id, tx, ty );
+
+ if ( !env_to_bool(getenv("GAMESCOPE_DISABLE_TOUCH_GESTURES")) ) {
+ bool start_gesture = false;
+
+ // Round the x-coordinate to the nearest whole number
+ uint32_t roundedCursorX = static_cast<int>(std::round(wlserver.mouse_surface_cursorx));
+ // Grab 2% of the display to be used for the edge range
+ double edge_range = g_nOutputWidth * 0.02;
+
+ // if the touch cursor x position is less or equal to the range then start the gesture for left to right
+ if (roundedCursorX <= edge_range) {
+ start_gesture = true;
+ }
+ // if the touch cursor x position is the output width minus the edge range value then we are doing right to left
+ if (roundedCursorX >= g_nOutputWidth - edge_range) {
+ start_gesture = true;
+ }
+ // when the gesture is started and we are moving to the end of the edge range open home
+ if (start_gesture && roundedCursorX >= 1 && roundedCursorX <= edge_range) {
+ wl_log.infof("Detected Home gesture");
+ wlserver_open_steam_menu(false);
+ start_gesture = false;
+ }
+ // when the gesture is started and we are moving from the output width minus the edge range to the output width open QAM
+ if (start_gesture && roundedCursorX >= g_nOutputWidth - edge_range && roundedCursorX <= g_nOutputWidth ) {
+ wl_log.infof("Detected QAM gesture");
+ wlserver_open_steam_menu(true);
+ start_gesture = false;
+ }
+ }
}
else if ( eMode == gamescope::TouchClickModes::Disabled )
{

View File

@ -1,50 +0,0 @@
diff --git a/src/drm.cpp b/src/drm.cpp
index 628bfc9..7776422 100644
--- a/src/drm.cpp
+++ b/src/drm.cpp
@@ -550,6 +550,19 @@ static constexpr uint32_t s_kSteamDeckOLEDRates[] =
90,
};
+static constexpr uint32_t s_kLegionGoRates[] =
+{
+ 60,
+ 144,
+};
+
+static constexpr uint32_t s_kLokiRates[] =
+{
+ 40,
+ 50,
+ 60,
+};
+
static void update_connector_display_info_wl(struct drm_t *drm)
{
wlserver_lock();
@@ -2109,6 +2122,10 @@ namespace gamescope
( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "ANX7530 U"sv ) ||
( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Jupiter"sv ) ||
( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Galileo"sv );
+ const bool bLegionGoDisplay =
+ ( m_Mutable.szMakePNP == "LEN"sv && m_Mutable.szModel == "Go Display"sv );
+ const bool bLokiDisplay =
+ ( m_Mutable.szMakePNP == "AYN"sv && m_Mutable.szModel == "LK-GOLDSPV58"sv );
if ( bSteamDeckDisplay )
{
@@ -2131,6 +2148,14 @@ namespace gamescope
m_Mutable.ValidDynamicRefreshRates = std::span( s_kSteamDeckLCDRates );
}
}
+ else if ( bLegionGoDisplay )
+ {
+ m_Mutable.ValidDynamicRefreshRates = std::span( s_kLegionGoRates );
+ }
+ else if ( bLokiDisplay )
+ {
+ m_Mutable.ValidDynamicRefreshRates = std::span( s_kLokiRates );
+ }
// Colorimetry
const char *pszColorOverride = getenv( "GAMESCOPE_INTERNAL_COLORIMETRY_OVERRIDE" );

View File

@ -1,104 +0,0 @@
From 312e25b14640f3fa88469b57e898a4b2c069a186 Mon Sep 17 00:00:00 2001
From: Joshua Ashton <joshua@froggi.es>
Date: Thu, 16 May 2024 08:56:56 +0100
Subject: [PATCH] InputEmulation: refcounting/lifetime fixes
---
src/InputEmulation.cpp | 70 +++++++++++++++++++++++++++++-------------
1 file changed, 49 insertions(+), 21 deletions(-)
diff --git a/src/InputEmulation.cpp b/src/InputEmulation.cpp
index 5a63e4f48..236cb4df3 100644
--- a/src/InputEmulation.cpp
+++ b/src/InputEmulation.cpp
@@ -77,7 +77,7 @@ namespace gamescope
eis_seat_configure_capability( pSeat, EIS_DEVICE_CAP_POINTER );
eis_seat_configure_capability( pSeat, EIS_DEVICE_CAP_POINTER_ABSOLUTE );
eis_seat_configure_capability( pSeat, EIS_DEVICE_CAP_KEYBOARD );
- eis_seat_configure_capability( pSeat, EIS_DEVICE_CAP_TOUCH );
+ //eis_seat_configure_capability( pSeat, EIS_DEVICE_CAP_TOUCH );
eis_seat_configure_capability( pSeat, EIS_DEVICE_CAP_BUTTON );
eis_seat_configure_capability( pSeat, EIS_DEVICE_CAP_SCROLL );
eis_seat_add( pSeat );
@@ -98,33 +98,61 @@ namespace gamescope
eis_client *pClient = eis_event_get_client( pEisEvent );
eis_seat *pSeat = eis_event_get_seat( pEisEvent );
- eis_device *pVirtualInput = eis_seat_new_device( pSeat );
- eis_device_configure_name( pVirtualInput, "Gamescope Virtual Input" );
- eis_device_configure_capability( pVirtualInput, EIS_DEVICE_CAP_POINTER );
- eis_device_configure_capability( pVirtualInput, EIS_DEVICE_CAP_POINTER_ABSOLUTE );
- eis_device_configure_capability( pVirtualInput, EIS_DEVICE_CAP_BUTTON );
- eis_device_configure_capability( pVirtualInput, EIS_DEVICE_CAP_SCROLL );
- eis_device_configure_capability( pVirtualInput, EIS_DEVICE_CAP_KEYBOARD );
- // Can add this someday if we want it.
- //eis_device_configure_capability( pVirtualInput, EIS_DEVICE_CAP_TOUCH );
-
- eis_region *pVirtualInputRegion = eis_device_new_region( pVirtualInput );
- eis_region_set_mapping_id( pVirtualInputRegion, "Mr. Worldwide" );
- eis_region_set_size( pVirtualInputRegion, INT32_MAX, INT32_MAX );
- eis_region_set_offset( pVirtualInputRegion, 0, 0 );
- eis_region_add( pVirtualInputRegion );
-
- eis_device_add( pVirtualInput );
- eis_device_resume( pVirtualInput );
- if ( !eis_client_is_sender( pClient ) )
- eis_device_start_emulating( pVirtualInput, ++s_uSequence );
+ bool bWantsDevice = eis_event_seat_has_capability( pEisEvent, EIS_DEVICE_CAP_POINTER ) ||
+ eis_event_seat_has_capability( pEisEvent, EIS_DEVICE_CAP_POINTER_ABSOLUTE ) ||
+ eis_event_seat_has_capability( pEisEvent, EIS_DEVICE_CAP_BUTTON ) ||
+ eis_event_seat_has_capability( pEisEvent, EIS_DEVICE_CAP_SCROLL ) ||
+ eis_event_seat_has_capability( pEisEvent, EIS_DEVICE_CAP_KEYBOARD );
+
+ bool bHasDevice = eis_client_get_user_data( pClient ) != nullptr;
+
+ if ( bWantsDevice && !bHasDevice )
+ {
+ eis_device *pVirtualInput = eis_seat_new_device( pSeat );
+ eis_device_configure_name( pVirtualInput, "Gamescope Virtual Input" );
+ eis_device_configure_capability( pVirtualInput, EIS_DEVICE_CAP_POINTER );
+ eis_device_configure_capability( pVirtualInput, EIS_DEVICE_CAP_POINTER_ABSOLUTE );
+ eis_device_configure_capability( pVirtualInput, EIS_DEVICE_CAP_BUTTON );
+ eis_device_configure_capability( pVirtualInput, EIS_DEVICE_CAP_SCROLL );
+ eis_device_configure_capability( pVirtualInput, EIS_DEVICE_CAP_KEYBOARD );
+ // Can add this someday if we want it.
+ //eis_device_configure_capability( pVirtualInput, EIS_DEVICE_CAP_TOUCH );
+
+ eis_region *pVirtualInputRegion = eis_device_new_region( pVirtualInput );
+ eis_region_set_mapping_id( pVirtualInputRegion, "Mr. Worldwide" );
+ eis_region_set_size( pVirtualInputRegion, INT32_MAX, INT32_MAX );
+ eis_region_set_offset( pVirtualInputRegion, 0, 0 );
+ eis_region_add( pVirtualInputRegion );
+ // We don't want this anymore, but pVirtualInput can own it
+ eis_region_unref( pVirtualInputRegion );
+
+ eis_device_add( pVirtualInput );
+ eis_device_resume( pVirtualInput );
+ if ( !eis_client_is_sender( pClient ) )
+ eis_device_start_emulating( pVirtualInput, ++s_uSequence );
+
+ // We have a ref on pVirtualInput, store that in pClient's userdata so we can remove device later.
+ eis_client_set_user_data( pClient, (void *) pVirtualInput );
+ }
+ else if ( !bWantsDevice && bHasDevice )
+ {
+ eis_device *pDevice = (eis_device *) eis_client_get_user_data( pClient );
+ eis_device_remove( pDevice );
+ eis_device_unref( pDevice );
+ eis_client_set_user_data( pClient, nullptr );
+ }
}
break;
case EIS_EVENT_DEVICE_CLOSED:
{
+ eis_client *pClient = eis_event_get_client( pEisEvent );
eis_device *pDevice = eis_event_get_device( pEisEvent );
+
+ // Remove the device from our tracking on the client.
eis_device_remove( pDevice );
+ eis_device_unref( pDevice );
+ eis_client_set_user_data( pClient, nullptr );
}
break;

View File

@ -1,81 +0,0 @@
diff --git a/src/backend.h b/src/backend.h
index 9c2db15..046eb10 100644
--- a/src/backend.h
+++ b/src/backend.h
@@ -17,6 +17,7 @@ struct wlr_buffer;
struct wlr_dmabuf_attributes;
struct FrameInfo_t;
+extern gamescope::GamescopeScreenType g_ForcedScreenType;
namespace gamescope
{
@@ -213,6 +214,8 @@ namespace gamescope
// Dumb helper we should remove to support multi display someday.
gamescope::GamescopeScreenType GetScreenType()
{
+ if (g_ForcedScreenType != GAMESCOPE_SCREEN_TYPE_AUTO)
+ return g_ForcedScreenType;
if ( GetCurrentConnector() )
return GetCurrentConnector()->GetScreenType();
diff --git a/src/gamescope_shared.h b/src/gamescope_shared.h
index f34174e..ed30d8c 100644
--- a/src/gamescope_shared.h
+++ b/src/gamescope_shared.h
@@ -22,6 +22,7 @@ namespace gamescope
{
GAMESCOPE_SCREEN_TYPE_INTERNAL,
GAMESCOPE_SCREEN_TYPE_EXTERNAL,
+ GAMESCOPE_SCREEN_TYPE_AUTO,
GAMESCOPE_SCREEN_TYPE_COUNT
};
diff --git a/src/main.cpp b/src/main.cpp
index 6f4cae4..27a6c8f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -122,6 +122,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 },
{ "disable-color-management", no_argument, nullptr, 0 },
@@ -173,6 +174,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"
+ " --force-panel-type force gamescope to treat the display as either internal or external\n"
" --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"
@@ -371,6 +373,18 @@ static GamescopePanelOrientation force_external_orientation(const char *str)
exit(1);
}
}
+gamescope::GamescopeScreenType g_ForcedScreenType = gamescope::GAMESCOPE_SCREEN_TYPE_AUTO;
+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) {
+ return gamescope::GAMESCOPE_SCREEN_TYPE_EXTERNAL;
+ } else {
+ fprintf( stderr, "gamescope: invalid value for --force-panel-type\n" );
+ exit(1);
+ }
+}
static enum GamescopeUpscaleScaler parse_upscaler_scaler(const char *str)
{
@@ -669,6 +683,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 );
+ } else if (strcmp(opt_name, "force-panel-type") == 0) {
+ g_ForcedScreenType = force_panel_type( optarg );
} else if (strcmp(opt_name, "sharpness") == 0 ||
strcmp(opt_name, "fsr-sharpness") == 0) {
g_upscaleFilterSharpness = atoi( optarg );