Commit a7a20f72 authored by Stanimir Varbanov's avatar Stanimir Varbanov Committed by Mauro Carvalho Chehab

media: venus: venc: Fix setting of profile and level

The profile and level in op_set_ctrl was recently changed but during
v4l2_ctrl_handler_setup profile and level control values are mangled.

Fixes: 435c53c3 ("media: venus: venc: Use helper to set profile and level")
Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 9ac924b9
...@@ -243,8 +243,19 @@ struct venc_controls { ...@@ -243,8 +243,19 @@ struct venc_controls {
u32 header_mode; u32 header_mode;
u32 profile; struct {
u32 level; u32 h264;
u32 mpeg4;
u32 hevc;
u32 vp8;
u32 vp9;
} profile;
struct {
u32 h264;
u32 mpeg4;
u32 hevc;
u32 vp9;
} level;
}; };
struct venus_buffer { struct venus_buffer {
......
...@@ -537,6 +537,7 @@ static int venc_set_properties(struct venus_inst *inst) ...@@ -537,6 +537,7 @@ static int venc_set_properties(struct venus_inst *inst)
struct hfi_quantization quant; struct hfi_quantization quant;
struct hfi_quantization_range quant_range; struct hfi_quantization_range quant_range;
u32 ptype, rate_control, bitrate; u32 ptype, rate_control, bitrate;
u32 profile, level;
int ret; int ret;
ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2); ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2);
...@@ -684,7 +685,35 @@ static int venc_set_properties(struct venus_inst *inst) ...@@ -684,7 +685,35 @@ static int venc_set_properties(struct venus_inst *inst)
if (ret) if (ret)
return ret; return ret;
ret = venus_helper_set_profile_level(inst, ctr->profile, ctr->level); switch (inst->hfi_codec) {
case HFI_VIDEO_CODEC_H264:
profile = ctr->profile.h264;
level = ctr->level.h264;
break;
case HFI_VIDEO_CODEC_MPEG4:
profile = ctr->profile.mpeg4;
level = ctr->level.mpeg4;
break;
case HFI_VIDEO_CODEC_VP8:
profile = ctr->profile.vp8;
level = 0;
break;
case HFI_VIDEO_CODEC_VP9:
profile = ctr->profile.vp9;
level = ctr->level.vp9;
break;
case HFI_VIDEO_CODEC_HEVC:
profile = ctr->profile.hevc;
level = ctr->level.hevc;
break;
case HFI_VIDEO_CODEC_MPEG2:
default:
profile = 0;
level = 0;
break;
}
ret = venus_helper_set_profile_level(inst, profile, level);
if (ret) if (ret)
return ret; return ret;
......
...@@ -103,15 +103,25 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -103,15 +103,25 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
ctr->h264_entropy_mode = ctrl->val; ctr->h264_entropy_mode = ctrl->val;
break; break;
case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
ctr->profile.mpeg4 = ctrl->val;
break;
case V4L2_CID_MPEG_VIDEO_H264_PROFILE: case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
ctr->profile.h264 = ctrl->val;
break;
case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE: case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:
ctr->profile.hevc = ctrl->val;
break;
case V4L2_CID_MPEG_VIDEO_VP8_PROFILE: case V4L2_CID_MPEG_VIDEO_VP8_PROFILE:
ctr->profile = ctrl->val; ctr->profile.vp8 = ctrl->val;
break; break;
case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
ctr->level.mpeg4 = ctrl->val;
break;
case V4L2_CID_MPEG_VIDEO_H264_LEVEL: case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
ctr->level.h264 = ctrl->val;
break;
case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL: case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:
ctr->level = ctrl->val; ctr->level.hevc = ctrl->val;
break; break;
case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP: case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP:
ctr->h264_i_qp = ctrl->val; ctr->h264_i_qp = ctrl->val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment