radv: fix cik macroModeIndex.
authorDave Airlie <airlied@redhat.com>
Tue, 14 Feb 2017 06:05:43 +0000 (16:05 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 14 Feb 2017 19:02:13 +0000 (05:02 +1000)
This just a CIK fix ported from radeonsi.

Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c

index 02aad3c81d21e57e567f39dbaaa804caaa017e37..dc596ff0574b0a56c07278aca7aa8e0216ee9a27 100644 (file)
@@ -274,6 +274,19 @@ static void radv_set_micro_tile_mode(struct radeon_surf *surf,
                surf->micro_tile_mode = G_009910_MICRO_TILE_MODE(tile_mode);
 }
 
+static unsigned cik_get_macro_tile_index(struct radeon_surf *surf)
+{
+       unsigned index, tileb;
+
+       tileb = 8 * 8 * surf->bpe;
+       tileb = MIN2(surf->tile_split, tileb);
+
+       for (index = 0; tileb > 64; index++)
+               tileb >>= 1;
+
+       assert(index < 16);
+       return index;
+}
 
 static int radv_amdgpu_winsys_surface_init(struct radeon_winsys *_ws,
                                           struct radeon_surf *surf)
@@ -435,6 +448,7 @@ static int radv_amdgpu_winsys_surface_init(struct radeon_winsys *_ws,
                                AddrSurfInfoIn.tileIndex = 10; /* 2D displayable */
                        else
                                AddrSurfInfoIn.tileIndex = 14; /* 2D non-displayable */
+                       AddrSurfInfoOut.macroModeIndex = cik_get_macro_tile_index(surf);
                }
        }