mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 23:24:22 -04:00
msm: vidc: Add support for V4L2_FLAG_CVPMETADATA_SKIP flag
Introduced CVP skip flag as part of qbuf to indicate buffer is skipped CVP processing. This is required in order to re-use CVP metadata from previous frame when it is not an error case. Video firmware will look at this flag and reuse CVP metadata from earlier frame to encode current frame. Change-Id: Icf89daa2d5f19790a04f0467a15165870b283ee4 Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
This commit is contained in:
parent
e13d370e88
commit
1b9472cc6f
4 changed files with 25 additions and 6 deletions
|
|
@ -864,6 +864,7 @@ static int msm_cvp_frame_process(struct msm_vidc_inst *inst,
|
|||
else
|
||||
operating_rate = cvp->operating_rate;
|
||||
|
||||
mbuf->vvb.flags &= ~V4L2_BUF_FLAG_CVPMETADATA_SKIP;
|
||||
/* frame skip logic */
|
||||
fps = max(cvp->frame_rate, operating_rate) >> 16;
|
||||
if (fps > fps_max) {
|
||||
|
|
@ -878,10 +879,11 @@ static int msm_cvp_frame_process(struct msm_vidc_inst *inst,
|
|||
skipframe = cvp->framecount % skip_framecount;
|
||||
}
|
||||
if (skipframe) {
|
||||
print_cvp_buffer(VIDC_LOW, "input frame skipped",
|
||||
print_cvp_buffer(VIDC_LOW, "input frame with skipflag",
|
||||
inst, &cvp->fullres_buffer);
|
||||
cvp->framecount++;
|
||||
cvp->metadata_available = false;
|
||||
mbuf->vvb.flags |= V4L2_BUF_FLAG_CVPMETADATA_SKIP;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4220,6 +4220,9 @@ static void populate_frame_data(struct vidc_frame_data *data,
|
|||
if (vbuf->flags & V4L2_BUF_FLAG_CODECCONFIG)
|
||||
data->flags |= HAL_BUFFERFLAG_CODECCONFIG;
|
||||
|
||||
if(vbuf->flags & V4L2_BUF_FLAG_CVPMETADATA_SKIP)
|
||||
data->flags |= HAL_BUFFERFLAG_CVPMETADATA_SKIP;
|
||||
|
||||
msm_comm_fetch_input_tag(&inst->etb_data, vb->index,
|
||||
&itag, &itag2);
|
||||
data->input_tag = itag;
|
||||
|
|
@ -4385,6 +4388,7 @@ static int msm_comm_qbuf_superframe_to_hfi(struct msm_vidc_inst *inst,
|
|||
u64 ts_delta_us;
|
||||
struct vidc_frame_data *frames;
|
||||
u32 num_etbs, superframe_count, frame_size, hfi_fmt;
|
||||
bool skip_allowed = false;
|
||||
|
||||
if (!inst || !inst->core || !inst->core->device || !mbuf) {
|
||||
dprintk(VIDC_ERR, "%s: Invalid arguments\n", __func__);
|
||||
|
|
@ -4425,16 +4429,23 @@ static int msm_comm_qbuf_superframe_to_hfi(struct msm_vidc_inst *inst,
|
|||
/* prepare superframe buffers */
|
||||
frames[0].filled_len = frame_size;
|
||||
/*
|
||||
* superframe logic updates extradata and eos flags only, so
|
||||
* ensure no other flags are populated in populate_frame_data()
|
||||
* superframe logic updates extradata, cvpmetadata_skip and eos flags only,
|
||||
* so ensure no other flags are populated in populate_frame_data()
|
||||
*/
|
||||
frames[0].flags &= ~HAL_BUFFERFLAG_EXTRADATA;
|
||||
frames[0].flags &= ~HAL_BUFFERFLAG_EOS;
|
||||
frames[0].flags &= ~HAL_BUFFERFLAG_CVPMETADATA_SKIP;
|
||||
if (frames[0].flags)
|
||||
dprintk(VIDC_ERR, "%s: invalid flags %#x\n",
|
||||
__func__, frames[0].flags);
|
||||
frames[0].flags = 0;
|
||||
|
||||
/* Add skip flag only if CVP metadata is enabled */
|
||||
if (inst->prop.extradata_ctrls & EXTRADATA_ENC_INPUT_CVP) {
|
||||
skip_allowed = true;
|
||||
frames[0].flags |= HAL_BUFFERFLAG_CVPMETADATA_SKIP;
|
||||
}
|
||||
|
||||
for (i = 0; i < superframe_count; i++) {
|
||||
if (i)
|
||||
memcpy(&frames[i], &frames[0],
|
||||
|
|
@ -4443,8 +4454,8 @@ static int msm_comm_qbuf_superframe_to_hfi(struct msm_vidc_inst *inst,
|
|||
frames[i].timestamp += i * ts_delta_us;
|
||||
if (!i) {
|
||||
/* first frame */
|
||||
if (frames[i].extradata_addr)
|
||||
frames[i].flags |= HAL_BUFFERFLAG_EXTRADATA;
|
||||
if (frames[0].extradata_addr)
|
||||
frames[0].flags |= HAL_BUFFERFLAG_EXTRADATA;
|
||||
} else if (i == superframe_count - 1) {
|
||||
/* last frame */
|
||||
if (mbuf->vvb.flags & V4L2_BUF_FLAG_EOS)
|
||||
|
|
@ -4453,6 +4464,11 @@ static int msm_comm_qbuf_superframe_to_hfi(struct msm_vidc_inst *inst,
|
|||
num_etbs++;
|
||||
}
|
||||
|
||||
/* If cvp metadata is enabled and metadata is available,
|
||||
* do not add skip flag for only first frame */
|
||||
if (skip_allowed && !(mbuf->vvb.flags & V4L2_BUF_FLAG_CVPMETADATA_SKIP))
|
||||
frames[0].flags &= ~HAL_BUFFERFLAG_CVPMETADATA_SKIP;
|
||||
|
||||
rc = call_hfi_op(hdev, session_process_batch, inst->session,
|
||||
num_etbs, frames, 0, NULL);
|
||||
if (rc) {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#define HFI_BUFFERFLAG_DROP_FRAME 0x20000000
|
||||
#define HFI_BUFFERFLAG_TEI 0x40000000
|
||||
#define HFI_BUFFERFLAG_DISCONTINUITY 0x80000000
|
||||
#define HFI_BUFFERFLAG_CVPMETADATA_REPEAT 0x00000800
|
||||
|
||||
|
||||
#define HFI_ERR_SESSION_EMPTY_BUFFER_DONE_OUTPUT_PENDING \
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#define HAL_BUFFERFLAG_DROP_FRAME 0x20000000
|
||||
#define HAL_BUFFERFLAG_TS_DISCONTINUITY 0x40000000
|
||||
#define HAL_BUFFERFLAG_TS_ERROR 0x80000000
|
||||
|
||||
#define HAL_BUFFERFLAG_CVPMETADATA_SKIP 0x00000800
|
||||
|
||||
|
||||
#define HAL_DEBUG_MSG_LOW 0x00000001
|
||||
|
|
|
|||
Loading…
Reference in a new issue