This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-AM335X: Colors swapped in Qt EGLFS

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: AM3358

Hi, I have what seems to be a common problem -- the sample QT applications have red and blue swapped on an AM3358 system running with EGLFS.

At the recommendation of some other posts on this forum, I have edited my /etc/powervr.ini file to look like this:

[default]
#default library without double buffering:
#WindowSystem=libpvrDRMWSEGL_FRONT.so
#alternative library, slower but with double buffering
WindowSystem=libpvrDRMWSEGL.so
#DisableHWTQTextureUpload=1
DisableHWTQTextureUpload=0
ParamBufferSize=1677216
DefaultPixelFormat=RGB565

And my /etc/profile.d/qt_env.sh looks like this:

#!/bin/sh

logger qt_env.sh is being run

export QSG_INFO=1
export QT_QPA_EGLFS_DEBUG=1
export QT_QPA_EGLFS_HIDECURSOR=1
export QT_QPA_EGLFS_INTEGRATION=none
export QT_QPA_EGLFS_PHYSICAL_WIDTH=154
export QT_QPA_EGLFS_PHYSICAL_HEIGHT=86
libevdev-tweak-device --abs ABS_MT_POSITION_X --max 799 /dev/input/event0
libevdev-tweak-device --abs ABS_MT_POSITION_Y --max 479 /dev/input/event0

After a reboot I can confirm that the environment variables are being set, but EGLFS still seems to be selecting RGB888 mode. Any advice?

# env
SSH_CLIENT=10.92.1.103 58932 22
MAIL=/var/mail/root
USER=root
SHLVL=1
HOME=/root
SSH_TTY=/dev/pts/0
QT_QPA_EGLFS_DEBUG=1
PAGER=/bin/more
PS1=#
QT_QPA_EGLFS_PHYSICAL_HEIGHT=86
QSG_INFO=1
LOGNAME=root
QT_QPA_EGLFS_INTEGRATION=none
TERM=xterm
QT_QPA_EGLFS_HIDECURSOR=1
PATH=/bin:/sbin:/usr/bin:/usr/sbin
SHELL=/bin/sh
QT_QPA_EGLFS_PHYSICAL_WIDTH=154
PWD=/root
SSH_CONNECTION=10.92.1.103 58932 10.92.1.107 22
EDITOR=/bin/vi
# /usr/lib/qt/examples/quick/demos/photosurface/photosurface
PVR: Hint: Setting ParamBufferSize to 1677216

PVR: Hint: Setting WindowSystem to libpvrDRMWSEGL.so

mode for connector 20 is 800x480
mode for CRTC of connector 20 is 800x480
DRM SET CRTC: index: 0 fd: 6, crtc: 12, fb: 18, conn: 14, mode: 800x480
qt.scenegraph.general: threaded render loop
qt.scenegraph.general: Using sg animation driver
qt.scenegraph.general: Animation Driver: using vsync: 16.67 ms
PVR: Hint: Setting DisableHWTQTextureUpload to 0

Created context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::SwapBehavior(DoubleBuffer), swapInterval 1, profile  QSurfaceFormat::OpenGLContextProfile(NoProfile)) with config:
        EGL_BUFFER_SIZE: 32
        EGL_ALPHA_SIZE: 8
        EGL_BLUE_SIZE: 8
        EGL_GREEN_SIZE: 8
        EGL_RED_SIZE: 8
        EGL_DEPTH_SIZE: 24
        EGL_STENCIL_SIZE: 8
        EGL_CONFIG_CAVEAT: 12344
        EGL_CONFIG_ID: 8
        EGL_LEVEL: 0
        EGL_MAX_PBUFFER_HEIGHT: 2048
        EGL_MAX_PBUFFER_PIXELS: 4194304
        EGL_MAX_PBUFFER_WIDTH: 2048
        EGL_NATIVE_RENDERABLE: 0
        EGL_NATIVE_VISUAL_ID: 0
        EGL_NATIVE_VISUAL_TYPE: 0
        EGL_SAMPLES: 0
        EGL_SAMPLE_BUFFERS: 0
        EGL_SURFACE_TYPE: 5
        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: 0
        EGL_MAX_SWAP_INTERVAL: 1
