[Nouveau] [PATCH] dri2: fix allocation of Z16 depth attachments

Christoph Bumiller e0425955 at student.tuwien.ac.at
Wed Dec 7 10:23:57 PST 2011


---
 src/nouveau_dri2.c    |    4 +++-
 src/nv_accel_common.c |    4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index d14443f..b99893f 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -46,6 +46,8 @@ nouveau_dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment,
 
 		ppix->refcnt++;
 	} else {
+		/* 'format' is just depth */
+		unsigned int depth = NOUVEAU_ALIGN(format, 2);
 		unsigned int usage_hint = NOUVEAU_CREATE_PIXMAP_TILED;
 
 		if (attachment == DRI2BufferDepth ||
@@ -55,7 +57,7 @@ nouveau_dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment,
 			usage_hint |= NOUVEAU_CREATE_PIXMAP_SCANOUT;
 
 		ppix = pScreen->CreatePixmap(pScreen, pDraw->width,
-					     pDraw->height, pDraw->depth,
+					     pDraw->height, depth,
 					     usage_hint);
 	}
 
diff --git a/src/nv_accel_common.c b/src/nv_accel_common.c
index 3219dbe..51cc66a 100644
--- a/src/nv_accel_common.c
+++ b/src/nv_accel_common.c
@@ -71,7 +71,7 @@ nouveau_allocate_surface(ScrnInfoPtr scrn, int width, int height, int bpp,
 				tile_mode = 0x00;
 
 			if (usage_hint & NOUVEAU_CREATE_PIXMAP_ZETA)
-				tile_flags = 0x1100; /* S8Z24 */
+				tile_flags = (bpp == 16) ? 0x0100 : 0x1100; /* Z16 : Z24S8 */
 			else
 				tile_flags = 0xfe00;
 
@@ -90,7 +90,7 @@ nouveau_allocate_surface(ScrnInfoPtr scrn, int width, int height, int bpp,
 				tile_mode = 0;
 
 			if (usage_hint & NOUVEAU_CREATE_PIXMAP_ZETA)
-				tile_flags = 0x22800;
+				tile_flags = (bpp == 16) ? 0x26c00 : 0x22800;
 			else if (usage_hint & NOUVEAU_CREATE_PIXMAP_SCANOUT)
 				tile_flags = (bpp == 16 ? 0x7000 : 0x7a00);
 			else
-- 
1.7.3.4



More information about the Nouveau mailing list