EGL applications on X11 display black screen with NVidia drivers, but work with nouveau

I have trouble running Qt applications in “EGL fullscreen” mode (eglfs platform plugin) on X11 with NVidia drivers (tested 390.116 and 430.26 on Ubuntu 18.04). They all just display black screen. The result is the same on machines with different NVidia GPUs (GTX 1060, GTX 1080, Jetson TX2). Nothing is displayed in Qt example OpenGL apps nor in our applications.

The applications work as expected with nouveau driver and on Intel.

Here is the minimalistic app that reproduces the problem:

#include <QGuiApplication>
#include <QOpenGLWindow>
#include <QOpenGLContext>
#include <QOpenGLFunctions>

class Window : public QOpenGLWindow {
protected:
    void paintGL() override {
        QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
        f->glClearColor(1.f, 0.f, 0.f, 1.f);
        f->glClear(GL_COLOR_BUFFER_BIT);
    }
};

int main(int argc, char** argv) {
    QGuiApplication app(argc, argv);

    Window window;
    window.showFullScreen();

    return app.exec();
}

And CMakeLists.txt to build it:

cmake_minimum_required(VERSION 3.5)
project(redscreen)

set(CMAKE_CXX_STANDARD 11)

find_package(Qt5 COMPONENTS Gui REQUIRED)

add_executable(redscreen main.cpp)
target_link_libraries(redscreen Qt5::Gui)

To run it with EGL instead of default GLX one need to pass “-platform eglfs” switch.

Did anyone resolve this issue, I am getting the same thing using Qt5.15 and Jetpack 4.5 today

I also have the same issue. Can anybody help, please?