dri: Add __DRI_IMAGE_FORMAT_SABGR8
authorTapani Pälli <tapani.palli@intel.com>
Mon, 19 Mar 2018 11:41:44 +0000 (13:41 +0200)
committerTapani Pälli <tapani.palli@intel.com>
Tue, 24 Apr 2018 11:55:18 +0000 (14:55 +0300)
Add format definition and required plumbing to create images.
Note that there is no match to drm_fourcc definition, just like
with existing _DRI_IMAGE_FOURCC_SARGB8888.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
include/GL/internal/dri_interface.h
src/loader/loader_dri3_helper.c
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/utils.c

index 4f4795c7ae3017ae1c7107f3c51b6b016a5b1707..319a1fe4f90ce7d8605ca40c38a6eaac49891a3e 100644 (file)
@@ -1253,6 +1253,7 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_FORMAT_YUYV         0x100f
 #define __DRI_IMAGE_FORMAT_XBGR2101010  0x1010
 #define __DRI_IMAGE_FORMAT_ABGR2101010  0x1011
+#define __DRI_IMAGE_FORMAT_SABGR8       0x1012
 
 #define __DRI_IMAGE_USE_SHARE          0x0001
 #define __DRI_IMAGE_USE_SCANOUT                0x0002
@@ -1289,6 +1290,7 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_FOURCC_ABGR8888    0x34324241
 #define __DRI_IMAGE_FOURCC_XBGR8888    0x34324258
 #define __DRI_IMAGE_FOURCC_SARGB8888   0x83324258
+#define __DRI_IMAGE_FOURCC_SABGR8888   0x84324258
 #define __DRI_IMAGE_FOURCC_ARGB2101010 0x30335241
 #define __DRI_IMAGE_FOURCC_XRGB2101010 0x30335258
 #define __DRI_IMAGE_FOURCC_ABGR2101010 0x30334241
index fe17df14738369d464e2b08ac2113d7aa79928e8..23729f7ecb247bffcd7ed6ab5ae0281d619d4c38 100644 (file)
@@ -1022,6 +1022,7 @@ dri3_cpp_for_format(uint32_t format) {
    case  __DRI_IMAGE_FORMAT_XBGR2101010:
    case  __DRI_IMAGE_FORMAT_ABGR2101010:
    case  __DRI_IMAGE_FORMAT_SARGB8:
+   case  __DRI_IMAGE_FORMAT_SABGR8:
       return 4;
    case  __DRI_IMAGE_FORMAT_NONE:
    default:
@@ -1041,6 +1042,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_SABGR8: return __DRI_IMAGE_FOURCC_SABGR8888;
    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 0b94d19fa5d43521b1e0dcdd450ba03a8d7be283..7cb6248b1306696108c6337804e645c64f5f7d30 100644 (file)
@@ -900,6 +900,8 @@ driGLFormatToImageFormat(mesa_format format)
       return __DRI_IMAGE_FORMAT_GR88;
    case MESA_FORMAT_NONE:
       return __DRI_IMAGE_FORMAT_NONE;
+   case MESA_FORMAT_R8G8B8A8_SRGB:
+      return __DRI_IMAGE_FORMAT_SABGR8;
    case MESA_FORMAT_B8G8R8A8_SRGB:
       return __DRI_IMAGE_FORMAT_SARGB8;
    default:
@@ -937,6 +939,8 @@ driImageFormatToGLFormat(uint32_t image_format)
       return MESA_FORMAT_R16G16_UNORM;
    case __DRI_IMAGE_FORMAT_SARGB8:
       return MESA_FORMAT_B8G8R8A8_SRGB;
+   case __DRI_IMAGE_FORMAT_SABGR8:
+      return MESA_FORMAT_R8G8B8A8_SRGB;
    case __DRI_IMAGE_FORMAT_NONE:
       return MESA_FORMAT_NONE;
    default:
index 1cffd3ad08eeafab0080ea739fa16039281eab45..fc5e2d19f343d515b6b7746b7e2c43572df87251 100644 (file)
@@ -208,6 +208,7 @@ driCreateConfigs(mesa_format format,
       masks = masks_table[2];
       break;
    case MESA_FORMAT_R8G8B8A8_UNORM:
+   case MESA_FORMAT_R8G8B8A8_SRGB:
       masks = masks_table[5];
       break;
    case MESA_FORMAT_R8G8B8X8_UNORM: