Ilia Mirkin
2013-Aug-10 10:39 UTC
[Nouveau] [PATCH 1/4] nouveau: fix number of surfaces in video buffer, use defines
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu> --- The pipe_surface miscount caused issues for my (failed) attempt at getting vdpau to work with pmpeg. src/gallium/drivers/nouveau/nouveau_video.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_video.h b/src/gallium/drivers/nouveau/nouveau_video.h index 1d6ced0..be53758 100644 --- a/src/gallium/drivers/nouveau/nouveau_video.h +++ b/src/gallium/drivers/nouveau/nouveau_video.h @@ -10,10 +10,10 @@ struct nouveau_video_buffer { struct pipe_video_buffer base; unsigned num_planes; - struct pipe_resource *resources[3]; - struct pipe_sampler_view *sampler_view_planes[3]; - struct pipe_sampler_view *sampler_view_components[3]; - struct pipe_surface *surfaces[3]; + struct pipe_resource *resources[VL_NUM_COMPONENTS]; + struct pipe_sampler_view *sampler_view_planes[VL_NUM_COMPONENTS]; + struct pipe_sampler_view *sampler_view_components[VL_NUM_COMPONENTS]; + struct pipe_surface *surfaces[VL_NUM_COMPONENTS * 2]; }; struct nouveau_decoder { -- 1.8.1.5
Ilia Mirkin
2013-Aug-10 10:39 UTC
[Nouveau] [PATCH 2/4] nouveau: set buffer format of video buffer
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu> --- I don't think anything looks at this right now, but seems good to store. (Also ran into it with my vdpau attempt.) src/gallium/drivers/nouveau/nouveau_video.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c index 9357508..2e7f9b1 100644 --- a/src/gallium/drivers/nouveau/nouveau_video.c +++ b/src/gallium/drivers/nouveau/nouveau_video.c @@ -810,6 +810,7 @@ nouveau_video_buffer_create(struct pipe_context *pipe, buffer->base.get_sampler_view_components = nouveau_video_buffer_sampler_view_components; buffer->base.get_surfaces = nouveau_video_buffer_surfaces; buffer->base.chroma_format = templat->chroma_format; + buffer->base.buffer_format = templat->buffer_format; buffer->base.width = width; buffer->base.height = height; buffer->num_planes = 2; -- 1.8.1.5
Ilia Mirkin
2013-Aug-10 10:39 UTC
[Nouveau] [PATCH 3/4] 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 at alum.mit.edu> --- Tested this on both nv44 and nv96, and it works, all at the same time. Without the 0x72 command, they default to different scan orders. Putting the 0x72 command only at the beginning (in nouveau_vpe_init) seemed to cause pmpeg to hang. src/gallium/drivers/nouveau/nouveau_video.c | 27 ++++++++++++--------------- src/gallium/drivers/nv30/nv30_context.c | 2 ++ src/gallium/drivers/nv30/nv30_screen.c | 1 + 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 2e7f9b1..cbe2477 100644 --- a/src/gallium/drivers/nouveau/nouveau_video.c +++ b/src/gallium/drivers/nouveau/nouveau_video.c @@ -108,21 +108,10 @@ nouveau_vpe_mb_dct_blocks(struct nouveau_decoder *dec, const struct pipe_mpeg12_ 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) @@ -443,6 +432,11 @@ nouveau_decoder_decode_macroblock(struct pipe_video_decoder *decoder, 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) { @@ -528,6 +522,8 @@ nouveau_create_decoder(struct pipe_context *context, 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) @@ -793,7 +789,8 @@ nouveau_video_buffer_create(struct pipe_context *pipe, * 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); diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c index bd05042..e872c02 100644 --- a/src/gallium/drivers/nv30/nv30_context.c +++ b/src/gallium/drivers/nv30/nv30_context.c @@ -257,5 +257,7 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv) 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 3d55d6f..40e8b5f 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -377,6 +377,7 @@ nv30_screen_create(struct nouveau_device *dev) 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; -- 1.8.1.5
Ilia Mirkin
2013-Aug-10 10:39 UTC
[Nouveau] [PATCH 4/4] nv50: allow forcing PMPEG use, for ease of testing
This also allows people who don't want to install the binary blobs required for VP2 to still get MPEG decoding. Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu> --- src/gallium/drivers/nv50/nv50_context.c | 3 ++- src/gallium/drivers/nv50/nv50_screen.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index 79a0473..185d241 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -258,7 +258,8 @@ nv50_create(struct pipe_screen *pscreen, void *priv) draw_set_rasterize_stage(nv50->draw, nv50_draw_render_stage(nv50)); #endif - if (screen->base.device->chipset < 0x84) { + if (screen->base.device->chipset < 0x84 || + debug_get_bool_option("NOUVEAU_PMPEG", FALSE)) { /* PMPEG */ nouveau_context_init_vdec(&nv50->base); } else if (screen->base.device->chipset < 0x98 || diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 2951eb4..0cbee5d 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -647,7 +647,8 @@ nv50_screen_create(struct nouveau_device *dev) nv50_screen_init_resource_functions(pscreen); - if (screen->base.device->chipset < 0x84) { + if (screen->base.device->chipset < 0x84 || + debug_get_bool_option("NOUVEAU_PMPEG", FALSE)) { /* PMPEG */ nouveau_screen_init_vdec(&screen->base); } else if (screen->base.device->chipset < 0x98 || -- 1.8.1.5
Reasonably Related Threads
- [PATCH] nv50: H.264/MPEG2 decoding support via VP2, available on NV84-NV96, NVA0
- [PATCH 1/2] nv30: hook up PMPEG support via nouveau_video, enables XvMC to work
- [PATCH] nv50: H.264/MPEG2 decoding support via VP2, available on NV84-NV96, NVA0
- [PATCH] nv50: H.264/MPEG2 decoding support via VP2, available on NV84-NV96, NVA0
- [PATCH 00/10] Add support for MPEG2 and VC-1 on VP3/VP4 for NV98-NVAF