summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2013-07-02 17:33:41 -0400
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>2013-08-15 15:15:12 +0200
commitee3ca3614ee55ed42bd8f78c62b7eaabb2a0fbe2 (patch)
tree1f896e0bb9a75ff481bd38f600463b4e771f53da
parent6010c683d054d75ae2afca48c8c894f0129a9e0f (diff)
nv30: hook up PMPEG support via nouveau_video, enables XvMC to work
Force the format to be the reasonable format that doesn't require an inverse z-scan. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
-rw-r--r--src/gallium/drivers/nouveau/nouveau_video.c27
-rw-r--r--src/gallium/drivers/nv30/nv30_context.c2
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c1
3 files changed, 15 insertions, 15 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c
index 5377872077c..0fdc3cefa1d 100644
--- a/src/gallium/drivers/nouveau/nouveau_video.c
+++ b/src/gallium/drivers/nouveau/nouveau_video.c
@@ -105,27 +105,16 @@ nouveau_vpe_mb_dct_blocks(struct nouveau_decoder *dec, const struct pipe_mpeg12_
{
int cbb;
unsigned cbp = mb->coded_block_pattern;
short *db = mb->blocks;
for (cbb = 0x20; cbb > 0; cbb >>= 1) {
if (cbb & cbp) {
- static const int lookup[64] = {
- 0, 1, 8,16, 9, 2, 3,10,
- 17,24,32,25,18,11, 4, 5,
- 12,19,26,33,40,48,41,34,
- 27,20,13, 6, 7,14,21,28,
- 35,42,49,56,57,50,43,36,
- 29,22,15,23,30,37,44,51,
- 58,59,52,45,38,31,39,46,
- 53,60,61,54,47,55,62,63
- };
- int i, j = 0, found = 0;
+ int i, found = 0;
for (i = 0; i < 64; ++i) {
- if (!db[lookup[i]]) { j += 2; continue; }
- dec->data[dec->data_pos++] = (db[lookup[i]] << 16) | j;
- j = 0;
+ if (!db[i]) continue;
+ dec->data[dec->data_pos++] = (db[i] << 16) | (i * 2);
found = 1;
}
if (found)
dec->data[dec->data_pos - 1] |= 1;
else
dec->data[dec->data_pos++] = 1;
@@ -440,12 +429,17 @@ nouveau_decoder_decode_macroblock(struct pipe_video_decoder *decoder,
if (desc->ref[1])
dec->future = nouveau_decoder_surface_index(dec, desc->ref[1]);
if (desc->ref[0])
dec->past = nouveau_decoder_surface_index(dec, desc->ref[0]);
if (nouveau_vpe_init(dec)) return;
+
+ /* initialize scan order */
+ nouveau_vpe_write(dec, 0x720000c0);
+ nouveau_vpe_write(dec, dec->data_pos);
+
mb = (const struct pipe_mpeg12_macroblock *)pipe_mb;
for (i = 0; i < num_macroblocks; ++i, mb++) {
if (mb->macroblock_type & PIPE_MPEG12_MB_TYPE_INTRA) {
nouveau_vpe_mb_dct_header(dec, mb, TRUE);
nouveau_vpe_mb_dct_header(dec, mb, FALSE);
} else {
@@ -525,12 +519,14 @@ nouveau_create_decoder(struct pipe_context *context,
if (getenv("XVMC_VL"))
goto vl;
if (u_reduce_video_profile(profile) != PIPE_VIDEO_CODEC_MPEG12)
goto vl;
if (screen->device->chipset >= 0x98 && screen->device->chipset != 0xa0)
goto vl;
+ if (screen->device->chipset < 0x31 || screen->device->chipset == 0x35)
+ goto vl;
dec = CALLOC_STRUCT(nouveau_decoder);
if (!dec)
return NULL;
ret = nouveau_object_new(&screen->device->object, 0,
@@ -790,13 +786,14 @@ nouveau_video_buffer_create(struct pipe_context *pipe,
/* Only do a linear surface when a hardware decoder is used
* hardware decoder is only supported on some chipsets
* and it only supports the NV12 format
*/
if (templat->buffer_format != PIPE_FORMAT_NV12 || getenv("XVMC_VL") ||
- (screen->device->chipset >= 0x98 && screen->device->chipset != 0xa0))
+ (screen->device->chipset >= 0x98 && screen->device->chipset != 0xa0) ||
+ screen->device->chipset < 0x31 || screen->device->chipset == 0x35)
return vl_video_buffer_create(pipe, templat);
assert(templat->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420);
width = align(templat->width, 64);
height = align(templat->height, 64);
diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c
index bd05042ca22..e872c027ae3 100644
--- a/src/gallium/drivers/nv30/nv30_context.c
+++ b/src/gallium/drivers/nv30/nv30_context.c
@@ -254,8 +254,10 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv)
nv30->blitter = util_blitter_create(pipe);
if (!nv30->blitter) {
nv30_context_destroy(pipe);
return NULL;
}
+ nouveau_context_init_vdec(&nv30->base);
+
return pipe;
}
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index 3d55d6fd649..40e8b5fbbfc 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -374,12 +374,13 @@ nv30_screen_create(struct nouveau_device *dev)
pscreen->get_param = nv30_screen_get_param;
pscreen->get_paramf = nv30_screen_get_paramf;
pscreen->get_shader_param = nv30_screen_get_shader_param;
pscreen->context_create = nv30_context_create;
pscreen->is_format_supported = nv30_screen_is_format_supported;
nv30_resource_screen_init(pscreen);
+ nouveau_screen_init_vdec(&screen->base);
screen->base.fence.emit = nv30_screen_fence_emit;
screen->base.fence.update = nv30_screen_fence_update;
ret = nouveau_screen_init(&screen->base, dev);
if (ret)