dri3, i915, i965: Add __DRI_IMAGE_FOURCC_SARGB8888
authorKeith Packard <keithp@keithp.com>
Fri, 22 Nov 2013 04:08:35 +0000 (20:08 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 31 Jan 2014 01:29:23 +0000 (17:29 -0800)
The __DRIimage createImageFromFds function takes a fourcc code, but there was
no fourcc code that match __DRI_IMAGE_FORMAT_SARGB8. This adds a define for
that format, adds a translation in DRI3 from __DRI_IMAGE_FORMAT_SARGB8 to
__DRI_IMAGE_FOURCC_SARGB8888 and then adds translations *back* to
__IMAGE_FORMAT_SARGB8 in both the i915 and i965 drivers.

I'll refrain from comments on whether I think having two separate sets of
format defines in dri_interface.h is a good idea or not...

Fixes piglit glx-tfp and glx-visuals-depth

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
include/GL/internal/dri_interface.h
src/glx/dri3_glx.c
src/mesa/drivers/dri/i915/intel_screen.c
src/mesa/drivers/dri/i965/intel_screen.c

index 81f7e60e55fbd5246bb661e37089e0fdcc777d80..9e829045e61505f56b208278e0d5c677aa401862 100644 (file)
@@ -1041,6 +1041,7 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_FOURCC_XRGB8888    0x34325258
 #define __DRI_IMAGE_FOURCC_ABGR8888    0x34324241
 #define __DRI_IMAGE_FOURCC_XBGR8888    0x34324258
+#define __DRI_IMAGE_FOURCC_SARGB8888    0x83324258
 #define __DRI_IMAGE_FOURCC_YUV410      0x39565559
 #define __DRI_IMAGE_FOURCC_YUV411      0x31315559
 #define __DRI_IMAGE_FOURCC_YUV420      0x32315559
index c91f5000db5bbf27c737e63bd7749234681d3631..94f0eca8588f9fe50b9358a2d8f3ae30c4bbe96a 100644 (file)
@@ -937,6 +937,7 @@ image_format_to_fourcc(int format)
 
    /* Convert from __DRI_IMAGE_FORMAT to __DRI_IMAGE_FOURCC (sigh) */
    switch (format) {
+   case __DRI_IMAGE_FORMAT_SARGB8: return __DRI_IMAGE_FOURCC_SARGB8888;
    case __DRI_IMAGE_FORMAT_RGB565: return __DRI_IMAGE_FOURCC_RGB565;
    case __DRI_IMAGE_FORMAT_XRGB8888: return __DRI_IMAGE_FOURCC_XRGB8888;
    case __DRI_IMAGE_FORMAT_ARGB8888: return __DRI_IMAGE_FOURCC_ARGB8888;
index f3c0fa32320069f806fc98af9e99e038d3c1f49a..b34c81561582e1eb8906b781211317eaa80dda2c 100644 (file)
@@ -184,6 +184,9 @@ static struct intel_image_format intel_image_formats[] = {
    { __DRI_IMAGE_FOURCC_ARGB8888, __DRI_IMAGE_COMPONENTS_RGBA, 1,
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 } } },
 
+   { __DRI_IMAGE_FOURCC_SARGB8888, __DRI_IMAGE_COMPONENTS_RGBA, 1,
+     { { 0, 0, 0, __DRI_IMAGE_FORMAT_SARGB8, 4 } } },
+
    { __DRI_IMAGE_FOURCC_XRGB8888, __DRI_IMAGE_COMPONENTS_RGB, 1,
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB8888, 4 }, } },
 
index 7700a4ef0cfc48cd481e6842ff9e4ea1bc9ba0fc..b2bd47cbb4c77117bf66b6ac03b32b7880b56e2a 100644 (file)
@@ -220,6 +220,9 @@ static struct intel_image_format intel_image_formats[] = {
    { __DRI_IMAGE_FOURCC_ARGB8888, __DRI_IMAGE_COMPONENTS_RGBA, 1,
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 } } },
 
+   { __DRI_IMAGE_FOURCC_SARGB8888, __DRI_IMAGE_COMPONENTS_RGBA, 1,
+     { { 0, 0, 0, __DRI_IMAGE_FORMAT_SARGB8, 4 } } },
+
    { __DRI_IMAGE_FOURCC_XRGB8888, __DRI_IMAGE_COMPONENTS_RGB, 1,
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB8888, 4 }, } },