Fix GL window bleed-through on Win32 with Intel GPUs#4845
Fix GL window bleed-through on Win32 with Intel GPUs#4845andrewachen wants to merge 1 commit intoXpra-org:masterfrom
Conversation
On Win32 with Intel integrated GPUs, ChoosePixelFormat returns a pixel format with 8 alpha bits even when none are requested. DWM reads undefined alpha as transparent, causing window bleed-through (freedesktop.org bug #14165). Intel+Win32 workarounds (in platform/win32/gl_context.py): - Override _fixup_present_alpha to force alpha=1 via glColorMask before each present, with a one-time glReadPixels to prime the Intel driver (Intel's glClear doesn't respect glColorMask without a prior readback) Intel+Win32 workarounds (in client/gtk3/opengl/): - Force RGBA visual on GL windows (client_window.py) - Force alpha in GtkGLArea readback (glarea_backing.py) Platform-independent fixes: - Clear non-alpha FBOs with alpha=1 instead of alpha=0 (backing.py) - Add _fixup_present_alpha hook in do_present_fbo (backing.py) - Set app_paintable on GL DrawingArea (drawing_area.py) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Sponsored-By: Netflix
|
This feels a little invasive and the Intel machine is not my daily driver, so I won't feel terrible if you decide not to merge this -- it's unfortunate that the Intel integrated GPU needs such things. |
|
Claude "max effort" review confirms some of my concerns:
2009 on Linux...
Is this absolutely needed?
If it is well known, I would expect workarounds to be more common and easier than readback!
Claude was making good progress, but then:
|
|
@andrewachen can you try running 88d8abc with Claude said: Worth testing: it's a much lighter change than the per-frame workaround, but it may or may not be sufficient depending on whether Intel's blit honours the alpha source. I found an Intel card, but it stopped working after a reboot! |
that's the point of using a drawing area after all
|
The Intel card is working again, turns out that this GPU is so big that it bent the SATA connectors out of their sockets, which prevented the OS from loading... Anyway, I can test with Intel now, but I'm not seeing any issues. Which app can I used to reproduce the problem and how? |
that's the point of using a drawing area after all
that's the point of using a drawing area after all
Problem
On Win32 with Intel integrated GPUs, OpenGL windows show content from windows behind them bleeding through character/text backgrounds. Affects both native WGL and GtkGLArea rendering paths.
Root cause: Intel's
ChoosePixelFormatreturns a pixel format with 8 alpha bits even whencAlphaBits=0is requested. DWM reads undefined alpha from the window surface as transparent (freedesktop.org bug #14165).Confirmed on Intel(R) Graphics, driver build 32.0.101.8508. Does not affect NVIDIA, AMD, or Adreno (ARM64/GLon12).
Fix
The workaround is Intel+Win32-specific, gated on
GL_VENDORcontaining "Intel". The bulk of the workaround logic lives inplatform/win32/gl_context.pyto keep platform-specific hacks out of the shared OpenGL code. The sharedbacking.pyonly adds a no-op_fixup_present_alpha()hook that the Win32 code overrides.Intel+Win32 workarounds:
client_window.py)glarea_backing.py)glColorMask+glClearbefore each present, with a one-timeglReadPixelsto prime the Intel driver — Intel'sglCleardoesn't properly respectglColorMaskwithout a prior readback (gl_context.py:setup_intel_workarounds)Platform-independent:
backing.py)_fixup_present_alphahook indo_present_fbo(backing.py)app_paintableon GL DrawingArea — matches the Cairo path (drawing_area.py)Testing
Tested on Win32 x64 with Intel(R) Graphics (driver 32.0.101.8508):
opengl=force(native WGL path) — no bleedthroughopengl=force:glarea(GtkGLArea path) — no bleedthroughopengl=off(Cairo) — unaffected, still worksTested on Win32 ARM64 with Adreno X1-85 (GLon12) — no regression, workaround not activated.
Confirmed
WS_EX_LAYEREDis NOT set on any decorated GL window after the RGBA visual change.References
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Sponsored-By: Netflix