aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50/nv50_miptree.c
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2013-07-16 17:50:43 -0400
committerMaarten Lankhorst <[email protected]>2013-07-18 07:52:32 +0200
commitfbdae1ca41946af374c7924fd4c296199172890d (patch)
treec5cbfa59180eb586e0efebd9a99fa5c4e23dd276 /src/gallium/drivers/nv50/nv50_miptree.c
parentf96c07abf6ded1ac07a1e8fe3952321ec170193d (diff)
nv50: H.264/MPEG2 decoding support via VP2, available on NV84-NV96, NVA0
Adds H.264 and MPEG2 codec support via VP2, using firmware from the blob. Acceleration is supported at the bitstream level for H.264 and IDCT level for MPEG2. Known issues: - H.264 interlaced doesn't render properly - H.264 shows very occasional artifacts on a small fraction of videos - MPEG2 + VDPAU shows frequent but small artifacts, which aren't there when using XvMC on the same videos Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_miptree.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_miptree.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 036f1c733c7..28be76872f0 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -239,6 +239,28 @@ nv50_miptree_init_layout_linear(struct nv50_miptree *mt, unsigned pitch_align)
}
static void
+nv50_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);
+
+ assert(pt->last_level == 0);
+ assert(mt->ms_x == 0 && mt->ms_y == 0);
+ assert(!util_format_is_compressed(pt->format));
+
+ mt->layout_3d = pt->target == PIPE_TEXTURE_3D;
+
+ mt->level[0].tile_mode = 0x20;
+ mt->level[0].pitch = align(pt->width0 * blocksize, 64);
+ mt->total_size = align(pt->height0, 16) * mt->level[0].pitch * (mt->layout_3d ? pt->depth0 : 1);
+
+ if (pt->array_size > 1) {
+ mt->layer_stride = align(mt->total_size, NV50_TILE_SIZE(0x20));
+ mt->total_size = mt->layer_stride * pt->array_size;
+ }
+}
+
+static void
nv50_miptree_init_layout_tiled(struct nv50_miptree *mt)
{
struct pipe_resource *pt = &mt->base.base;
@@ -311,6 +333,11 @@ nv50_miptree_create(struct pipe_screen *pscreen,
return NULL;
}
+ if (unlikely(pt->flags & NV50_RESOURCE_FLAG_VIDEO)) {
+ nv50_miptree_init_layout_video(mt);
+ /* BO allocation done by client */
+ return pt;
+ } else
if (bo_config.nv50.memtype != 0) {
nv50_miptree_init_layout_tiled(mt);
} else