Merge "video: driver: tune dcvs and batching buffer count"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

commit
a71714eae3
@@ -2516,6 +2516,8 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst)
|
|||||||
inst->decode_batch.enable = true;
|
inst->decode_batch.enable = true;
|
||||||
inst->decode_batch.size = MAX_DEC_BATCH_SIZE;
|
inst->decode_batch.size = MAX_DEC_BATCH_SIZE;
|
||||||
}
|
}
|
||||||
|
if (core->capabilities[DCVS].value)
|
||||||
|
inst->power.dcvs_mode = true;
|
||||||
|
|
||||||
f = &inst->fmts[INPUT_PORT];
|
f = &inst->fmts[INPUT_PORT];
|
||||||
f->type = INPUT_MPLANE;
|
f->type = INPUT_MPLANE;
|
||||||
|
@@ -1731,6 +1731,10 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
|
|||||||
i_vpr_h(inst, "%s()\n", __func__);
|
i_vpr_h(inst, "%s()\n", __func__);
|
||||||
|
|
||||||
core = inst->core;
|
core = inst->core;
|
||||||
|
|
||||||
|
if (core->capabilities[DCVS].value)
|
||||||
|
inst->power.dcvs_mode = true;
|
||||||
|
|
||||||
f = &inst->fmts[OUTPUT_PORT];
|
f = &inst->fmts[OUTPUT_PORT];
|
||||||
f->type = OUTPUT_MPLANE;
|
f->type = OUTPUT_MPLANE;
|
||||||
f->fmt.pix_mp.width = DEFAULT_WIDTH;
|
f->fmt.pix_mp.width = DEFAULT_WIDTH;
|
||||||
|
@@ -117,7 +117,8 @@ u32 msm_vidc_input_extra_count(struct msm_vidc_inst *inst)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (is_encode_session(inst)) {
|
} else if (is_encode_session(inst)) {
|
||||||
/* add dcvs buffers */
|
/* add dcvs buffers, if platform supports dcvs */
|
||||||
|
if (core->capabilities[DCVS].value)
|
||||||
count = DCVS_ENC_EXTRA_INPUT_BUFFERS;
|
count = DCVS_ENC_EXTRA_INPUT_BUFFERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +144,8 @@ u32 msm_vidc_output_extra_count(struct msm_vidc_inst *inst)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (is_decode_session(inst)) {
|
if (is_decode_session(inst)) {
|
||||||
/* add dcvs buffers */
|
/* add dcvs buffers, if platform supports dcvs */
|
||||||
|
if (core->capabilities[DCVS].value)
|
||||||
count = DCVS_DEC_EXTRA_OUTPUT_BUFFERS;
|
count = DCVS_DEC_EXTRA_OUTPUT_BUFFERS;
|
||||||
/*
|
/*
|
||||||
* if decode batching enabled, ensure minimum batch size
|
* if decode batching enabled, ensure minimum batch size
|
||||||
|
@@ -644,7 +644,7 @@ static int msm_vidc_update_buffer_count_if_needed(struct msm_vidc_inst* inst,
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
bool update_input_port = false, update_output_port = false;
|
bool update_input_port = false, update_output_port = false;
|
||||||
|
|
||||||
if (!inst || !inst->capabilities || !ctrl) {
|
if (!inst || !ctrl) {
|
||||||
d_vpr_e("%s: invalid parameters\n", __func__);
|
d_vpr_e("%s: invalid parameters\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -658,6 +658,7 @@ static int msm_vidc_update_buffer_count_if_needed(struct msm_vidc_inst* inst,
|
|||||||
update_input_port = true;
|
update_input_port = true;
|
||||||
break;
|
break;
|
||||||
case V4L2_CID_MPEG_VIDC_THUMBNAIL_MODE:
|
case V4L2_CID_MPEG_VIDC_THUMBNAIL_MODE:
|
||||||
|
case V4L2_CID_MPEG_VIDC_PRIORITY:
|
||||||
update_input_port = true;
|
update_input_port = true;
|
||||||
update_output_port = true;
|
update_output_port = true;
|
||||||
break;
|
break;
|
||||||
@@ -752,6 +753,17 @@ int msm_v4l2_op_s_ctrl(struct v4l2_ctrl *ctrl)
|
|||||||
rc = msm_vidc_adjust_session_priority(inst, ctrl);
|
rc = msm_vidc_adjust_session_priority(inst, ctrl);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the last static s_ctrl from client(commit point). So update
|
||||||
|
* input & output counts to reflect final buffer counts based on dcvs
|
||||||
|
* & decoder_batching enable/disable. So client is expected to query
|
||||||
|
* for final counts after setting priority control.
|
||||||
|
*/
|
||||||
|
if (is_decode_session(inst))
|
||||||
|
inst->decode_batch.enable = msm_vidc_allow_decode_batch(inst);
|
||||||
|
|
||||||
|
msm_vidc_allow_dcvs(inst);
|
||||||
}
|
}
|
||||||
if (is_meta_ctrl(ctrl->id)) {
|
if (is_meta_ctrl(ctrl->id)) {
|
||||||
if (cap_id == META_DPB_TAG_LIST) {
|
if (cap_id == META_DPB_TAG_LIST) {
|
||||||
|
@@ -2712,6 +2712,12 @@ void msm_vidc_allow_dcvs(struct msm_vidc_inst *inst)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allow = !is_lowlatency_session(inst);
|
||||||
|
if (!allow) {
|
||||||
|
i_vpr_h(inst, "%s: lowlatency session\n", __func__);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
i_vpr_h(inst, "%s: dcvs: %s\n", __func__, allow ? "enabled" : "disabled");
|
i_vpr_h(inst, "%s: dcvs: %s\n", __func__, allow ? "enabled" : "disabled");
|
||||||
|
|
||||||
@@ -2721,14 +2727,17 @@ exit:
|
|||||||
|
|
||||||
bool msm_vidc_allow_decode_batch(struct msm_vidc_inst *inst)
|
bool msm_vidc_allow_decode_batch(struct msm_vidc_inst *inst)
|
||||||
{
|
{
|
||||||
|
struct msm_vidc_inst_capability *capability;
|
||||||
struct msm_vidc_core *core;
|
struct msm_vidc_core *core;
|
||||||
bool allow = false;
|
bool allow = false;
|
||||||
|
u32 value = 0;
|
||||||
|
|
||||||
if (!inst || !inst->core) {
|
if (!inst || !inst->core || !inst->capabilities) {
|
||||||
d_vpr_e("%s: invalid params\n", __func__);
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
core = inst->core;
|
core = inst->core;
|
||||||
|
capability = inst->capabilities;
|
||||||
|
|
||||||
allow = inst->decode_batch.enable;
|
allow = inst->decode_batch.enable;
|
||||||
if (!allow) {
|
if (!allow) {
|
||||||
@@ -2778,6 +2787,22 @@ bool msm_vidc_allow_decode_batch(struct msm_vidc_inst *inst)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
value = msm_vidc_get_fps(inst);
|
||||||
|
allow = value < capability->cap[BATCH_FPS].value;
|
||||||
|
if (!allow) {
|
||||||
|
i_vpr_h(inst, "%s: unsupported fps %u, max %u\n", __func__,
|
||||||
|
value, capability->cap[BATCH_FPS].value);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = msm_vidc_get_mbs_per_frame(inst);
|
||||||
|
allow = value < capability->cap[BATCH_MBPF].value;
|
||||||
|
if (!allow) {
|
||||||
|
i_vpr_h(inst, "%s: unsupported mbpf %u, max %u\n", __func__,
|
||||||
|
value, capability->cap[BATCH_MBPF].value);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
i_vpr_h(inst, "%s: batching: %s\n", __func__, allow ? "enabled" : "disabled");
|
i_vpr_h(inst, "%s: batching: %s\n", __func__, allow ? "enabled" : "disabled");
|
||||||
|
|
||||||
@@ -4090,7 +4115,7 @@ int msm_vidc_core_init(struct msm_vidc_core *core)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (!core || !core->platform) {
|
if (!core || !core->capabilities) {
|
||||||
d_vpr_e("%s: invalid params\n", __func__);
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user