[Mesa-dev] [PATCH v2] st/dri: add 32-bit RGBX/RGBA formats
Rob Herring
robh at kernel.org
Tue Jul 25 13:49:27 UTC 2017
On Mon, Jul 24, 2017 at 9:46 PM, Chih-Wei Huang <cwhuang at android-x86.org> wrote:
> On Tue 11 Jul 2017, Rob Herring wrote:
>>> From: Marek Olšák <marek.olsak at amd.com>
>>>
>>> Add support for 32-bit RGBX/RGBA formats which are required for Android.
>>>
>>> The original patch (commit ccdcf91104a5) was reverted (commit
>>> c0c6ca40a25e) in mesa as it broke GLX resulting in swapped colors. Based
>>> on further investigation by Chad Versace, moving the RGBX/RGBA configs
>>> to the end is enough to prevent breaking GLX.
>>>
>>> The handling of RGBA/RGBX in dri_fill_st_visual is a fix from Marek
>>> Olšák.
>>>
>>> Cc: Eric Anholt <eric at anholt.net>
>>> Cc: Chad Versace <chadversary at chromium.org>
>>> Cc: Mauro Rossi <issor.oruam at gmail.com>
>>> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
>>> Signed-off-by: Rob Herring <robh at kernel.org>
>>> ---
>>> v2:
>>> - Incorporated dri_fill_st_visual RGBA/X handling from Marek
>>> - Handle RGBA/X in dri2_drawable_get_buffers for completeness
>
> Hi Rob,
> I'm testing this patch with your gbm_gralloc and mesa 17.1.5.
> Before applying this patch, the SurfaceFlinger sees
> the alpha=8 in RenderEngine::chooseEglConfig()
>
> 07-25 02:19:13.188 1125 1125 I SurfaceFlinger: EGL information: format=0x1
> 07-25 02:19:13.188 1125 1125 I SurfaceFlinger: vendor : Android
> 07-25 02:19:13.188 1125 1125 I SurfaceFlinger: version : 1.4
> Android META-EGL
> 07-25 02:19:13.188 1125 1125 I SurfaceFlinger: extensions:
> EGL_KHR_get_all_proc_addresses EGL_ANDROID_presentation_time
> EGL_KHR_swap_buffers_with_damage EGL_ANDROID_create_native_cli
> ent_buffer EGL_ANDROID_front_buffer_auto_refresh EGL_KHR_image_base
> EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image
> EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_ima
> ge EGL_KHR_reusable_sync EGL_KHR_fence_sync EGL_KHR_create_context
> EGL_KHR_config_attribs EGL_KHR_surfaceless_context
> EGL_ANDROID_image_native_buffer EGL_KHR_wait_sync EGL_ANDROID_reco
> rdable EGL_EXT_buffer_age
> 07-25 02:19:13.188 1125 1125 I SurfaceFlinger: Client API: OpenGL_ES
> 07-25 02:19:13.188 1125 1125 I SurfaceFlinger: EGLSurface: 8-8-8-8,
> config=0xa5485880
>
> ^^^^^^^^ (r-b-g-a)
> 07-25 02:19:13.211 1125 1125 I SurfaceFlinger: OpenGL ES
> informations: format=0x1
> 07-25 02:19:13.211 1125 1125 I SurfaceFlinger: vendor : Red Hat
> 07-25 02:19:13.211 1125 1125 I SurfaceFlinger: renderer : Gallium
> 0.4 on virgl
> 07-25 02:19:13.211 1125 1125 I SurfaceFlinger: version : OpenGL ES
> 3.0 Mesa 17.1.5 (git-317b5bd)
>
> After applying the patch, however, alpha becomes 0
>
> 07-25 02:34:46.522 1125 1125 I SurfaceFlinger: EGL information: format=0x1
> 07-25 02:34:46.522 1125 1125 I SurfaceFlinger: vendor : Android
> 07-25 02:34:46.522 1125 1125 I SurfaceFlinger: version : 1.4
> Android META-EGL
> 07-25 02:34:46.522 1125 1125 I SurfaceFlinger: extensions:
> EGL_KHR_get_all_proc_addresses EGL_ANDROID_presentation_time
> EGL_KHR_swap_buffers_with_damage
> EGL_ANDROID_create_native_client_buffer
> EGL_ANDROID_front_buffer_auto_refresh EGL_KHR_image_base
> EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image
> EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image
> EGL_KHR_reusable_sync EGL_KHR_fence_sync EGL_KHR_create_context
> EGL_KHR_config_attribs EGL_KHR_surfaceless_context
> EGL_ANDROID_image_native_buffer EGL_KHR_wait_sync
> EGL_ANDROID_recordable EGL_EXT_buffer_age
> 07-25 02:34:46.522 1125 1125 I SurfaceFlinger: Client API: OpenGL_ES
> 07-25 02:34:46.522 1125 1125 I SurfaceFlinger: EGLSurface: 8-8-8-0,
> config=0xabc24d80
>
> ^^^^^^^^
> 07-25 02:34:46.574 1125 1125 I SurfaceFlinger: OpenGL ES
> informations: format=0x1
> 07-25 02:34:46.574 1125 1125 I SurfaceFlinger: vendor : Red Hat
> 07-25 02:34:46.574 1125 1125 I SurfaceFlinger: renderer : Gallium
> 0.4 on virgl
> 07-25 02:34:46.574 1125 1125 I SurfaceFlinger: version : OpenGL ES
> 3.0 Mesa 17.1.5 (git-317b5bd)
>
>
> Therefore, eglCreateWindowSurface() finally chose
> HAL_PIXEL_FORMAT_RGBX_8888 instead of
> HAL_PIXEL_FORMAT_RGBA_8888.
> Is that expected?
Yes. I believe the client requested a config without alpha, so RGBX
satisfies that.
Do you observe any problems because of the change?
Rob
More information about the mesa-dev
mailing list