msm: vidc: Add support for video decoder extradata
Add support for timeinfo and aspect ratio extradata
by setting the corresponding properties to Venus FW.
Change-Id: Ie33a451c8088d4bfe169c770fa054a73cdfcf78f
Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
[smuckle@codeaurora.org: backported from msm-3.7]
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
diff --git a/drivers/media/platform/msm/vidc/hfi_packetization.c b/drivers/media/platform/msm/vidc/hfi_packetization.c
index 787b30d..44e23ed 100644
--- a/drivers/media/platform/msm/vidc/hfi_packetization.c
+++ b/drivers/media/platform/msm/vidc/hfi_packetization.c
@@ -215,8 +215,8 @@
case HAL_EXTRADATA_NUM_CONCEALED_MB:
ret = HFI_PROPERTY_PARAM_VDEC_NUM_CONCEALED_MB;
break;
- case HAL_EXTRADATA_INDEX:
- ret = HFI_PROPERTY_PARAM_EXTRA_DATA_HEADER_CONFIG;
+ case HAL_EXTRADATA_ASPECT_RATIO:
+ ret = HFI_PROPERTY_PARAM_INDEX_EXTRADATA;
break;
default:
dprintk(VIDC_WARN, "Extradata index not found: %d\n", index);
@@ -1056,7 +1056,10 @@
(struct hfi_index_extradata_config *)
&pkt->rg_property_data[1];
hfi->enable = extra->enable;
- index = get_hfi_extradata_index(extra->index);
+ if (extra->index == HAL_EXTRADATA_ASPECT_RATIO)
+ index = EXTRADATA_ASPECT_RATIO;
+ else
+ index = get_hfi_extradata_index(extra->index);
if (index)
hfi->index_extra_data_id = index;
else {
diff --git a/drivers/media/platform/msm/vidc/msm_vidc_common.c b/drivers/media/platform/msm/vidc/msm_vidc_common.c
index 75affed..4f3c338 100644
--- a/drivers/media/platform/msm/vidc/msm_vidc_common.c
+++ b/drivers/media/platform/msm/vidc/msm_vidc_common.c
@@ -668,7 +668,7 @@
if (inst->session_type == MSM_VIDC_ENCODER)
goto exit;
if (cur_time_stamp >= LLONG_MAX) {
- dprintk(VIDC_WARN,
+ dprintk(VIDC_DBG,
"Clock scaling failed : Timestamp invalid\n");
goto exit;
}
@@ -1621,6 +1621,9 @@
dprintk(VIDC_DBG,
"Received CODECCONFIG on output cap\n");
}
+ if (vb->v4l2_buf.flags &
+ V4L2_QCOM_BUF_TIMESTAMP_INVALID)
+ frame_data.timestamp = LLONG_MAX;
dprintk(VIDC_DBG,
"Sending etb to hal: Alloc: %d :filled: %d\n",
frame_data.alloc_len, frame_data.filled_len);
@@ -2222,6 +2225,9 @@
case V4L2_MPEG_VIDC_EXTRADATA_METADATA_FILLER:
ret = HAL_EXTRADATA_METADATA_FILLER;
break;
+ case V4L2_MPEG_VIDC_INDEX_EXTRADATA_ASPECT_RATIO:
+ ret = HAL_EXTRADATA_ASPECT_RATIO;
+ break;
default:
dprintk(VIDC_WARN, "Extradata not found: %d\n", index);
break;
diff --git a/drivers/media/platform/msm/vidc/vidc_hfi_api.h b/drivers/media/platform/msm/vidc/vidc_hfi_api.h
index 4644dc7..6b9b7a0 100644
--- a/drivers/media/platform/msm/vidc/vidc_hfi_api.h
+++ b/drivers/media/platform/msm/vidc/vidc_hfi_api.h
@@ -92,6 +92,7 @@
HAL_EXTRADATA_INDEX,
HAL_EXTRADATA_NUM_CONCEALED_MB,
HAL_EXTRADATA_METADATA_FILLER,
+ HAL_EXTRADATA_ASPECT_RATIO,
};
enum hal_property {
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 9d38db32..2972dc0 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -696,6 +696,9 @@
#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800
#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000
#define V4L2_BUF_FLAG_EOS 0x2000
+#define V4L2_QCOM_BUF_FLAG_CODECCONFIG 0x4000
+#define V4L2_QCOM_BUF_FLAG_EOSEQ 0x8000
+#define V4L2_QCOM_BUF_TIMESTAMP_INVALID 0x10000
/*
* O V E R L A Y P R E V I E W
@@ -2140,9 +2143,6 @@
};
};
-#define V4L2_QCOM_BUF_FLAG_CODECCONFIG 0x4000
-#define V4L2_QCOM_BUF_FLAG_EOSEQ 0x8000
-
/* Decoder commands */
#define V4L2_DEC_CMD_START (0)
#define V4L2_DEC_CMD_STOP (1)
diff --git a/include/media/msm_vidc.h b/include/media/msm_vidc.h
index 4261d34..fae1efa 100644
--- a/include/media/msm_vidc.h
+++ b/include/media/msm_vidc.h
@@ -67,8 +67,8 @@
unsigned int frame_rate;
};
struct msm_vidc_ts_payload {
- unsigned int timestamp_hi;
unsigned int timestamp_lo;
+ unsigned int timestamp_hi;
};
struct msm_vidc_concealmb_payload {
unsigned int num_mbs;
@@ -76,6 +76,15 @@
struct msm_vidc_recoverysei_payload {
unsigned int flags;
};
+
+struct msm_vidc_aspect_ratio_payload {
+ unsigned int size;
+ unsigned int version;
+ unsigned int port_index;
+ unsigned int aspect_width;
+ unsigned int aspect_height;
+};
+
struct msm_vidc_panscan_window {
unsigned int panscan_height_offset;
unsigned int panscan_width_offset;
@@ -100,6 +109,7 @@
EXTRADATA_MULTISLICE_INFO = 0x7F100000,
EXTRADATA_NUM_CONCEALED_MB = 0x7F100001,
EXTRADATA_INDEX = 0x7F100002,
+ EXTRADATA_ASPECT_RATIO = 0x7F100003,
EXTRADATA_METADATA_FILLER = 0x7FE00002,
};
enum msm_vidc_interlace_type {