@emfo said in X11 Nvidia black window:
Skip to content
7
qtws26_logo
The Qt Event of the Year: Qt World Summit 2026
Save Your Spot >
Brand Logo
Home
Qt Development
General and Desktop
X11 Nvidia black window
Unsolved
General and Desktop
6 Posts 3 Posters 331 Views 3 Watching
E Offline
emfo
wrote 26 days ago last edited by
#1
We get a black window when running smallest possible Qt application using OpenGL on Linux with an Nvidia graphics card (proprietary 580.159.03).
To rule out environment and driver problems, we have written three corresponding applications using xlib only, xcb only, and a xlib xcb mix. All three of them work on the same Nvidia graphics card in the same environment.
The attached xlib.cpp, xcb.cpp, xcb_xlib.cpp and qt.cpp can be built following the instructions in build_and_run.sh (replace the QT path in the script to where your Qt installation is first).
Replacing EGL_PLATFORM_XCB_KHR with EGL_PLATFORM_X11_KHR in xcb_xlib.cpp, and using xlib display, causes eglCreatePlatformWindowSurfaceEXT to return a nullptr for EGLSurface in xcb_xlib.cpp, exactly what we see in Qt.
Is there something we're missing in qt.cpp to make this work or is this a bug in Qt that can be fixed?
We started looking into the Qt source code, the call to eglCreatePlatformWindowSurfaceEXT(EGL_PLATFORM_X11_KHR, xlib display, [...]) returns 0. If we modify Qt to call eglCreatePlatformWindowSurfaceEXT(EGL_PLATFORM_XCB_KHR, xcb connection, [...]), we instead get a valid surface that can be queried with eglQuerySurface that report the correct size. The window is still black but having a surface is a good start for anyone looking into this.
Attached source files
16 days later
Axel Spoerl Offline
Axel Spoerl
Moderators
wrote 10 days ago last edited by
#2
I am using X11 on Nvidia and I don't have this issue.
Please post a minimal reproducer here.
Software Engineer
The Qt Company, Oslo
SGaist Offline
SGaist
Lifetime Qt Champion
wrote 10 days ago last edited by
#3
Hi and welcome to devnet,
You should also provide the kernel version you are using as well graphics card model.
Interested in AI ? www.idiap.ch
Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
9 days later
E Offline
emfo
wrote a day ago last edited by
#4
@Axel-Spoerl the attached sources are a minimal reproducible example.
E Offline
emfo
wrote a day ago last edited by
#5
@SGaist Thank you. I will find that information and post it here asap.
E Offline
emfo
wrote about 12 hours ago
last edited by emfo
#6
We've reproduced the issue on the following combinations:
Ubuntu 26.04, Linux 7.0.0, Quadro P2200, driver version 580.178
Ubuntu 26.04.1 LTS, Linux 7.0.0-38-generic, GeForce RTX 4060, driver version 595.99.02
In addition, we've seen the problem manifest on several other combinations of Ubuntu/Linux/graphics card/driver versions, with the only common factor being Qt.
TimTom420 Online
5 unread
TimTom420
Since the Xlib and XCB examples behave differently, it might help to check the EGL error immediately after the failed surface creation using eglGetError(). That could narrow down whether the problem is related to the native window handle or the EGL platform selection.
It would also be useful to know the Qt version and whether forcing the XCB Qt platform plugin changes the result.
If U R sad click here:
https://www.youtube.com/watch?v=dQw4w9WgXcQ