From 6d1cdec3ba151168bfc3aef222fba6265dfb41fb Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Fri, 6 Apr 2012 15:41:55 +0200 Subject: nouveau: switch to libdrm_nouveau-2.0 --- src/gallium/drivers/nvc0/nvc0_miptree.c | 81 +++++++++++++++++---------------- 1 file changed, 42 insertions(+), 39 deletions(-) (limited to 'src/gallium/drivers/nvc0/nvc0_miptree.c') diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c b/src/gallium/drivers/nvc0/nvc0_miptree.c index b180fc8db37..591ac4402db 100644 --- a/src/gallium/drivers/nvc0/nvc0_miptree.c +++ b/src/gallium/drivers/nvc0/nvc0_miptree.c @@ -65,80 +65,82 @@ nvc0_mt_choose_storage_type(struct nv50_miptree *mt, boolean compressed) compressed = FALSE; /* not yet supported */ - if (mt->base.base.bind & PIPE_BIND_CURSOR) - return NOUVEAU_BO_TILE_SCANOUT; + if (unlikely(mt->base.base.bind & PIPE_BIND_CURSOR)) + return 0; + if (unlikely(mt->base.base.flags & NOUVEAU_RESOURCE_FLAG_LINEAR)) + return 0; switch (mt->base.base.format) { case PIPE_FORMAT_Z16_UNORM: if (compressed) - tile_flags = 0x0200 + (ms << 8); + tile_flags = 0x02 + ms; else - tile_flags = 0x0100; + tile_flags = 0x01; break; case PIPE_FORMAT_S8_UINT_Z24_UNORM: if (compressed) - tile_flags = 0x5100 + (ms << 8); + tile_flags = 0x51 + ms; else - tile_flags = 0x4600; + tile_flags = 0x46; break; case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_Z24_UNORM_S8_UINT: if (compressed) - tile_flags = 0x1700 + (ms << 8); + tile_flags = 0x17 + ms; else - tile_flags = 0x1100; + tile_flags = 0x11; break; case PIPE_FORMAT_Z32_FLOAT: if (compressed) - tile_flags = 0x8600 + (ms << 8); + tile_flags = 0x86 + ms; else - tile_flags = 0x7b00; + tile_flags = 0x7b; break; case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: if (compressed) - tile_flags = 0xce00 + (ms << 8); + tile_flags = 0xce + ms; else - tile_flags = 0xc300; + tile_flags = 0xc3; break; default: switch (util_format_get_blocksizebits(mt->base.base.format)) { case 128: if (compressed) - tile_flags = 0xf400 + (ms << 9); + tile_flags = 0xf4 + ms; else - tile_flags = 0xfe00; + tile_flags = 0xfe; break; case 64: if (compressed) { switch (ms) { - case 0: tile_flags = 0xe600; break; - case 1: tile_flags = 0xeb00; break; - case 2: tile_flags = 0xed00; break; - case 3: tile_flags = 0xf200; break; + case 0: tile_flags = 0xe6; break; + case 1: tile_flags = 0xeb; break; + case 2: tile_flags = 0xed; break; + case 3: tile_flags = 0xf2; break; default: return 0; } } else { - tile_flags = 0xfe00; + tile_flags = 0xfe; } break; case 32: if (compressed) { switch (ms) { - case 0: tile_flags = 0xdb00; break; - case 1: tile_flags = 0xdd00; break; - case 2: tile_flags = 0xdf00; break; - case 3: tile_flags = 0xe400; break; + case 0: tile_flags = 0xdb; break; + case 1: tile_flags = 0xdd; break; + case 2: tile_flags = 0xdf; break; + case 3: tile_flags = 0xe4; break; default: return 0; } } else { - tile_flags = 0xfe00; + tile_flags = 0xfe; } break; case 16: case 8: - tile_flags = 0xfe00; + tile_flags = 0xfe; break; default: return 0; @@ -146,12 +148,6 @@ nvc0_mt_choose_storage_type(struct nv50_miptree *mt, boolean compressed) break; } - if (mt->base.base.bind & PIPE_BIND_SCANOUT) - tile_flags |= NOUVEAU_BO_TILE_SCANOUT; - - if (unlikely(mt->base.base.flags & NOUVEAU_RESOURCE_FLAG_LINEAR)) - tile_flags &= ~0xff00; - return tile_flags; } @@ -279,7 +275,8 @@ nvc0_miptree_create(struct pipe_screen *pscreen, struct nv50_miptree *mt = CALLOC_STRUCT(nv50_miptree); struct pipe_resource *pt = &mt->base.base; int ret; - uint32_t tile_flags; + union nouveau_bo_config bo_config; + uint32_t bo_flags; if (!mt) return NULL; @@ -289,7 +286,7 @@ nvc0_miptree_create(struct pipe_screen *pscreen, pipe_reference_init(&pt->reference, 1); pt->screen = pscreen; - tile_flags = nvc0_mt_choose_storage_type(mt, TRUE); + bo_config.nvc0.memtype = nvc0_mt_choose_storage_type(mt, TRUE); if (!nvc0_miptree_init_ms_mode(mt)) { FREE(mt); @@ -299,23 +296,29 @@ nvc0_miptree_create(struct pipe_screen *pscreen, if (unlikely(pt->flags & NVC0_RESOURCE_FLAG_VIDEO)) { nvc0_miptree_init_layout_video(mt); } else - if (tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) { + if (likely(bo_config.nvc0.memtype)) { nvc0_miptree_init_layout_tiled(mt); } else if (!nv50_miptree_init_layout_linear(mt)) { FREE(mt); return NULL; } + bo_config.nvc0.tile_mode = mt->level[0].tile_mode; - ret = nouveau_bo_new_tile(dev, NOUVEAU_BO_VRAM, 4096, - mt->total_size, - mt->level[0].tile_mode, tile_flags, - &mt->base.bo); + mt->base.domain = NOUVEAU_BO_VRAM; + + bo_flags = mt->base.domain | NOUVEAU_BO_NOSNOOP; + + if (mt->base.base.bind & (PIPE_BIND_CURSOR | PIPE_BIND_DISPLAY_TARGET)) + bo_flags |= NOUVEAU_BO_CONTIG; + + ret = nouveau_bo_new(dev, bo_flags, 4096, mt->total_size, &bo_config, + &mt->base.bo); if (ret) { FREE(mt); return NULL; } - mt->base.domain = NOUVEAU_BO_VRAM; + mt->base.address = mt->base.bo->offset; return pt; } -- cgit v1.2.3