diff options
author | Christian König <[email protected]> | 2013-07-15 01:50:24 -0600 |
---|---|---|
committer | Christian König <[email protected]> | 2013-08-19 10:21:14 +0200 |
commit | 53e20b8b418cc85e13d70f41ce160e17847a5096 (patch) | |
tree | fab98050b72995f12e7126c3df148d5aaab77415 /src/gallium/drivers/nvc0/nvc0_video.c | |
parent | d13003f544417db6de44c65a0c118bd2b189458a (diff) |
vl: use a template for create_video_decoder
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nvc0/nvc0_video.c')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_video.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_video.c b/src/gallium/drivers/nvc0/nvc0_video.c index 5891f0909d6..1b2dcd18ffc 100644 --- a/src/gallium/drivers/nvc0/nvc0_video.c +++ b/src/gallium/drivers/nvc0/nvc0_video.c @@ -58,11 +58,7 @@ nvc0_decoder_decode_bitstream(struct pipe_video_decoder *decoder, struct pipe_video_decoder * nvc0_create_decoder(struct pipe_context *context, - enum pipe_video_profile profile, - enum pipe_video_entrypoint entrypoint, - enum pipe_video_chroma_format chroma_format, - unsigned width, unsigned height, unsigned max_references, - bool chunked_decode) + const struct pipe_video_decoder *templ) { struct nouveau_screen *screen = &((struct nvc0_context *)context)->screen->base; struct nouveau_vp3_decoder *dec; @@ -79,12 +75,10 @@ nvc0_create_decoder(struct pipe_context *context, u32 tmp_size = 0; if (getenv("XVMC_VL")) - return vl_create_decoder(context, profile, entrypoint, - chroma_format, width, height, - max_references, chunked_decode); + return vl_create_decoder(context, templ); - if (entrypoint != PIPE_VIDEO_ENTRYPOINT_BITSTREAM) { - debug_printf("%x\n", entrypoint); + if (templ->entrypoint != PIPE_VIDEO_ENTRYPOINT_BITSTREAM) { + debug_printf("%x\n", templ->entrypoint); return NULL; } @@ -168,13 +162,8 @@ nvc0_create_decoder(struct pipe_context *context, BEGIN_NVC0(push[2], SUBC_PPP(NV01_SUBCHAN_OBJECT), 1); PUSH_DATA (push[2], dec->ppp->handle); + dec->base = *templ; dec->base.context = context; - dec->base.profile = profile; - dec->base.entrypoint = entrypoint; - dec->base.chroma_format = chroma_format; - dec->base.width = width; - dec->base.height = height; - dec->base.max_references = max_references; dec->base.decode_bitstream = nvc0_decoder_decode_bitstream; for (i = 0; i < NOUVEAU_VP3_VIDEO_QDEPTH && !ret; ++i) @@ -194,29 +183,29 @@ nvc0_create_decoder(struct pipe_context *context, if (ret) goto fail; - switch (u_reduce_video_profile(profile)) { + switch (u_reduce_video_profile(templ->profile)) { case PIPE_VIDEO_CODEC_MPEG12: { codec = 1; - assert(max_references <= 2); + assert(templ->max_references <= 2); break; } case PIPE_VIDEO_CODEC_MPEG4: { codec = 4; - tmp_size = mb(height)*16 * mb(width)*16; - assert(max_references <= 2); + tmp_size = mb(templ->height)*16 * mb(templ->width)*16; + assert(templ->max_references <= 2); break; } case PIPE_VIDEO_CODEC_VC1: { ppp_codec = codec = 2; - tmp_size = mb(height)*16 * mb(width)*16; - assert(max_references <= 2); + tmp_size = mb(templ->height)*16 * mb(templ->width)*16; + assert(templ->max_references <= 2); break; } case PIPE_VIDEO_CODEC_MPEG4_AVC: { codec = 3; - dec->tmp_stride = 16 * mb_half(width) * nouveau_vp3_video_align(height) * 3 / 2; - tmp_size = dec->tmp_stride * (max_references + 1); - assert(max_references <= 16); + dec->tmp_stride = 16 * mb_half(templ->width) * nouveau_vp3_video_align(templ->height) * 3 / 2; + tmp_size = dec->tmp_stride * (templ->max_references + 1); + assert(templ->max_references <= 16); break; } default: @@ -230,7 +219,7 @@ nvc0_create_decoder(struct pipe_context *context, if (ret) goto fail; - ret = nouveau_vp3_load_firmware(dec, profile, screen->device->chipset); + ret = nouveau_vp3_load_firmware(dec, templ->profile, screen->device->chipset); if (ret) goto fw_fail; } @@ -242,9 +231,9 @@ nvc0_create_decoder(struct pipe_context *context, goto fail; } - dec->ref_stride = mb(width)*16 * (mb_half(height)*32 + nouveau_vp3_video_align(height)/2); + dec->ref_stride = mb(templ->width)*16 * (mb_half(templ->height)*32 + nouveau_vp3_video_align(templ->height)/2); ret = nouveau_bo_new(screen->device, NOUVEAU_BO_VRAM, 0, - dec->ref_stride * (max_references+2) + tmp_size, + dec->ref_stride * (templ->max_references+2) + tmp_size, &cfg, &dec->ref_bo); if (ret) goto fail; |