summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@gmail.com>2016-04-19 16:25:23 +0300
committerEmil Velikov <emil.l.velikov@gmail.com>2016-05-05 11:47:52 +0100
commit5f9ca20dbe0c674a7c3c70d9d4d3c040abb26e5e (patch)
tree1781b208c05f5ed5c0ba774999de63971e752515
parent3f40f8e4f28f05bb2220c8356227b98a921efe9b (diff)
r600g: set endianess of 16/32-bit buffers according to do_endian_swap
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 do_endian_swap parameter. The only exception is for array formats, which are always set to not do swapping, because for them gallium sets an alias based on the machine's endianess. v4: V_0280A0_COLOR_16_16 and V_0280A0_COLOR_16_16_FLOAT should be set to 8IN16 because the bytes inside need to be swapped even for array formats. Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com> Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org> Reviewed-by: Marek Olšák <marek.olsak@amd.com> (cherry picked from commit 686ad477bdfc698b8ff7ccfba6225b2c1c68214a)
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index bd34eddf1b6..c434e7304b6 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -2510,17 +2510,24 @@ uint32_t r600_colorformat_endian_swap(uint32_t colorformat, bool do_endian_swap)
return ENDIAN_NONE;
/* 16-bit buffers. */
+ case V_0280A0_COLOR_8_8:
+ /*
+ * No need to do endian swaps on array formats,
+ * as mesa<-->pipe formats conversion take into account
+ * the endianess
+ */
+ return ENDIAN_NONE;
+
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;
+ return (do_endian_swap ? ENDIAN_8IN16 : ENDIAN_NONE);
/* 32-bit buffers. */
case V_0280A0_COLOR_8_8_8_8:
/*
- * No need to do endian swaps on four 8-bits components,
+ * No need to do endian swaps on array formats,
* as mesa<-->pipe formats conversion take into account
* the endianess
*/
@@ -2530,9 +2537,11 @@ uint32_t r600_colorformat_endian_swap(uint32_t colorformat, bool do_endian_swap)
case V_0280A0_COLOR_8_24:
case V_0280A0_COLOR_24_8:
case V_0280A0_COLOR_32_FLOAT:
+ return (do_endian_swap ? ENDIAN_8IN32 : ENDIAN_NONE);
+
case V_0280A0_COLOR_16_16_FLOAT:
case V_0280A0_COLOR_16_16:
- return ENDIAN_8IN32;
+ return ENDIAN_8IN16;
/* 64-bit buffers. */
case V_0280A0_COLOR_16_16_16_16: