st/dri: add 32-bit RGBX/RGBA formats
authorRob Herring <robh@kernel.org>
Wed, 20 Apr 2016 22:39:54 +0000 (17:39 -0500)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 21 Apr 2016 13:45:53 +0000 (14:45 +0100)
Add support for 32-bit RGBX/RGBA formats which are preferred for Android.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/gallium/state_trackers/dri/dri2.c
src/gallium/state_trackers/dri/dri_screen.c

index 675a9bb21cfdc712d87d742d2e463ce0dd9ccacb..9d948a26fc376732119011b933848f647acda5ee 100644 (file)
@@ -120,6 +120,9 @@ static enum pipe_format dri2_format_to_pipe_format (int format)
    case __DRI_IMAGE_FORMAT_ARGB8888:
       pf = PIPE_FORMAT_BGRA8888_UNORM;
       break;
+   case __DRI_IMAGE_FORMAT_XBGR8888:
+      pf = PIPE_FORMAT_RGBX8888_UNORM;
+      break;
    case __DRI_IMAGE_FORMAT_ABGR8888:
       pf = PIPE_FORMAT_RGBA8888_UNORM;
       break;
@@ -297,6 +300,9 @@ dri_image_drawable_get_buffers(struct dri_drawable *drawable,
       case PIPE_FORMAT_BGRA8888_UNORM:
          image_format = __DRI_IMAGE_FORMAT_ARGB8888;
          break;
+      case PIPE_FORMAT_RGBX8888_UNORM:
+         image_format = __DRI_IMAGE_FORMAT_XBGR8888;
+         break;
       case PIPE_FORMAT_RGBA8888_UNORM:
          image_format = __DRI_IMAGE_FORMAT_ABGR8888;
          break;
index 2ac55c88926c3785ca463162db0c547efd178f46..2856ec0535516b5607e600b3de15f89574ae76a6 100644 (file)
@@ -104,6 +104,8 @@ static const __DRIconfig **
 dri_fill_in_modes(struct dri_screen *screen)
 {
    static const mesa_format mesa_formats[] = {
+      MESA_FORMAT_R8G8B8A8_UNORM,
+      MESA_FORMAT_R8G8B8X8_UNORM,
       MESA_FORMAT_B8G8R8A8_UNORM,
       MESA_FORMAT_B8G8R8X8_UNORM,
       MESA_FORMAT_B8G8R8A8_SRGB,
@@ -111,6 +113,8 @@ dri_fill_in_modes(struct dri_screen *screen)
       MESA_FORMAT_B5G6R5_UNORM,
    };
    static const enum pipe_format pipe_formats[] = {
+      PIPE_FORMAT_RGBA8888_UNORM,
+      PIPE_FORMAT_RGBX8888_UNORM,
       PIPE_FORMAT_BGRA8888_UNORM,
       PIPE_FORMAT_BGRX8888_UNORM,
       PIPE_FORMAT_BGRA8888_SRGB,