summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2017-12-31 01:05:06 -0500
committerIlia Mirkin <[email protected]>2018-02-19 22:33:58 -0500
commitebdc4c31e23ffd5ce0d1fc47dd8f76c146961e25 (patch)
treefdd9dbae065b2aa46f2a7c1070287b503919cdb9 /src/gallium
parentd88a2906f86843fa11d95f7ac2f39cd0b2713d72 (diff)
mesa: add xbgr support adjacent to xrgb
Signed-off-by: Ilia Mirkin <[email protected]> Acked-by: Daniel Stone <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/dri/dri2.c36
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.c3
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.c17
3 files changed, 55 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 415002d2cd0..2a3a2a805b4 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -57,6 +57,8 @@
static const int fourcc_formats[] = {
__DRI_IMAGE_FOURCC_ARGB2101010,
__DRI_IMAGE_FOURCC_XRGB2101010,
+ __DRI_IMAGE_FOURCC_ABGR2101010,
+ __DRI_IMAGE_FOURCC_XBGR2101010,
__DRI_IMAGE_FOURCC_ARGB8888,
__DRI_IMAGE_FOURCC_ABGR8888,
__DRI_IMAGE_FOURCC_SARGB8888,
@@ -115,6 +117,14 @@ static int convert_fourcc(int format, int *dri_components_p)
format = __DRI_IMAGE_FORMAT_XRGB2101010;
dri_components = __DRI_IMAGE_COMPONENTS_RGB;
break;
+ case __DRI_IMAGE_FOURCC_ABGR2101010:
+ format = __DRI_IMAGE_FORMAT_ABGR2101010;
+ dri_components = __DRI_IMAGE_COMPONENTS_RGBA;
+ break;
+ case __DRI_IMAGE_FOURCC_XBGR2101010:
+ format = __DRI_IMAGE_FORMAT_XBGR2101010;
+ dri_components = __DRI_IMAGE_COMPONENTS_RGB;
+ break;
case __DRI_IMAGE_FOURCC_R8:
format = __DRI_IMAGE_FORMAT_R8;
dri_components = __DRI_IMAGE_COMPONENTS_R;
@@ -186,6 +196,12 @@ static int convert_to_fourcc(int format)
case __DRI_IMAGE_FORMAT_XRGB2101010:
format = __DRI_IMAGE_FOURCC_XRGB2101010;
break;
+ case __DRI_IMAGE_FORMAT_ABGR2101010:
+ format = __DRI_IMAGE_FOURCC_ABGR2101010;
+ break;
+ case __DRI_IMAGE_FORMAT_XBGR2101010:
+ format = __DRI_IMAGE_FOURCC_XBGR2101010;
+ break;
case __DRI_IMAGE_FORMAT_R8:
format = __DRI_IMAGE_FOURCC_R8;
break;
@@ -224,6 +240,12 @@ static enum pipe_format dri2_format_to_pipe_format (int format)
case __DRI_IMAGE_FORMAT_ARGB2101010:
pf = PIPE_FORMAT_B10G10R10A2_UNORM;
break;
+ case __DRI_IMAGE_FORMAT_XBGR2101010:
+ pf = PIPE_FORMAT_R10G10B10X2_UNORM;
+ break;
+ case __DRI_IMAGE_FORMAT_ABGR2101010:
+ pf = PIPE_FORMAT_R10G10B10A2_UNORM;
+ break;
case __DRI_IMAGE_FORMAT_R8:
pf = PIPE_FORMAT_R8_UNORM;
break;
@@ -288,6 +310,12 @@ static enum pipe_format fourcc_to_pipe_format(int fourcc)
case __DRI_IMAGE_FOURCC_XRGB2101010:
pf = PIPE_FORMAT_B10G10R10X2_UNORM;
break;
+ case __DRI_IMAGE_FOURCC_ABGR2101010:
+ pf = PIPE_FORMAT_R10G10B10A2_UNORM;
+ break;
+ case __DRI_IMAGE_FOURCC_XBGR2101010:
+ pf = PIPE_FORMAT_R10G10B10X2_UNORM;
+ break;
case __DRI_IMAGE_FOURCC_NV12:
pf = PIPE_FORMAT_NV12;
@@ -406,10 +434,12 @@ dri2_drawable_get_buffers(struct dri_drawable *drawable,
*/
switch(format) {
case PIPE_FORMAT_B10G10R10A2_UNORM:
+ case PIPE_FORMAT_R10G10B10A2_UNORM:
case PIPE_FORMAT_BGRA8888_UNORM:
case PIPE_FORMAT_RGBA8888_UNORM:
depth = 32;
break;
+ case PIPE_FORMAT_R10G10B10X2_UNORM:
case PIPE_FORMAT_B10G10R10X2_UNORM:
depth = 30;
break;
@@ -502,6 +532,12 @@ dri_image_drawable_get_buffers(struct dri_drawable *drawable,
case PIPE_FORMAT_B10G10R10A2_UNORM:
image_format = __DRI_IMAGE_FORMAT_ARGB2101010;
break;
+ case PIPE_FORMAT_R10G10B10X2_UNORM:
+ image_format = __DRI_IMAGE_FORMAT_XBGR2101010;
+ break;
+ case PIPE_FORMAT_R10G10B10A2_UNORM:
+ image_format = __DRI_IMAGE_FORMAT_ABGR2101010;
+ break;
default:
image_format = __DRI_IMAGE_FORMAT_NONE;
break;
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index a5999be574a..e5a7537e473 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -263,6 +263,9 @@ dri_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
case PIPE_FORMAT_B10G10R10A2_UNORM:
internal_format = PIPE_FORMAT_B10G10R10X2_UNORM;
break;
+ case PIPE_FORMAT_R10G10B10A2_UNORM:
+ internal_format = PIPE_FORMAT_R10G10B10X2_UNORM;
+ break;
case PIPE_FORMAT_BGRA8888_UNORM:
internal_format = PIPE_FORMAT_BGRX8888_UNORM;
break;
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index adce2ff36db..bd0925b9055 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -110,6 +110,8 @@ dri_fill_in_modes(struct dri_screen *screen)
static const mesa_format mesa_formats[] = {
MESA_FORMAT_B10G10R10A2_UNORM,
MESA_FORMAT_B10G10R10X2_UNORM,
+ MESA_FORMAT_R10G10B10A2_UNORM,
+ MESA_FORMAT_R10G10B10X2_UNORM,
MESA_FORMAT_B8G8R8A8_UNORM,
MESA_FORMAT_B8G8R8X8_UNORM,
MESA_FORMAT_B8G8R8A8_SRGB,
@@ -140,6 +142,8 @@ dri_fill_in_modes(struct dri_screen *screen)
static const enum pipe_format pipe_formats[] = {
PIPE_FORMAT_B10G10R10A2_UNORM,
PIPE_FORMAT_B10G10R10X2_UNORM,
+ PIPE_FORMAT_R10G10B10A2_UNORM,
+ PIPE_FORMAT_R10G10B10X2_UNORM,
PIPE_FORMAT_BGRA8888_UNORM,
PIPE_FORMAT_BGRX8888_UNORM,
PIPE_FORMAT_BGRA8888_SRGB,
@@ -238,7 +242,9 @@ dri_fill_in_modes(struct dri_screen *screen)
if (!allow_rgb10 &&
(mesa_formats[format] == MESA_FORMAT_B10G10R10A2_UNORM ||
- mesa_formats[format] == MESA_FORMAT_B10G10R10X2_UNORM))
+ mesa_formats[format] == MESA_FORMAT_B10G10R10X2_UNORM ||
+ mesa_formats[format] == MESA_FORMAT_R10G10B10A2_UNORM ||
+ mesa_formats[format] == MESA_FORMAT_R10G10B10X2_UNORM))
continue;
if (!p_screen->is_format_supported(p_screen, pipe_formats[format],
@@ -310,6 +316,15 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
}
break;
+ case 0x000003FF:
+ if (mode->alphaMask) {
+ assert(mode->alphaMask == 0xC0000000);
+ stvis->color_format = PIPE_FORMAT_R10G10B10A2_UNORM;
+ } else {
+ stvis->color_format = PIPE_FORMAT_R10G10B10X2_UNORM;
+ }
+ break;
+
case 0x00FF0000:
if (mode->alphaMask) {
assert(mode->alphaMask == 0xFF000000);