Skip to content

Commit a7a20f7

Browse files
Stanimir Varbanovmchehab
authored andcommitted
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: 435c53c ("media: venus: venc: Use helper to set profile and level") Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent 9ac924b commit a7a20f7

3 files changed

Lines changed: 55 additions & 5 deletions

File tree

drivers/media/platform/qcom/venus/core.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,19 @@ struct venc_controls {
243243

244244
u32 header_mode;
245245

246-
u32 profile;
247-
u32 level;
246+
struct {
247+
u32 h264;
248+
u32 mpeg4;
249+
u32 hevc;
250+
u32 vp8;
251+
u32 vp9;
252+
} profile;
253+
struct {
254+
u32 h264;
255+
u32 mpeg4;
256+
u32 hevc;
257+
u32 vp9;
258+
} level;
248259
};
249260

250261
struct venus_buffer {

drivers/media/platform/qcom/venus/venc.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ static int venc_set_properties(struct venus_inst *inst)
537537
struct hfi_quantization quant;
538538
struct hfi_quantization_range quant_range;
539539
u32 ptype, rate_control, bitrate;
540+
u32 profile, level;
540541
int ret;
541542

542543
ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2);
@@ -684,7 +685,35 @@ static int venc_set_properties(struct venus_inst *inst)
684685
if (ret)
685686
return ret;
686687

687-
ret = venus_helper_set_profile_level(inst, ctr->profile, ctr->level);
688+
switch (inst->hfi_codec) {
689+
case HFI_VIDEO_CODEC_H264:
690+
profile = ctr->profile.h264;
691+
level = ctr->level.h264;
692+
break;
693+
case HFI_VIDEO_CODEC_MPEG4:
694+
profile = ctr->profile.mpeg4;
695+
level = ctr->level.mpeg4;
696+
break;
697+
case HFI_VIDEO_CODEC_VP8:
698+
profile = ctr->profile.vp8;
699+
level = 0;
700+
break;
701+
case HFI_VIDEO_CODEC_VP9:
702+
profile = ctr->profile.vp9;
703+
level = ctr->level.vp9;
704+
break;
705+
case HFI_VIDEO_CODEC_HEVC:
706+
profile = ctr->profile.hevc;
707+
level = ctr->level.hevc;
708+
break;
709+
case HFI_VIDEO_CODEC_MPEG2:
710+
default:
711+
profile = 0;
712+
level = 0;
713+
break;
714+
}
715+
716+
ret = venus_helper_set_profile_level(inst, profile, level);
688717
if (ret)
689718
return ret;
690719

drivers/media/platform/qcom/venus/venc_ctrls.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,25 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
103103
ctr->h264_entropy_mode = ctrl->val;
104104
break;
105105
case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
106+
ctr->profile.mpeg4 = ctrl->val;
107+
break;
106108
case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
109+
ctr->profile.h264 = ctrl->val;
110+
break;
107111
case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:
112+
ctr->profile.hevc = ctrl->val;
113+
break;
108114
case V4L2_CID_MPEG_VIDEO_VP8_PROFILE:
109-
ctr->profile = ctrl->val;
115+
ctr->profile.vp8 = ctrl->val;
110116
break;
111117
case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
118+
ctr->level.mpeg4 = ctrl->val;
119+
break;
112120
case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
121+
ctr->level.h264 = ctrl->val;
122+
break;
113123
case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:
114-
ctr->level = ctrl->val;
124+
ctr->level.hevc = ctrl->val;
115125
break;
116126
case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP:
117127
ctr->h264_i_qp = ctrl->val;

0 commit comments

Comments
 (0)