[Mesa-stable] [PATCH] egl/android: Change order of EGLConfig generation (v2)
Rob Herring
robh at kernel.org
Thu Jun 22 16:56:53 UTC 2017
On Tue, Jun 20, 2017 at 5:03 PM, Chad Versace <chadversary at chromium.org> wrote:
> Many Android apps (such as Google's official NDK GLES2 example app), and
> even portions the core framework code (such as SystemServiceManager in
> Nougat), incorrectly choose their EGLConfig. They neglect to match the
> EGLConfig's EGL_NATIVE_VISUAL_ID against the window's native format, and
> instead choose the first EGLConfig whose channel sizes match those of
> the native window format while ignoring the channel *ordering*.
>
> We can detect such buggy clients in logcat when they call
> eglCreateSurface, by detecting the mismatch between the EGLConfig's
> format and the window's format.
>
> As a workaround, this patch changes the order of EGLConfig generation
> such that all EGLConfigs for HAL pixel format i precede those for HAL
> pixel format i+1. In my (chadversary) testing on Android Nougat, this
> was good enough to pacify the buggy clients.
>
> v2: Rebase to make patch cherry-pickable to stable.
>
> Cc: mesa-stable at lists.freedesktop.org
> Cc: Tomasz Figa <tfiga at chromium.org>
> Cc: Rob Herring <robh at kernel.org>
> Cc: Tapani Pälli <tapani.palli at intel.com>
> Cc: Emil Velikov <emil.velikov at collabora.com>
Tested-by: Rob Herring <robh at kernel.org>
One question though...
>
> ---
> src/egl/drivers/dri2/platform_android.c | 32 +++++++++++++++++++++++++-------
> 1 file changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
> index 5550f580a80..eaaeff4641c 100644
> --- a/src/egl/drivers/dri2/platform_android.c
> +++ b/src/egl/drivers/dri2/platform_android.c
> @@ -1049,20 +1049,38 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
> unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };
> int count, i, j;
>
> + /* The nesting of loops is significant here. Also significant is the order
> + * of the HAL pixel formats. Many Android apps (such as Google's official
> + * NDK GLES2 example app), and even portions the core framework code (such
> + * as SystemServiceManager in Nougat), incorrectly choose their EGLConfig.
> + * They neglect to match the EGLConfig's EGL_NATIVE_VISUAL_ID against the
> + * window's native format, and instead choose the first EGLConfig whose
> + * channel sizes match those of the native window format while ignoring the
> + * channel *ordering*.
> + *
> + * We can detect such buggy clients in logcat when they call
> + * eglCreateSurface, by detecting the mismatch between the EGLConfig's
> + * format and the window's format.
How do we find the buggy clients with this patch applied other than reverting?
Rob
More information about the mesa-stable
mailing list