From patchwork Sun May 11 22:40:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: aurtzy X-Patchwork-Id: 42537 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5E36627BC49; Sun, 11 May 2025 23:48:38 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 14D2327BC4A for ; Sun, 11 May 2025 23:48:36 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uEFSn-0006N7-KZ; Sun, 11 May 2025 18:48:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uEFSl-0006Mj-Jv for guix-patches@gnu.org; Sun, 11 May 2025 18:48:03 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uEFSl-00019v-AR for guix-patches@gnu.org; Sun, 11 May 2025 18:48:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=pCMnfeRYrBy7nLlDV3KO0d35EY/C0+dLre8YtG4xi54=; b=amOJOtm6zIaktwtcPmQzVQo/5guioRsnp9omcxN9E2LC+6dzf1cxKOiY96dKx7fnzkB+7E27r4DP09SpRfgA4QeWwOw7r23DtPV5DJp6beXjFpJ1l2kLqgQ82sGn0WO6K6vIbn6cBIhvlvt/bcH+JDzAWZCEzb7bXl643FcHk9c81NON8Xt3NHyQ4/75hFSdNI6MQ9A5vlawYkdTkQ1C/WHI84it8Ktyq77+zGVhMt/1RdALgfyKluIDMwW78mrMgaFC1EReGUU3VOau76UJDscbXNwMLVBvM6TbsFdHw5WG/6X0utMKYz0HJnBiVVvXqn4bv/4qtYp2A4+J9OuanA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uEFSk-0000AS-Mn; Sun, 11 May 2025 18:48:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70493] [PATCH v2] gnu: Add gamescope. References: In-Reply-To: Resent-From: aurtzy Original-Sender: "Debbugs-submit" Resent-CC: i@dan.games, guix-patches@gnu.org Resent-Date: Sun, 11 May 2025 22:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70493 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70493@debbugs.gnu.org Cc: aurtzy , Demis Balbach , dan , dan X-Debbugs-Original-Xcc: dan Received: via spool by 70493-submit@debbugs.gnu.org id=B70493.1747003679635 (code B ref 70493); Sun, 11 May 2025 22:48:02 +0000 Received: (at 70493) by debbugs.gnu.org; 11 May 2025 22:47:59 +0000 Received: from localhost ([127.0.0.1]:46158 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uEFSg-0000A9-LD for submit@debbugs.gnu.org; Sun, 11 May 2025 18:47:59 -0400 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:54748) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uEFSc-000097-99 for 70493@debbugs.gnu.org; Sun, 11 May 2025 18:47:56 -0400 Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-7cadd46ea9aso622033985a.1 for <70493@debbugs.gnu.org>; Sun, 11 May 2025 15:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747003668; x=1747608468; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pCMnfeRYrBy7nLlDV3KO0d35EY/C0+dLre8YtG4xi54=; b=bzgZYmEabUjI8CFMnmQQSL5ZgfPc3ksv4rHeQ5RCgfiNeQeWY5KWZtrqbvTHF9v13h 3X8mGevp5Vt07wZcwm6udV4UndnPqYTMpEWSs6muqeg4wP/VdrBXbXFkgkwG6kGgcEhq 0UzEVzFmO8syJwYg8wj0Cq6ZkYcyZS4knILUncVxntWWExPwNuznFScwxH8dGLJK/W7Z y+7pQ+NsdGrb6n6lTm3YUBVqeE/h85thoRxky7Q7s1NkcXJ1SWfmVyinIzmXlsiLbpxH Dw0Zr0u6zlGz3zABg/yqq2lcjWJ/mghgh+U4xSBz9mYCz9w3zEVTjsSRkFzw14L8qD2o 2B7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747003668; x=1747608468; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pCMnfeRYrBy7nLlDV3KO0d35EY/C0+dLre8YtG4xi54=; b=eiiGoVrdFMDrXgWkxnBFDdv6frZuUeAI81OIJrpJ+sFZD/OsrOyMW22yx/ueQYE23b Ehv7C/k8MW2HaxyfbPBVLOYmAIDpgSzvVSaqq5z0s8hCDvWIxkW4IUGXxp8SojsQMebU B7I5/wPivXZ0M5VkN/aJn9/20BKY0UZSdvdFxeh9sE09mnwexJKY9HHHr8OgduYV+ap+ gI4JE8yKLdMtBEScftcYt2m+ZBdPjeyAu73SZAugiZKLk32gECtIgYCPEEnY/cGWI/zW 0VeL0wkGxWJLmKAM6nWTXtu7ccdidcfK0utUlMxciYjCJcKnzgSAHxxPVqVRkUM0aKGa mnZQ== X-Gm-Message-State: AOJu0YzwXRlBGM1w1pCRxeuNFAfPTfTcuxudg0Xr9P/Eqy78MqNHtgSp dDRFY0+K8c14lDfNoKSQBV+yvBFHzE9JPTbXz0tcNs5LWX8UK0lypt86ag== X-Gm-Gg: ASbGncvK8D2EAUKlPQVFnAz4AtcuEc/7BmwFqBfAVm1zVUzjobnS/WGG96pInFIATKj sWJ1jDdGl8HIET5XBbzteNPKrOAPaHyFYB3jIERIWcu2YOqmeYM/PyMc1eoL2/xzp+fHsNI2QGc +XP8M+rtUdxKJ5v24hKu7WZ3Qu9aH8NkUh2JKRKzzL6zF5Ph0nFsL+4B3etu8Eyf2i+GdzFa7O+ EfR5P7PrTcXTt2djh0bcprRkpRVJDclVVcS8+amgbu5OOBBVojBCkb7AEEFtaExiCLRKza1eL7B f8R/j2JU7TRXYR8KbAmTzIl1gFaVHkWEwPXFF/QfRRTDjA== X-Google-Smtp-Source: AGHT+IE3750gDqWzj3KCB5as71yI3nJgrhrp3uAx+11cbLZN+r15Yh4C190C7hapQq6vE5qzjSBe9w== X-Received: by 2002:a05:620a:4713:b0:7c7:827b:46bf with SMTP id af79cd13be357-7cd01157860mr1544479885a.39.1747003667869; Sun, 11 May 2025 15:47:47 -0700 (PDT) Received: from localhost.localdomain ([2600:4808:a053:1800::7c1b]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cd00f4e1a5sm442933885a.13.2025.05.11.15.47.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 May 2025 15:47:46 -0700 (PDT) From: aurtzy Date: Sun, 11 May 2025 18:40:39 -0400 Message-ID: X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: dan * gnu/packages/wm.scm (%gamescope-version, libliftoff-for-gamescope, reshade-for-gamescope, vkroots-for-gamescope, wlroots-for-gamescope, gamescope): New variables. Change-Id: If86bc6127144854189f8fa66415f32bc80a26d6b Co-authored-by: aurtzy Co-authored-by: Demis Balbach --- Hey, (Coming from: ) Sorry about the long delay! Finally got around to looking at this again. I've attached a v2 with our patches combined in addition to any updates since then, with all notable changes from v1 listed below. This depends on a pending patch to add stb-image-resize [1]. Changes from dan's v1: - Update gamescope version to 3.16.4. - Drop libavif-1.0 patch; we can use libavif which is updated, now. - Convert libliftoff and vkroots patches to libliftoff-for-gamescope and vkroots-for-gamescope due to upstream relying on unstable features and strongly recommending against using different versions [2]. Also subject wlroots to this treatment. - Use origin snippet to add pinned submodule/dependency sources. - Remove HWDATA_PNP_IDS configure flag, since (IIUC) hwdata outputs have since been merged into the default "out" output which made pkgconfig able to automatically find hwdata files. - Add a 'patch-loader-path phase to fix an error when starting gamescope due to "Failed to load vulkan module" (related issue [3]). - Add a 'patch-version phase that patches in version number instead of trying to execute git to infer version from tag. - Opt for patching stb via wrap file instead of meson.build which should (probably) be less brittle. - Drop libdisplay-info patch, since versions up to 0.3.0 are accepted now. - Use gcc instead of gcc-toolchain (toolchain version doesn't seem to be needed?). Also use newer version (gcc-14) since gamescope 3.16.4 would fail to build without at least gcc-13. - Include various additional inputs that are searched for during the build. Related side note: I've managed to get gamescope with the "nice" capability working with the following services (some personal config stuff omitted so it can work for others; source here [4]), although I'm still trying to figure out if anything can be done about removing a hack that's currently needed: #+begin_src scheme ;; gamescopereaper needs to be available in PATH. (list (simple-service 'name profile-service-type (list gamescope)) (simple-service 'name privileged-program-service-type (list (privileged-program (program (file-append gamescope "/bin/gamescope")) (capabilities "cap_sys_nice=eip")))) ;; HACK: Using privileges causes gamescope to not inherit ;; environment, so it fails an attempt to search for needed ;; vulkan files. Conveniently provide them at this location, ;; which gamescope searches by default. (simple-service 'name etc-service-type `(("vulkan" ,(file-append mesa "/share/vulkan"))))) #+end_src [1] https://issues.guix.gnu.org/78294 [2] https://github.com/ValveSoftware/gamescope/commit/7741cd587fa2274989f3307a3c6f23ab08e98460 [3] https://issues.guix.gnu.org/71109 [4] https://github.com/aurtzy/guix-config/blob/54eeb0a1587a90b4c59ae88e96c1609ba6cebeba/modules/my-guix/mods/entertainment.scm#L70 Cheers, aurtzy gnu/packages/wm.scm | 182 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 181 insertions(+), 1 deletion(-) base-commit: 8635dad843d299497bd46e036266a8b2a2abff11 diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm index 66dd5f2035..6d01066570 100644 --- a/gnu/packages/wm.scm +++ b/gnu/packages/wm.scm @@ -81,6 +81,8 @@ ;;; Copyright © 2025 Tomáš Čech ;;; Copyright © 2025 Ricardo Wurmus ;;; Copyright © 2025 Junker +;;; Copyright © 2022 Demis Balbach +;;; Copyright © 2025 aurtzy ;;; ;;; This file is part of GNU Guix. ;;; @@ -117,6 +119,7 @@ (define-module (gnu packages wm) #:use-module (guix utils) #:use-module (gnu packages) #:use-module (gnu packages bash) + #:use-module (gnu packages benchmark) #:use-module (gnu packages admin) #:use-module (gnu packages autotools) #:use-module (gnu packages base) @@ -179,8 +182,10 @@ (define-module (gnu packages wm) #:use-module (gnu packages qt) #:use-module (gnu packages readline) #:use-module (gnu packages regex) + #:use-module (gnu packages sdl) #:use-module (gnu packages serialization) #:use-module (gnu packages sphinx) + #:use-module (gnu packages stb) #:use-module (gnu packages suckless) #:use-module (gnu packages texinfo) #:use-module (gnu packages textutils) @@ -189,7 +194,8 @@ (define-module (gnu packages wm) #:use-module (gnu packages web) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xml) - #:use-module (gnu packages xorg)) + #:use-module (gnu packages xorg) + #:use-module (srfi srfi-26)) (define-public bspwm (package @@ -4419,3 +4425,177 @@ (define-public scenefx "A drop-in replacement for the wlroots scene API that allows wayland compositors to render surfaces with eye-candy effects.") (license license:expat))) + +;; Upstream strongly recommends using some of its pinned dependencies due to +;; relying on unstable features; these should be checked when updating +;; gamescope. See: +;; +(define %gamescope-version "3.16.4") + +(define libliftoff-for-gamescope + (origin + (method git-fetch) + (uri (git-reference + (url "https://gitlab.freedesktop.org/emersion/libliftoff.git") + (commit "8b08dc1c14fd019cc90ddabe34ad16596b0691f4"))) + (file-name (git-file-name "libliftoff-for-gamescope" %gamescope-version)) + (sha256 (base32 "163g8ndsbma7acy2k9mrnvlpb7yi4431hgkx1gygkafgwpq1ii1x")))) + +(define reshade-for-gamescope + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Joshua-Ashton/reshade") + (commit "696b14cd6006ae9ca174e6164450619ace043283"))) + (file-name (git-file-name "reshade-for-gamescope" %gamescope-version)) + (sha256 + (base32 "1zvhf3pgd8bhn8bynrsh725xn1dszsf05j8c9g6zabgv7vnz04a5")))) + +(define vkroots-for-gamescope + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Joshua-Ashton/vkroots") + (commit "5106d8a0df95de66cc58dc1ea37e69c99afc9540"))) + (file-name (git-file-name "vkroots-for-gamescope" %gamescope-version)) + (sha256 (base32 "0hrp0xqq93552ipw2bmryixgm1aywnz49xagsx5rwzg2d0hwa0aa")))) + +(define wlroots-for-gamescope + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Joshua-Ashton/wlroots.git") + (commit "4bc5333a2cbba0b0b88559f281dbde04b849e6ef"))) + (file-name (git-file-name "wlroots-for-gamescope" %gamescope-version)) + (sha256 (base32 "14m9j9qkaphzm3g36im43b6h92rh3xyjh7j46vw9w2qm602ndwcf")))) + +(define-public gamescope + (package + (name "gamescope") + (version %gamescope-version) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ValveSoftware/gamescope") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "09h7046vwqn0w3kv1zaij4h3rcrvs1r2qlm0vva3mk3gg44fnhjl")) + (modules '((guix build utils) + (ice-9 match))) + (snippet + #~(begin + ;; Add some dependencies to source tree where they're expected. + (for-each (match-lambda + ((source dest) + (copy-recursively source dest))) + '((#$libliftoff-for-gamescope "subprojects/libliftoff") + (#$reshade-for-gamescope "src/reshade") + (#$vkroots-for-gamescope "subprojects/vkroots") + (#$wlroots-for-gamescope "subprojects/wlroots"))))))) + (build-system meson-build-system) + (arguments + (list + #:configure-flags #~(list "-Dpipewire=enabled" + "-Denable_openvr_support=false") + #:modules '((guix build meson-build-system) + (guix build utils) + (srfi srfi-26)) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-usr-dir + (lambda _ + (substitute* "src/reshade_effect_manager.cpp" + (("/usr") #$output)))) + (add-after 'unpack 'patch-loader-path + ;; "Failed to load vulkan module" error occurs without this patch. + ;; Related issue: https://issues.guix.gnu.org/71109 + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/rendervulkan.cpp" + (("dlopen\\( \"libvulkan\\.so") + (string-append "dlopen( \"" + (search-input-file + inputs "/lib/libvulkan.so")))))) + (add-after 'unpack 'patch-version + (lambda _ + (substitute* "src/meson.build" + (("^vcs_tag = .*$") + (string-append + "vcs_tag = '" #$(package-version this-package) "'\n"))))) + (add-after 'unpack 'patch-stb + (lambda _ + (let ((stb-files-dir #+(directory-union + "stb" + (map (cut this-package-native-input <>) + (list "stb-image" + "stb-image-write" + "stb-image-resize"))))) + (copy-recursively (string-append stb-files-dir "/include") + "subprojects/stb")) + (copy-recursively "subprojects/packagefiles/stb" + "subprojects/stb") + (call-with-output-file "subprojects/stb.wrap" + (cut format <> "\ +[wrap-file] +directory = stb +")))) + (add-after 'unpack 'patch-spirv-headers + (lambda _ + (substitute* "src/meson.build" + (("../thirdparty/SPIRV-Headers") + #$(this-package-native-input "spirv-headers")))))))) + (native-inputs (list gcc-14 + glslang + pkg-config + python-3 + spirv-headers + stb-image + stb-image-write + stb-image-resize + vulkan-headers)) + (inputs (list benchmark + glm + hwdata + lcms + libavif + libdecor + libdisplay-info + libdrm + libei + libinput + libseat + libx11 + libxcomposite + libxcursor + libxdamage + libxext + libxkbcommon + libxmu + libxrender + libxres + libxt + libxtst + libxxf86vm + luajit + pipewire + pixman + sdl2 + vulkan-loader + xcb-util-wm + xcb-util-errors + xorg-server-xwayland + wayland + wayland-protocols)) + (home-page "https://github.com/ValveSoftware/gamescope") + (synopsis "Micro-compositor for running games") + (description + "gamescope is a micro-compositor for running games. Its goal is to +provide an isolated compositor that is tailored towards gaming and supports +many gaming-centric features such as: +@itemize +@item Spoofing resolutions. +@item Upscaling. +@item Limiting framerates. +@end itemize") + (license license:bsd-2)))