[Mesa-dev] [PATCH v2 1/5] egl: Add EGL_FRAMEBUFFER_TARGET_ANDROID attribute

Emil Velikov emil.l.velikov at gmail.com
Fri Apr 1 12:27:33 UTC 2016


On 22 February 2016 at 15:24, Rob Herring <robh at kernel.org> wrote:
> On Thu, Feb 18, 2016 at 11:11 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> Hi Rob,
>>
>> On 2 February 2016 at 20:23, Rob Herring <robh at kernel.org> wrote:
>>> This is used by Android to select an eglconfig compatible with HWComposer.
>>>
>>> Signed-off-by: Rob Herring <robh at kernel.org>
>>> ---
>>> v2:
>>> - Also add reporting the extension string
>>>
>>>  src/egl/main/eglapi.c     | 1 +
>>>  src/egl/main/eglconfig.c  | 5 ++++-
>>>  src/egl/main/eglconfig.h  | 2 ++
>>>  src/egl/main/egldisplay.h | 1 +
>>>  4 files changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
>>> index 323634e..4619855 100644
>>> --- a/src/egl/main/eglapi.c
>>> +++ b/src/egl/main/eglapi.c
>>> @@ -381,6 +381,7 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
>>>     char *exts = dpy->ExtensionsString;
>>>
>>>     /* Please keep these sorted alphabetically. */
>>> +   _EGL_CHECK_EXTENSION(ANDROID_framebuffer_target);
>> Based off a quick look at the spec, it seems that we're sort of lucky
>> that things work as is ?
>> I'm wondering about a brief comment would be best suited to describe
>> the current situation.
>>
>> If you can think of something let me know and I'll amend and push the
>> lot (same goes for ANDROID_recordable and 5/5 which enables both).
>
> The SurfaceFlinger EGLconfig selection will use either these
> extensions or fallback to requesting a specific visual id. The
> fallback only works if Android is patched to use BGRA instead of RGBA
> for target framebuffers as RGBA is not supported in gallium drivers (I
> have some patches to add that). Android-x86 works as it is carrying a
> SurfaceFlinger patch to use BGRA.
>
It wasn't a question of how one can end up using RGBA vs BGRA vs
others. But about the following hunk from the extension

   " ... One implementation, which is used to
    send the result of performing window composition to a display, may have
    some device-specific restrictions ..."

The fact that we, currently, do not list such restricted/custom
EGLConfig(s) feels a bit surprising. Hopefully that won't come to bite
us soon(ish).

Just realised that we want/need a hunk like below, otherwise we'll
accept with attribute even when the extension is not enabled. I'll
squash it before pushing.

diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index d79c0e1..dfc26cb 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -486,6 +486,8 @@ _eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr)
       return EGL_FALSE;

    switch (attr) {
+   case EGL_FRAMEBUFFER_TARGET_ANDROID:
+      return conf->Display->Extensions.ANDROID_framebuffer_target;
    case EGL_Y_INVERTED_NOK:
       return conf->Display->Extensions.NOK_texture_from_pixmap;
    default:


-Emil


More information about the mesa-dev mailing list