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

Eric Anholt eric at anholt.net
Fri Jul 15 18:27:08 UTC 2016


Tomasz Figa <tfiga at chromium.org> writes:

> 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>
> ---
>  src/egl/drivers/dri2/egl_dri2.h         |  1 +
>  src/egl/drivers/dri2/platform_android.c | 61 +++++++++++++++++++++++++++------
>  2 files changed, 51 insertions(+), 11 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
> index 317de06..3ffc177 100644
> --- a/src/egl/drivers/dri2/egl_dri2.h
> +++ b/src/egl/drivers/dri2/egl_dri2.h
> @@ -287,6 +287,7 @@ struct dri2_egl_surface
>     struct ANativeWindow *window;
>     struct ANativeWindowBuffer *buffer;
>     __DRIimage *dri_image;
> +   __DRIimage *dri_front_image;
>  
>     /* EGL-owned buffers */
>     __DRIbuffer           *local_buffers[__DRI_BUFFER_COUNT];
> diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
> index 7495445..0f707dd 100644
> --- a/src/egl/drivers/dri2/platform_android.c
> +++ b/src/egl/drivers/dri2/platform_android.c
> @@ -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;
> +      }

Style nitpick, I'd either drop the "else" or use some braces and put the
comments within the inner blocks.  Having the "else if" separated from
the "if" by the comment looked weird.  Up to you, though.

The actual contents of the patch are:

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160715/fb7f5937/attachment.sig>


More information about the mesa-dev mailing list