[Mesa-dev] [PATCH] egl/android: Partially handle HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED

Rob Herring robh at kernel.org
Mon Nov 27 19:42:31 UTC 2017


On Mon, Nov 27, 2017 at 8:14 AM, Robert Foss <robert.foss at collabora.com> wrote:
> From: Tomasz Figa <tfiga at chromium.org>
>
> There is no API available to properly query the IMPLEMENTATION_DEFINED
> format. As a workaround we rely here on gralloc allocating either
> an arbitrary YCbCr 4:2:0 or RGBX_8888, with the latter being recognized
> by lock_ycbcr failing.
>
> Reviewed-on: https://chromium-review.googlesource.com/566793
>
> Signed-off-by: Tomasz Figa <tfiga at chromium.org>
> Reviewed-by: Chad Versace <chadversary at chromium.org>
> Signed-off-by: Robert Foss <robert.foss at collabora.com>
> ---
>  src/egl/drivers/dri2/platform_android.c | 39 +++++++++++++++++++++++++++++++--
>  1 file changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
> index 63223e9a69..ae914d79c1 100644
> --- a/src/egl/drivers/dri2/platform_android.c
> +++ b/src/egl/drivers/dri2/platform_android.c
> @@ -59,6 +59,10 @@ static const struct droid_yuv_format droid_yuv_formats[] = {
>     { HAL_PIXEL_FORMAT_YCbCr_420_888,   0, 1, __DRI_IMAGE_FOURCC_YUV420 },
>     { HAL_PIXEL_FORMAT_YCbCr_420_888,   1, 1, __DRI_IMAGE_FOURCC_YVU420 },
>     { HAL_PIXEL_FORMAT_YV12,            1, 1, __DRI_IMAGE_FOURCC_YVU420 },
> +   /* HACK: See droid_create_image_from_prime_fd() and b/32077885. */
> +   { HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,   0, 2, __DRI_IMAGE_FOURCC_NV12 },
> +   { HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,   0, 1, __DRI_IMAGE_FOURCC_YUV420 },
> +   { HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,   1, 1, __DRI_IMAGE_FOURCC_YVU420 },
>  };
>
>  static int
> @@ -90,6 +94,11 @@ get_format_bpp(int native)
>
>     switch (native) {
>     case HAL_PIXEL_FORMAT_RGBA_8888:
> +   case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
> +      /*
> +       * HACK: Hardcode this to RGBX_8888 as per cros_gralloc hack.

Does this work with other grallocs?

> +       * TODO: Remove this once b/32077885 is fixed.

Is that a public bug? A full url would be better if so.

Rob


More information about the mesa-dev mailing list