From 51311d2374887e52df89d4aee86edbd309a80da6 Mon Sep 17 00:00:00 2001 From: Madhukumar S J Date: Thu, 22 Jun 2023 16:06:23 +0530 Subject: [PATCH] msm: vidc: fix tier and level issue for hevc - Bits: 0-27 are used to specify the level information and bits 28-31 are reserved for non-level information. For HEVC, these 4 bits(MSB) are used for communicating the tier info. - CTS tc will set the tier first, the level next and the same is set to firmware. In doing so, the level will override the tier value which is set earlier and the same is communicated to the firmware resulting in level info mismatch. - Fix here is to extract the 4 MSB bits containing the tier info and add it to the level value, then communicate it to the firmware. Change-Id: I530f0a0a92417f2076d5a1f93f724b6514ae9309 Signed-off-by: Madhukumar S J --- msm/vidc/msm_venc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/msm/vidc/msm_venc.c b/msm/vidc/msm_venc.c index 719bb76a3a49..25a282e5aa4a 100644 --- a/msm/vidc/msm_venc.c +++ b/msm/vidc/msm_venc.c @@ -1587,7 +1587,7 @@ static int msm_venc_update_bitrate(struct msm_vidc_inst *inst) int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) { - int rc = 0; + int rc = 0, hevc_tier_value = 0; struct msm_vidc_mastering_display_colour_sei_payload *mdisp_sei = NULL; struct msm_vidc_content_light_level_sei_payload *cll_sei = NULL; u32 i_qp_min, i_qp_max, p_qp_min, p_qp_max, b_qp_min, b_qp_max; @@ -1816,7 +1816,13 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) break; case V4L2_CID_MPEG_VIDEO_H264_LEVEL: case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL: - inst->level = msm_comm_v4l2_to_hfi(ctrl->id, ctrl->val, sid); + if ((inst->level & 0xf0000000) && get_v4l2_codec(inst) == V4L2_PIX_FMT_HEVC) { + hevc_tier_value = (inst->level & 0xf0000000); + inst->level = msm_comm_v4l2_to_hfi(ctrl->id, ctrl->val, sid) | hevc_tier_value; + } + else { + inst->level = msm_comm_v4l2_to_hfi(ctrl->id, ctrl->val, sid); + } break; case V4L2_CID_MPEG_VIDEO_HEVC_TIER: inst->level |=