diff options
author | Marek Olšák <[email protected]> | 2016-06-08 20:24:21 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-06-14 20:22:16 +0200 |
commit | 789618e3b4619225f1e86d52f7b692bf6eb866eb (patch) | |
tree | a9fe13e713627cb7d6c3bae7881b3e8325a991ff /src/gallium/winsys/radeon | |
parent | 63c5d5c6c46c8472ee7a8241a0f80f13d79cb8cd (diff) |
gallium/radeon: add micro_tile_mode to radeon_surf
for easier access
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/winsys/radeon')
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_surface.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_surface.c b/src/gallium/winsys/radeon/drm/radeon_drm_surface.c index 6fb877490ea..c6025ff03d8 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_surface.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_surface.c @@ -45,6 +45,27 @@ static unsigned cik_get_macro_tile_index(struct radeon_surf *surf) return index; } +#define G_009910_MICRO_TILE_MODE(x) (((x) >> 0) & 0x03) +#define G_009910_MICRO_TILE_MODE_NEW(x) (((x) >> 22) & 0x07) + +static void set_micro_tile_mode(struct radeon_surf *surf, + struct radeon_info *info) +{ + uint32_t tile_mode; + + if (info->chip_class < SI) { + surf->micro_tile_mode = 0; + return; + } + + tile_mode = info->si_tile_mode_array[surf->tiling_index[0]]; + + if (info->chip_class >= CIK) + surf->micro_tile_mode = G_009910_MICRO_TILE_MODE_NEW(tile_mode); + else + surf->micro_tile_mode = G_009910_MICRO_TILE_MODE(tile_mode); +} + static void surf_level_winsys_to_drm(struct radeon_surface_level *level_drm, const struct radeon_surf_level *level_ws) { @@ -114,7 +135,8 @@ static void surf_winsys_to_drm(struct radeon_surface *surf_drm, } } -static void surf_drm_to_winsys(struct radeon_surf *surf_ws, +static void surf_drm_to_winsys(struct radeon_drm_winsys *ws, + struct radeon_surf *surf_ws, const struct radeon_surface *surf_drm) { int i; @@ -153,6 +175,8 @@ static void surf_drm_to_winsys(struct radeon_surf *surf_ws, surf_ws->tiling_index[i] = surf_drm->tiling_index[i]; surf_ws->stencil_tiling_index[i] = surf_drm->stencil_tiling_index[i]; } + + set_micro_tile_mode(surf_ws, &ws->info); } static int radeon_winsys_surface_init(struct radeon_winsys *rws, @@ -168,7 +192,7 @@ static int radeon_winsys_surface_init(struct radeon_winsys *rws, if (r) return r; - surf_drm_to_winsys(surf_ws, &surf_drm); + surf_drm_to_winsys(ws, surf_ws, &surf_drm); return 0; } @@ -185,7 +209,7 @@ static int radeon_winsys_surface_best(struct radeon_winsys *rws, if (r) return r; - surf_drm_to_winsys(surf_ws, &surf_drm); + surf_drm_to_winsys(ws, surf_ws, &surf_drm); return 0; } |