qt.scenegraph.general: Using sg animation driver
qt.scenegraph.general: Animation Driver: using vsync: 16.67 ms
qt.scenegraph.general: texture atlas dimensions: 1024x512
qt.scenegraph.general: R/G/B/A Buffers:    8 8 8 8
qt.scenegraph.general: Depth Buffer:       24
qt.scenegraph.general: Stencil Buffer:     8
qt.scenegraph.general: Samples:            0
qt.scenegraph.general: GL_VENDOR:          Imagination Technologies
qt.scenegraph.general: GL_RENDERER:        PowerVR SGX 530
qt.scenegraph.general: GL_VERSION:         OpenGL ES 2.0 build 1.9@2253347
qt.scenegraph.general: GL_EXTENSIONS:      GL_EXT_discard_framebuffer GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_shader_texture_lod GL_IMG_read_format GL_OES_EGL_image_external GL_OES_egl_sync GL_IMG_texture_format_BGRA8888 GL_OES_depth24 GL_OES_compressed_ETC1_RGB8_texture GL_OES_fragment_precision_high GL_OES_rgb8_rgba8 GL_OES_get_program_binary GL_EXT_texture_format_BGRA8888 GL_IMG_program_binary GL_IMG_multisampled_render_to_texture GL_OES_element_index_uint GL_IMG_shader_binary GL_TI_image_external_raw_video GL_OES_mapbuffer GL_OES_required_internalformat GL_IMG_texture_npot GL_OES_vertex_half_float GL_OES_EGL_image  GL_OES_texture_float GL_IMG_texture_compression_pvrtc GL_OES_vertex_array_object GL_OES_texture_half_float GL_OES_standard_derivatives GL_IMG_uniform_buffer_object GL_EXT_multi_draw_arrays
qt.scenegraph.general: Max Texture Size:  2048
qt.scenegraph.general: Debug context:     false

