Skip to content

fix(x11): Decline a GLX context the X server rejected - #26288

Merged
ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:dev/rara/x11-glx-context-validation
Nov 10, 2026
Merged

ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:dev/rara/x11-glx-context-validation

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #23338

PR Type:

🐞 Bugfix

What changed? 🚀

#23338 reported the X11 host dying on X_GLXCreateNewContext BadValue (NVIDIA) instead of falling back. Two of the three parts are already handled on master:

  • The host installs an X error handler that logs instead of exiting (ba0313d7d1b, in 6.7.65+), so the error no longer kills the process.
  • The renderer negotiation falls back when GLX context creation throws, and an empty FBConfig list / no matching visual already throws.

The remaining gap: GLX errors are asynchronous, so a driver can return a non-null context for a request the server then rejects. Nothing checked for that, so the context was accepted and every frame's glXMakeCurrent failed (logged only): a black window, no fallback.

CreateGLXWindow now:

  • counts X errors (the host's error handler increments a counter) and declines the context if any arrived across the XSync after glXCreateNewContext;
  • makes the context current on the new window once, and declines it if that fails.

Declining destroys the context/window and throws, so CreateWindowAndContext falls through to the next backend (EGL/GLES, then software).

Validation (SamplesApp net10.0-desktop from this branch, WSL Ubuntu 24.04 + Xvfb, Mesa):

  • Forced OpenGL (UNO_X11_RENDERER=OpenGL): still wins negotiation on OpenGL and renders (no false decline from the new checks).
  • Default backend, Vulkan and GLX broken (VK_ICD_FILENAMES=/nonexistent.json LIBGL_ALWAYS_INDIRECT=1): reproduces the reported ErrorCode: 2 (BadValue), MinorCode: 24 (X_GLXCreateNewContext), ResourceId: 0x0; the app logs it, falls back to OpenGLES and renders. On Mesa glXCreateNewContext returns null itself here, so this goes through the existing null check.
  • The new rejected-context path, which Mesa doesn't produce: a temporary local fault injection issuing a failing X request right after a successful glXCreateNewContext was declined with "glXCreateNewContext was rejected by the X server", and the app fell back to OpenGLES and rendered. Not tested on an NVIDIA driver.

PR Checklist ✅

🤖 Generated with Claude Code

GLX errors are asynchronous: a driver can hand back a context handle
for a glXCreateNewContext the server then rejects (BadValue on
X_GLXCreateNewContext, as reported on NVIDIA). Since the host's X error
handler only logs, that context was accepted and every frame's
glXMakeCurrent failed, with no fallback.

Count X errors in the handler, and after creating the context check
that none arrived across an XSync and that it can be made current on
the new window. Otherwise destroy it and throw, so the negotiation
falls back to the next backend.

Fixes unoplatform#23338

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions github-actions Bot added the platform/x11 🐧 Categorizes an issue or PR as relevant to X11 label Nov 10, 2026
@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 245226 found UI Test snapshots differences: skia-linux-screenshots: 249, skia-windows-screenshots: 287

Details
  • skia-linux-screenshots: 249 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • Border_CornerRadius_Binding.png-dark
    • Buttons.png-dark
    • Border_CornerRadius_Binding.png
    • Buttons.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • CompositionPath.png-dark
    • CompositionPath.png
    • CornerRadiusControls.png-dark
    • CornerRadiusControls.png
    • AnimatedVisualsTestbedPage.png-dark
    • BasicAcrylicBrushTest.png-dark
    • BasicAcrylicBrushTest.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DamageRegion_ShadowChildShape.png-dark
  • skia-windows-screenshots: 287 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedVisualsTestbedPage.png-dark
    • AutomationProperties_AutomationId.png-dark
    • AutomationProperties_AutomationId.png
    • AutomationProperties_StructureAndProps.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CompositionPath.png-dark
    • CompositionPath.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ContentPresenter_NativeEmbedding.png-dark
    • ContentPresenter_NativeEmbedding.png
    • AutomationProperties_StructureAndProps.png-dark
    • BasicAcrylicBrushTest2.png-dark
    • BasicAcrylicBrushTest2.png
    • Border_CornerRadius_Binding.png-dark

@ajpinedam ajpinedam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ramezgerges Let me know if you want me to test this fix

@ramezgerges
ramezgerges merged commit 3d7115d into unoplatform:master Nov 10, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform/x11 🐧 Categorizes an issue or PR as relevant to X11

Projects

None yet

Development

Successfully merging this pull request may close these issues.

X11 desktop host aborts the process on glXCreateNewContext failure instead of falling back

4 participants