X11 Nvidia black window
-
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.