Mesa (nvc0): nvc0: use tile flags in a way compatible with nouveau

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Thu Dec 9 14:31:34 UTC 2010


Module: Mesa
Branch: nvc0
Commit: 6e753e3c2950d486aa0e06dff587ef53b9c4ebc4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e753e3c2950d486aa0e06dff587ef53b9c4ebc4

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Thu Dec  9 15:08:29 2010 +0100

nvc0: use tile flags in a way compatible with nouveau

---

 src/gallium/drivers/nvc0/nvc0_miptree.c  |   40 +++++++++++++++---------------
 src/gallium/drivers/nvc0/nvc0_transfer.c |    6 ++--
 src/gallium/drivers/nvc0/nvc0_winsys.h   |    6 ++++
 3 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c b/src/gallium/drivers/nvc0/nvc0_miptree.c
index aac09d7..cca307b 100644
--- a/src/gallium/drivers/nvc0/nvc0_miptree.c
+++ b/src/gallium/drivers/nvc0/nvc0_miptree.c
@@ -143,40 +143,40 @@ nvc0_miptree_create(struct pipe_screen *pscreen,
 
    switch (pt->format) {
    case PIPE_FORMAT_Z16_UNORM:
-      tile_flags = 0x070; /* COMPRESSED */
-      tile_flags = 0x020; /* NORMAL ? */
-      tile_flags = 0x010; /* NORMAL ? */
+      tile_flags = 0x0700; /* COMPRESSED */
+      tile_flags = 0x0200; /* NORMAL ? */
+      tile_flags = 0x0100; /* NORMAL ? */
       break;
    case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
-      tile_flags = 0x530; /* MSAA 4, COMPRESSED */
-      tile_flags = 0x460; /* NORMAL */
+      tile_flags = 0x5300; /* MSAA 4, COMPRESSED */
+      tile_flags = 0x4600; /* NORMAL */
       break;
    case PIPE_FORMAT_Z24X8_UNORM:
    case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
-      tile_flags = 0x110; /* NORMAL */
+      tile_flags = 0x1100; /* NORMAL */
       if (w * h >= 128 * 128 && 0)
-         tile_flags = 0x170; /* COMPRESSED, requires magic */
+         tile_flags = 0x1700; /* COMPRESSED, requires magic */
       break;
    case PIPE_FORMAT_R32G32B32A32_FLOAT:
-      tile_flags = 0xf50; /* COMPRESSED */
-      tile_flags = 0xf70; /* MSAA 2 */
-      tile_flags = 0xf90; /* MSAA 4 */
-      tile_flags = 0xfe0; /* NORMAL */
+      tile_flags = 0xf500; /* COMPRESSED */
+      tile_flags = 0xf700; /* MSAA 2 */
+      tile_flags = 0xf900; /* MSAA 4 */
+      tile_flags = 0xfe00; /* NORMAL */
       break;
    case PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED:
-      tile_flags = 0xce0; /* COMPRESSED */
-      tile_flags = 0xcf0; /* MSAA 2, COMPRESSED */
-      tile_flags = 0xd00; /* MSAA 4, COMPRESSED */
-      tile_flags = 0xc30; /* NORMAL */
+      tile_flags = 0xce00; /* COMPRESSED */
+      tile_flags = 0xcf00; /* MSAA 2, COMPRESSED */
+      tile_flags = 0xd000; /* MSAA 4, COMPRESSED */
+      tile_flags = 0xc300; /* NORMAL */
       break;
    case PIPE_FORMAT_R16G16B16A16_UNORM:
-      tile_flags = 0xe90; /* COMPRESSED */
+      tile_flags = 0xe900; /* COMPRESSED */
       break;
    default:
-      tile_flags = 0xe00; /* MSAA 4, COMPRESSED 32 BIT */
-      tile_flags = 0xfe0; /* NORMAL 32 BIT */
+      tile_flags = 0xe000; /* MSAA 4, COMPRESSED 32 BIT */
+      tile_flags = 0xfe00; /* NORMAL 32 BIT */
       if (w * h >= 128 * 128 && 0)
-         tile_flags = 0xdb0; /* COMPRESSED 32 BIT, requires magic */
+         tile_flags = 0xdb00; /* COMPRESSED 32 BIT, requires magic */
       break;
    }
 
@@ -224,7 +224,7 @@ nvc0_miptree_create(struct pipe_screen *pscreen,
    }
 
    alloc_size = mt->total_size;
-   if (tile_flags == 0x170)
+   if (tile_flags == 0x1700)
       alloc_size *= 3; /* HiZ, XXX: correct size */
 
    ret = nouveau_bo_new_tile(dev, NOUVEAU_BO_VRAM, 256, alloc_size,
diff --git a/src/gallium/drivers/nvc0/nvc0_transfer.c b/src/gallium/drivers/nvc0/nvc0_transfer.c
index 56c5fe1..10d0995 100644
--- a/src/gallium/drivers/nvc0/nvc0_transfer.c
+++ b/src/gallium/drivers/nvc0/nvc0_transfer.c
@@ -30,7 +30,7 @@ nvc0_m2mf_transfer_rect(struct pipe_screen *pscreen,
 
    assert(dst->cpp == src->cpp);
 
-   if (src->bo->tile_flags) {      
+   if (nouveau_bo_tile_layout(src->bo)) {
       BEGIN_RING(chan, RING_MF(TILING_MODE_IN), 5);
       OUT_RING  (chan, src->tile_mode);
       OUT_RING  (chan, src->width * cpp);
@@ -46,7 +46,7 @@ nvc0_m2mf_transfer_rect(struct pipe_screen *pscreen,
       exec |= NVC0_M2MF_EXEC_LINEAR_IN;
    }
 
-   if (dst->bo->tile_flags) {
+   if (nouveau_bo_tile_layout(dst->bo)) {
       BEGIN_RING(chan, RING_MF(TILING_MODE_OUT), 5);
       OUT_RING  (chan, dst->tile_mode);
       OUT_RING  (chan, dst->width * cpp);
@@ -185,7 +185,7 @@ nvc0_m2mf_push_rect(struct pipe_screen *pscreen,
    const int line_len = nblocksx * cpp;
    int dy = dst->y;
 
-   assert(dst->bo->tile_flags);
+   assert(nouveau_bo_tile_layout(dst->bo));
 
    BEGIN_RING(chan, RING_MF(TILING_MODE_OUT), 5);
    OUT_RING  (chan, dst->tile_mode);
diff --git a/src/gallium/drivers/nvc0/nvc0_winsys.h b/src/gallium/drivers/nvc0/nvc0_winsys.h
index e97ca8e..4da30ec 100644
--- a/src/gallium/drivers/nvc0/nvc0_winsys.h
+++ b/src/gallium/drivers/nvc0/nvc0_winsys.h
@@ -40,6 +40,12 @@ extern uint64_t nouveau_bo_gpu_address(struct nouveau_bo *);
 
 int nouveau_pushbuf_flush(struct nouveau_channel *, unsigned min);
 
+static inline uint32_t
+nouveau_bo_tile_layout(struct nouveau_bo *bo)
+{
+   return bo->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK;
+}
+
 static INLINE void
 WAIT_RING(struct nouveau_channel *chan, unsigned size)
 {




More information about the mesa-commit mailing list