summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@gmail.com>2016-03-02 21:11:49 +0200
committerEmil Velikov <emil.l.velikov@gmail.com>2016-04-11 21:02:17 +0100
commit1ad8541963e038816a6b3b0abe36add4509d23fe (patch)
tree44221fb26755ed2ae707949b63a73d8dd0b1310a
parenteadc1b61342a8ecaa6f9e3b7826c136d05b06a10 (diff)
r600g: Do colorformat endian swap for PIPE_USAGE_STAGING
There is an old if statement (dated to 2011) that prevented doing endian swap for colorformat, in case the buffer is marked as PIPE_USAGE_STAGING. This is now wrong because st_ReadPixels() reads into a destination texture that is marked with PIPE_USAGE_STAGING. Therefore, even if the texture is rendered correctly to the monitor, when reading it back we get unswapped/wrong values. This patch makes the check_rgba() function in gl-1.0-readpixsanity piglit test pass in big-endian. v2: removed duplicate call to r600_colorformat_endian_swap() inside evergreen_init_color_surface_rat() 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 ef5183faea98dfdaa1ca0c7368c4678a031dd804)
-rw-r--r--src/gallium/drivers/r600/evergreen_state.c13
-rw-r--r--src/gallium/drivers/r600/r600_state.c6
2 files changed, 2 insertions, 17 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 21ed9970cbc..cf3fa99570f 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -962,13 +962,6 @@ void evergreen_init_color_surface_rat(struct r600_context *rctx,
MAX2(64, rctx->screen->b.tiling_info.group_bytes / block_size);
unsigned pitch = align(pipe_buffer->width0, pitch_alignment);
- /* XXX: This is copied from evergreen_init_color_surface(). I don't
- * know why this is necessary.
- */
- if (pipe_buffer->usage == PIPE_USAGE_STAGING) {
- endian = ENDIAN_NONE;
- }
-
surf->cb_color_base = r600_resource(pipe_buffer)->gpu_address >> 8;
surf->cb_color_pitch = (pitch / 8) - 1;
@@ -1119,11 +1112,7 @@ void evergreen_init_color_surface(struct r600_context *rctx,
swap = r600_translate_colorswap(surf->base.format);
assert(swap != ~0);
- if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) {
- endian = ENDIAN_NONE;
- } else {
- endian = r600_colorformat_endian_swap(format);
- }
+ endian = r600_colorformat_endian_swap(format);
/* blend clamp should be set for all NORM/SRGB types */
if (ntype == V_028C70_NUMBER_UNORM || ntype == V_028C70_NUMBER_SNORM ||
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index b59d17286bc..5b59af4787f 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -930,11 +930,7 @@ static void r600_init_color_surface(struct r600_context *rctx,
swap = r600_translate_colorswap(surf->base.format);
assert(swap != ~0);
- if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) {
- endian = ENDIAN_NONE;
- } else {
- endian = r600_colorformat_endian_swap(format);
- }
+ endian = r600_colorformat_endian_swap(format);
/* set blend bypass according to docs if SINT/UINT or
8/24 COLOR variants */