QT_QPA_EGLFS_FB not picking up /dev/fb1



  • Hello, I installed nVidia Quadro 420 into my target PC, and rebuilt my kernel to with CONFIG_DRM_NOUVEAU defconfig, and Qt5 with OpenGL ES 2.0 support. I also built mesa3d with Gallium nouveau driver and OpenGL EGL and OpenGL ES support. The nVidia card is correctly probed and shows up as the 2nd framebuffer device on my target (/dev/fb1; /dev/fb0 is the on-board Intel VGA controller--the i915 chip variety).

    When I run the Qt5 example application with -platform eglfs, it seems that mesa is trying to find i915_dri, which doesn't make sense, since the on-board Intel video controller is NOT what I want. I read this page http://doc.qt.io/qt-5/embedded-linux.html, and after skimming the mesa code for a bit, hypothesized that mesa is asking /dev/fb0 for the name of the device driver, based on this output (only the 1st few lines are important, because the rest is just trying to (but still failing to) fall back on the SW drivers:

    ./2dpainting -platform eglfs:fb=/dev/fb1

    gbm: failed to open any driver (search paths /usr/lib/dri)
    gbm: Last dlopen error: /usr/lib/dri/i915_dri.so: cannot open shared object file: No such file or directory
    failed to load driver: i915
    gbm: failed to open any driver (search paths /usr/lib/dri)
    gbm: Last dlopen error: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: No such file or directory
    failed to load driver: kms_swrast
    gbm: failed to open any driver (search paths /usr/lib/dri)
    gbm: Last dlopen error: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory
    failed to load swrast driver
    failed to load module: /usr/lib/gbm/gbm_gallium_drm.so: cannot open shared object file: No such file or directory
    Could not initialize egl display
    Aborted

    According to the Qt eglfs documentation, I tried making eglfs get the device driver characteristics from /dev/fb1:

    export QT_QPA_EGLFS_FB=/dev/fb1

    But as you can see from the above output, the word "nouveau" is still not appearing anywhere.

    Can you please point out if I neglected some paragraph in the eglfs documentation?

    w/ regards,
    Henry



  • QT_QPA_EGLFS_FB is currently only useful on certain devices, for example i.MX6-based boards where we have some specific support for the GPU vendors custom APIs that allow specifying which framebuffer to be used by EGL.

    With Mesa you should rather use DRM/KMS. In Qt 5.5 eglfs has a new KMS backend (replacing the older kms platform plugin). I am not entirely certain how this multi GPU setup would function, but I assume specifying a given /dev/dri/cardX will allow selecting which card to use. See https://doc-snapshots.qt.io/qt5-5.5/embedded-linux.html#display-output

    For earlier Qt versions you could experiment with the kms platform plugin. This should also be functional to some extent and it does have multi-device support: it creates a QScreen for each active connector of each device.



  • Thank you very much for the reply. I did not quite understand your explanation--probably because I am a newbie to low level display SW. In particular, I was not clear whether you were saying that eglfs will NOT work at all for me even if I can somehow get Qt to see the fb corresponding to my nVidia card, or whether the problem is simply that there is no way for eglfs to use anything other than /dev/fb0. I tried to work around this problem (/dev/fb0 vs /dev/fb1) by removing the Intel GPU support from my Linux kernel, so that only the nouveau card will be enumerated as /dev/fb0. But when I did that, I got a different error:

    ./openglwindow -platform eglfs

    Unable to query physical screen size, defaulting to 100 dpi.
    To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
    EGL Error : Could not create the egl surface: error = 0x300b

    Aborted

    Do you know whether EGLFS should work for the nouveau drivers (maybe this is what you were saying)?



  • I just looked at the qt5base source code a bit, and traced the error to here:

    if (!rx::IsValidEGLNativeWindowType(win))
    {
        recordError(egl::Error(EGL_BAD_NATIVE_WINDOW));
        return EGL_NO_SURFACE;
    }
    

    But then it gets bizarre, because the IsValidEGLNativeWindowType() method is only supplied in win32 or winrt--when in fact I am on Linux--as you can see here:

    ~/work/o755/buildroot/output/build/qt5base-5.4.0$ grep -nR --include="*.cpp" IsValidEGLNativeWindowType *
    src/3rdparty/angle/src/libEGL/libEGL.cpp:414: if (!rx::IsValidEGLNativeWindowType(win))
    src/3rdparty/angle/src/common/win32/NativeWindow.cpp:14:bool IsValidEGLNativeWindowType(EGLNativeWindowType window)
    src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.cpp:198:bool IsValidEGLNativeWindowType(EGLNativeWindowType window)

    On Googling, I see that some people talk about writing a platform specific GLES binder code. I am trying to run on Linux noveau driver (NVS420) WITHOUT X-Windows. Does anyone know if the work has already been done? If not, can someone please point me to a guide on how to write the necessary "glue" code? Thank you very much for reading.

    w/ regards,
    Henry


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.