OSDN Git Service

egl/android: Change order of EGLConfig generation (v2)
authorChad Versace <chadversary@chromium.org>
Sat, 17 Jun 2017 02:11:21 +0000 (19:11 -0700)
committerAndres Gomez <agomez@igalia.com>
Wed, 28 Jun 2017 17:15:04 +0000 (20:15 +0300)
commit83c15002fbc9bf3938411c65fec87d16d24e1501
treea3e6627219cd61cf3bd4b80037fd54c8e1ec6649
parenta49cad48966f48be26ad0e8596922bda3e365711
egl/android: Change order of EGLConfig generation (v2)

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@lists.freedesktop.org
Cc: Tomasz Figa <tfiga@chromium.org>
Cc: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 5e884353e647261ac815c85724fc108e86dd1d85)
src/egl/drivers/dri2/platform_android.c