From d13e82012e7940f090c9c02c34254cb788c278aa Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Wed, 1 Jan 2025 21:00:34 -0800 Subject: [PATCH] chore: Add Nvidia patch for gamescope --- spec_files/gamescope/1671.patch | 54 +++++++++++++++++++++++++++++ spec_files/gamescope/gamescope.spec | 5 ++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 spec_files/gamescope/1671.patch diff --git a/spec_files/gamescope/1671.patch b/spec_files/gamescope/1671.patch new file mode 100644 index 0000000000..846c228d5d --- /dev/null +++ b/spec_files/gamescope/1671.patch @@ -0,0 +1,54 @@ +From 4da5c0a60ece2955cd60166ad0f93c93b0871723 Mon Sep 17 00:00:00 2001 +From: brainantifreeze +Date: Thu, 19 Dec 2024 09:16:15 +0000 +Subject: [PATCH] add layer env var to hide present wait ext + +--- + layer/VkLayer_FROG_gamescope_wsi.cpp | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/layer/VkLayer_FROG_gamescope_wsi.cpp b/layer/VkLayer_FROG_gamescope_wsi.cpp +index 718a2604f3..f33da7f22f 100644 +--- a/layer/VkLayer_FROG_gamescope_wsi.cpp ++++ b/layer/VkLayer_FROG_gamescope_wsi.cpp +@@ -496,7 +496,11 @@ namespace GamescopeWSILayer { + createInfo.ppEnabledExtensionNames = enabledExts.data(); + + setenv("vk_xwayland_wait_ready", "false", 0); +- setenv("vk_khr_present_wait", "true", 0); ++ if (getHidePresentWait()) { ++ setenv("vk_khr_present_wait", "false", 0); ++ } else { ++ setenv("vk_khr_present_wait", "true", 0); ++ } + + VkResult result = pfnCreateInstanceProc(&createInfo, pAllocator, pInstance); + if (result != VK_SUCCESS) +@@ -801,6 +805,10 @@ namespace GamescopeWSILayer { + const vkroots::VkInstanceDispatch* pDispatch, + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures2* pFeatures) { ++ if (getHidePresentWait()) { ++ fprintf(stderr, "[Gamescope WSI] Removing VkPhysicalDevicePresentWaitFeaturesKHR because GAMESCOPE_WSI_HIDE_PRESENT_WAIT_EXT is set\n"); ++ vkroots::RemoveFromChain(pFeatures); ++ } + pDispatch->GetPhysicalDeviceFeatures2(physicalDevice, pFeatures); + } + +@@ -1015,6 +1023,16 @@ namespace GamescopeWSILayer { + return value; + } + ++ static bool getHidePresentWait() { ++ static bool s_hidePresentWait = []() -> bool { ++ if (auto hide = parseEnv("GAMESCOPE_WSI_HIDE_PRESENT_WAIT_EXT")) { ++ return *hide == 1; ++ } ++ return false; ++ }(); ++ return s_hidePresentWait; ++ } ++ + static uint32_t getMinImageCount() { + static uint32_t s_minImageCount = []() -> uint32_t { + if (auto minCount = parseEnv("GAMESCOPE_WSI_MIN_IMAGE_COUNT")) { diff --git a/spec_files/gamescope/gamescope.spec b/spec_files/gamescope/gamescope.spec index 01eb70b45b..45e5c90530 100644 --- a/spec_files/gamescope/gamescope.spec +++ b/spec_files/gamescope/gamescope.spec @@ -8,7 +8,7 @@ Name: gamescope #Version: 100.%{gamescope_tag} -Version: 101.%{short_commit} +Version: 102.%{short_commit} Release: 1.bazzite Summary: Micro-compositor for video games on Wayland @@ -27,6 +27,9 @@ Patch1: handheld.patch # https://github.com/ValveSoftware/gamescope/pull/740 Patch2: 740.patch +# https://github.com/ValveSoftware/gamescope/pull/1671 +Patch3: 1671.patch + BuildRequires: meson >= 0.54.0 BuildRequires: ninja-build BuildRequires: cmake