Where is eglGetConfigs getting its configs from?

chris.laplante at agilent.com chris.laplante at agilent.com
Fri Nov 5 16:19:58 UTC 2021


Hi Daniel,

Thanks for all your help!

> EGLConfigs are only semi-related to this. Ultimately they do have to render
> to a framebuffer for display, however they can be used for intermediate
> non-display rendering as well (e.g. FBOs, depth/stencil buffers). So, the list
> of EGLConfigs you get is essentially a list of configurations the GPU is able to
> render to. A subset of those will be suitable for display. The mechanism used
> for selecting a display-compatible config is to look at the
> EGL_NATIVE_VISUAL_ID and match this to a DRM format ...

Interesting, thanks for the explanation!

> > [01:36:24.725] Bad/unknown DRM format code 0x00000000.
> 
> This is already quite suspicious, since drm_output_init_egl() shouldn't be
> passing anything with 0 in the list?
> 

I think the 0 is coming from the last element of the format array in drm-gbm.c:

static int 
drm_backend_create_gl_renderer(struct drm_backend *b) 
{
    uint32_t format[3] = { 
        b->gbm_format,
        fallback_format_for(b->gbm_format),
        0,
    };  
    struct gl_renderer_display_options options = { 
        .egl_platform = EGL_PLATFORM_GBM_KHR,
        .egl_native_display = b->gbm,
        .egl_surface_type = EGL_WINDOW_BIT,
        .drm_formats = format,
        .drm_formats_count = 2,
    };  

    if (format[1])
        options.drm_formats_count = 3;

    if (gl_renderer->display_create(b->compositor, &options) < 0)
        return -1; 
0
    return 0;
}


> > [01:36:24.725] No EGLConfig matches { win|pbf; XRGB8888 }.
> 
> I would also expect to see ARGB8888 in this list ...
> 
> >                id:   9 rgba: 8 8 8 8 buf: 32 dep: 24 stcl: 8 int: 0-10 type:
> win|pix|pbf|swap_preserved vis_id: ARGB8888 (0x34325241)
> 
> This is an ARGB8888 config (note the rgba: 8 8 8 8) and the vis_id ...
> 
> >                id:  38 rgba: 8 8 8 0 buf: 24 dep: 24 stcl: 8 int: 0-10
> > type: win|pix|pbf|swap_preserved vis_id: ARGB8888 (0x34325241)
> 
> And this is an XRGB8888 config, but incorrectly declared to have a native
> visual ID of ARGB8888.
> 
> >                id:  41 rgba: 8 8 8 0 buf: 24 dep: 24 stcl: 8 int: 0-10
> > type: win|pix|pbf|ms_resolve_box|swap_preserved vis_id: ARGB8888
> > (0x34325241)

Ah interesting. As I mentioned I don't have access to the source of libEGL (since it is provided as a binary from here: https://github.com/Xilinx/mali-userspace-binaries). So I suppose I will either need to patch Weston or write a LD_PRELOAD shim for libEGL.

> These and the following are not relevant as they are multi-sampled and/or
> depth/stencil configs.
> 
> So, my thoughts are:
>   - how do you get to 'Bad/unknown DRM format code 0x00000000' given that
> drm_output_init_egl() explicitly prunes the list for this?
>   - why is DRM_FORMAT_ARGB8888 not found as a fallback format for
> DRM_FORMAT_XRGB8888, given that we should be getting that through
> fallback_format_for()?

Xilinx applies a patch to Weston that I thought could explain this behavior" https://github.com/Xilinx/meta-xilinx/blob/master/meta-xilinx-bsp/recipes-graphics/wayland/files/0001-libweston-Remove-substitute-format-for-ARGB8888.patch. However, I disabled the patch and nothing changed. I will need to dig deeper.

>   - your EGL stack is buggy, because it declares a 8880 format (i.e.
> XRGB8888) to be ARGB8888, so fixing that would likely solve the immediate
> problem, but the fallbacks above should work
> 
> Best of luck.

