vidc: vdec: Report dropped field for interlace clips.
For field based interlace clips, video core will generate
an error when one of field is missing in bitstream.
Driver will report this to upper layer, so that it can
take appropriate action.
CRs-fixed: 290659
Signed-off-by: Gopikrishnaiah Anandan <gopikr@codeaurora.org>
diff --git a/drivers/video/msm/vidc/common/dec/vdec.c b/drivers/video/msm/vidc/common/dec/vdec.c
index 6b55078..3dc74f1 100644
--- a/drivers/video/msm/vidc/common/dec/vdec.c
+++ b/drivers/video/msm/vidc/common/dec/vdec.c
@@ -140,6 +140,42 @@
ERR("%s(): ERROR. client_ctx is NULL\n", __func__);
}
+static void vid_dec_handle_field_drop(struct video_client_ctx *client_ctx,
+ u32 event, u32 status, int64_t time_stamp)
+{
+ struct vid_dec_msg *vdec_msg;
+
+ if (!client_ctx) {
+ ERR("%s() NULL pointer\n", __func__);
+ return;
+ }
+
+ vdec_msg = kzalloc(sizeof(struct vid_dec_msg), GFP_KERNEL);
+ if (!vdec_msg) {
+ ERR("%s(): cannot allocate vid_dec_msg "
+ " buffer\n", __func__);
+ return;
+ }
+ vdec_msg->vdec_msg_info.status_code = vid_dec_get_status(status);
+ if (event == VCD_EVT_IND_INFO_FIELD_DROPPED) {
+ vdec_msg->vdec_msg_info.msgcode =
+ VDEC_MSG_EVT_INFO_FIELD_DROPPED;
+ vdec_msg->vdec_msg_info.msgdata.output_frame.time_stamp
+ = time_stamp;
+ DBG("Send FIELD_DROPPED message to client = %p\n", client_ctx);
+ } else {
+ ERR("vid_dec_input_frame_done(): invalid event type: "
+ "%d\n", event);
+ vdec_msg->vdec_msg_info.msgcode = VDEC_MSG_INVALID;
+ }
+ vdec_msg->vdec_msg_info.msgdatasize =
+ sizeof(struct vdec_output_frameinfo);
+ mutex_lock(&client_ctx->msg_queue_lock);
+ list_add_tail(&vdec_msg->list, &client_ctx->msg_queue);
+ mutex_unlock(&client_ctx->msg_queue_lock);
+ wake_up(&client_ctx->msg_wait);
+}
+
static void vid_dec_input_frame_done(struct video_client_ctx *client_ctx,
u32 event, u32 status,
struct vcd_frame_data *vcd_frame_data)
@@ -411,6 +447,13 @@
vid_dec_input_frame_done(client_ctx, event, status,
(struct vcd_frame_data *)info);
break;
+ case VCD_EVT_IND_INFO_FIELD_DROPPED:
+ if (info)
+ vid_dec_handle_field_drop(client_ctx, event,
+ status, *((int64_t *)info));
+ else
+ pr_err("Wrong Payload for Field dropped\n");
+ break;
case VCD_EVT_RESP_OUTPUT_DONE:
case VCD_EVT_RESP_OUTPUT_FLUSHED:
vid_dec_output_frame_done(client_ctx, event, status,
diff --git a/drivers/video/msm/vidc/common/vcd/vcd_status.h b/drivers/video/msm/vidc/common/vcd/vcd_status.h
index 807718f..1a36167 100644
--- a/drivers/video/msm/vidc/common/vcd/vcd_status.h
+++ b/drivers/video/msm/vidc/common/vcd/vcd_status.h
@@ -32,6 +32,7 @@
#define VCD_EVT_IND_HWERRFATAL (VCD_EVT_IND_BASE + 0x3)
#define VCD_EVT_IND_RESOURCES_LOST (VCD_EVT_IND_BASE + 0x4)
#define VCD_EVT_IND_INFO_OUTPUT_RECONFIG (VCD_EVT_IND_BASE + 0x5)
+#define VCD_EVT_IND_INFO_FIELD_DROPPED (VCD_EVT_IND_BASE + 0x6)
#define VCD_S_SUCCESS 0x0
diff --git a/drivers/video/msm/vidc/common/vcd/vcd_sub.c b/drivers/video/msm/vidc/common/vcd/vcd_sub.c
index c657e46..5c8d71d 100644
--- a/drivers/video/msm/vidc/common/vcd/vcd_sub.c
+++ b/drivers/video/msm/vidc/common/vcd/vcd_sub.c
@@ -2032,6 +2032,7 @@
(struct ddl_frame_data_tag *) payload;
struct vcd_transc *transc;
u32 rc;
+ s64 time_stamp;
rc = vcd_validate_io_done_pyld(cctxt, payload, status);
if (rc == VCD_ERR_CLIENT_FATAL)
@@ -2079,8 +2080,10 @@
transc->frame = op_frm->vcd_frm.frame;
transc->frame_done = true;
- if (transc->input_done && transc->frame_done)
+ if (transc->input_done && transc->frame_done) {
+ time_stamp = transc->time_stamp;
vcd_release_trans_tbl_entry(transc);
+ }
if (status == VCD_ERR_INTRLCD_FIELD_DROP ||
(op_frm->vcd_frm.intrlcd_ip_frm_tag !=
@@ -2088,6 +2091,13 @@
op_frm->vcd_frm.intrlcd_ip_frm_tag)) {
vcd_handle_frame_done_for_interlacing(cctxt, transc,
op_frm, status);
+ if (status == VCD_ERR_INTRLCD_FIELD_DROP) {
+ cctxt->callback(VCD_EVT_IND_INFO_FIELD_DROPPED,
+ VCD_S_SUCCESS,
+ &time_stamp,
+ sizeof(time_stamp),
+ cctxt, cctxt->client_data);
+ }
}
if (status != VCD_ERR_INTRLCD_FIELD_DROP) {
diff --git a/include/linux/msm_vidc_dec.h b/include/linux/msm_vidc_dec.h
index d127a3b..748c590 100644
--- a/include/linux/msm_vidc_dec.h
+++ b/include/linux/msm_vidc_dec.h
@@ -57,6 +57,7 @@
#define VDEC_MSG_EVT_CONFIG_CHANGED (VDEC_MSG_BASE + 13)
#define VDEC_MSG_EVT_HW_ERROR (VDEC_MSG_BASE + 14)
#define VDEC_MSG_EVT_INFO_CONFIG_CHANGED (VDEC_MSG_BASE + 15)
+#define VDEC_MSG_EVT_INFO_FIELD_DROPPED (VDEC_MSG_BASE + 16)
/*Buffer flags bits masks.*/
#define VDEC_BUFFERFLAG_EOS 0x00000001