[Mesa-dev] [PATCH 2/2] i965: Support Android RGBX8888 format for EGL generated images
Chad Versace
chad.versace at linux.intel.com
Tue Apr 24 16:09:37 PDT 2012
On 04/24/2012 07:49 AM, Sean V Kelley wrote:
> Enabled MESA_FORMAT_RGBX8888_REV for RGBX. Android software
> requires RGBX8888 format to be supported for software rendering.
> That requires EGL to be capable of generating images from this
> format.
>
> Signed-off-by: Sean V Kelley <sean.v.kelley at linux.intel.com>
> ---
> src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 2 ++
> src/mesa/drivers/dri/intel/intel_screen.c | 10 ++++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index 69af0ee..8983195 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -291,6 +291,8 @@ brw_format_for_mesa_format(gl_format mesa_format)
> [MESA_FORMAT_RGBA8888_REV] = BRW_SURFACEFORMAT_R8G8B8A8_UNORM,
> [MESA_FORMAT_ARGB8888] = BRW_SURFACEFORMAT_B8G8R8A8_UNORM,
> [MESA_FORMAT_ARGB8888_REV] = 0,
> + [MESA_FORMAT_RGBX8888] = 0,
> + [MESA_FORMAT_RGBX8888_REV] = BRW_SURFACEFORMAT_R8G8B8X8_UNORM,
> [MESA_FORMAT_XRGB8888] = BRW_SURFACEFORMAT_B8G8R8X8_UNORM,
> [MESA_FORMAT_XRGB8888_REV] = 0,
> [MESA_FORMAT_RGB888] = 0,
> diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
> index e823792..7edf5c1 100644
> --- a/src/mesa/drivers/dri/intel/intel_screen.c
> +++ b/src/mesa/drivers/dri/intel/intel_screen.c
> @@ -209,6 +209,11 @@ intel_create_image_from_name(__DRIscreen *screen,
> image->internal_format = GL_RGBA;
> image->data_type = GL_UNSIGNED_BYTE;
> break;
> + case __DRI_IMAGE_FORMAT_XBGR8888:
> + image->format = MESA_FORMAT_RGBX8888_REV;
> + image->internal_format = GL_RGB;
> + image->data_type = GL_UNSIGNED_BYTE;
> + break;
> default:
> free(image);
> return NULL;
> @@ -310,6 +315,11 @@ intel_create_image(__DRIscreen *screen,
> image->internal_format = GL_RGBA;
> image->data_type = GL_UNSIGNED_BYTE;
> break;
> + case __DRI_IMAGE_FORMAT_XBGR8888:
> + image->format = MESA_FORMAT_RGBX8888_REV;
> + image->internal_format = GL_RGB;
> + image->data_type = GL_UNSIGNED_BYTE;
> + break;
> default:
> free(image);
> return NULL;
This looks good to me, but I want to see a comment from Ken or Eric
before committing because they are more familiar with the format code.
Reviewed-by: Chad Versace <chad.versace at linux.intel.com>
I wish we had a test for this new format, but I don't see a way to easily
write one. One possiblity is that we write a test using EGL_PLATFORM=drm;
add a new gbm format, GBM_FORMAT_XBGR888; allocate a buffer with the
new format and pass it to the driver with GLEGLImageTargetRenderbufferStorageOES.
(I don't know much about GBM, so I'm climbing out on a limb here).
Ken or Eric, any ideas?
----
Chad Versace
chad.versace at linux.intel.com
More information about the mesa-dev
mailing list