I should have mentioned, I did actually get this all working in an older version of Weston (7.0.0) with an older kernel (5.4 instead of the 5.10 I'm using now). AFAICT the libEGL version is the same. My weston.ini was basically the same. Below is the /var/log/weston.log. Note that I grafted on the code from Weston 9.0.0 to display all the EGLConfigs. It's interesting that the reported EGLConfigs look basically the same (including the misclassification of some XRGB8888 as ARGB8888).

Also worth mentioning is that in this build, Xilinx applied an additional patch to Weston: https://github.com/Xilinx/meta-xilinx/blob/rel-v2020.2/meta-xilinx-bsp/recipes-graphics/weston/files/0001-gl-renderer.c-Use-gr-egl_config-to-create-pbuffer-su.patch. Moving from Weston 7.0.0 => 9.0.0 they dropped the patch for some unexplained reason.

Thanks again for taking a look,
Chris 



Date: 2021-11-05 UTC
[13:35:12.812] weston 7.0.0
               https://wayland.freedesktop.org
               Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
               Build: 7.0.0
[13:35:12.812] Command line: /usr/bin/weston --log=/var/log/weston.log
[13:35:12.812] OS: Linux, 5.4.0-xilinx-v2020.2, #1 SMP Mon Apr 26 14:53:23 UTC 2021, aarch64
[13:35:12.812] Using config file '/etc/xdg/weston/weston.ini'
[13:35:12.812] Output repaint window is 7 ms maximum.
[13:35:12.812] Loading module '/usr/lib/libweston-7/drm-backend.so'
[13:35:12.822] initializing drm backend
[13:35:12.824] using /dev/dri/card0
[13:35:12.824] DRM: supports universal planes
[13:35:12.824] DRM: supports atomic modesetting
[13:35:12.824] DRM: supports picture aspect ratio
[13:35:12.824] Loading module '/usr/lib/libweston-7/gl-renderer.so'
[13:35:12.825] EGL client extensions: EGL_EXT_client_extensions
               EGL_EXT_platform_base EGL_KHR_platform_gbm
               EGL_KHR_platform_wayland
[13:35:12.825] EGL version: 1.4 Linux-r9p0-01rel0
[13:35:12.825] EGL vendor: ARM
[13:35:12.825] EGL client APIs: OpenGL_ES
[13:35:12.825] EGL extensions: EGL_KHR_image EGL_KHR_image_base
               EGL_KHR_image_pixmap EGL_EXT_image_dma_buf_import
               EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image
               EGL_KHR_gl_renderbuffer_image EGL_KHR_fence_sync
               EGL_KHR_wait_sync EGL_KHR_swap_buffers_with_damage
               EGL_EXT_swap_buffers_with_damage EGL_KHR_lock_surface
               EGL_KHR_lock_surface2 EGL_EXT_create_context_robustness
               EGL_ANDROID_blob_cache EGL_KHR_create_context
               EGL_WL_bind_wayland_display EGL_KHR_partial_update
               EGL_KHR_create_context_no_error
[13:35:12.826] Unable to use first choice EGL config with id 0x34325258, succeeded with alternate id 0x34325241.
[13:35:12.826] warning: Disabling render GPU timeline and explicit synchronization due to missing EGL_ANDROID_native_fence_sync extension
[13:35:12.826] EGL_KHR_surfaceless_context unavailable. Trying PbufferSurface
[13:35:12.826] All available EGLConfigs:
               id:   5 rgba: 5 6 5 0 buf: 16 dep: 24 stcl: 8 int: 0-10 type: win|pix|pbf|swap_preserved vis_id: RGB565 (0x36314752)
               id:   3 rgba: 5 6 5 0 buf: 16 dep: 24 stcl: 8 int: 0-10 type: win|pix|pbf|ms_resolve_box|swap_preserved vis_id: RGB565 (0x36314752)
               id:   4 rgba: 5 6 5 0 buf: 16 dep: 24 stcl: 8 int: 0-10 type: win|pix|pbf|ms_resolve_box|swap_preserved vis_id: RGB565 (0x36314752)
               id:  19 rgba: 5 5 5 1 buf: 16 dep: 24 stcl: 8 int: 0-10 type: pbf|swap_preserved vis_id: 0
               id:  18 rgba: 5 5 5 1 buf: 16 dep: 24 stcl: 8 int: 0-10 type: pbf|swap_preserved vis_id: 0
               id:  20 rgba: 5 5 5 1 buf: 16 dep: 24 stcl: 8 int: 0-10 type: pbf|swap_preserved vis_id: 0
               id:  21 rgba: 4 4 4 4 buf: 16 dep: 24 stcl: 8 int: 0-10 type: pbf|swap_preserved vis_id: 0
               id:  22 rgba: 4 4 4 4 buf: 16 dep: 24 stcl: 8 int: 0-10 type: pbf|swap_preserved vis_id: 0
               id:  23 rgba: 4 4 4 4 buf: 16 dep: 24 stcl: 8 int: 0-10 type: pbf|swap_preserved vis_id: 0
               id:   9 rgba: 8 8 8 8 buf: 32 dep: 24 stcl: 8 int: 0-10 type: win|pix|pbf|swap_preserved vis_id: ARGB8888 (0x34325241)
               id:  38 rgba: 8 8 8 0 buf: 24 dep: 24 stcl: 8 int: 0-10 type: win|pix|pbf|swap_preserved vis_id: ARGB8888 (0x34325241)
               id:  41 rgba: 8 8 8 0 buf: 24 dep: 24 stcl: 8 int: 0-10 type: win|pix|pbf|ms_resolve_box|swap_preserved vis_id: ARGB8888 (0x34325241)
               id:  42 rgba: 8 8 8 0 buf: 24 dep: 24 stcl: 8 int: 0-10 type: win|pix|pbf|ms_resolve_box|swap_preserved vis_id: ARGB8888 (0x34325241)
               id:  12 rgba: 8 8 8 8 buf: 32 dep: 24 stcl: 8 int: 0-10 type: win|pix|pbf|ms_resolve_box|swap_preserved vis_id: ARGB8888 (0x34325241)
               id:  15 rgba: 8 8 8 8 buf: 32 dep: 24 stcl: 8 int: 0-10 type: win|pix|pbf|ms_resolve_box|swap_preserved vis_id: ARGB8888 (0x34325241)
               id:  13 rgba: 0 0 0 0 buf:  8 dep:  0 stcl: 0 int: 0-0 type: pix vis_id: 0
               id:  14 rgba: 0 0 0 8 buf: 16 dep:  0 stcl: 0 int: 0-0 type: pix vis_id: 0
               id:  28 rgba: 5 6 5 0 buf: 16 dep:  0 stcl: 0 int: 0-10 type: win|swap_preserved vis_id: RGB565 (0x36314752)
               id:  35 rgba: 5 5 5 1 buf: 16 dep:  0 stcl: 0 int: 0-10 type: swap_preserved vis_id: 0
               id:  34 rgba: 8 8 8 8 buf: 32 dep:  0 stcl: 0 int: 0-10 type: win|swap_preserved vis_id: ARGB8888 (0x34325241)
               id:  27 rgba: 8 8 8 8 buf: 32 dep:  0 stcl: 0 int: 0-10 type: win|swap_preserved vis_id: ARGB8888 (0x34325241)
[13:35:12.827] GL version: OpenGL ES 2.0 "67dc026"
[13:35:12.827] GLSL version: OpenGL ES GLSL ES 1.00
[13:35:12.827] GL vendor: ARM
[13:35:12.827] GL renderer: Mali-400 MP
[13:35:12.827] GL extensions: GL_OES_texture_npot GL_OES_vertex_array_object
               GL_OES_compressed_ETC1_RGB8_texture
               GL_EXT_compressed_ETC1_RGB8_sub_texture
               GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_depth24
               GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth_texture
               GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888
               GL_OES_vertex_half_float GL_EXT_blend_minmax
               GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_rgb8_rgba8
               GL_EXT_multisampled_render_to_texture
               GL_EXT_discard_framebuffer GL_OES_get_program_binary
               GL_ARM_mali_program_binary GL_EXT_shader_texture_lod
               GL_EXT_robustness GL_OES_depth_texture_cube_map GL_KHR_debug
               GL_ARM_shader_framebuffer_fetch
               GL_ARM_shader_framebuffer_fetch_depth_stencil GL_OES_mapbuffer
               GL_KHR_no_error
[13:35:12.827] GL ES 2 renderer features:
               read-back format: RGBA
               wl_shm sub-image to texture: no
               EGL Wayland extension: yes
[13:35:12.834] event1  - CHICONY USB Keyboard: is tagged by udev as: Keyboard
[13:35:12.834] event1  - CHICONY USB Keyboard: device is a keyboard
[13:35:12.837] event2  - CHICONY USB Keyboard System Control: is tagged by udev as: Keyboard
[13:35:12.837] event2  - CHICONY USB Keyboard System Control: device is a keyboard
[13:35:12.839] event3  - CHICONY USB Keyboard Consumer Control: is tagged by udev as: Keyboard
[13:35:12.839] event3  - CHICONY USB Keyboard Consumer Control: device is a keyboard
[13:35:12.842] event4  - CHICONY USB Keyboard: is tagged by udev as: Keyboard
[13:35:12.842] event4  - CHICONY USB Keyboard: device is a keyboard
[13:35:12.900] event5  - Razer Razer DeathAdder Elite: is tagged by udev as: Mouse
[13:35:12.901] event5  - Razer Razer DeathAdder Elite: device is a pointer
[13:35:12.903] event6  - Razer Razer DeathAdder Elite Keyboard: is tagged by udev as: Keyboard
[13:35:12.903] event6  - Razer Razer DeathAdder Elite Keyboard: device is a keyboard
[13:35:12.906] event7  - Razer Razer DeathAdder Elite Consumer Control: is tagged by udev as: Keyboard
[13:35:12.906] event7  - Razer Razer DeathAdder Elite Consumer Control: device is a keyboard
[13:35:12.908] event8  - Razer Razer DeathAdder Elite System Control: is tagged by udev as: Keyboard
[13:35:12.908] event8  - Razer Razer DeathAdder Elite System Control: device is a keyboard
[13:35:12.911] event9  - Razer Razer DeathAdder Elite: not tagged as supported input device
[13:35:12.911] event9  - not using input device '/dev/input/event9'
[13:35:12.913] event10 - Razer Razer DeathAdder Elite: is tagged by udev as: Keyboard
[13:35:12.913] event10 - Razer Razer DeathAdder Elite: device is a keyboard
[13:35:12.916] event0  - Atmel maXTouch Touchscreen: is tagged by udev as: Touchscreen
[13:35:12.916] event0  - Atmel maXTouch Touchscreen: device is a touch device
[13:35:12.936] libinput: configuring device "CHICONY USB Keyboard".
[13:35:12.937] libinput: configuring device "CHICONY USB Keyboard System Control".
[13:35:12.937] libinput: configuring device "CHICONY USB Keyboard Consumer Control".
[13:35:12.937] libinput: configuring device "CHICONY USB Keyboard".
[13:35:12.937] libinput: configuring device "Razer Razer DeathAdder Elite".
[13:35:12.937] libinput: configuring device "Razer Razer DeathAdder Elite Keyboard".
[13:35:12.937] libinput: configuring device "Razer Razer DeathAdder Elite Consumer Control".
[13:35:12.937] libinput: configuring device "Razer Razer DeathAdder Elite System Control".
[13:35:12.937] libinput: configuring device "Razer Razer DeathAdder Elite".
[13:35:12.937] Touchscreen - Atmel maXTouch Touchscreen - /sys/devices/platform/amba_pl at 0/a0000000.i2c/i2c-2/2-004a/input/input0/event0
[13:35:12.937] libinput: configuring device "Atmel maXTouch Touchscreen".
[13:35:12.937] input device event0 has no enabled output associated (none named), skipping calibration for now.
[13:35:12.944] DRM: head 'DPI-1' found, connector 35 is connected, EDID make 'unknown', model 'unknown', serial 'unknown'
[13:35:12.945] Registered plugin API 'weston_drm_output_api_v1' of size 24
[13:35:12.945] Registered plugin API 'weston_drm_virtual_output_api_v1' of size 48
[13:35:12.945] Unable to use first choice EGL config with id 0x34325258, succeeded with alternate id 0x34325241.
[13:35:12.945] Chosen EGL config details:
               RGBA bits: 8 8 8 8
               swap interval range: 0 - 10
[13:35:12.946] Output DPI-1 (crtc 33) video modes:
               800x480 at 59.9, preferred, current, 33.2 MHz
[13:35:12.946] associating input device event1 with output DPI-1 (none by udev)
[13:35:12.946] associating input device event2 with output DPI-1 (none by udev)
[13:35:12.946] associating input device event3 with output DPI-1 (none by udev)
[13:35:12.946] associating input device event4 with output DPI-1 (none by udev)
[13:35:12.946] associating input device event5 with output DPI-1 (none by udev)
[13:35:12.946] associating input device event6 with output DPI-1 (none by udev)
[13:35:12.946] associating input device event7 with output DPI-1 (none by udev)
[13:35:12.946] associating input device event8 with output DPI-1 (none by udev)
[13:35:12.946] associating input device event10 with output DPI-1 (none by udev)
[13:35:12.946] associating input device event0 with output DPI-1 (none by udev)
[13:35:12.946] Output 'DPI-1' enabled with head(s) DPI-1
[13:35:12.946] Compositor capabilities:
               arbitrary surface rotation: yes
               screen capture uses y-flip: yes
               presentation clock: CLOCK_MONOTONIC, id 1
               presentation clock resolution: 0.000000001 s
[13:35:12.946] Loading module '/usr/lib/weston/desktop-shell.so'
[13:35:12.947] launching '/usr/libexec/weston-keyboard'
[13:35:12.949] launching '/usr/libexec/weston-desktop-shell'


More information about the wayland-devel mailing list