[Mesa-dev] [PATCH 06/10] egl/android: Fix support for pbuffers

Rob Herring robh at kernel.org
Thu Jul 21 16:26:53 UTC 2016


On Thu, Jul 21, 2016 at 12:35 AM, Tomasz Figa <tfiga at chromium.org> wrote:
> On Thu, Jul 21, 2016 at 6:19 AM, Rob Herring <robh at kernel.org> wrote:
>> On Fri, Jul 15, 2016 at 2:53 AM, Tomasz Figa <tfiga at chromium.org> wrote:
>>> From: Nicolas Boichat <drinkcat at chromium.org>
>>>
>>> Existing image loader code supports creating images only for window
>>> surfaces. Moreover droid_create_surface() passes wrong surface type to
>>> dri2_get_dri_config(), resulting in incorrect configs being returned for
>>> pbuffers. This patch fixes these issues.
>>>
>>> In addition, the config generation code is fixed to include single
>>> buffered contexts required for pbuffers and make sure that generated
>>> configs support only surfaces which can handle their supported buffering
>>> modes.
>>>
>>> Signed-off-by: Nicolas Boichat <drinkcat at chromium.org>
>>> Signed-off-by: Tomasz Figa <tfiga at chromium.org>
>>> ---

[...]

>>> @@ -728,6 +754,19 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
>>>        /* there is no front buffer so no OpenGL */
>>>        dri2_conf->base.RenderableType &= ~EGL_OPENGL_BIT;
>>>        dri2_conf->base.Conformant &= ~EGL_OPENGL_BIT;
>>> +
>>> +      for (j = 0; j < 2; j++) {
>>> +         /* Unsupported color space variants should not affect surface type. */
>>> +         if (!dri2_conf->dri_single_config[j] && !dri2_conf->dri_double_config[j])
>>> +            continue;
>>> +
>>> +         /* Pbuffers support only single buffering. */
>>> +         if (!dri2_conf->dri_single_config[j])
>>> +            dri2_conf->base.SurfaceType &= ~EGL_PBUFFER_BIT;
>>> +         /* Windows support only double buffering. */
>>> +         else if (!dri2_conf->dri_double_config[j])
>>> +            dri2_conf->base.SurfaceType &= ~EGL_WINDOW_BIT;
>>> +      }
>>
>> I still don't know why this patch causes problems, but I don't think
>> this hunk is needed. The core DRI2 EGL code takes care of this. It's
>> not so obvious though. EGL_PBUFFER_BIT is cleared in dri2_add_config,
>> and dri2_get_dri_config returns single or double config based on the
>> surface type.
>
> Well, it just doesn't work correctly without this.
>
> If DRI driver exposes certain double buffered configs that don't have
> their equivalent single buffered configs then it will leave double
> buffered configs with EGL_PBUFFER_BIT set and dri2_get_dri_config()
> will return NULL at the time of eglCreateSurface(), which doesn't
> conform to the spec and will cause failures, because it is expected
> that if eglChooseConfig() is given EGL_PBUFFER_BIT then resulting
> config must support pbuffers. Similarly for EGL_WINDOW_BIT and
> single-buffered configs without double-buffered equivalents.
>
> Also I don't see where dri2_add_config() clears EGL_PBUFFER_BIT. I can
> see only EGL_PIXMAP_BIT.

Oh yes, you are correct. Sorry for the noise.

Rob


More information about the mesa-dev mailing list