[Mesa-stable] [Mesa-dev] [PATCH 1/2] r600g: Do colorformat endian swap for PIPE_USAGE_STAGING
Oded Gabbay
oded.gabbay at gmail.com
Thu Mar 3 07:12:42 UTC 2016
On Wed, Mar 2, 2016 at 11:48 PM, Marek Olšák <maraeo at gmail.com> wrote:
> On Wed, Mar 2, 2016 at 8:22 PM, Oded Gabbay <oded.gabbay at gmail.com> wrote:
>> 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.
>>
>> Signed-off-by: Oded Gabbay <oded.gabbay at gmail.com>
>> Cc: "11.1 11.2" <mesa-stable at lists.freedesktop.org>
>> ---
>> src/gallium/drivers/r600/evergreen_state.c | 13 ++-----------
>> src/gallium/drivers/r600/r600_state.c | 6 +-----
>> 2 files changed, 3 insertions(+), 16 deletions(-)
>>
>> diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
>> index a12638a..47ca7ce 100644
>> --- a/src/gallium/drivers/r600/evergreen_state.c
>> +++ b/src/gallium/drivers/r600/evergreen_state.c
>> @@ -989,12 +989,7 @@ void evergreen_init_color_surface_rat(struct r600_context *rctx,
>> MAX2(64, rctx->screen->b.info.pipe_interleave_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;
>> - }
>> + endian = r600_colorformat_endian_swap(format);
>
> endian is already initiailzed at the beginning of the function.
Thanks, I'll of course fix that before pushing.
Oded
>
> Other than that:
>
> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
>
> Marek
More information about the mesa-stable
mailing list