summaryrefslogtreecommitdiff
authorgan.zhang <gan.zhang@amlogic.com>2020-10-02 09:51:50 (GMT)
committer Bin Yang <bin.yang@amlogic.com>2020-10-23 09:29:00 (GMT)
commit7f186970f984ffa3e54a8061f7d7c111a67ff2a6 (patch)
tree456ae4971b434798d2f5542c0d58df428f0db6e0
parent3a4762e5f183e76d961eed2d3440a253aa696bb4 (diff)
downloadmedia_modules-amlogic-4.9-dev_forQ.zip
media_modules-amlogic-4.9-dev_forQ.tar.gz
media_modules-amlogic-4.9-dev_forQ.tar.bz2
media: Pass the hdr10p data to the vpp. [2/2]
PD#SWPL-33535 Problem: No hdr10p data was passed to the vpp via vf. Solution: hdr10p data is passed to the vpp via vf. Verify: U212 Change-Id: Ic2ef7592f59c6cf8878b8f7414966476da7d0c71 Signed-off-by: gan.zhang <gan.zhang@amlogic.com>
Diffstat
-rw-r--r--drivers/frame_provider/decoder/h265/vh265.c59
-rw-r--r--drivers/frame_provider/decoder/utils/vdec.h4
-rw-r--r--drivers/frame_provider/decoder/utils/vdec_input.c20
-rw-r--r--drivers/frame_provider/decoder/utils/vdec_input.h2
-rw-r--r--drivers/frame_provider/decoder/vp9/vvp9.c45
-rw-r--r--drivers/stream_input/amports/amstream.c20
6 files changed, 149 insertions, 1 deletions
diff --git a/drivers/frame_provider/decoder/h265/vh265.c b/drivers/frame_provider/decoder/h265/vh265.c
index 091935d..1ef70dd 100644
--- a/drivers/frame_provider/decoder/h265/vh265.c
+++ b/drivers/frame_provider/decoder/h265/vh265.c
@@ -1439,6 +1439,8 @@ struct PIC_s {
bool vframe_bound;
bool ip_mode;
u32 stream_frame_size; //for stream base
+ u32 hdr10p_data_size;
+ char *hdr10p_data_buf;
} /*PIC_t */;
#define MAX_TILE_COL_NUM 10
@@ -7937,8 +7939,22 @@ static int parse_sei(struct hevc_state_s *hevc,
&& p_sei[2] == 0x3C
&& p_sei[3] == 0x00
&& p_sei[4] == 0x01
- && p_sei[5] == 0x04)
+ && p_sei[5] == 0x04) {
+ char *new_buf;
hevc->sei_present_flag |= SEI_HDR10PLUS_MASK;
+ new_buf = vzalloc(payload_size);
+ if (new_buf) {
+ memcpy(new_buf, p_sei, payload_size);
+ pic->hdr10p_data_buf = new_buf;
+ pic->hdr10p_data_size = payload_size;
+ } else {
+ hevc_print(hevc, 0,
+ "%s:hdr10p data vzalloc size(%d) fail\n",
+ __func__, payload_size);
+ pic->hdr10p_data_buf = NULL;
+ pic->hdr10p_data_size = 0;
+ }
+ }
break;
case SEI_MasteringDisplayColorVolume:
@@ -8198,6 +8214,41 @@ static void set_frame_info(struct hevc_state_s *hevc, struct vframe_s *vf,
vdec_v4l_set_hdr_infos(ctx, &hdr);
}
+ if ((hevc->sei_present_flag & SEI_HDR10PLUS_MASK) && (pic->hdr10p_data_buf != NULL)
+ && (pic->hdr10p_data_size != 0)) {
+ char *new_buf;
+ new_buf = vzalloc(pic->hdr10p_data_size);
+
+ if (new_buf) {
+ memcpy(new_buf, pic->hdr10p_data_buf, pic->hdr10p_data_size);
+ if (get_dbg_flag(hevc) & H265_DEBUG_BUFMGR_MORE) {
+ hevc_print(hevc, 0,
+ "hdr10p data: (size %d)\n",
+ pic->hdr10p_data_size);
+ for (i = 0; i < pic->hdr10p_data_size; i++) {
+ hevc_print_cont(hevc, 0,
+ "%02x ", pic->hdr10p_data_buf[i]);
+ if (((i + 1) & 0xf) == 0)
+ hevc_print_cont(hevc, 0, "\n");
+ }
+ hevc_print_cont(hevc, 0, "\n");
+ }
+
+ vf->hdr10p_data_size = pic->hdr10p_data_size;
+ vf->hdr10p_data_buf = new_buf;
+ } else {
+ hevc_print(hevc, 0,
+ "%s:hdr10p data vzalloc size(%d) fail\n",
+ __func__, pic->hdr10p_data_size);
+ vf->hdr10p_data_buf = NULL;
+ vf->hdr10p_data_size = 0;
+ }
+
+ vfree(pic->hdr10p_data_buf);
+ pic->hdr10p_data_buf = NULL;
+ pic->hdr10p_data_size = 0;
+ }
+
vf->sidebind_type = hevc->sidebind_type;
vf->sidebind_channel_id = hevc->sidebind_channel_id;
}
@@ -8427,6 +8478,12 @@ static void vh265_vf_put(struct vframe_s *vf, void *op_arg)
kfifo_put(&hevc->newframe_q, (const struct vframe_s *)vf);
spin_lock_irqsave(&lock, flags);
+ if (vf->hdr10p_data_buf) {
+ vfree(vf->hdr10p_data_buf);
+ vf->hdr10p_data_buf = NULL;
+ vf->hdr10p_data_size = 0;
+ }
+
if (index_top != 0xff
&& index_top < MAX_REF_PIC_NUM
&& hevc->m_PIC[index_top]) {
diff --git a/drivers/frame_provider/decoder/utils/vdec.h b/drivers/frame_provider/decoder/utils/vdec.h
index 54c5903..86b35b0 100644
--- a/drivers/frame_provider/decoder/utils/vdec.h
+++ b/drivers/frame_provider/decoder/utils/vdec.h
@@ -275,6 +275,10 @@ struct vdec_s {
int parallel_dec;
struct vdec_frames_s *mvfrm;
struct vdec_sync sync;
+
+ u32 hdr10p_data_size;
+ char hdr10p_data_buf[PAGE_SIZE];
+ bool hdr10p_data_valid;
};
/* common decoder vframe provider name to use default vfm path */
diff --git a/drivers/frame_provider/decoder/utils/vdec_input.c b/drivers/frame_provider/decoder/utils/vdec_input.c
index 284dc02..d10a9bc 100644
--- a/drivers/frame_provider/decoder/utils/vdec_input.c
+++ b/drivers/frame_provider/decoder/utils/vdec_input.c
@@ -864,6 +864,26 @@ int vdec_input_add_chunk(struct vdec_input_s *input, const char *buf,
return -ENOMEM;
}
+ if ((vdec->hdr10p_data_valid == true) &&
+ (vdec->hdr10p_data_size != 0)) {
+ char *new_buf;
+ new_buf = vzalloc(vdec->hdr10p_data_size);
+ if (new_buf) {
+ memcpy(new_buf, vdec->hdr10p_data_buf, vdec->hdr10p_data_size);
+ chunk->hdr10p_data_buf = new_buf;
+ chunk->hdr10p_data_size = vdec->hdr10p_data_size;
+ } else {
+ pr_err("%s:hdr10p data vzalloc size(%d) failed\n",
+ __func__, vdec->hdr10p_data_size);
+ chunk->hdr10p_data_buf = NULL;
+ chunk->hdr10p_data_size = 0;
+ }
+ } else {
+ chunk->hdr10p_data_buf = NULL;
+ chunk->hdr10p_data_size = 0;
+ }
+ vdec->hdr10p_data_valid = false;
+
chunk->magic = 0x4b554843;
if (vdec->pts_valid) {
chunk->pts = vdec->pts;
diff --git a/drivers/frame_provider/decoder/utils/vdec_input.h b/drivers/frame_provider/decoder/utils/vdec_input.h
index 1ca9ebe..f7e62ef 100644
--- a/drivers/frame_provider/decoder/utils/vdec_input.h
+++ b/drivers/frame_provider/decoder/utils/vdec_input.h
@@ -56,6 +56,8 @@ struct vframe_chunk_s {
bool timestamp_valid;
u64 sequence;
struct vframe_block_list_s *block;
+ u32 hdr10p_data_size;
+ char *hdr10p_data_buf;
};
#define VDEC_INPUT_TARGET_VLD 0
diff --git a/drivers/frame_provider/decoder/vp9/vvp9.c b/drivers/frame_provider/decoder/vp9/vvp9.c
index 2e0b5a7..661ff59 100644
--- a/drivers/frame_provider/decoder/vp9/vvp9.c
+++ b/drivers/frame_provider/decoder/vp9/vvp9.c
@@ -601,6 +601,10 @@ struct PIC_BUFFER_CONFIG_s {
/* vdec sync. */
struct fence *fence;
+
+ /* hdr10 plus data */
+ u32 hdr10p_data_size;
+ char *hdr10p_data_buf;
} PIC_BUFFER_CONFIG;
enum BITSTREAM_PROFILE {
@@ -6877,6 +6881,41 @@ static void set_frame_info(struct VP9Decoder_s *pbi, struct vframe_s *vf)
vdec_v4l_set_hdr_infos(ctx, &hdr);
}
+ if ((pbi->chunk != NULL) && (pbi->chunk->hdr10p_data_buf != NULL)
+ && (pbi->chunk->hdr10p_data_size != 0)) {
+ char *new_buf;
+ int i = 0;
+ new_buf = vzalloc(pbi->chunk->hdr10p_data_size);
+
+ if (new_buf) {
+ memcpy(new_buf, pbi->chunk->hdr10p_data_buf, pbi->chunk->hdr10p_data_size);
+ if (debug & VP9_DEBUG_BUFMGR_MORE) {
+ vp9_print(pbi, VP9_DEBUG_BUFMGR_MORE,
+ "hdr10p data: (size %d)\n",
+ pbi->chunk->hdr10p_data_size);
+ for (i = 0; i < pbi->chunk->hdr10p_data_size; i++) {
+ vp9_print(pbi, VP9_DEBUG_BUFMGR_MORE,
+ "%02x ", pbi->chunk->hdr10p_data_buf[i]);
+ if (((i + 1) & 0xf) == 0)
+ vp9_print(pbi, VP9_DEBUG_BUFMGR_MORE, "\n");
+ }
+ vp9_print(pbi, VP9_DEBUG_BUFMGR_MORE, "\n");
+ }
+
+ vf->hdr10p_data_size = pbi->chunk->hdr10p_data_size;
+ vf->hdr10p_data_buf = new_buf;
+ } else {
+ vp9_print(pbi, 0, "%s:hdr10p data vzalloc size(%d) fail\n",
+ __func__, pbi->chunk->hdr10p_data_size);
+ vf->hdr10p_data_size = pbi->chunk->hdr10p_data_size;
+ vf->hdr10p_data_buf = new_buf;
+ }
+
+ vfree(pbi->chunk->hdr10p_data_buf);
+ pbi->chunk->hdr10p_data_buf = NULL;
+ pbi->chunk->hdr10p_data_size = 0;
+ }
+
vf->sidebind_type = pbi->sidebind_type;
vf->sidebind_channel_id = pbi->sidebind_channel_id;
}
@@ -6963,6 +7002,12 @@ static void vvp9_vf_put(struct vframe_s *vf, void *op_arg)
vf->fence = NULL;
}
+ if (vf->hdr10p_data_buf) {
+ vfree(vf->hdr10p_data_buf);
+ vf->hdr10p_data_buf = NULL;
+ vf->hdr10p_data_size = 0;
+ }
+
kfifo_put(&pbi->newframe_q, (const struct vframe_s *)vf);
pbi->vf_put_count++;
if (index < pbi->used_buf_num) {
diff --git a/drivers/stream_input/amports/amstream.c b/drivers/stream_input/amports/amstream.c
index b204dc6..dbca277 100644
--- a/drivers/stream_input/amports/amstream.c
+++ b/drivers/stream_input/amports/amstream.c
@@ -2567,6 +2567,26 @@ static long amstream_ioctl_set_ptr(struct port_priv_s *priv, ulong arg)
} else
r = -EINVAL;
break;
+ case AMSTREAM_SET_PTR_HDR10P_DATA:
+ if ((this->type & PORT_TYPE_VIDEO) && (this->type & PORT_TYPE_FRAME)) {
+ if (!parm.pointer || (parm.len <= 0) ||
+ (parm.len > PAGE_SIZE)) {
+ r = -EINVAL;
+ } else {
+ r = copy_from_user(priv->vdec->hdr10p_data_buf,
+ parm.pointer, parm.len);
+ if (r) {
+ priv->vdec->hdr10p_data_size = 0;
+ priv->vdec->hdr10p_data_valid = false;
+ r = -EINVAL;
+ } else {
+ priv->vdec->hdr10p_data_size = parm.len;
+ priv->vdec->hdr10p_data_valid = true;
+ }
+ }
+ } else
+ r = -EINVAL;
+ break;
default:
r = -ENOIOCTLCMD;
break;