video: driver: refine image session handling
Amended below logics for image session. - set constant quality - set tier: V4L2_MPEG_VIDEO_HEVC_TIER_MAIN - frame_rate: 1 - enable subframe metadata - stage: - image encode: 2 stage - image decode: 1 stage - pipe: 4(work_route) - power mode: max_quality. Change-Id: I67acd5284910e7cbe26446b5dfc526d002b98981 Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
This commit is contained in:
@@ -542,17 +542,7 @@ int msm_buffer_size_iris2(struct msm_vidc_inst *inst,
|
||||
return size;
|
||||
}
|
||||
|
||||
static int msm_buffer_encoder_dpb_count(struct msm_vidc_inst *inst)
|
||||
{
|
||||
if (!inst || !inst->capabilities) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return msm_vidc_get_recon_buf_count(inst);
|
||||
}
|
||||
|
||||
static int msm_buffer_decoder_dpb_count(struct msm_vidc_inst *inst)
|
||||
static int msm_buffer_dpb_count(struct msm_vidc_inst *inst)
|
||||
{
|
||||
int count = 0;
|
||||
u32 color_fmt;
|
||||
@@ -562,11 +552,17 @@ static int msm_buffer_decoder_dpb_count(struct msm_vidc_inst *inst)
|
||||
return 0;
|
||||
}
|
||||
|
||||
color_fmt = inst->capabilities->cap[PIX_FMTS].value;
|
||||
if (is_linear_colorformat(color_fmt))
|
||||
count = inst->buffers.output.min_count;
|
||||
/* decoder dpb buffer count */
|
||||
if (is_decode_session(inst)) {
|
||||
color_fmt = inst->capabilities->cap[PIX_FMTS].value;
|
||||
if (is_linear_colorformat(color_fmt))
|
||||
count = inst->buffers.output.min_count;
|
||||
|
||||
return count;
|
||||
return count;
|
||||
}
|
||||
|
||||
/* encoder dpb buffer count */
|
||||
return msm_vidc_get_recon_buf_count(inst);
|
||||
}
|
||||
|
||||
int msm_buffer_min_count_iris2(struct msm_vidc_inst *inst,
|
||||
@@ -579,54 +575,32 @@ int msm_buffer_min_count_iris2(struct msm_vidc_inst *inst,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_decode_session(inst)) {
|
||||
switch (buffer_type) {
|
||||
case MSM_VIDC_BUF_INPUT:
|
||||
case MSM_VIDC_BUF_INPUT_META:
|
||||
count = msm_vidc_input_min_count(inst);
|
||||
break;
|
||||
case MSM_VIDC_BUF_OUTPUT:
|
||||
case MSM_VIDC_BUF_OUTPUT_META:
|
||||
count = msm_vidc_output_min_count(inst);
|
||||
break;
|
||||
case MSM_VIDC_BUF_BIN:
|
||||
case MSM_VIDC_BUF_COMV:
|
||||
case MSM_VIDC_BUF_NON_COMV:
|
||||
case MSM_VIDC_BUF_LINE:
|
||||
case MSM_VIDC_BUF_PERSIST:
|
||||
count = msm_vidc_internal_buffer_count(inst, buffer_type);
|
||||
break;
|
||||
case MSM_VIDC_BUF_DPB:
|
||||
count = msm_buffer_decoder_dpb_count(inst);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (is_encode_session(inst)) {
|
||||
switch (buffer_type) {
|
||||
case MSM_VIDC_BUF_INPUT:
|
||||
case MSM_VIDC_BUF_INPUT_META:
|
||||
count = msm_vidc_input_min_count(inst);
|
||||
break;
|
||||
case MSM_VIDC_BUF_OUTPUT:
|
||||
case MSM_VIDC_BUF_OUTPUT_META:
|
||||
count = msm_vidc_output_min_count(inst);
|
||||
break;
|
||||
case MSM_VIDC_BUF_BIN:
|
||||
case MSM_VIDC_BUF_COMV:
|
||||
case MSM_VIDC_BUF_NON_COMV:
|
||||
case MSM_VIDC_BUF_LINE:
|
||||
case MSM_VIDC_BUF_ARP:
|
||||
case MSM_VIDC_BUF_VPSS:
|
||||
count = 1;
|
||||
break;
|
||||
case MSM_VIDC_BUF_DPB:
|
||||
count = msm_buffer_encoder_dpb_count(inst);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (buffer_type) {
|
||||
case MSM_VIDC_BUF_INPUT:
|
||||
case MSM_VIDC_BUF_INPUT_META:
|
||||
count = msm_vidc_input_min_count(inst);
|
||||
break;
|
||||
case MSM_VIDC_BUF_OUTPUT:
|
||||
case MSM_VIDC_BUF_OUTPUT_META:
|
||||
count = msm_vidc_output_min_count(inst);
|
||||
break;
|
||||
case MSM_VIDC_BUF_BIN:
|
||||
case MSM_VIDC_BUF_COMV:
|
||||
case MSM_VIDC_BUF_NON_COMV:
|
||||
case MSM_VIDC_BUF_LINE:
|
||||
case MSM_VIDC_BUF_PERSIST:
|
||||
case MSM_VIDC_BUF_ARP:
|
||||
case MSM_VIDC_BUF_VPSS:
|
||||
count = msm_vidc_internal_buffer_count(inst, buffer_type);
|
||||
break;
|
||||
case MSM_VIDC_BUF_DPB:
|
||||
count = msm_buffer_dpb_count(inst);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
i_vpr_l(inst, "%s: type %u, count %u\n", __func__, buffer_type, count);
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -653,5 +627,6 @@ int msm_buffer_extra_count_iris2(struct msm_vidc_inst *inst,
|
||||
break;
|
||||
}
|
||||
|
||||
i_vpr_l(inst, "%s: type %u, count %u\n", __func__, buffer_type, count);
|
||||
return count;
|
||||
}
|
||||
|
@@ -532,6 +532,12 @@ int msm_vidc_decide_work_mode_iris2(struct msm_vidc_inst* inst)
|
||||
out_f = &inst->fmts[OUTPUT_PORT];
|
||||
inp_f = &inst->fmts[INPUT_PORT];
|
||||
|
||||
if (is_image_decode_session(inst))
|
||||
work_mode = MSM_VIDC_STAGE_1;
|
||||
|
||||
if (is_image_session(inst))
|
||||
goto exit;
|
||||
|
||||
if (is_decode_session(inst)) {
|
||||
height = out_f->fmt.pix_mp.height;
|
||||
width = out_f->fmt.pix_mp.width;
|
||||
@@ -563,6 +569,7 @@ int msm_vidc_decide_work_mode_iris2(struct msm_vidc_inst* inst)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
exit:
|
||||
i_vpr_h(inst, "Configuring work mode = %u low latency = %u",
|
||||
work_mode, lowlatency);
|
||||
msm_vidc_update_cap_value(inst, STAGE, work_mode, __func__);
|
||||
@@ -587,6 +594,9 @@ int msm_vidc_decide_work_route_iris2(struct msm_vidc_inst* inst)
|
||||
core = inst->core;
|
||||
work_route = core->capabilities[NUM_VPP_PIPE].value;
|
||||
|
||||
if (is_image_session(inst))
|
||||
goto exit;
|
||||
|
||||
if (is_decode_session(inst)) {
|
||||
if (inst->capabilities->cap[CODED_FRAMES].value ==
|
||||
CODED_FRAMES_INTERLACE)
|
||||
@@ -609,6 +619,7 @@ int msm_vidc_decide_work_route_iris2(struct msm_vidc_inst* inst)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
exit:
|
||||
i_vpr_h(inst, "Configuring work route = %u", work_route);
|
||||
msm_vidc_update_cap_value(inst, PIPE, work_route, __func__);
|
||||
|
||||
@@ -620,7 +631,7 @@ int msm_vidc_decide_quality_mode_iris2(struct msm_vidc_inst* inst)
|
||||
struct msm_vidc_inst_capability* capability = NULL;
|
||||
struct msm_vidc_core *core;
|
||||
u32 mbpf, mbps, max_hq_mbpf, max_hq_mbps;
|
||||
u32 mode;
|
||||
u32 mode = MSM_VIDC_POWER_SAVE_MODE;
|
||||
|
||||
if (!inst || !inst->capabilities) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
@@ -632,7 +643,12 @@ int msm_vidc_decide_quality_mode_iris2(struct msm_vidc_inst* inst)
|
||||
if (!is_encode_session(inst))
|
||||
return 0;
|
||||
|
||||
mode = MSM_VIDC_POWER_SAVE_MODE;
|
||||
/* image session always runs at quality mode */
|
||||
if (is_image_session(inst)) {
|
||||
mode = MSM_VIDC_MAX_QUALITY_MODE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
mbpf = msm_vidc_get_mbs_per_frame(inst);
|
||||
mbps = mbpf * msm_vidc_get_fps(inst);
|
||||
core = inst->core;
|
||||
@@ -644,6 +660,7 @@ int msm_vidc_decide_quality_mode_iris2(struct msm_vidc_inst* inst)
|
||||
(mbpf <= max_hq_mbpf && mbps <= max_hq_mbps))
|
||||
mode = MSM_VIDC_MAX_QUALITY_MODE;
|
||||
|
||||
exit:
|
||||
msm_vidc_update_cap_value(inst, QUALITY_MODE, mode, __func__);
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user