summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2012-06-12 18:09:55 -0400
committerJerome Glisse <jglisse@redhat.com>2012-06-12 18:09:55 -0400
commitd1fcfb17b9642ae351b03056a27b328f314ca80a (patch)
tree60d460685e6fe70dff180a91eba178aede454bf7
parent2f56002cc0b5424902dfe2bd4024f7b825ecde67 (diff)
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>
-rw-r--r--radeon/radeon_surface.c37
1 files changed, 37 insertions, 0 deletions
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) {