[Mesa-dev] [PATCH] r600g: Fix ARB_texture_rgb10_a2ui support in big-endian

Michel Dänzer michel at daenzer.net
Mon Feb 29 01:51:01 UTC 2016


On 28.02.2016 05:48, Oded Gabbay wrote:
> This patch enables the correct detection of PIPE_FORMAT_R10G10B10A2_UINT
> and PIPE_FORMAT_B10G10R10A2_UINT formats in r600g in big-endian mode, by
> adjusting the order of channels in various functions.
> 
> This enables support for ARB_texture_rgb10_a2ui, which otherwise is not
> detected as supported.
> 
> Signed-off-by: Oded Gabbay <oded.gabbay at gmail.com>
> ---
>  src/gallium/drivers/r600/r600_state_common.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
> index b231d1e..b02b6a9 100644
> --- a/src/gallium/drivers/r600/r600_state_common.c
> +++ b/src/gallium/drivers/r600/r600_state_common.c
> @@ -2468,10 +2468,13 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen,
>  				result = FMT_1_5_5_5;
>  				goto out_word4;
>  			}
> -			if (desc->channel[0].size == 10 &&
> -			    desc->channel[1].size == 10 &&
> -			    desc->channel[2].size == 10 &&
> -			    desc->channel[3].size == 2) {
> +			if ((desc->channel[1].size == 10 &&
> +				  desc->channel[2].size == 10) &&
> +					((desc->channel[0].size == 10 &&
> +					  desc->channel[3].size == 2) ||
> +					 (R600_BIG_ENDIAN &&
> +					  desc->channel[0].size == 2 &&
> +					  desc->channel[3].size == 10))) {
>  				result = FMT_2_10_10_10;
>  				goto out_word4;
>  			}
> @@ -2694,9 +2697,11 @@ uint32_t r600_translate_colorformat(enum chip_class chip, enum pipe_format forma
>  			}
>  		} else if (HAS_SIZE(5,5,5,1)) {
>  			return V_0280A0_COLOR_1_5_5_5;
> -		} else if (HAS_SIZE(10,10,10,2)) {
> +		} else if (HAS_SIZE(10,10,10,2) ||
> +				(R600_BIG_ENDIAN && HAS_SIZE(2,10,10,10))) {

Since the components of these formats cross byte boundaries, these
formats should really be treated as packed by the core Gallium code, in
which case this change probably wouldn't be necessary. In other words,
this is probably working around a core Gallium bug.


>  		}
> +
>  		break;
>  	}

Don't add this blank line.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list