summaryrefslogtreecommitdiffstats
path: root/src/amd/common/ac_surface.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-07-25 00:08:55 +0200
committerMarek Olšák <[email protected]>2017-07-26 19:53:26 +0200
commit5e81df0f103667d888bd346e148843f510a80adc (patch)
treea10ceaf2cd0f6cbd916e5059bb5bd63175180bc4 /src/amd/common/ac_surface.c
parented2b3f5c81b76281ff0e4728928ac55944b930b8 (diff)
ac/surface: fix hybrid graphics where APU=GFX9, dGPU=older
v2: don't do it for compressed textures (bpp = 0) Cc: 17.2 <[email protected]> Reviewed-by: Alex Deucher <[email protected]> (v1) Reviewed-by: Nicolai Hähnle <[email protected]> (v1)
Diffstat (limited to 'src/amd/common/ac_surface.c')
-rw-r--r--src/amd/common/ac_surface.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
index cd3d7b715cf..26f3729adf9 100644
--- a/src/amd/common/ac_surface.c
+++ b/src/amd/common/ac_surface.c
@@ -257,6 +257,18 @@ static int gfx6_compute_level(ADDR_HANDLE addrlib,
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 &&
+ AddrSurfInfoIn->bpp) {
+ 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)