st/dri2: Add format translations for BGR[A/X]1010102 formats.
authorMario Kleiner <mario.kleiner.de@gmail.com>
Fri, 15 Dec 2017 22:05:04 +0000 (23:05 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 3 Jan 2018 21:57:57 +0000 (22:57 +0100)
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/state_trackers/dri/dri2.c

index 3388b17da53838c92dc78ebd16111d35a98fa20f..c0f0921337bab1cc4527335786bac7c88949709f 100644 (file)
@@ -55,6 +55,8 @@
 #endif
 
 static const int fourcc_formats[] = {
+   __DRI_IMAGE_FOURCC_ARGB2101010,
+   __DRI_IMAGE_FOURCC_XRGB2101010,
    __DRI_IMAGE_FOURCC_ARGB8888,
    __DRI_IMAGE_FOURCC_ABGR8888,
    __DRI_IMAGE_FOURCC_SARGB8888,
@@ -105,6 +107,14 @@ static int convert_fourcc(int format, int *dri_components_p)
       format = __DRI_IMAGE_FORMAT_XBGR8888;
       dri_components = __DRI_IMAGE_COMPONENTS_RGB;
       break;
+   case __DRI_IMAGE_FOURCC_ARGB2101010:
+      format = __DRI_IMAGE_FORMAT_ARGB2101010;
+      dri_components = __DRI_IMAGE_COMPONENTS_RGBA;
+      break;
+   case __DRI_IMAGE_FOURCC_XRGB2101010:
+      format = __DRI_IMAGE_FORMAT_XRGB2101010;
+      dri_components = __DRI_IMAGE_COMPONENTS_RGB;
+      break;
    case __DRI_IMAGE_FOURCC_R8:
       format = __DRI_IMAGE_FORMAT_R8;
       dri_components = __DRI_IMAGE_COMPONENTS_R;
@@ -170,6 +180,12 @@ static int convert_to_fourcc(int format)
    case __DRI_IMAGE_FORMAT_XBGR8888:
       format = __DRI_IMAGE_FOURCC_XBGR8888;
       break;
+   case __DRI_IMAGE_FORMAT_ARGB2101010:
+      format = __DRI_IMAGE_FOURCC_ARGB2101010;
+      break;
+   case __DRI_IMAGE_FORMAT_XRGB2101010:
+      format = __DRI_IMAGE_FOURCC_XRGB2101010;
+      break;
    case __DRI_IMAGE_FORMAT_R8:
       format = __DRI_IMAGE_FOURCC_R8;
       break;
@@ -202,6 +218,12 @@ static enum pipe_format dri2_format_to_pipe_format (int format)
    case __DRI_IMAGE_FORMAT_ABGR8888:
       pf = PIPE_FORMAT_RGBA8888_UNORM;
       break;
+   case __DRI_IMAGE_FORMAT_XRGB2101010:
+      pf = PIPE_FORMAT_B10G10R10X2_UNORM;
+      break;
+   case __DRI_IMAGE_FORMAT_ARGB2101010:
+      pf = PIPE_FORMAT_B10G10R10A2_UNORM;
+      break;
    case __DRI_IMAGE_FORMAT_R8:
       pf = PIPE_FORMAT_R8_UNORM;
       break;
@@ -260,6 +282,12 @@ static enum pipe_format fourcc_to_pipe_format(int fourcc)
    case __DRI_IMAGE_FOURCC_XBGR8888:
       pf = PIPE_FORMAT_RGBX8888_UNORM;
       break;
+   case __DRI_IMAGE_FOURCC_ARGB2101010:
+      pf = PIPE_FORMAT_B10G10R10A2_UNORM;
+      break;
+   case __DRI_IMAGE_FOURCC_XRGB2101010:
+      pf = PIPE_FORMAT_B10G10R10X2_UNORM;
+      break;
 
    case __DRI_IMAGE_FOURCC_NV12:
       pf = PIPE_FORMAT_NV12;