Files
marfrit-packages/arch/qt6-base-fourier/patches/0001-qopengltextureglyphcache-pick-GL_R8-on-ES3.patch
T
marfrit 1dada5122b
build and publish packages / distcc-avahi-aarch64 (push) Successful in 30s
build and publish packages / lmcp-any (push) Successful in 7s
build and publish packages / lmcp-debian (push) Successful in 5s
build and publish packages / claude-his-any (push) Successful in 8s
build and publish packages / ffmpeg-v4l2-request-aarch64 (push) Successful in 12m5s
build and publish packages / claude-his-debian (push) Successful in 4s
qt6-base-fourier: GL_ALPHA → GL_R8 on OpenGL ES 3.x
Three small runtime checks in qtbase 6.11.0:

1. src/opengl/qopengltextureglyphcache.cpp createTextureData() and
   load_glyph_image_to_texture() — the `#else` branch (active when
   qtbase is built with QT_CONFIG(opengles2), every aarch64 distro)
   hard-codes GL_ALPHA without checking the runtime context's ES
   version. Replace with `useR8 = ctx->format().majorVersion() >= 3`
   so ES 3+ contexts get GL_R8 + GL_RED.

2. src/gui/rhi/qrhigles2.cpp toGlTextureFormat() RED_OR_ALPHA8 case
   — gated only on caps.coreProfile. Extend with
   `caps.gles && caps.ctxMajor >= 3`.

3. src/opengl/qopengltextureuploader.cpp Format_Alpha8 and
   Format_Grayscale8 cases — short-circuit on `context->isOpenGLES()`
   before reaching the swizzle fallback. Restrict to ES 2 only so
   ES 3+ falls through to the existing TextureSwizzle path.

Discovered while validating chromium-fourier patch 3/3 (NV12
EXTERNAL_OES) on ohm. The chrome stall, VLC vout init failure and
mpv "could not initialize video chain" all share this Qt 6 root
cause: every Qt application running on Mali / panfrost / panthor
under a KWin Wayland session emits glTexImage2D(GL_ALPHA) on every
text-glyph cache upload, mesa returns GL_INVALID_VALUE, the
compositor's frame-callback path stalls, and every wayland video
client deadlocks behind it.

PKGBUILD inherits from extra/qt6-base 6.11.0-2 with arch+=aarch64,
epoch=1 to dominate Arch's pkgrel until upstream lands the fix.
qt6-base-cflags.patch and qt6-base-nostrip.patch carried verbatim
from upstream packaging.

KWIN_PIVOT.md (in chromium-fourier/) carries the full diagnosis
thread.
2026-04-28 12:35:08 +00:00

44 lines
2.2 KiB
Diff

diff --git a/src/opengl/qopengltextureglyphcache.cpp b/src/opengl/qopengltextureglyphcache.cpp
index 0bab710b..46bad551 100644
--- a/src/opengl/qopengltextureglyphcache.cpp
+++ b/src/opengl/qopengltextureglyphcache.cpp
@@ -108,14 +108,20 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
for (int i = 0; i < data.size(); ++i)
data[i] = 0;
#if !QT_CONFIG(opengles2)
const GLint internalFormat = isCoreProfile() ? GL_R8 : GL_ALPHA;
const GLenum format = isCoreProfile() ? GL_RED : GL_ALPHA;
#else
- const GLint internalFormat = GL_ALPHA;
- const GLenum format = GL_ALPHA;
+ // qt6-base-fourier: OpenGL ES 3.x removed GL_ALPHA from
+ // glTexImage2D's valid internalFormat list (ES 3 spec
+ // section 3.8.3, table 3.13). Pick GL_R8 + matching format
+ // when the runtime context is ES 3 or newer; only legacy
+ // ES 2 contexts fall through to the historic GL_ALPHA path.
+ const bool useR8 = ctx->format().majorVersion() >= 3;
+ const GLint internalFormat = useR8 ? GL_R8 : GL_ALPHA;
+ const GLenum format = useR8 ? GL_RED : GL_ALPHA;
#endif
funcs->glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, GL_UNSIGNED_BYTE, &data[0]);
}
funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@@ -210,13 +216,14 @@ static void load_glyph_image_to_texture(QOpenGLContext *ctx,
} else {
// The scanlines in image are 32-bit aligned, even for mono or 8-bit formats. This
// is good because it matches the default of 4 bytes for GL_UNPACK_ALIGNMENT.
#if !QT_CONFIG(opengles2)
const GLenum format = isCoreProfile() ? GL_RED : GL_ALPHA;
#else
- const GLenum format = GL_ALPHA;
+ // qt6-base-fourier: ES 3 path — see createTextureData() above.
+ const GLenum format = ctx->format().majorVersion() >= 3 ? GL_RED : GL_ALPHA;
#endif
funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, tx, ty, imgWidth, imgHeight, format, GL_UNSIGNED_BYTE, img.constBits());
}
}
static void load_glyph_image_region_to_texture(QOpenGLContext *ctx,