Luckfox Pico Ultra W + LF40-720720-ARK + QT5 aplication

  • maxkr wrote: 2024-11-05 18:52 Hi!

    I'm use Luckfox Pico Ultra W + LF40-720720-ARK as described in https://wiki.luckfox.com/Luckfox-Pico/L ... GB-Screen/ with Ubuntu 22.04 (pre-build images from Google Drive). Modetest working fine for me.

    Trying to start any native or pyside2 (python binding) QT 5 application with environment variables

    Code: Select all

    QT_QPA_PLATFORM=eglfs
    QT_QPA_EGLFS_INTEGRATION=eglfs_kms
    QT_QPA_EGLFS_KMS_ATOMIC=1
    
    All works fine when I'm don't touch anything.
    But when I touch there is some glitches on the screen and I seen in the console:

    Code: Select all

    KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory
    QEGLPlatformContext: eglSwapBuffers failed: 3003
    Could not lock GBM surface front buffer!
    
    But buffer size is quite enough:

    Code: Select all

    root@luckfox:/# cat /proc/meminfo | grep 'Cma'
    CmaTotal:          43008 kB
    CmaAllocated:       6772 kB
    CmaReleased:       36236 kB
    CmaFree:               0 kB
    
    How can I fix it?
    Searching for error give only one answer - increase CMA buffer, but look like this is not valid way.
    Hello did you install your QT 5 application yourself via apt?
  • maxkr wrote: 2024-11-05 18:52 Hi!

    I'm use Luckfox Pico Ultra W + LF40-720720-ARK as described in https://wiki.luckfox.com/Luckfox-Pico/L ... GB-Screen/ with Ubuntu 22.04 (pre-build images from Google Drive). Modetest working fine for me.

    Trying to start any native or pyside2 (python binding) QT 5 application with environment variables

    Code: Select all

    QT_QPA_PLATFORM=eglfs
    QT_QPA_EGLFS_INTEGRATION=eglfs_kms
    QT_QPA_EGLFS_KMS_ATOMIC=1
    
    All works fine when I'm don't touch anything.
    But when I touch there is some glitches on the screen and I seen in the console:

    Code: Select all

    KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory
    QEGLPlatformContext: eglSwapBuffers failed: 3003
    Could not lock GBM surface front buffer!
    
    But buffer size is quite enough:

    Code: Select all

    root@luckfox:/# cat /proc/meminfo | grep 'Cma'
    CmaTotal:          43008 kB
    CmaAllocated:       6772 kB
    CmaReleased:       36236 kB
    CmaFree:               0 kB
    
    How can I fix it?
    Searching for error give only one answer - increase CMA buffer, but look like this is not valid way.
    After testing, this does happen

    Code: Select all

    root@luckfox:~/egl_test# ./egl_test
    Failed to move cursor on screen UNKNOWN1: -14
    Failed to move cursor on screen UNKNOWN1: -14
    Running on a software rasterizer (LLVMpipe), expect limited performance.
    KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory
    [  114.589530] [drm:rockchip_gem_create_object] *ERROR* failed to alKMS: DRM_IOCTL_MODE_CREATE_DUMB flocate 1048576 byte ailed: Cannot alldma bocate memoryuf
    fer
    QEGLPlatformContext: eglSwapBuffers failed: 3003
    Could not lock GBM surface front buffer!
    
    I think it might be caused by not loading the Reximicro GPU driver
  • Alenwowo wrote: 2024-11-08 1:57 Hello did you install your QT 5 application yourself via apt?
    I just install python3-pyside2.* packages via apt and try base example:

    Code: Select all

    #!/usr/bin/python3
    # -'''- coding: utf-8 -'''-
    
    import sys
    from PySide2.QtWidgets import QApplication, QPushButton
    
    def say_hello():
            print("Button clicked, Hello!")
    
    app = QApplication(sys.argv)
    
    button = QPushButton("Click me")
    button.clicked.connect(say_hello)
    button.show()
    
    app.exec_()
    
    Also trying another environment variables:

    Code: Select all

    export QT_QPA_PLATFORM="eglfs"
    export QT_QPA_EGLFS_INTEGRATION="eglfs_kms"
    export QT_QPA_EGLFS_FORCEVSYNC="1"
    export QT_QPA_EGLFS_KMS_ATOMIC="1"
    export QT_QPA_EGLFS_DEBUG="1"
    
    After start application was return:

    Code: Select all

    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
    Failed to move cursor on screen UNKNOWN1: -14
    Failed to move cursor on screen UNKNOWN1: -14
    Created context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 0, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 0, stencilBufferSize 0, samples 0, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile) with config:
            EGL_BUFFER_SIZE: 24
            EGL_ALPHA_SIZE: 0
            EGL_BLUE_SIZE: 8
            EGL_GREEN_SIZE: 8
            EGL_RED_SIZE: 8
            EGL_DEPTH_SIZE: 0
            EGL_STENCIL_SIZE: 0
            EGL_CONFIG_CAVEAT: 12344
            EGL_CONFIG_ID: 31
            EGL_LEVEL: 0
            EGL_MAX_PBUFFER_HEIGHT: 4096
            EGL_MAX_PBUFFER_PIXELS: 0
            EGL_MAX_PBUFFER_WIDTH: 4096
            EGL_NATIVE_RENDERABLE: 1
            EGL_NATIVE_VISUAL_ID: 875713112
            EGL_NATIVE_VISUAL_TYPE: 12344
            EGL_SAMPLES: 0
            EGL_SAMPLE_BUFFERS: 0
            EGL_SURFACE_TYPE: 4
            EGL_TRANSPARENT_TYPE: 12344
            EGL_TRANSPARENT_BLUE_VALUE: 0
            EGL_TRANSPARENT_GREEN_VALUE: 0
            EGL_TRANSPARENT_RED_VALUE: 0
            EGL_BIND_TO_TEXTURE_RGB: 0
            EGL_BIND_TO_TEXTURE_RGBA: 0
            EGL_MIN_SWAP_INTERVAL: 1
            EGL_MAX_SWAP_INTERVAL: 1
    Running on a software rasterizer (LLVMpipe), expect limited performance.
    
    but still with glitches.
    Alenwowo wrote: 2024-11-08 6:08 I think it might be caused by not loading the Reximicro GPU driver
    How it can be loaded?

    Probably, I better switch to the buidroot's image and try Qt there.
  • maxkr wrote: 2024-11-09 8:58
    Alenwowo wrote: 2024-11-08 1:57 Hello did you install your QT 5 application yourself via apt?
    I just install python3-pyside2.* packages via apt and try base example:

    Code: Select all

    #!/usr/bin/python3
    # -'''- coding: utf-8 -'''-
    
    import sys
    from PySide2.QtWidgets import QApplication, QPushButton
    
    def say_hello():
            print("Button clicked, Hello!")
    
    app = QApplication(sys.argv)
    
    button = QPushButton("Click me")
    button.clicked.connect(say_hello)
    button.show()
    
    app.exec_()
    
    Also trying another environment variables:

    Code: Select all

    export QT_QPA_PLATFORM="eglfs"
    export QT_QPA_EGLFS_INTEGRATION="eglfs_kms"
    export QT_QPA_EGLFS_FORCEVSYNC="1"
    export QT_QPA_EGLFS_KMS_ATOMIC="1"
    export QT_QPA_EGLFS_DEBUG="1"
    
    After start application was return:

    Code: Select all

    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
    Failed to move cursor on screen UNKNOWN1: -14
    Failed to move cursor on screen UNKNOWN1: -14
    Created context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 0, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 0, stencilBufferSize 0, samples 0, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile) with config:
            EGL_BUFFER_SIZE: 24
            EGL_ALPHA_SIZE: 0
            EGL_BLUE_SIZE: 8
            EGL_GREEN_SIZE: 8
            EGL_RED_SIZE: 8
            EGL_DEPTH_SIZE: 0
            EGL_STENCIL_SIZE: 0
            EGL_CONFIG_CAVEAT: 12344
            EGL_CONFIG_ID: 31
            EGL_LEVEL: 0
            EGL_MAX_PBUFFER_HEIGHT: 4096
            EGL_MAX_PBUFFER_PIXELS: 0
            EGL_MAX_PBUFFER_WIDTH: 4096
            EGL_NATIVE_RENDERABLE: 1
            EGL_NATIVE_VISUAL_ID: 875713112
            EGL_NATIVE_VISUAL_TYPE: 12344
            EGL_SAMPLES: 0
            EGL_SAMPLE_BUFFERS: 0
            EGL_SURFACE_TYPE: 4
            EGL_TRANSPARENT_TYPE: 12344
            EGL_TRANSPARENT_BLUE_VALUE: 0
            EGL_TRANSPARENT_GREEN_VALUE: 0
            EGL_TRANSPARENT_RED_VALUE: 0
            EGL_BIND_TO_TEXTURE_RGB: 0
            EGL_BIND_TO_TEXTURE_RGBA: 0
            EGL_MIN_SWAP_INTERVAL: 1
            EGL_MAX_SWAP_INTERVAL: 1
    Running on a software rasterizer (LLVMpipe), expect limited performance.
    
    but still with glitches.
    Alenwowo wrote: 2024-11-08 6:08 I think it might be caused by not loading the Reximicro GPU driver
    How it can be loaded?

    Probably, I better switch to the buidroot's image and try Qt there.
    Yes, it's best to use buildroot to use QT