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 <jglisse@redhat.com>
main
Jerome Glisse 2012-06-12 18:09:55 -04:00
parent 2f56002cc0
commit d1fcfb17b9
1 changed files with 37 additions and 0 deletions

View File

@ -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) {