Merge "video: driver: Add changes to calculate auto framerate"

This commit is contained in:
qctecmdr
2021-08-18 09:11:50 -07:00
committed by Gerrit - the friendly Code Review server

View File

@@ -2056,7 +2056,7 @@ int msm_vidc_set_auto_framerate(struct msm_vidc_inst *inst, u64 timestamp)
struct msm_vidc_timestamp *ts;
struct msm_vidc_timestamp *prev = NULL;
u32 counter = 0, prev_fr = 0, curr_fr = 0;
u64 time_ms = 0;
u64 time_us = 0;
int rc = 0;
if (!inst || !inst->core || !inst->capabilities) {
@@ -2075,9 +2075,9 @@ int msm_vidc_set_auto_framerate(struct msm_vidc_inst *inst, u64 timestamp)
list_for_each_entry(ts, &inst->timestamps.list, sort.list) {
if (prev) {
time_ms = div_u64(ts->sort.val - prev->sort.val, 1000);
time_us = ts->sort.val - prev->sort.val;
prev_fr = curr_fr;
curr_fr = time_ms ? div_u64(MSEC_PER_SEC, time_ms) << 16 :
curr_fr = time_us ? DIV64_U64_ROUND_CLOSEST(USEC_PER_SEC, time_us) << 16 :
inst->auto_framerate;
if (curr_fr > inst->capabilities->cap[FRAME_RATE].max)
curr_fr = inst->capabilities->cap[FRAME_RATE].max;
@@ -2091,7 +2091,8 @@ int msm_vidc_set_auto_framerate(struct msm_vidc_inst *inst, u64 timestamp)
/* if framerate changed and stable for 2 frames, set to firmware */
if (curr_fr == prev_fr && curr_fr != inst->auto_framerate) {
i_vpr_l(inst, "%s: updated fps to %u\n", __func__, curr_fr >> 16);
i_vpr_l(inst, "%s: updated fps: %u -> %u\n", __func__,
inst->auto_framerate >> 16, curr_fr >> 16);
rc = venus_hfi_session_property(inst,
HFI_PROP_FRAME_RATE,
HFI_HOST_FLAGS_NONE,