[Mesa-dev] [PATCH] ac/surface: fix hybrid graphics where APU=GFX9, dGPU=older
Marek Olšák
maraeo at gmail.com
Tue Jul 25 16:38:32 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
Cc: 17.2 <mesa-stable at lists.freedesktop.org>
---
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. */
--
2.7.4
More information about the mesa-dev
mailing list