[Mesa-dev] [PATCH 2/3] st/dri: add 32-bit RGBX/RGBA formats
Rob Herring
robh at kernel.org
Tue Apr 19 19:38:40 UTC 2016
Add support for 32-bit RGBX/RGBA formats which are preferred for Android.
Signed-off-by: Rob Herring <robh at kernel.org>
---
src/gallium/state_trackers/dri/dri2.c | 9 +++++++++
src/gallium/state_trackers/dri/dri_screen.c | 4 ++++
2 files changed, 13 insertions(+)
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index fb0a180..17e15db 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -267,6 +267,9 @@ dri_image_drawable_get_buffers(struct dri_drawable *drawable,
case PIPE_FORMAT_BGRA8888_UNORM:
image_format = __DRI_IMAGE_FORMAT_ARGB8888;
break;
+ case PIPE_FORMAT_RGBX8888_UNORM:
+ image_format = __DRI_IMAGE_FORMAT_XBGR8888;
+ break;
case PIPE_FORMAT_RGBA8888_UNORM:
image_format = __DRI_IMAGE_FORMAT_ABGR8888;
break;
@@ -732,6 +735,9 @@ dri2_create_image_from_winsys(__DRIscreen *_screen,
case __DRI_IMAGE_FORMAT_ARGB8888:
pf = PIPE_FORMAT_BGRA8888_UNORM;
break;
+ case __DRI_IMAGE_FORMAT_XBGR8888:
+ pf = PIPE_FORMAT_RGBX8888_UNORM;
+ break;
case __DRI_IMAGE_FORMAT_ABGR8888:
pf = PIPE_FORMAT_RGBA8888_UNORM;
break;
@@ -855,6 +861,9 @@ dri2_create_image(__DRIscreen *_screen,
case __DRI_IMAGE_FORMAT_ARGB8888:
pf = PIPE_FORMAT_BGRA8888_UNORM;
break;
+ case __DRI_IMAGE_FORMAT_XBGR8888:
+ pf = PIPE_FORMAT_RGBX8888_UNORM;
+ break;
case __DRI_IMAGE_FORMAT_ABGR8888:
pf = PIPE_FORMAT_RGBA8888_UNORM;
break;
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 2ac55c8..2856ec0 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -104,6 +104,8 @@ static const __DRIconfig **
dri_fill_in_modes(struct dri_screen *screen)
{
static const mesa_format mesa_formats[] = {
+ MESA_FORMAT_R8G8B8A8_UNORM,
+ MESA_FORMAT_R8G8B8X8_UNORM,
MESA_FORMAT_B8G8R8A8_UNORM,
MESA_FORMAT_B8G8R8X8_UNORM,
MESA_FORMAT_B8G8R8A8_SRGB,
@@ -111,6 +113,8 @@ dri_fill_in_modes(struct dri_screen *screen)
MESA_FORMAT_B5G6R5_UNORM,
};
static const enum pipe_format pipe_formats[] = {
+ PIPE_FORMAT_RGBA8888_UNORM,
+ PIPE_FORMAT_RGBX8888_UNORM,
PIPE_FORMAT_BGRA8888_UNORM,
PIPE_FORMAT_BGRX8888_UNORM,
PIPE_FORMAT_BGRA8888_SRGB,
--
2.7.4
More information about the mesa-dev
mailing list