Qt World Summit: Register Today!

Raspberry Pi2 running Buildroot with QT5 Set screen resolution

  • I'm in development of a QT5 application for RPi2 running build root. Initially I'm trying out QTQuick 2 with QML, and running into the issue where the app launches with a resolution of 1280x720 instead of the intended 1920x1080 on an 8" HDMI display.

    I don't know if the change I need to make is somewhere within the running OS, or some value within the QT app in order to fix the resolution.

    Logging Screen.width and Screen.height in QML outputs the following:

    qml: x: 1280 y: 720

    I have tried setting env variables by creating a file in /etc/profiles.d/ with the following.

    export QT_QPA_EGLFS_WIDTH=1920 
    export QT_QPA_EGLFS_HEIGHT=1080
    export QT_QPA_EGLFS_DEPTH=24
    #export QT_DEBUG_PLUGINS=1
    export QT_QPA_EGLFS_DEBUG=1
    #export QSG_INFO=1
    export QT_LOGGING_RULES=qt.qpa.*=true

    However that results in the app not detecting the variables set:

    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).

    If I manually source a file containing the env variables the error above is not output, indicating I believe that they have been seen by QT but still no change is reflected.

    I am SSH'ing into the Pi to make changes and run the QT app, and I have also tried using fbset to change there resolution, which does seem to set the terminal into 1080p, but not the app when ran.

    fbset -xres 1920 -yres 1080

    Here is the logging output when the app is ran.

        qt.qpa.egldeviceintegration: EGL device integration plugin keys: ("eglfs_brcm")
        qt.qpa.egldeviceintegration: EGL device integration plugin keys (sorted): ("eglfs_brcm")
        qt.qpa.egldeviceintegration: Trying to load device EGL integration "eglfs_brcm"
        qt.qpa.egldeviceintegration: Using EGL device integration "eglfs_brcm"
        qt.qpa.input: evdevkeyboard: Using device discovery
        qt.qpa.input: udev device discovery for type QFlags(0x8)
        qt.qpa.input: Found matching devices ()
        qt.qpa.input: evdevmouse: Using device discovery
        qt.qpa.input: udev device discovery for type QFlags(0x1|0x2)
        qt.qpa.input: Found matching devices ()
        qt.qpa.input: evdevtouch: Using device discovery
        qt.qpa.input: udev device discovery for type QFlags(0x2|0x4)
        qt.qpa.input: Found matching devices ()
        qml: x: 1280 y: 720
        Created context for format QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior 2, swapInterval 1, profile  0) with config:
            EGL_BUFFER_SIZE: 16
            EGL_ALPHA_SIZE: 0
            EGL_BLUE_SIZE: 5
            EGL_GREEN_SIZE: 6
            EGL_RED_SIZE: 5
            EGL_DEPTH_SIZE: 24
            EGL_STENCIL_SIZE: 8
            EGL_CONFIG_CAVEAT: 12344
            EGL_CONFIG_ID: 17
            EGL_LEVEL: 0
            EGL_MAX_PBUFFER_HEIGHT: 2048
            EGL_MAX_PBUFFER_PIXELS: 4194304
            EGL_MAX_PBUFFER_WIDTH: 2048
            EGL_NATIVE_VISUAL_ID: 107544
            EGL_NATIVE_VISUAL_TYPE: 12344
            EGL_SAMPLES: 0
            EGL_SAMPLE_BUFFERS: 0
            EGL_SURFACE_TYPE: 1639
            EGL_TRANSPARENT_TYPE: 12344
            EGL_BIND_TO_TEXTURE_RGB: 1
            EGL_MIN_SWAP_INTERVAL: 0
            EGL_MAX_SWAP_INTERVAL: 2147483647

  • Realised buildroot hadn't copied over a config.txt to the boot partition of the SD card. Copied across a minimal config and set configured a few arguments as stated in this thread.


    That forced the RPi into 1080p mode and now my QT app is displaying correctly at 1920x1080.