Thanks,
Isaac

  • The software team have been notified. They will respond here.
  • Which version of SDK are you using? Is your board configured to work in 16 bits per pixel mode?
  • I'm using the 2017.05 buildroot tag with the beaglebone_qt_defconfig, which seems to be grabbing particular commits from the TI git repositories. In particular:

    • linux kernel is 52c4aa7cdb93d61f8008f380135beaf7b8fa6593 grabbed from git://git.ti.com/processor-sdk/processor-sdk-linux.git
    • ti-sgx-demos is f24650bc8243b25c23d6a0a502ed79fc472ac424 grabbed from git://git.ti.com/graphics/img-pvr-sdk.git
    • ti-sgx-km is 2b7523d07a13ab704a24a7664749551f4a13ed32 grabbed from git://git.ti.com/graphics/omap5-sgx-ddk-linux.git
    • ti-sgx-um is e15f1543bab4de9e8927a2c4934addf3fd16ffcb grabbed from git://git.ti.com/graphics/omap5-sgx-ddk-um-linux.git

    I've attached images showing that Tux's feet are yellow/reddish at boot (good) but the Chameleon man has a blue brick wall behind him (bad). I'm using a 4DCAPE-70CT kit, and basically the device tree shared by Kemal at this thread:  (I couldn't figure out how to attach my own device tree which is slightly customized but certainly no intentional color swapping)

    Output of gfx_check.sh:

    # ./gfx_check.sh
    WSEGL settings
    [default]
    WindowSystem=libpvrDRMWSEGL_FRONT.so
    DisableHWTQTextureUpload=1
    DefaultPixelFormat=RGB565
    ------
    ARM CPU information
    processor       : 0
    model name      : ARMv7 Processor rev 2 (v7l)
    BogoMIPS        : 996.14
    Features        : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
    CPU implementer : 0x41
    CPU architecture: 7
    CPU variant     : 0x3
    CPU part        : 0xc08
    CPU revision    : 2
    
    Hardware        : Generic AM33XX (Flattened Device Tree)
    Revision        : 0000
    Serial          : 0000000000000000
    ------
    SGX driver information
    Version SGX_DDK_Linux_CustomerTI sgxddk 19 1.9@2253347 (release) omap335x_linux
    System Version String: SGX revision = 125
    ------
    Framebuffer settings
    ------
    Rotation settings
    0
    ------
    Kernel Module information
    Module                  Size  Used by    Tainted: G
    ipv6                  408424 12 [permanent]
    hid_generic             1031  0
    usbmouse                2785  0
    usbkbd                  4516  0
    usbhid                 27673  0
    musb_dsps               7877  0
    musb_hdrc              55856  1 musb_dsps
    udc_core               12006  1 musb_hdrc
    usbcore               183133  4 usbmouse,usbkbd,usbhid,musb_hdrc
    usb_common              3335  4 musb_dsps,musb_hdrc,udc_core,usbcore
    evdev                  10787  0
    joydev                  9419  0
    omapdrm_pvr           333711  0
    omap_rng                4575  0
    rng_core                7831  1 omap_rng
    edt_ft5x06             10699  0
    rtc_omap                8172  0
    musb_am335x             1346  0 [permanent]
    omap_wdt                4884  0
    leds_gpio               3649  0
    led_class               6705  1 leds_gpio
    ------
    Boot settings
    console=ttyO0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait
    ------
    Linux Kernel version
    Linux buildroot 4.1.6 #1 SMP PREEMPT Sat Dec 9 14:09:46 EST 2017 armv7l GNU/Linux
    

  • RGB 565 support in DDK UM was added very recently. It uses DDK 1.14. Here's the link and branch having the commit id for RGB565 support.
    git.ti.com/.../1.14.3699939

    commit 3af51eb8fe10f73c4bb64c4cc31e44ab4676081f
    Author: Eric Ruei <e-ruei1@ti.com>
    Date: Fri Jun 17 15:04:45 2016 -0400

    um: null_drm/gbm: add RGB565 support

    Signed-off-by: Eric Ruei <e-ruei1@ti.com>
  • OK so I pulled these into my buildroot packages:

    • ti-sgx-km (git://git.ti.com/graphics/omap5-sgx-ddk-linux.git): commit fed0756f1b8b9d526da2821635c7d742989d47c3
    • ti-sgx-um (git://git.ti.com/graphics/omap5-sgx-ddk-um-linux.git): commit bbbd5cbb55e4c54d3b02456ae553bea86fd61506

    since these seemed to bring me up to date with the latest user space stuff combined with DDK 1.14 on a 4.1 kernel. When I run the demos I get the following:

    # /usr/bin/OGLES2ChameleonMan
    /usr/bin/OGLES2ChameleonMan: error while loading shared libraries: libgbm.so.2: cannot open shared object file: No such file or directory
    

    so I guess I have to find a recipe to build libgbm now? I'm starting to get worried that libgbm will have other dependencies I don't know about... I wonder if buildroot is the way to go, or whether someone can point me to an RGB565 SGX EGLFS recipe for the AM3358 processor...

  • Apparently Mesa3D provides libgbm but then I'm missing libwayland-server. When I add that I get a failure compiling host-cmake. For kicks I downloaded ti-processor-sdk-linux-am335x-evm-04.01.00.06 and ran the bundled create-sdcard.sh script with the result that the first partition on my sdcard is now unmountable and the board won't boot. Hmm, I guess I'll keep trying with buildroot because I'm almost there -- just missing RGB565 because of an outdated version of the sgx sdk.

    This really is harder than it should be. When I get this all figured out I need to post a nice tutorial someplace online for the next guy. :-)
  • Hi Isaac,

    I find that you were earlier using  am4/k4.1 branch- .

    defaultPixelFormat is also supported in am3/k4.1 branch which should have been used for BBB. It will be much easier for you to migrate to w and pick the last commit id there then trying to migrate to earlier recommended branch ti-img-sgx/1.14.3699939 by me.

  • Fantastic! Your instruction to use the am3/k4.1 branch of the omap5-sgx-ddk-um-linux repository is what I needed. For the record, a rough outline of my steps to get RGB565 color mode working for beaglebone black and a 4DCAPE-70CT is as follows:

    1. clone buildroot and checkout branch 2017.05
    2. make beaglebone_qt5_defconfig
    3. edit package/ti-sgx-km/ti-sgx-km.mk as follows:
      1. we want the latest from ti-img-sgx/1.14.3699939/k4.1. At time of writing this post this means setting TI_SGX_KM_VERSION = fed0756f1b8b9d526da2821635c7d742989d47c3
      2. delete all the logic for TI_SGX_KM_PLATFORM_NAME and just replace it with TI_SGX_KM_PLATFORM_NAME = omap
    4. edit package/ti-sgx-um/ti-sgx-um.mk as follows:
      1. we want the latest from am3/k4.1. At time of writing this post, this means setting TI_SGX_UM_VERSION = 84ae5444c7cbc3f4c65a226b9fea62d4a513f3e0
    5. make (it will barf at the end because it can't fine the beaglebonegreen device tree file)
    6. grab the dts file referred to earlier in this thread and add it to output/build/linux-*/arch/arm/boot/dts/am335x-boneblack-4d7ct.dts
    7. modify board/beaglebone/genimage.cfg replacing the dtb entries with an entry for the "am335x-boneblack-4d7ct.dtb" added in the previous step
    8. use "make menuconfig" and replace the device tree entries with one corresponding to the dtb added above
    9. add the line "fdtfile=am335x-boneblack-4d7ct.dtb" somewhere in board/beaglebone/uEnv.txt
    10. make (this time it should succeed)
    11. use "dd" to write the output/images/sdcard.img to your SD Card