[Mesa-stable] [Mesa-dev] [PATCH 1/4] radeonsi: fix DCC fast clear for luminance and alpha formats

Andres Gomez agomez at igalia.com
Thu Jul 6 18:24:28 UTC 2017


Marek, would we want this series in -stable or we shouldn't bother ?

On Tue, 2017-06-20 at 19:06 +0200, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> I reproduced this bug on Polaris11 and Raven.
> 
> I can't get this bug on Fiji. The reason might be that Fiji doesn't use
> 2D tiling for the test due to higher 2D tiling alignment requirements.
> 
> Fixes piglit: spec at ext_framebuffer_object@fbo-fast-clear
> ---
>  src/gallium/drivers/radeon/r600_texture.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
> index d0492d6..f74bbce 100644
> --- a/src/gallium/drivers/radeon/r600_texture.c
> +++ b/src/gallium/drivers/radeon/r600_texture.c
> @@ -2404,39 +2404,48 @@ static void evergreen_set_clear_color(struct r600_texture *rtex,
>  static bool vi_get_fast_clear_parameters(enum pipe_format surface_format,
>  					 const union pipe_color_union *color,
>  					 uint32_t* reset_value,
>  					 bool* clear_words_needed)
>  {
>  	bool values[4] = {};
>  	int i;
>  	bool main_value = false;
>  	bool extra_value = false;
>  	int extra_channel;
> +
> +	/* This is needed to get the correct DCC clear value for luminance formats.
> +	 * 1) Get the linear format (because the next step can't handle L8_SRGB).
> +	 * 2) Convert luminance to red. (the real hw format for luminance)
> +	 */
> +	surface_format = util_format_linear(surface_format);
> +	surface_format = util_format_luminance_to_red(surface_format);
> +
>  	const struct util_format_description *desc = util_format_description(surface_format);
>  
>  	if (desc->block.bits == 128 &&
>  	    (color->ui[0] != color->ui[1] ||
>  	     color->ui[0] != color->ui[2]))
>  		return false;
>  
>  	*clear_words_needed = true;
>  	*reset_value = 0x20202020U;
>  
>  	/* If we want to clear without needing a fast clear eliminate step, we
>  	 * can set each channel to 0 or 1 (or 0/max for integer formats). We
>  	 * have two sets of flags, one for the last or first channel(extra) and
>  	 * one for the other channels(main).
>  	 */
>  
>  	if (surface_format == PIPE_FORMAT_R11G11B10_FLOAT ||
>  	    surface_format == PIPE_FORMAT_B5G6R5_UNORM ||
> -	    surface_format == PIPE_FORMAT_B5G6R5_SRGB) {
> +	    surface_format == PIPE_FORMAT_B5G6R5_SRGB ||
> +	    util_format_is_alpha(surface_format)) {
>  		extra_channel = -1;
>  	} else if (desc->layout == UTIL_FORMAT_LAYOUT_PLAIN) {
>  		if(r600_translate_colorswap(surface_format, false) <= 1)
>  			extra_channel = desc->nr_channels - 1;
>  		else
>  			extra_channel = 0;
>  	} else
>  		return true;
>  
>  	for (i = 0; i < 4; ++i) {
-- 
Br,

Andres


More information about the mesa-stable mailing list