diff options
author | Christoph Bumiller <[email protected]> | 2011-12-18 22:34:50 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2011-12-18 22:37:45 +0100 |
commit | f20261028843a4c5d572e0001b813f7c786a2f12 (patch) | |
tree | 99d45925127d28f1e9ff07395fe3b1ac4bfcf209 /src/gallium/drivers | |
parent | 3788b4b5c942b2346bf122486b687c632ab7eac4 (diff) |
nvc0: add NVC0_RESOURCE_FLAG_VIDEO
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_miptree.c | 28 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_resource.h | 2 |
2 files changed, 30 insertions, 0 deletions
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 @@ -188,6 +188,31 @@ 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) { struct pipe_resource *pt = &mt->base.base; @@ -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) |