The nv84 code (vp2) - bitstream h264 - idct and bitstream mpeg12 Generic video (vpe2) - mc and idct mpeg12
v2: Drop extra brackets, assert on incorrect video format. Reviewed-by: Ilia Mirkin <imir...@alum.mit.edu> Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com> --- src/gallium/drivers/nouveau/nouveau_video.c | 15 ++++++++------ src/gallium/drivers/nouveau/nv50/nv84_video.c | 28 ++++++++++++++++++++------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c index 8795c9d..d686d2d 100644 --- a/src/gallium/drivers/nouveau/nouveau_video.c +++ b/src/gallium/drivers/nouveau/nouveau_video.c @@ -510,13 +510,11 @@ nouveau_create_decoder(struct pipe_context *context, int ret; bool is8274 = screen->device->chipset > 0x80; - debug_printf("Acceleration level: %s\n", templ->entrypoint <= PIPE_VIDEO_ENTRYPOINT_BITSTREAM ? "bit": - templ->entrypoint == PIPE_VIDEO_ENTRYPOINT_IDCT ? "IDCT" : "MC"); + debug_printf("Acceleration level: %s\n", templ->entrypoint == PIPE_VIDEO_ENTRYPOINT_IDCT ? "IDCT" : "MC"); if (getenv("XVMC_VL")) goto vl; - if (u_reduce_video_profile(templ->profile) != PIPE_VIDEO_FORMAT_MPEG12) - goto vl; + assert(u_reduce_video_profile(templ->profile) == PIPE_VIDEO_FORMAT_MPEG12); if (screen->device->chipset >= 0x98 && screen->device->chipset != 0xa0) goto vl; if (screen->device->chipset < 0x40) @@ -838,8 +836,13 @@ nouveau_screen_get_video_param(struct pipe_screen *pscreen, { switch (param) { case PIPE_VIDEO_CAP_SUPPORTED: - return entrypoint >= PIPE_VIDEO_ENTRYPOINT_IDCT && - u_reduce_video_profile(profile) == PIPE_VIDEO_FORMAT_MPEG12; + switch (entrypoint) { + case PIPE_VIDEO_ENTRYPOINT_IDCT: + case PIPE_VIDEO_ENTRYPOINT_MC: + return u_reduce_video_profile(profile) == PIPE_VIDEO_FORMAT_MPEG12; + default: + return 0; + } case PIPE_VIDEO_CAP_NPOT_TEXTURES: return 1; case PIPE_VIDEO_CAP_MAX_WIDTH: diff --git a/src/gallium/drivers/nouveau/nv50/nv84_video.c b/src/gallium/drivers/nouveau/nv50/nv84_video.c index a39f572..36b0077 100644 --- a/src/gallium/drivers/nouveau/nv50/nv84_video.c +++ b/src/gallium/drivers/nouveau/nv50/nv84_video.c @@ -280,10 +280,16 @@ nv84_create_decoder(struct pipe_context *context, if (getenv("XVMC_VL")) return vl_create_decoder(context, templ); - if ((is_h264 && templ->entrypoint != PIPE_VIDEO_ENTRYPOINT_BITSTREAM) || - (is_mpeg12 && templ->entrypoint > PIPE_VIDEO_ENTRYPOINT_IDCT)) { - debug_printf("%x\n", templ->entrypoint); - return NULL; + switch (templ->entrypoint) { + case PIPE_VIDEO_ENTRYPOINT_BITSTREAM: + assert(is_mpeg12 || is_h264); + break; + case PIPE_VIDEO_ENTRYPOINT_IDCT: + assert(is_mpeg12); + break; + default: + assert(!"Unsupported video entrypoint"); + break; } if (!is_h264 && !is_mpeg12) { @@ -812,9 +818,17 @@ nv84_screen_get_video_param(struct pipe_screen *pscreen, switch (param) { case PIPE_VIDEO_CAP_SUPPORTED: codec = u_reduce_video_profile(profile); - return (codec == PIPE_VIDEO_FORMAT_MPEG4_AVC || - codec == PIPE_VIDEO_FORMAT_MPEG12) && - firmware_present(pscreen, codec); + switch (codec) { + case PIPE_VIDEO_FORMAT_MPEG12: + return (entrypoint == PIPE_VIDEO_ENTRYPOINT_BITSTREAM || + entrypoint == PIPE_VIDEO_ENTRYPOINT_IDCT) && + firmware_present(pscreen, codec); + case PIPE_VIDEO_FORMAT_MPEG4_AVC: + return (entrypoint == PIPE_VIDEO_ENTRYPOINT_BITSTREAM) && + firmware_present(pscreen, codec); + default: + return 0; + } case PIPE_VIDEO_CAP_NPOT_TEXTURES: return 1; case PIPE_VIDEO_CAP_MAX_WIDTH: -- 1.9.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev