[Mesa-dev] [PATCH 3/4] st/xa: Support a couple of new formats

Thomas Hellstrom thellstrom at vmware.com
Tue Nov 13 07:35:26 UTC 2018


Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
---
 src/gallium/state_trackers/xa/xa_tracker.c    | 33 ++++++++++++++-----
 src/gallium/state_trackers/xa/xa_tracker.h.in |  5 +++
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c
index 5ac98f8eed0..0909044fb91 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -89,6 +89,15 @@ xa_get_pipe_format(struct xa_tracker *xa, enum xa_formats xa_format)
     fdesc.xa_format = xa_format;
 
     switch (xa_format) {
+    case xa_format_a8:
+        if (xa->screen->is_format_supported(xa->screen, PIPE_FORMAT_R8_UNORM,
+                                            PIPE_TEXTURE_2D, 0, 0,
+                                            stype_bind[xa_type_a] |
+                                            PIPE_BIND_RENDER_TARGET))
+            fdesc.format = PIPE_FORMAT_R8_UNORM;
+        else
+            fdesc.format = PIPE_FORMAT_L8_UNORM;
+	break;
     case xa_format_a8r8g8b8:
 	fdesc.format = PIPE_FORMAT_B8G8R8A8_UNORM;
 	break;
@@ -101,15 +110,21 @@ xa_get_pipe_format(struct xa_tracker *xa, enum xa_formats xa_format)
     case xa_format_x1r5g5b5:
 	fdesc.format = PIPE_FORMAT_B5G5R5A1_UNORM;
 	break;
-    case xa_format_a8:
-        if (xa->screen->is_format_supported(xa->screen, PIPE_FORMAT_R8_UNORM,
-                                            PIPE_TEXTURE_2D, 0, 0,
-                                            stype_bind[xa_type_a] |
-                                            PIPE_BIND_RENDER_TARGET))
-            fdesc.format = PIPE_FORMAT_R8_UNORM;
-        else
-            fdesc.format = PIPE_FORMAT_L8_UNORM;
-	break;
+    case xa_format_a4r4g4b4:
+        fdesc.format = PIPE_FORMAT_B4G4R4A4_UNORM;
+        break;
+    case xa_format_a2b10g10r10:
+        fdesc.format = PIPE_FORMAT_R10G10B10A2_UNORM;
+        break;
+    case xa_format_x2b10g10r10:
+        fdesc.format = PIPE_FORMAT_R10G10B10X2_UNORM;
+        break;
+    case xa_format_b8g8r8a8:
+        fdesc.format = PIPE_FORMAT_A8R8G8B8_UNORM;
+        break;
+    case xa_format_b8g8r8x8:
+        fdesc.format = PIPE_FORMAT_X8R8G8B8_UNORM;
+        break;
     case xa_format_z24:
 	fdesc.format = PIPE_FORMAT_Z24X8_UNORM;
 	break;
diff --git a/src/gallium/state_trackers/xa/xa_tracker.h.in b/src/gallium/state_trackers/xa/xa_tracker.h.in
index fc721eed38b..3d136707152 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.h.in
+++ b/src/gallium/state_trackers/xa/xa_tracker.h.in
@@ -126,6 +126,11 @@ enum xa_formats {
     xa_format_x8r8g8b8 = xa_format(32, xa_type_argb, 0, 8, 8, 8),
     xa_format_r5g6b5 = xa_format(16, xa_type_argb, 0, 5, 6, 5),
     xa_format_x1r5g5b5 = xa_format(16, xa_type_argb, 0, 5, 5, 5),
+    xa_format_a4r4g4b4 = xa_format(16, xa_type_argb, 4, 4, 4, 4),
+    xa_format_a2b10g10r10 = xa_format(32, xa_type_abgr, 2, 10, 10, 10),
+    xa_format_x2b10g10r10 = xa_format(32, xa_type_abgr, 0, 10, 10, 10),
+    xa_format_b8g8r8a8 = xa_format(32, xa_type_bgra, 8, 8, 8, 8),
+    xa_format_b8g8r8x8 = xa_format(32, xa_type_bgra, 0, 8, 8, 8),
 
     xa_format_z16 = xa_format_c(16, xa_type_z, 16, 0),
     xa_format_z32 = xa_format_c(32, xa_type_z, 32, 0),
-- 
2.19.0.rc1



More information about the mesa-dev mailing list