diff --git a/msm/vidc/msm_venc.c b/msm/vidc/msm_venc.c index 9c603016add0..2a2aadb37868 100644 --- a/msm/vidc/msm_venc.c +++ b/msm/vidc/msm_venc.c @@ -1672,7 +1672,7 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) if (inst->state < MSM_VIDC_LOAD_RESOURCES) msm_vidc_calculate_buffer_counts(inst); if (inst->state == MSM_VIDC_START_DONE) { - rc = msm_venc_set_frame_rate(inst); + rc = msm_venc_set_frame_rate(inst, true); if (rc) s_vpr_e(sid, "%s: set frame rate failed\n", __func__); @@ -2095,7 +2095,7 @@ int msm_venc_set_frame_size(struct msm_vidc_inst *inst) return rc; } -int msm_venc_set_frame_rate(struct msm_vidc_inst *inst) +int msm_venc_set_frame_rate(struct msm_vidc_inst *inst, bool external_requested) { int rc = 0; struct hfi_device *hdev; @@ -2128,9 +2128,16 @@ int msm_venc_set_frame_rate(struct msm_vidc_inst *inst) s_vpr_h(inst->sid, "%s: %#x\n", __func__, frame_rate.frame_rate); - rc = call_hfi_op(hdev, session_set_property, - inst->session, HFI_PROPERTY_CONFIG_FRAME_RATE, + if (external_requested) { + rc = call_hfi_op(hdev, session_set_property, + inst->session, HFI_PROPERTY_CONFIG_FRAME_RATE, + &frame_rate, sizeof(frame_rate)); + } else { + s_vpr_l(inst->sid, "Auto frame rate set"); + rc = call_hfi_op(hdev, session_set_property, + inst->session, HFI_PROPERTY_CONFIG_VENC_AUTO_FRAME_RATE, &frame_rate, sizeof(frame_rate)); + } if (rc) s_vpr_e(inst->sid, "%s: set property failed\n", __func__); @@ -2202,7 +2209,7 @@ int msm_venc_store_timestamp(struct msm_vidc_inst *inst, u64 timestamp_us) inst->clk_data.frame_rate = entry->framerate; s_vpr_l(inst->sid, "%s: updated fps to %u\n", __func__, (inst->clk_data.frame_rate >> 16)); - msm_venc_set_frame_rate(inst); + msm_venc_set_frame_rate(inst, false); } unlock: @@ -4910,7 +4917,7 @@ int msm_venc_set_properties(struct msm_vidc_inst *inst) rc = msm_venc_set_frame_size(inst); if (rc) goto exit; - rc = msm_venc_set_frame_rate(inst); + rc = msm_venc_set_frame_rate(inst, true); if (rc) goto exit; rc = msm_venc_set_secure_mode(inst); diff --git a/msm/vidc/msm_venc.h b/msm/vidc/msm_venc.h index e172bf748336..ac3f38a829ff 100644 --- a/msm/vidc/msm_venc.h +++ b/msm/vidc/msm_venc.h @@ -23,7 +23,7 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl); int msm_venc_set_properties(struct msm_vidc_inst *inst); int msm_venc_set_extradata(struct msm_vidc_inst *inst); -int msm_venc_set_frame_rate(struct msm_vidc_inst *inst); +int msm_venc_set_frame_rate(struct msm_vidc_inst *inst, bool external_requested); int msm_venc_store_timestamp(struct msm_vidc_inst *inst, u64 timestamp_us); int msm_venc_set_bitrate(struct msm_vidc_inst *inst); int msm_venc_set_layer_bitrate(struct msm_vidc_inst *inst); diff --git a/msm/vidc/vidc_hfi_helper.h b/msm/vidc/vidc_hfi_helper.h index 177069932797..bf1d55a4f1ea 100644 --- a/msm/vidc/vidc_hfi_helper.h +++ b/msm/vidc/vidc_hfi_helper.h @@ -379,6 +379,8 @@ struct hfi_buffer_info { (HFI_PROPERTY_CONFIG_VENC_COMMON_START + 0x015) #define HFI_PROPERTY_CONFIG_CVP_SKIP_RATIO \ (HFI_PROPERTY_CONFIG_VENC_COMMON_START + 0x016) +#define HFI_PROPERTY_CONFIG_VENC_AUTO_FRAME_RATE \ + (HFI_PROPERTY_CONFIG_VENC_COMMON_START + 0x017) #define HFI_PROPERTY_PARAM_VPE_COMMON_START \ (HFI_DOMAIN_BASE_VPE + HFI_ARCH_COMMON_OFFSET + 0x7000)