From 8edb79f1ef95581c20ed0c3dc49aabe99d7f072a Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Thu, 1 Aug 2013 12:50:10 -0400 Subject: [PATCH] nv50: fix some h264 interlaced decoding on vp2 Some videos specify mb_adaptive_frame_field_flag instead of field_pic_flag. This implies that the pic height needs to be halved, and this field needs to be passed to the VP engine. Cc: "9.2" mesa-stable@lists.freedesktop.org Signed-off-by: Ilia Mirkin --- src/gallium/drivers/nv50/nv84_video_bsp.c | 3 +-- src/gallium/drivers/nv50/nv84_video_vp.c | 12 +++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/nv50/nv84_video_bsp.c b/src/gallium/drivers/nv50/nv84_video_bsp.c index 7885210e94d..28ba90f34dc 100644 --- a/src/gallium/drivers/nv50/nv84_video_bsp.c +++ b/src/gallium/drivers/nv50/nv84_video_bsp.c @@ -136,12 +136,11 @@ nv84_decoder_bsp(struct nv84_decoder *dec, params.iseqparm.chroma_format_idc = 1; params.iseqparm.pic_width_in_mbs_minus1 = mb(dec->base.width) - 1; - if (desc->field_pic_flag) + if (desc->field_pic_flag || desc->mb_adaptive_frame_field_flag) params.iseqparm.pic_height_in_map_units_minus1 = mb_half(dec->base.height) - 1; else params.iseqparm.pic_height_in_map_units_minus1 = mb(dec->base.height) - 1; - /* TODO: interlaced still doesn't work, maybe due to ref frame management. */ if (desc->bottom_field_flag) params.ipicparm.curr_pic_order_cnt = desc->field_order_cnt[1]; else diff --git a/src/gallium/drivers/nv50/nv84_video_vp.c b/src/gallium/drivers/nv50/nv84_video_vp.c index e968546ae7b..581361b71d7 100644 --- a/src/gallium/drivers/nv50/nv84_video_vp.c +++ b/src/gallium/drivers/nv50/nv84_video_vp.c @@ -39,10 +39,10 @@ struct h264_iparm1 { uint32_t h1; // 1fc uint32_t h2; // 200 uint32_t h3; // 204 - uint32_t unk208; - uint32_t field_pic_flag; - uint32_t format; - uint32_t unk214; + uint32_t mb_adaptive_frame_field_flag; // 208 + uint32_t field_pic_flag; // 20c + uint32_t format; // 210 + uint32_t unk214; // 214 }; struct h264_iparm2 { @@ -56,7 +56,7 @@ struct h264_iparm2 { uint32_t h2; // 1c uint32_t h3; // 20 uint32_t unk24; - uint32_t unk28; + uint32_t mb_adaptive_frame_field_flag; // 28 uint32_t top; // 2c uint32_t bottom; // 30 uint32_t is_reference; // 34 @@ -100,6 +100,7 @@ nv84_decoder_vp_h264(struct nv84_decoder *dec, param1.height = param1.h2 = height; param1.h1 = param1.h3 = align(height, 32); param1.format = 0x3231564e; /* 'NV12' */ + param1.mb_adaptive_frame_field_flag = desc->mb_adaptive_frame_field_flag; param1.field_pic_flag = desc->field_pic_flag; param2.width = width; @@ -115,6 +116,7 @@ nv84_decoder_vp_h264(struct nv84_decoder *dec, param2.top = desc->bottom_field_flag ? 2 : 1; param2.bottom = desc->bottom_field_flag; } + param2.mb_adaptive_frame_field_flag = desc->mb_adaptive_frame_field_flag; param2.is_reference = desc->is_reference; PUSH_SPACE(push, 5 + 16 + 3 + 2 + 6 + (is_ref ? 2 : 0) + 3 + 2 + 4 + 2);