summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {