egl/android: remove HAL_PIXEL_FORMAT_BGRA_8888 support

Submitted by Lepton Wu on July 31, 2019, 10:49 p.m.

Details

Message ID 20190731224952.251468-1-lepton@chromium.org
State New
Headers show
Series "egl/android: remove HAL_PIXEL_FORMAT_BGRA_8888 support" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Lepton Wu July 31, 2019, 10:49 p.m.
From: Emil Velikov <emil.velikov@collabora.com>

As said in the EGL_KHR_platform_android extensions

    For each EGLConfig that belongs to the Android platform, the
    EGL_NATIVE_VISUAL_ID attribute is an Android window format, such as
    WINDOW_FORMAT_RGBA_8888.

Although it should be applicable overall.

Even though we use HAL_PIXEL_FORMAT here, those are numerically
identical to the  WINDOW_FORMAT_ and AHARDWAREBUFFER_FORMAT_ ones.

Barring the said format of course. That one is only listed in HAL.

Keep in mind that even if we try to use the said format, you'll get
caught by droid_create_surface(). The function compares the format of
the underlying window, against the NATIVE_VISUAL_ID of the config.

Unfortunatelly it only prints a warning, rather than error out, likely
leading to visual corruption.

While SDL will even call ANativeWindow_setBuffersGeometry() with the
wrong format, and conviniently ignore the [expected] failure.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Tomasz Figa <tfiga@chromium.org>
(tfiga: Remove only respective EGL config, leave EGL image as is.)
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Lepton Wu <lepton@chromium.org>
---
 src/egl/drivers/dri2/platform_android.c | 1 -
 1 file changed, 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index d37f6b8e447..6c54fc4f1fe 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -1193,7 +1193,6 @@  droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
       { HAL_PIXEL_FORMAT_RGBA_8888, { 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 } },
       { HAL_PIXEL_FORMAT_RGBX_8888, { 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000 } },
       { HAL_PIXEL_FORMAT_RGB_565,   { 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000 } },
-      { HAL_PIXEL_FORMAT_BGRA_8888, { 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 } },
    };
 
    unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };

Comments

Any concern for this CL? I think it's pretty safe to merge this since
any way android egl wrapper
doesn't like HAL_PIXEL_FORMAT_BGRA_8888 and won't return it for native
window format
and then won't set it as native window format.

https://android.googlesource.com/platform/frameworks/native/+/refs/heads/master/opengl/libs/EGL/eglApi.cpp#608

On Wed, Jul 31, 2019 at 3:50 PM Lepton Wu <lepton@chromium.org> wrote:
>
> From: Emil Velikov <emil.velikov@collabora.com>
>
> As said in the EGL_KHR_platform_android extensions
>
>     For each EGLConfig that belongs to the Android platform, the
>     EGL_NATIVE_VISUAL_ID attribute is an Android window format, such as
>     WINDOW_FORMAT_RGBA_8888.
>
> Although it should be applicable overall.
>
> Even though we use HAL_PIXEL_FORMAT here, those are numerically
> identical to the  WINDOW_FORMAT_ and AHARDWAREBUFFER_FORMAT_ ones.
>
> Barring the said format of course. That one is only listed in HAL.
>
> Keep in mind that even if we try to use the said format, you'll get
> caught by droid_create_surface(). The function compares the format of
> the underlying window, against the NATIVE_VISUAL_ID of the config.
>
> Unfortunatelly it only prints a warning, rather than error out, likely
> leading to visual corruption.
>
> While SDL will even call ANativeWindow_setBuffersGeometry() with the
> wrong format, and conviniently ignore the [expected] failure.
>
> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> Acked-by: Tomasz Figa <tfiga@chromium.org>
> (tfiga: Remove only respective EGL config, leave EGL image as is.)
> Signed-off-by: Tomasz Figa <tfiga@chromium.org>
> Signed-off-by: Lepton Wu <lepton@chromium.org>
> ---
>  src/egl/drivers/dri2/platform_android.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
> index d37f6b8e447..6c54fc4f1fe 100644
> --- a/src/egl/drivers/dri2/platform_android.c
> +++ b/src/egl/drivers/dri2/platform_android.c
> @@ -1193,7 +1193,6 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
>        { HAL_PIXEL_FORMAT_RGBA_8888, { 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 } },
>        { HAL_PIXEL_FORMAT_RGBX_8888, { 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000 } },
>        { HAL_PIXEL_FORMAT_RGB_565,   { 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000 } },
> -      { HAL_PIXEL_FORMAT_BGRA_8888, { 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 } },
>     };
>
>     unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };
> --
> 2.22.0.770.g0f2c4a37fd-goog
>
On 8/14/19 7:43 AM, Lepton Wu wrote:
> Any concern for this CL? I think it's pretty safe to merge this since
> any way android egl wrapper
> doesn't like HAL_PIXEL_FORMAT_BGRA_8888 and won't return it for native
> window format
> and then won't set it as native window format.
> 
> https://android.googlesource.com/platform/frameworks/native/+/refs/heads/master/opengl/libs/EGL/eglApi.cpp#608

No concerns, this is fine.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>


> On Wed, Jul 31, 2019 at 3:50 PM Lepton Wu <lepton@chromium.org> wrote:
>>
>> From: Emil Velikov <emil.velikov@collabora.com>
>>
>> As said in the EGL_KHR_platform_android extensions
>>
>>      For each EGLConfig that belongs to the Android platform, the
>>      EGL_NATIVE_VISUAL_ID attribute is an Android window format, such as
>>      WINDOW_FORMAT_RGBA_8888.
>>
>> Although it should be applicable overall.
>>
>> Even though we use HAL_PIXEL_FORMAT here, those are numerically
>> identical to the  WINDOW_FORMAT_ and AHARDWAREBUFFER_FORMAT_ ones.
>>
>> Barring the said format of course. That one is only listed in HAL.
>>
>> Keep in mind that even if we try to use the said format, you'll get
>> caught by droid_create_surface(). The function compares the format of
>> the underlying window, against the NATIVE_VISUAL_ID of the config.
>>
>> Unfortunatelly it only prints a warning, rather than error out, likely
>> leading to visual corruption.
>>
>> While SDL will even call ANativeWindow_setBuffersGeometry() with the
>> wrong format, and conviniently ignore the [expected] failure.
>>
>> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
>> Acked-by: Tomasz Figa <tfiga@chromium.org>
>> (tfiga: Remove only respective EGL config, leave EGL image as is.)
>> Signed-off-by: Tomasz Figa <tfiga@chromium.org>
>> Signed-off-by: Lepton Wu <lepton@chromium.org>
>> ---
>>   src/egl/drivers/dri2/platform_android.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
>> index d37f6b8e447..6c54fc4f1fe 100644
>> --- a/src/egl/drivers/dri2/platform_android.c
>> +++ b/src/egl/drivers/dri2/platform_android.c
>> @@ -1193,7 +1193,6 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
>>         { HAL_PIXEL_FORMAT_RGBA_8888, { 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 } },
>>         { HAL_PIXEL_FORMAT_RGBX_8888, { 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000 } },
>>         { HAL_PIXEL_FORMAT_RGB_565,   { 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000 } },
>> -      { HAL_PIXEL_FORMAT_BGRA_8888, { 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 } },
>>      };
>>
>>      unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };
>> --
>> 2.22.0.770.g0f2c4a37fd-goog
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>