summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/GL/internal/dri_interface.h2
-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
-rw-r--r--src/loader/loader_dri3_helper.c4
-rw-r--r--src/mesa/drivers/dri/common/utils.c10
-rw-r--r--src/mesa/main/framebuffer.c4
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c2
8 files changed, 76 insertions, 2 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index a0c11f184c8..4f4795c7ae3 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1251,6 +1251,8 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_FORMAT_R16 0x100d
#define __DRI_IMAGE_FORMAT_GR1616 0x100e
#define __DRI_IMAGE_FORMAT_YUYV 0x100f
+#define __DRI_IMAGE_FORMAT_XBGR2101010 0x1010
+#define __DRI_IMAGE_FORMAT_ABGR2101010 0x1011
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
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);
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index 2912bb6749b..0cd0dffa69e 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -993,6 +993,8 @@ dri3_cpp_for_format(uint32_t format) {
case __DRI_IMAGE_FORMAT_XBGR8888:
case __DRI_IMAGE_FORMAT_XRGB2101010:
case __DRI_IMAGE_FORMAT_ARGB2101010:
+ case __DRI_IMAGE_FORMAT_XBGR2101010:
+ case __DRI_IMAGE_FORMAT_ABGR2101010:
case __DRI_IMAGE_FORMAT_SARGB8:
return 4;
case __DRI_IMAGE_FORMAT_NONE:
@@ -1020,6 +1022,8 @@ image_format_to_fourcc(int format)
case __DRI_IMAGE_FORMAT_XBGR8888: return __DRI_IMAGE_FOURCC_XBGR8888;
case __DRI_IMAGE_FORMAT_XRGB2101010: return __DRI_IMAGE_FOURCC_XRGB2101010;
case __DRI_IMAGE_FORMAT_ARGB2101010: return __DRI_IMAGE_FOURCC_ARGB2101010;
+ case __DRI_IMAGE_FORMAT_XBGR2101010: return __DRI_IMAGE_FOURCC_XBGR2101010;
+ case __DRI_IMAGE_FORMAT_ABGR2101010: return __DRI_IMAGE_FOURCC_ABGR2101010;
}
return 0;
}
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index e944754a424..1cffd3ad08e 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -177,6 +177,10 @@ driCreateConfigs(mesa_format format,
{ 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 },
/* MESA_FORMAT_R8G8B8X8_UNORM */
{ 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 },
+ /* MESA_FORMAT_R10G10B10X2_UNORM */
+ { 0x000003FF, 0x000FFC00, 0x3FF00000, 0x00000000 },
+ /* MESA_FORMAT_R10G10B10A2_UNORM */
+ { 0x000003FF, 0x000FFC00, 0x3FF00000, 0xC0000000 },
};
const uint32_t * masks;
@@ -215,6 +219,12 @@ driCreateConfigs(mesa_format format,
case MESA_FORMAT_B10G10R10A2_UNORM:
masks = masks_table[4];
break;
+ case MESA_FORMAT_R10G10B10X2_UNORM:
+ masks = masks_table[7];
+ break;
+ case MESA_FORMAT_R10G10B10A2_UNORM:
+ masks = masks_table[8];
+ break;
default:
fprintf(stderr, "[%s:%u] Unknown framebuffer type %s (%d).\n",
__func__, __LINE__,
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index e103f313e45..249e775f8cb 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -890,7 +890,9 @@ _mesa_get_color_read_type(struct gl_context *ctx,
return GL_UNSIGNED_SHORT_5_6_5;
if (format == MESA_FORMAT_B10G10R10A2_UNORM ||
- format == MESA_FORMAT_B10G10R10X2_UNORM)
+ format == MESA_FORMAT_B10G10R10X2_UNORM ||
+ format == MESA_FORMAT_R10G10B10A2_UNORM ||
+ format == MESA_FORMAT_R10G10B10X2_UNORM)
return GL_UNSIGNED_INT_2_10_10_10_REV;
switch (data_type) {
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 0800f5b3d29..02ae8e1380e 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -288,8 +288,10 @@ st_new_renderbuffer_fb(enum pipe_format format, unsigned samples, boolean sw)
switch (format) {
case PIPE_FORMAT_B10G10R10A2_UNORM:
+ case PIPE_FORMAT_R10G10B10A2_UNORM:
strb->Base.InternalFormat = GL_RGB10_A2;
break;
+ case PIPE_FORMAT_R10G10B10X2_UNORM:
case PIPE_FORMAT_B10G10R10X2_UNORM:
strb->Base.InternalFormat = GL_RGB10;
break;