Mesa (master): nvc0: add NVC0_RESOURCE_FLAG_VIDEO

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Sun Dec 18 21:39:09 UTC 2011


Module: Mesa
Branch: master
Commit: f20261028843a4c5d572e0001b813f7c786a2f12
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f20261028843a4c5d572e0001b813f7c786a2f12

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Sun Dec 18 22:34:50 2011 +0100

nvc0: add NVC0_RESOURCE_FLAG_VIDEO

---

 src/gallium/drivers/nvc0/nvc0_miptree.c  |   28 ++++++++++++++++++++++++++++
 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 a9d2c85..b180fc8 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 6d946c8..41b1667 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)




More information about the mesa-commit mailing list