hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/media/platform/qcom/venus/vdec_ctrls.c
....@@ -1,21 +1,13 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
34 * Copyright (C) 2017 Linaro Ltd.
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2 and
7
- * only version 2 as published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- *
145 */
156 #include <linux/types.h>
167 #include <media/v4l2-ctrls.h>
178
189 #include "core.h"
10
+#include "helpers.h"
1911 #include "vdec.h"
2012
2113 static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl)
....@@ -30,10 +22,12 @@
3022 case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
3123 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
3224 case V4L2_CID_MPEG_VIDEO_VP8_PROFILE:
25
+ case V4L2_CID_MPEG_VIDEO_VP9_PROFILE:
3326 ctr->profile = ctrl->val;
3427 break;
3528 case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
3629 case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
30
+ case V4L2_CID_MPEG_VIDEO_VP9_LEVEL:
3731 ctr->level = ctrl->val;
3832 break;
3933 default:
....@@ -47,35 +41,40 @@
4741 {
4842 struct venus_inst *inst = ctrl_to_inst(ctrl);
4943 struct vdec_controls *ctr = &inst->controls.dec;
50
- union hfi_get_property hprop;
51
- u32 ptype = HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT;
44
+ struct hfi_buffer_requirements bufreq;
45
+ enum hfi_version ver = inst->core->res->hfi_version;
46
+ u32 profile, level;
5247 int ret;
5348
5449 switch (ctrl->id) {
5550 case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
5651 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
5752 case V4L2_CID_MPEG_VIDEO_VP8_PROFILE:
58
- ret = hfi_session_get_property(inst, ptype, &hprop);
53
+ case V4L2_CID_MPEG_VIDEO_VP9_PROFILE:
54
+ ret = venus_helper_get_profile_level(inst, &profile, &level);
5955 if (!ret)
60
- ctr->profile = hprop.profile_level.profile;
56
+ ctr->profile = profile;
6157 ctrl->val = ctr->profile;
6258 break;
6359 case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
6460 case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
65
- ret = hfi_session_get_property(inst, ptype, &hprop);
61
+ case V4L2_CID_MPEG_VIDEO_VP9_LEVEL:
62
+ ret = venus_helper_get_profile_level(inst, &profile, &level);
6663 if (!ret)
67
- ctr->level = hprop.profile_level.level;
64
+ ctr->level = level;
6865 ctrl->val = ctr->level;
6966 break;
7067 case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER:
7168 ctrl->val = ctr->post_loop_deb_mode;
7269 break;
7370 case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
74
- ctrl->val = inst->num_output_bufs;
71
+ ret = venus_helper_get_bufreq(inst, HFI_BUFFER_OUTPUT, &bufreq);
72
+ if (!ret)
73
+ ctrl->val = HFI_BUFREQ_COUNT_MIN(&bufreq, ver);
7574 break;
7675 default:
7776 return -EINVAL;
78
- };
77
+ }
7978
8079 return 0;
8180 }
....@@ -90,7 +89,7 @@
9089 struct v4l2_ctrl *ctrl;
9190 int ret;
9291
93
- ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 7);
92
+ ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 9);
9493 if (ret)
9594 return ret;
9695
....@@ -137,6 +136,20 @@
137136 if (ctrl)
138137 ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
139138
139
+ ctrl = v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &vdec_ctrl_ops,
140
+ V4L2_CID_MPEG_VIDEO_VP9_PROFILE,
141
+ V4L2_MPEG_VIDEO_VP9_PROFILE_3,
142
+ 0, V4L2_MPEG_VIDEO_VP9_PROFILE_0);
143
+ if (ctrl)
144
+ ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
145
+
146
+ ctrl = v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &vdec_ctrl_ops,
147
+ V4L2_CID_MPEG_VIDEO_VP9_LEVEL,
148
+ V4L2_MPEG_VIDEO_VP9_LEVEL_6_2,
149
+ 0, V4L2_MPEG_VIDEO_VP9_LEVEL_1_0);
150
+ if (ctrl)
151
+ ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
152
+
140153 v4l2_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops,
141154 V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER, 0, 1, 1, 0);
142155