Merge pull request #649 from scottjones/m3/hyprland-software-renderer

hyprland: detect software rendering from the GL renderer
This commit is contained in:
Marcelo Alcantara authored and GitHub committed 2026-09-27 20:36:56 +10:00
commit 4d0c217634
4 files changed
+91 -3

No files matched your search

+1
View File
@@ -1,5 +1,6 @@
{
"source": "local",
"sync": false,
"release_ring": "fast",
"upstream": {
"git_tags": "https://github.com/hyprwm/Hyprland.git",
+7 -3
View File
@@ -5,7 +5,7 @@
pkgname=(hyprland hyprpm)
pkgver=0.56.2
pkgrel=3
pkgrel=4
pkgdesc='a highly customizable dynamic tiling Wayland compositor'
arch=(aarch64)
url="https://github.com/hyprwm/${pkgname^}"
@@ -65,12 +65,16 @@ optdepends=('hyprpm: build and install plugins'
'xdg-desktop-portal-hyprland: xdg-desktop-portal backend for hyprland')
provides=(wayland-compositor)
_archive="${pkgname^}-$pkgver"
source=("$_archive.tar.gz::$url/releases/download/v$pkgver/source-v$pkgver.tar.gz")
sha256sums=('03ad3f5ef152ff44116ffd56fcf808486211ecabf4f0ba567108ee746ba5cd2e')
source=("$_archive.tar.gz::$url/releases/download/v$pkgver/source-v$pkgver.tar.gz"
software-renderer.patch)
sha256sums=('03ad3f5ef152ff44116ffd56fcf808486211ecabf4f0ba567108ee746ba5cd2e'
'380bb6d61c36d6c68bcccf242131f5b259734e8570ea39b3bc519b9ed137eddd')
prepare() {
ln -sf hyprland-source "$_archive"
cd "$_archive"
# Backport of hyprwm/Hyprland#16343; drop once the packaged release includes it
patch -Np1 --fuzz=0 -i "$srcdir/software-renderer.patch"
sed -i -e '/^release:/{n;s/-D/-DCMAKE_SKIP_RPATH=ON -D/}' Makefile
sed -i -e '/find_package.glaze/s/7...<8 //' {.,hyprpm,start}/CMakeLists.txt
}
+7
View File
@@ -0,0 +1,7 @@
# Hyprland software-rendering backport
Automatic upstream version bumps are held (`sync: false`) while the packaged release carries [Hyprland #16343](https://github.com/hyprwm/Hyprland/pull/16343) as `software-renderer.patch`. `prepare()` applies that patch with `--fuzz=0`. Hyprland's `release_ring: fast` builds edge, rc, and stable from this recipe. Aquamarine changes in the official/ALARM repositories are checked by the separate six-hour `sync-rebuilds` job through `rebuild_on`, which proposes a package release bump for rebuilding.
The hold does not require staying on v0.56.2 until #16343 lands. If a newer upstream release does not yet include the fix, update `pkgver`, rebase the patch and refresh its checksum, and test software rendering and accelerated rendering before publishing. Keep `sync: false` while the backport is needed.
Remove `sync: false` and `software-renderer.patch` in the same change once the selected upstream release includes the #16343 behavior. Set `pkgver` to that release, then test software rendering and accelerated rendering before publishing.
@@ -0,0 +1,76 @@
From: Scott Jones <scottajones@gmail.com>
Subject: [PATCH] render: detect software rendering from the GL renderer (0.56.2 backport)
Backport-of: 61d0ff60a7547d49229714a68b7ca9c0b6658727
Backport-of: c3dcabc15ba7b71bd1bcd880e9f543909dd9372d
Upstream-PR: https://github.com/hyprwm/Hyprland/pull/16343
Co-authored-by: Eryk Wieliczko <44800858+erykwieliczko@users.noreply.github.com>
Adapt constructor and logger-context differences against v0.56.2 while
preserving the GL classification behavior. v0.56.2 has no
StringUtils.hpp, so the ASCII case-insensitive matcher lives as a
file-local helper in GLRenderer.cpp. Remove this backport once the
packaged upstream version includes this behavior.
--- a/src/render/GLRenderer.cpp
+++ b/src/render/GLRenderer.cpp
@@ -22,6 +22,7 @@
#include "./gl/GLTexture.hpp"
#include <cstdint>
+#include <string_view>
#include <hyprutils/memory/SharedPtr.hpp>
#include <hyprutils/memory/UniquePtr.hpp>
#include <hyprutils/utils/ScopeGuard.hpp>
@@ -36,7 +37,30 @@ extern "C" {
#include <xf86drm.h>
}
-CHyprGLRenderer::CHyprGLRenderer() : IHyprRenderer(), m_elementRenderer(makeUnique<CGLElementRenderer>()) {}
+// Whether haystack contains needle, ignoring ASCII case only; all other bytes must match exactly.
+static bool containsCaseInsensitive(const std::string_view haystack, const std::string_view needle) {
+ const auto lower = [](const unsigned char c) { return c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c; };
+
+ for (size_t i = 0; i + needle.size() <= haystack.size(); ++i) {
+ size_t j = 0;
+ while (j < needle.size() && lower(haystack[i + j]) == lower(needle[j]))
+ ++j;
+
+ if (j == needle.size())
+ return true;
+ }
+
+ return false;
+}
+
+CHyprGLRenderer::CHyprGLRenderer() : IHyprRenderer(), m_elementRenderer(makeUnique<CGLElementRenderer>()) {
+ // KMS can be display-only; classify the active GL renderer instead of the DRM driver.
+ g_pHyprOpenGL->makeEGLCurrent();
+ if (const auto* renderer = rc<const char*>(glGetString(GL_RENDERER))) {
+ const std::string_view name{renderer};
+ m_software = containsCaseInsensitive(name, "llvmpipe") || containsCaseInsensitive(name, "softpipe") || containsCaseInsensitive(name, "Software Rasterizer");
+ }
+}
IHyprRenderer::eType CHyprGLRenderer::type() {
return RT_GL;
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -104,8 +104,6 @@ IHyprRenderer::IHyprRenderer() {
m_nvidia = true;
else if (name.contains("i915"))
m_intel = true;
- else if (name.contains("softpipe") || name.contains("Software Rasterizer") || name.contains("llvmpipe"))
- m_software = true;
Log::logger->log(Log::DEBUG, "DRM driver information: {} v{}.{}.{} from {} description {}", name, DRMV->version_major, DRMV->version_minor, DRMV->version_patchlevel,
std::string{DRMV->date, DRMV->date_len}, std::string{DRMV->desc, DRMV->desc_len});
@@ -126,8 +124,6 @@ IHyprRenderer::IHyprRenderer() {
m_nvidia = true;
else if (name.contains("i915"))
m_intel = true;
- else if (name.contains("softpipe") || name.contains("Software Rasterizer") || name.contains("llvmpipe"))
- m_software = true;
Log::logger->log(Log::DEBUG, "Primary DRM driver information: {} v{}.{}.{} from {} description {}", name, DRMV->version_major, DRMV->version_minor,
DRMV->version_patchlevel, std::string{DRMV->date, DRMV->date_len}, std::string{DRMV->desc, DRMV->desc_len});