From: Christoph Bumiller Date: Thu, 9 Dec 2010 14:08:29 +0000 (+0100) Subject: nvc0: use tile flags in a way compatible with nouveau X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6e753e3c2950d486aa0e06dff587ef53b9c4ebc4;p=mesa.git nvc0: use tile flags in a way compatible with nouveau --- diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c b/src/gallium/drivers/nvc0/nvc0_miptree.c index aac09d776c7..cca307b37f1 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 56c5fe12c20..10d0995a5a5 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 e97ca8e90da..4da30ecb86f 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) {