From: Christoph Bumiller Date: Sun, 18 Dec 2011 21:34:50 +0000 (+0100) Subject: nvc0: add NVC0_RESOURCE_FLAG_VIDEO X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f20261028843a4c5d572e0001b813f7c786a2f12;p=mesa.git nvc0: add NVC0_RESOURCE_FLAG_VIDEO --- diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c b/src/gallium/drivers/nvc0/nvc0_miptree.c index a9d2c85624b..b180fc8db37 100644 --- a/src/gallium/drivers/nvc0/nvc0_miptree.c +++ b/src/gallium/drivers/nvc0/nvc0_miptree.c @@ -187,6 +187,31 @@ nvc0_miptree_init_ms_mode(struct nv50_miptree *mt) boolean nv50_miptree_init_layout_linear(struct nv50_miptree *); +static void +nvc0_miptree_init_layout_video(struct nv50_miptree *mt) +{ + const struct pipe_resource *pt = &mt->base.base; + const unsigned blocksize = util_format_get_blocksize(pt->format); + + unsigned nbx = util_format_get_nblocksx(pt->format, pt->width0); + unsigned nby = util_format_get_nblocksy(pt->format, pt->height0); + + assert(pt->last_level == 0); + assert(mt->ms_x == 0 && + mt->ms_y == 0); + assert(!util_format_is_compressed(pt->format)); + + assert(nby > 8); + mt->level[0].tile_mode = 0x10; + mt->level[0].pitch = align(nbx * blocksize, 64); + mt->total_size = align(nby, 16) * mt->level[0].pitch; + + if (pt->array_size > 1) { + mt->layer_stride = align(mt->total_size, NVC0_TILE_SIZE(0x10)); + mt->total_size = mt->layer_stride * pt->array_size; + } +} + static void nvc0_miptree_init_layout_tiled(struct nv50_miptree *mt) { @@ -271,6 +296,9 @@ nvc0_miptree_create(struct pipe_screen *pscreen, return NULL; } + if (unlikely(pt->flags & NVC0_RESOURCE_FLAG_VIDEO)) { + nvc0_miptree_init_layout_video(mt); + } else if (tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) { nvc0_miptree_init_layout_tiled(mt); } else diff --git a/src/gallium/drivers/nvc0/nvc0_resource.h b/src/gallium/drivers/nvc0/nvc0_resource.h index 6d946c83834..41b1667b2e4 100644 --- a/src/gallium/drivers/nvc0/nvc0_resource.h +++ b/src/gallium/drivers/nvc0/nvc0_resource.h @@ -4,6 +4,8 @@ #include "nv50/nv50_resource.h" +#define NVC0_RESOURCE_FLAG_VIDEO (NOUVEAU_RESOURCE_FLAG_DRV_PRIV << 0) + #define NVC0_TILE_SHIFT_X(m) ((((m) >> 0) & 0xf) + 6) #define NVC0_TILE_SHIFT_Y(m) ((((m) >> 4) & 0xf) + 3)