From d1fcfb17b9642ae351b03056a27b328f314ca80a Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 12 Jun 2012 18:09:55 -0400 Subject: [PATCH] radeon: force 1D array mode for z/stencil surface On r6xx or evergreen z/stencil surface don't support linear or linear aligned surface, force 1D tiled mode for those. Signed-off-by: Jerome Glisse --- radeon/radeon_surface.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c index 64a8dd41..0afd5965 100644 --- a/radeon/radeon_surface.c +++ b/radeon/radeon_surface.c @@ -384,6 +384,27 @@ static int r6_surface_init(struct radeon_surface_manager *surf_man, /* tiling mode */ mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK; + /* always enable z & stencil together */ + if (surf->flags & RADEON_SURF_ZBUFFER) { + surf->flags |= RADEON_SURF_SBUFFER; + } + if (surf->flags & RADEON_SURF_SBUFFER) { + surf->flags |= RADEON_SURF_ZBUFFER; + } + if (surf->flags & RADEON_SURF_ZBUFFER) { + /* zbuffer only support 1D or 2D tiled surface */ + switch (mode) { + case RADEON_SURF_MODE_1D: + case RADEON_SURF_MODE_2D: + break; + default: + mode = RADEON_SURF_MODE_1D; + surf->flags = RADEON_SURF_CLR(surf->flags, MODE); + surf->flags |= RADEON_SURF_SET(RADEON_SURF_MODE_1D, MODE); + break; + } + } + /* force 1d on kernel that can't do 2d */ if (!surf_man->hw_info.allow_2d && mode > RADEON_SURF_MODE_1D) { mode = RADEON_SURF_MODE_1D; @@ -740,6 +761,22 @@ static int eg_surface_init(struct radeon_surface_manager *surf_man, if (surf->flags & RADEON_SURF_ZBUFFER) { surf->flags |= RADEON_SURF_SBUFFER; } + if (surf->flags & RADEON_SURF_SBUFFER) { + surf->flags |= RADEON_SURF_ZBUFFER; + } + if (surf->flags & RADEON_SURF_ZBUFFER) { + /* zbuffer only support 1D or 2D tiled surface */ + switch (mode) { + case RADEON_SURF_MODE_1D: + case RADEON_SURF_MODE_2D: + break; + default: + mode = RADEON_SURF_MODE_1D; + surf->flags = RADEON_SURF_CLR(surf->flags, MODE); + surf->flags |= RADEON_SURF_SET(RADEON_SURF_MODE_1D, MODE); + break; + } + } r = eg_surface_sanity(surf_man, surf, mode); if (r) {