diff --git a/driver/platform/waipio/src/msm_vidc_waipio.c b/driver/platform/waipio/src/msm_vidc_waipio.c index 01a12aaac1..a94fcd8d23 100644 --- a/driver/platform/waipio/src/msm_vidc_waipio.c +++ b/driver/platform/waipio/src/msm_vidc_waipio.c @@ -352,7 +352,8 @@ static struct msm_platform_inst_capability instance_data_waipio[] = { {LTR_COUNT, IR_RANDOM, TIME_DELTA_BASED_RC, I_FRAME_QP, ENH_LAYER_COUNT, BIT_RATE, CONTENT_ADAPTIVE_CODING, BITRATE_BOOST, MIN_QUALITY, VBV_DELAY, PEAK_BITRATE, - SLICE_MODE, META_ROI_INFO, BLUR_TYPES}, + SLICE_MODE, META_ROI_INFO, BLUR_TYPES, + LOWLATENCY_MODE}, msm_vidc_adjust_bitrate_mode, msm_vidc_set_u32_enum}, {BITRATE_MODE, ENC, HEVC, @@ -370,7 +371,8 @@ static struct msm_platform_inst_capability instance_data_waipio[] = { CONSTANT_QUALITY, ENH_LAYER_COUNT, CONTENT_ADAPTIVE_CODING, BIT_RATE, BITRATE_BOOST, MIN_QUALITY, VBV_DELAY, - PEAK_BITRATE, SLICE_MODE, META_ROI_INFO, BLUR_TYPES}, + PEAK_BITRATE, SLICE_MODE, META_ROI_INFO, BLUR_TYPES, + LOWLATENCY_MODE}, msm_vidc_adjust_bitrate_mode, msm_vidc_set_u32_enum}, {LOSSLESS, ENC, HEVC|HEIC, @@ -468,7 +470,12 @@ static struct msm_platform_inst_capability instance_data_waipio[] = { {LOWLATENCY_MODE, ENC, H264 | HEVC, V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, 1, V4L2_MPEG_MSM_VIDC_DISABLE, - V4L2_CID_MPEG_VIDC_LOWLATENCY_REQUEST}, + V4L2_CID_MPEG_VIDC_LOWLATENCY_REQUEST, + 0, + CAP_FLAG_NONE, + {BITRATE_MODE}, + {STAGE}, + msm_vidc_adjust_lowlatency_mode, NULL}, {LOWLATENCY_MODE, DEC, H264|HEVC|VP9, V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE, @@ -1155,6 +1162,17 @@ static struct msm_platform_inst_capability instance_data_waipio[] = { CAP_FLAG_ROOT, {0}, {0}, NULL, msm_vidc_set_stage}, + + {STAGE, ENC, H264 | HEVC, + MSM_VIDC_STAGE_1, + MSM_VIDC_STAGE_2, 1, + MSM_VIDC_STAGE_2, + 0, + HFI_PROP_STAGE, + CAP_FLAG_NONE, + {LOWLATENCY_MODE}, {0}, + NULL, msm_vidc_set_stage}, + {PIPE, DEC|ENC, CODECS_ALL, MSM_VIDC_PIPE_1, MSM_VIDC_PIPE_4, 1, diff --git a/driver/variant/iris2/src/msm_vidc_iris2.c b/driver/variant/iris2/src/msm_vidc_iris2.c index 4f71d901bc..f2f701591d 100644 --- a/driver/variant/iris2/src/msm_vidc_iris2.c +++ b/driver/variant/iris2/src/msm_vidc_iris2.c @@ -537,7 +537,6 @@ int msm_vidc_decide_work_mode_iris2(struct msm_vidc_inst* inst) { u32 work_mode; struct v4l2_format* out_f; - struct v4l2_format* inp_f; u32 width, height; bool res_ok = false; @@ -548,7 +547,6 @@ int msm_vidc_decide_work_mode_iris2(struct msm_vidc_inst* inst) work_mode = MSM_VIDC_STAGE_2; out_f = &inst->fmts[OUTPUT_PORT]; - inp_f = &inst->fmts[INPUT_PORT]; if (is_image_decode_session(inst)) work_mode = MSM_VIDC_STAGE_1; @@ -567,8 +565,8 @@ int msm_vidc_decide_work_mode_iris2(struct msm_vidc_inst* inst) work_mode = MSM_VIDC_STAGE_1; } } else if (is_encode_session(inst)) { - height = inp_f->fmt.pix_mp.height; - width = inp_f->fmt.pix_mp.width; + height = inst->crop.height; + width = inst->crop.width; res_ok = !res_is_greater_than(width, height, 4096, 2160); if (res_ok && (inst->capabilities->cap[LOWLATENCY_MODE].value)) { diff --git a/driver/vidc/inc/msm_vidc_control.h b/driver/vidc/inc/msm_vidc_control.h index 90db0b245b..9595717963 100644 --- a/driver/vidc/inc/msm_vidc_control.h +++ b/driver/vidc/inc/msm_vidc_control.h @@ -34,6 +34,7 @@ int msm_vidc_adjust_hevc_max_qp(void *instance, struct v4l2_ctrl *ctrl); int msm_vidc_adjust_hevc_frame_qp(void *instance, struct v4l2_ctrl *ctrl); int msm_vidc_adjust_blur_type(void *instance, struct v4l2_ctrl *ctrl); int msm_vidc_adjust_blur_resolution(void *instance, struct v4l2_ctrl *ctrl); +int msm_vidc_adjust_lowlatency_mode(void *instance, struct v4l2_ctrl *ctrl); int msm_vidc_adjust_v4l2_properties(struct msm_vidc_inst *inst); int msm_vidc_adjust_session_priority(void *instance, struct v4l2_ctrl *ctrl); int msm_vidc_adjust_roi_info(void *instance, struct v4l2_ctrl *ctrl); diff --git a/driver/vidc/src/msm_vidc_control.c b/driver/vidc/src/msm_vidc_control.c index ebe787f880..d41214c136 100644 --- a/driver/vidc/src/msm_vidc_control.c +++ b/driver/vidc/src/msm_vidc_control.c @@ -1863,6 +1863,36 @@ int msm_vidc_adjust_blur_resolution(void *instance, struct v4l2_ctrl *ctrl) return 0; } +int msm_vidc_adjust_lowlatency_mode(void *instance, struct v4l2_ctrl *ctrl) +{ + struct msm_vidc_inst_capability *capability; + s32 adjusted_value; + struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance; + s32 rc_type = -1; + + if (!inst || !inst->capabilities) { + d_vpr_e("%s: invalid params\n", __func__); + return -EINVAL; + } + capability = inst->capabilities; + + adjusted_value = ctrl ? ctrl->val : + capability->cap[LOWLATENCY_MODE].value; + + if (msm_vidc_get_parent_value(inst, LOWLATENCY_MODE, BITRATE_MODE, + &rc_type, __func__)) + return -EINVAL; + + if (rc_type == HFI_RC_CBR_CFR || + rc_type == HFI_RC_CBR_VFR) + adjusted_value = 1; + + msm_vidc_update_cap_value(inst, LOWLATENCY_MODE, + adjusted_value, __func__); + + return 0; +} + int msm_vidc_adjust_session_priority(void *instance, struct v4l2_ctrl *ctrl) { int rc = 0;