[Mesa-dev] [PATCH 08/10] r600g: set endianess of 16/32-bit buffers according to endian_format

Oded Gabbay oded.gabbay at gmail.com
Mon Apr 11 14:34:11 UTC 2016


This patch modifies r600_colorformat_endian_swap(), so for 16-bit and for
32-bit buffers, the endianess configuration will be determined not only
by the color/texture format, but also by the resource's endian_format
value.

The only exception is for 8_8_8_8 formats, which are always set to
little-endian, because for them, gallium sets a different pipe_format
based on endianess

Signed-off-by: Oded Gabbay <oded.gabbay at gmail.com>
---
 src/gallium/drivers/r600/r600_state_common.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 2d4ec9b..9bccc6a 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -2736,12 +2736,13 @@ uint32_t r600_colorformat_endian_swap(uint32_t colorformat, enum pipe_endian end
 			return ENDIAN_NONE;
 
 		/* 16-bit buffers. */
-		case V_0280A0_COLOR_5_6_5:
-		case V_0280A0_COLOR_1_5_5_5:
 		case V_0280A0_COLOR_4_4_4_4:
-		case V_0280A0_COLOR_16:
 		case V_0280A0_COLOR_8_8:
-			return ENDIAN_8IN16;
+		case V_0280A0_COLOR_16:
+		case V_0280A0_COLOR_5_6_5:
+		case V_0280A0_COLOR_1_5_5_5:
+			return (endianformat == PIPE_ENDIAN_BIG) ? ENDIAN_8IN16 : ENDIAN_NONE;
+			break;
 
 		/* 32-bit buffers. */
 		case V_0280A0_COLOR_8_8_8_8:
@@ -2752,13 +2753,14 @@ uint32_t r600_colorformat_endian_swap(uint32_t colorformat, enum pipe_endian end
 			 */
 			return ENDIAN_NONE;
 
-		case V_0280A0_COLOR_2_10_10_10:
 		case V_0280A0_COLOR_8_24:
 		case V_0280A0_COLOR_24_8:
 		case V_0280A0_COLOR_32_FLOAT:
-		case V_0280A0_COLOR_16_16_FLOAT:
 		case V_0280A0_COLOR_16_16:
-			return ENDIAN_8IN32;
+		case V_0280A0_COLOR_2_10_10_10:
+		case V_0280A0_COLOR_16_16_FLOAT:
+			return (endianformat == PIPE_ENDIAN_BIG) ? ENDIAN_8IN32 : ENDIAN_NONE;
+			break;
 
 		/* 64-bit buffers. */
 		case V_0280A0_COLOR_16_16_16_16:
-- 
2.5.5



More information about the mesa-dev mailing list