[Mesa-dev] [PATCH] ac/surface: fix hybrid graphics where APU=GFX9, dGPU=older

Nicolai Hähnle nhaehnle at gmail.com
Wed Jul 26 11:37:49 UTC 2017


On 25.07.2017 18:38, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> Cc: 17.2 <mesa-stable at lists.freedesktop.org>

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>


> ---
>   src/amd/common/ac_surface.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
> index cd3d7b7..9e5390b 100644
> --- a/src/amd/common/ac_surface.c
> +++ b/src/amd/common/ac_surface.c
> @@ -250,20 +250,31 @@ static int gfx6_compute_level(ADDR_HANDLE addrlib,
>   			      ADDR_COMPUTE_HTILE_INFO_INPUT *AddrHtileIn,
>   			      ADDR_COMPUTE_HTILE_INFO_OUTPUT *AddrHtileOut)
>   {
>   	struct legacy_surf_level *surf_level;
>   	ADDR_E_RETURNCODE ret;
>   
>   	AddrSurfInfoIn->mipLevel = level;
>   	AddrSurfInfoIn->width = u_minify(config->info.width, level);
>   	AddrSurfInfoIn->height = u_minify(config->info.height, level);
>   
> +	/* Make GFX6 linear surfaces compatible with GFX9 for hybrid graphics,
> +	 * because GFX9 needs linear alignment of 256 bytes.
> +	 */
> +	if (config->info.levels == 1 &&
> +	    AddrSurfInfoIn->tileMode == ADDR_TM_LINEAR_ALIGNED) {
> +		unsigned alignment = 256 / (AddrSurfInfoIn->bpp / 8);
> +
> +		assert(util_is_power_of_two(AddrSurfInfoIn->bpp));
> +		AddrSurfInfoIn->width = align(AddrSurfInfoIn->width, alignment);
> +	}
> +
>   	if (config->is_3d)
>   		AddrSurfInfoIn->numSlices = u_minify(config->info.depth, level);
>   	else if (config->is_cube)
>   		AddrSurfInfoIn->numSlices = 6;
>   	else
>   		AddrSurfInfoIn->numSlices = config->info.array_size;
>   
>   	if (level > 0) {
>   		/* Set the base level pitch. This is needed for calculation
>   		 * of non-zero levels. */
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list