Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | #include <linux/slab.h> |
| 14 | #include "msm_vidc_internal.h" |
| 15 | #include "msm_vidc_common.h" |
| 16 | #include "vidc_hfi_api.h" |
| 17 | #include "msm_vidc_debug.h" |
| 18 | #include "msm_vidc_clocks.h" |
| 19 | |
| 20 | #define MSM_VENC_DVC_NAME "msm_venc_8974" |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 21 | #define MIN_BIT_RATE 32000 |
| 22 | #define MAX_BIT_RATE 300000000 |
| 23 | #define DEFAULT_BIT_RATE 64000 |
| 24 | #define BIT_RATE_STEP 100 |
| 25 | #define DEFAULT_FRAME_RATE 15 |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 26 | #define OPERATING_FRAME_RATE_STEP (1 << 16) |
| 27 | #define MAX_SLICE_BYTE_SIZE ((MAX_BIT_RATE)>>3) |
| 28 | #define MIN_SLICE_BYTE_SIZE 512 |
| 29 | #define MAX_SLICE_MB_SIZE ((4096 * 2304) >> 8) |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 30 | #define I_FRAME_QP 127 |
| 31 | #define P_FRAME_QP 127 |
| 32 | #define B_FRAME_QP 127 |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 33 | #define MAX_INTRA_REFRESH_MBS ((4096 * 2304) >> 8) |
| 34 | #define MAX_NUM_B_FRAMES 4 |
| 35 | #define MAX_LTR_FRAME_COUNT 10 |
| 36 | #define MAX_HYBRID_HIER_P_LAYERS 6 |
| 37 | |
| 38 | #define L_MODE V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 39 | #define MIN_TIME_RESOLUTION 1 |
| 40 | #define MAX_TIME_RESOLUTION 0xFFFFFF |
| 41 | #define DEFAULT_TIME_RESOLUTION 0x7530 |
Praneeth Paladugu | 6e63747 | 2017-05-16 16:06:46 -0700 | [diff] [blame] | 42 | #define MIN_NUM_ENC_OUTPUT_BUFFERS 4 |
| 43 | #define MIN_NUM_ENC_CAPTURE_BUFFERS 5 |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 44 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 45 | static const char *const mpeg_video_rate_control[] = { |
| 46 | "No Rate Control", |
| 47 | "VBR VFR", |
| 48 | "VBR CFR", |
| 49 | "CBR VFR", |
| 50 | "CBR CFR", |
| 51 | "MBR CFR", |
| 52 | "MBR VFR", |
| 53 | NULL |
| 54 | }; |
| 55 | |
| 56 | static const char *const mpeg_video_rotation[] = { |
| 57 | "No Rotation", |
| 58 | "90 Degree Rotation", |
| 59 | "180 Degree Rotation", |
| 60 | "270 Degree Rotation", |
| 61 | NULL |
| 62 | }; |
| 63 | |
Chinmay Sawarkar | 8775427 | 2017-09-01 14:50:10 -0700 | [diff] [blame] | 64 | static const char *const mpeg_video_flip[] = { |
| 65 | "No Flip", |
| 66 | "Horizontal Flip", |
| 67 | "Vertical Flip", |
| 68 | "Both", |
| 69 | NULL |
| 70 | }; |
| 71 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 72 | static const char *const h264_video_entropy_cabac_model[] = { |
| 73 | "Model 0", |
| 74 | "Model 1", |
| 75 | "Model 2", |
| 76 | NULL |
| 77 | }; |
| 78 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 79 | static const char *const hevc_tier_level[] = { |
| 80 | "Main Tier Level 1", |
| 81 | "Main Tier Level 2", |
| 82 | "Main Tier Level 2.1", |
| 83 | "Main Tier Level 3", |
| 84 | "Main Tier Level 3.1", |
| 85 | "Main Tier Level 4", |
| 86 | "Main Tier Level 4.1", |
| 87 | "Main Tier Level 5", |
| 88 | "Main Tier Level 5.1", |
| 89 | "Main Tier Level 5.2", |
| 90 | "Main Tier Level 6", |
| 91 | "Main Tier Level 6.1", |
| 92 | "Main Tier Level 6.2", |
| 93 | "High Tier Level 1", |
| 94 | "High Tier Level 2", |
| 95 | "High Tier Level 2.1", |
| 96 | "High Tier Level 3", |
| 97 | "High Tier Level 3.1", |
| 98 | "High Tier Level 4", |
| 99 | "High Tier Level 4.1", |
| 100 | "High Tier Level 5", |
| 101 | "High Tier Level 5.1", |
| 102 | "High Tier Level 5.2", |
| 103 | "High Tier Level 6", |
| 104 | "High Tier Level 6.1", |
| 105 | "High Tier Level 6.2", |
Vaibhav Deshu Venkatesh | ce58558 | 2017-05-18 13:45:33 -0700 | [diff] [blame] | 106 | "Level unknown", |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 107 | }; |
| 108 | |
Surajit Podder | e502daa | 2017-05-30 19:17:45 +0530 | [diff] [blame] | 109 | static const char *const tme_profile[] = { |
| 110 | "0", |
| 111 | "1", |
| 112 | "2", |
| 113 | "3", |
| 114 | }; |
| 115 | |
| 116 | static const char *const tme_level[] = { |
| 117 | "Integer", |
| 118 | }; |
| 119 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 120 | static const char *const hevc_profile[] = { |
| 121 | "Main", |
| 122 | "Main10", |
| 123 | "Main Still Pic", |
| 124 | }; |
| 125 | |
| 126 | static const char *const vp8_profile_level[] = { |
| 127 | "Unused", |
| 128 | "0.0", |
| 129 | "1.0", |
| 130 | "2.0", |
| 131 | "3.0", |
| 132 | }; |
| 133 | |
| 134 | static const char *const perf_level[] = { |
| 135 | "Nominal", |
| 136 | "Performance", |
| 137 | "Turbo" |
| 138 | }; |
| 139 | |
| 140 | static const char *const mbi_statistics[] = { |
| 141 | "Camcorder Default", |
| 142 | "Mode 1", |
| 143 | "Mode 2", |
| 144 | "Mode 3" |
| 145 | }; |
| 146 | |
| 147 | static const char *const intra_refresh_modes[] = { |
| 148 | "None", |
| 149 | "Cyclic", |
| 150 | "Adaptive", |
| 151 | "Cyclic Adaptive", |
| 152 | "Random" |
| 153 | }; |
| 154 | |
| 155 | static const char *const timestamp_mode[] = { |
| 156 | "Honor", |
| 157 | "Ignore", |
| 158 | }; |
| 159 | |
| 160 | static const char *const iframe_sizes[] = { |
| 161 | "Default", |
| 162 | "Medium", |
| 163 | "Huge", |
| 164 | "Unlimited" |
| 165 | }; |
| 166 | |
| 167 | static struct msm_vidc_ctrl msm_venc_ctrls[] = { |
| 168 | { |
| 169 | .id = V4L2_CID_MPEG_VIDC_VIDEO_IDR_PERIOD, |
| 170 | .name = "IDR Period", |
| 171 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 172 | .minimum = 1, |
| 173 | .maximum = INT_MAX, |
| 174 | .default_value = DEFAULT_FRAME_RATE, |
| 175 | .step = 1, |
| 176 | .menu_skip_mask = 0, |
| 177 | .qmenu = NULL, |
| 178 | }, |
| 179 | { |
| 180 | .id = V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAMES, |
| 181 | .name = "Intra Period for P frames", |
| 182 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 183 | .minimum = 0, |
| 184 | .maximum = INT_MAX, |
| 185 | .default_value = 2*DEFAULT_FRAME_RATE-1, |
| 186 | .step = 1, |
| 187 | .menu_skip_mask = 0, |
| 188 | .qmenu = NULL, |
| 189 | }, |
| 190 | { |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 191 | .id = V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP, |
| 192 | .name = "I Frame Quantization", |
| 193 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 194 | .minimum = 1, |
| 195 | .maximum = 127, |
| 196 | .default_value = I_FRAME_QP, |
| 197 | .step = 1, |
| 198 | .menu_skip_mask = 0, |
| 199 | .qmenu = NULL, |
| 200 | }, |
| 201 | { |
| 202 | .id = V4L2_CID_MPEG_VIDC_VIDEO_P_FRAME_QP, |
| 203 | .name = "P Frame Quantization", |
| 204 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 205 | .minimum = 1, |
| 206 | .maximum = 127, |
| 207 | .default_value = P_FRAME_QP, |
| 208 | .step = 1, |
| 209 | .menu_skip_mask = 0, |
| 210 | .qmenu = NULL, |
| 211 | }, |
| 212 | { |
| 213 | .id = V4L2_CID_MPEG_VIDC_VIDEO_B_FRAME_QP, |
| 214 | .name = "B Frame Quantization", |
| 215 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 216 | .minimum = 1, |
| 217 | .maximum = 127, |
| 218 | .default_value = B_FRAME_QP, |
| 219 | .step = 1, |
| 220 | .menu_skip_mask = 0, |
| 221 | .qmenu = NULL, |
| 222 | }, |
| 223 | { |
| 224 | .id = V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP_MIN, |
| 225 | .name = "I Frame Quantization Range Minimum", |
| 226 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 227 | .minimum = 1, |
| 228 | .maximum = 127, |
| 229 | .default_value = I_FRAME_QP, |
| 230 | .step = 1, |
| 231 | .menu_skip_mask = 0, |
| 232 | .qmenu = NULL, |
| 233 | }, |
| 234 | { |
| 235 | .id = V4L2_CID_MPEG_VIDC_VIDEO_P_FRAME_QP_MIN, |
| 236 | .name = "P Frame Quantization Range Minimum", |
| 237 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 238 | .minimum = 1, |
| 239 | .maximum = 127, |
| 240 | .default_value = P_FRAME_QP, |
| 241 | .step = 1, |
| 242 | .menu_skip_mask = 0, |
| 243 | .qmenu = NULL, |
| 244 | }, |
| 245 | { |
| 246 | .id = V4L2_CID_MPEG_VIDC_VIDEO_B_FRAME_QP_MIN, |
| 247 | .name = "B Frame Quantization Range Minimum", |
| 248 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 249 | .minimum = 1, |
| 250 | .maximum = 127, |
| 251 | .default_value = B_FRAME_QP, |
| 252 | .step = 1, |
| 253 | .menu_skip_mask = 0, |
| 254 | .qmenu = NULL, |
| 255 | }, |
| 256 | { |
| 257 | .id = V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP_MAX, |
| 258 | .name = "I Frame Quantization Range Maximum", |
| 259 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 260 | .minimum = 1, |
| 261 | .maximum = 127, |
| 262 | .default_value = I_FRAME_QP, |
| 263 | .step = 1, |
| 264 | .menu_skip_mask = 0, |
| 265 | .qmenu = NULL, |
| 266 | }, |
| 267 | { |
| 268 | .id = V4L2_CID_MPEG_VIDC_VIDEO_P_FRAME_QP_MAX, |
| 269 | .name = "P Frame Quantization Range Maximum", |
| 270 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 271 | .minimum = 1, |
| 272 | .maximum = 127, |
| 273 | .default_value = P_FRAME_QP, |
| 274 | .step = 1, |
| 275 | .menu_skip_mask = 0, |
| 276 | .qmenu = NULL, |
| 277 | }, |
| 278 | { |
| 279 | .id = V4L2_CID_MPEG_VIDC_VIDEO_B_FRAME_QP_MAX, |
| 280 | .name = "B Frame Quantization Range Maximum", |
| 281 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 282 | .minimum = 1, |
| 283 | .maximum = 127, |
| 284 | .default_value = B_FRAME_QP, |
| 285 | .step = 1, |
| 286 | .menu_skip_mask = 0, |
| 287 | .qmenu = NULL, |
| 288 | }, |
| 289 | { |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 290 | .id = V4L2_CID_MPEG_VIDC_VIDEO_QP_MASK, |
| 291 | .name = "QP mask for diff frame types", |
| 292 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 293 | .minimum = 1, |
| 294 | .maximum = 7, |
| 295 | .default_value = 7, |
| 296 | .step = 1, |
| 297 | .menu_skip_mask = 0, |
| 298 | .qmenu = NULL, |
| 299 | }, |
| 300 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 301 | .id = V4L2_CID_MPEG_VIDC_VIDEO_NUM_B_FRAMES, |
| 302 | .name = "Intra Period for B frames", |
| 303 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 304 | .minimum = 0, |
| 305 | .maximum = INT_MAX, |
| 306 | .default_value = 0, |
| 307 | .step = 1, |
| 308 | .menu_skip_mask = 0, |
| 309 | .qmenu = NULL, |
| 310 | }, |
| 311 | { |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 312 | .id = V4L2_CID_MIN_BUFFERS_FOR_CAPTURE, |
| 313 | .name = "CAPTURE Count", |
| 314 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 315 | .minimum = MIN_NUM_CAPTURE_BUFFERS, |
| 316 | .maximum = MAX_NUM_CAPTURE_BUFFERS, |
| 317 | .default_value = MIN_NUM_CAPTURE_BUFFERS, |
| 318 | .step = 1, |
| 319 | .menu_skip_mask = 0, |
| 320 | .qmenu = NULL, |
| 321 | .flags = V4L2_CTRL_FLAG_VOLATILE, |
| 322 | }, |
| 323 | { |
| 324 | .id = V4L2_CID_MIN_BUFFERS_FOR_OUTPUT, |
| 325 | .name = "OUTPUT Count", |
| 326 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 327 | .minimum = MIN_NUM_OUTPUT_BUFFERS, |
| 328 | .maximum = MAX_NUM_OUTPUT_BUFFERS, |
| 329 | .default_value = MIN_NUM_OUTPUT_BUFFERS, |
| 330 | .step = 1, |
| 331 | .menu_skip_mask = 0, |
| 332 | .qmenu = NULL, |
| 333 | .flags = V4L2_CTRL_FLAG_VOLATILE, |
| 334 | }, |
| 335 | |
| 336 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 337 | .id = V4L2_CID_MPEG_VIDC_VIDEO_REQUEST_IFRAME, |
| 338 | .name = "Request I Frame", |
| 339 | .type = V4L2_CTRL_TYPE_BUTTON, |
| 340 | .minimum = 0, |
| 341 | .maximum = 0, |
| 342 | .default_value = 0, |
| 343 | .step = 0, |
| 344 | .menu_skip_mask = 0, |
| 345 | .qmenu = NULL, |
| 346 | }, |
| 347 | { |
| 348 | .id = V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL, |
| 349 | .name = "Video Framerate and Bitrate Control", |
| 350 | .type = V4L2_CTRL_TYPE_MENU, |
| 351 | .minimum = V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_OFF, |
| 352 | .maximum = V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_MBR_VFR, |
| 353 | .default_value = V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_OFF, |
| 354 | .step = 0, |
| 355 | .menu_skip_mask = ~( |
| 356 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_OFF) | |
| 357 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_VBR_VFR) | |
| 358 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_VBR_CFR) | |
| 359 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_CBR_VFR) | |
| 360 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_CBR_CFR) | |
| 361 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_MBR_CFR) | |
| 362 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_MBR_VFR) |
| 363 | ), |
| 364 | .qmenu = mpeg_video_rate_control, |
| 365 | }, |
| 366 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 367 | .id = V4L2_CID_MPEG_VIDEO_BITRATE, |
| 368 | .name = "Bit Rate", |
| 369 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 370 | .minimum = MIN_BIT_RATE, |
| 371 | .maximum = MAX_BIT_RATE, |
| 372 | .default_value = DEFAULT_BIT_RATE, |
| 373 | .step = BIT_RATE_STEP, |
| 374 | .menu_skip_mask = 0, |
| 375 | .qmenu = NULL, |
| 376 | }, |
| 377 | { |
| 378 | .id = V4L2_CID_MPEG_VIDEO_BITRATE_PEAK, |
| 379 | .name = "Peak Bit Rate", |
| 380 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 381 | .minimum = MIN_BIT_RATE, |
| 382 | .maximum = MAX_BIT_RATE, |
| 383 | .default_value = DEFAULT_BIT_RATE, |
| 384 | .step = BIT_RATE_STEP, |
| 385 | .menu_skip_mask = 0, |
| 386 | .qmenu = NULL, |
| 387 | }, |
| 388 | { |
| 389 | .id = V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE, |
| 390 | .name = "Entropy Mode", |
| 391 | .type = V4L2_CTRL_TYPE_MENU, |
| 392 | .minimum = V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC, |
| 393 | .maximum = V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC, |
| 394 | .default_value = V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC, |
| 395 | .menu_skip_mask = ~( |
| 396 | (1 << V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC) | |
| 397 | (1 << V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC) |
| 398 | ), |
| 399 | }, |
| 400 | { |
| 401 | .id = V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL, |
| 402 | .name = "CABAC Model", |
| 403 | .type = V4L2_CTRL_TYPE_MENU, |
| 404 | .minimum = V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL_0, |
| 405 | .maximum = V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL_1, |
| 406 | .default_value = V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL_0, |
| 407 | .menu_skip_mask = ~( |
| 408 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL_0) | |
| 409 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL_1) | |
| 410 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL_2) |
| 411 | ), |
| 412 | .qmenu = h264_video_entropy_cabac_model, |
| 413 | }, |
| 414 | { |
| 415 | .id = V4L2_CID_MPEG_VIDEO_H264_PROFILE, |
| 416 | .name = "H264 Profile", |
| 417 | .type = V4L2_CTRL_TYPE_MENU, |
| 418 | .minimum = V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE, |
| 419 | .maximum = V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH, |
| 420 | .default_value = V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE, |
| 421 | .menu_skip_mask = 0, |
| 422 | }, |
| 423 | { |
| 424 | .id = V4L2_CID_MPEG_VIDEO_H264_LEVEL, |
| 425 | .name = "H264 Level", |
| 426 | .type = V4L2_CTRL_TYPE_MENU, |
| 427 | .minimum = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, |
Vaibhav Deshu Venkatesh | 234b4dc | 2017-03-21 16:54:28 -0700 | [diff] [blame] | 428 | .maximum = V4L2_MPEG_VIDEO_H264_LEVEL_UNKNOWN, |
| 429 | .default_value = V4L2_MPEG_VIDEO_H264_LEVEL_UNKNOWN, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 430 | .menu_skip_mask = 0, |
| 431 | }, |
| 432 | { |
| 433 | .id = V4L2_CID_MPEG_VIDC_VIDEO_VP8_PROFILE_LEVEL, |
| 434 | .name = "VP8 Profile Level", |
| 435 | .type = V4L2_CTRL_TYPE_MENU, |
| 436 | .minimum = V4L2_MPEG_VIDC_VIDEO_VP8_UNUSED, |
Chinmay Sawarkar | 7f1cc15 | 2017-05-05 18:16:36 -0700 | [diff] [blame] | 437 | .maximum = V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_3, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 438 | .default_value = V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_0, |
Chinmay Sawarkar | 7f1cc15 | 2017-05-05 18:16:36 -0700 | [diff] [blame] | 439 | .menu_skip_mask = 0, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 440 | .qmenu = vp8_profile_level, |
| 441 | }, |
| 442 | { |
| 443 | .id = V4L2_CID_MPEG_VIDC_VIDEO_HEVC_PROFILE, |
| 444 | .name = "HEVC Profile", |
| 445 | .type = V4L2_CTRL_TYPE_MENU, |
| 446 | .minimum = V4L2_MPEG_VIDC_VIDEO_HEVC_PROFILE_MAIN, |
| 447 | .maximum = V4L2_MPEG_VIDC_VIDEO_HEVC_PROFILE_MAIN_STILL_PIC, |
| 448 | .default_value = V4L2_MPEG_VIDC_VIDEO_HEVC_PROFILE_MAIN, |
| 449 | .menu_skip_mask = ~( |
| 450 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_PROFILE_MAIN) | |
| 451 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_PROFILE_MAIN10) | |
| 452 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_PROFILE_MAIN_STILL_PIC) |
| 453 | ), |
| 454 | .qmenu = hevc_profile, |
| 455 | }, |
| 456 | { |
| 457 | .id = V4L2_CID_MPEG_VIDC_VIDEO_HEVC_TIER_LEVEL, |
| 458 | .name = "HEVC Tier and Level", |
| 459 | .type = V4L2_CTRL_TYPE_MENU, |
| 460 | .minimum = V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_MAIN_TIER_LEVEL_1, |
Vaibhav Deshu Venkatesh | 234b4dc | 2017-03-21 16:54:28 -0700 | [diff] [blame] | 461 | .maximum = V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_UNKNOWN, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 462 | .default_value = |
Vaibhav Deshu Venkatesh | 234b4dc | 2017-03-21 16:54:28 -0700 | [diff] [blame] | 463 | V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_UNKNOWN, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 464 | .menu_skip_mask = ~( |
| 465 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_HIGH_TIER_LEVEL_1) | |
| 466 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_HIGH_TIER_LEVEL_2) | |
| 467 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_HIGH_TIER_LEVEL_2_1) | |
| 468 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_HIGH_TIER_LEVEL_3) | |
| 469 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_HIGH_TIER_LEVEL_3_1) | |
| 470 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_HIGH_TIER_LEVEL_4) | |
| 471 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_HIGH_TIER_LEVEL_4_1) | |
| 472 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_HIGH_TIER_LEVEL_5) | |
| 473 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_HIGH_TIER_LEVEL_5_1) | |
| 474 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_HIGH_TIER_LEVEL_5_2) | |
| 475 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_MAIN_TIER_LEVEL_1) | |
| 476 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_MAIN_TIER_LEVEL_2) | |
| 477 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_MAIN_TIER_LEVEL_2_1) | |
| 478 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_MAIN_TIER_LEVEL_3) | |
| 479 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_MAIN_TIER_LEVEL_3_1) | |
| 480 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_MAIN_TIER_LEVEL_4) | |
| 481 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_MAIN_TIER_LEVEL_4_1) | |
| 482 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_MAIN_TIER_LEVEL_5) | |
Vaibhav Deshu Venkatesh | 234b4dc | 2017-03-21 16:54:28 -0700 | [diff] [blame] | 483 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_MAIN_TIER_LEVEL_5_1) | |
| 484 | (1 << V4L2_MPEG_VIDC_VIDEO_HEVC_LEVEL_UNKNOWN) |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 485 | ), |
| 486 | .qmenu = hevc_tier_level, |
| 487 | }, |
| 488 | { |
Surajit Podder | e502daa | 2017-05-30 19:17:45 +0530 | [diff] [blame] | 489 | .id = V4L2_CID_MPEG_VIDC_VIDEO_TME_PROFILE, |
| 490 | .name = "TME Profile", |
| 491 | .type = V4L2_CTRL_TYPE_MENU, |
| 492 | .minimum = V4L2_MPEG_VIDC_VIDEO_TME_PROFILE_0, |
| 493 | .maximum = V4L2_MPEG_VIDC_VIDEO_TME_PROFILE_3, |
| 494 | .default_value = |
| 495 | V4L2_MPEG_VIDC_VIDEO_TME_PROFILE_0, |
| 496 | .menu_skip_mask = ~( |
| 497 | (1 << V4L2_MPEG_VIDC_VIDEO_TME_PROFILE_0) | |
| 498 | (1 << V4L2_MPEG_VIDC_VIDEO_TME_PROFILE_1) | |
| 499 | (1 << V4L2_MPEG_VIDC_VIDEO_TME_PROFILE_2) | |
| 500 | (1 << V4L2_MPEG_VIDC_VIDEO_TME_PROFILE_3) |
| 501 | ), |
| 502 | .qmenu = tme_profile, |
| 503 | }, |
| 504 | { |
| 505 | .id = V4L2_CID_MPEG_VIDC_VIDEO_TME_LEVEL, |
| 506 | .name = "TME Level", |
| 507 | .type = V4L2_CTRL_TYPE_MENU, |
| 508 | .minimum = V4L2_MPEG_VIDC_VIDEO_TME_LEVEL_INTEGER, |
| 509 | .maximum = V4L2_MPEG_VIDC_VIDEO_TME_LEVEL_INTEGER, |
| 510 | .default_value = V4L2_MPEG_VIDC_VIDEO_TME_LEVEL_INTEGER, |
| 511 | .menu_skip_mask = ~( |
| 512 | (1 << V4L2_MPEG_VIDC_VIDEO_TME_LEVEL_INTEGER) |
| 513 | ), |
| 514 | .qmenu = tme_level, |
| 515 | }, |
| 516 | { |
| 517 | .id = V4L2_CID_MPEG_VIDC_VIDEO_TME_PAYLOAD_VERSION, |
| 518 | .name = "TME Payload Version", |
| 519 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 520 | .minimum = 0, |
| 521 | .maximum = 0xFFFFFFF, |
| 522 | .default_value = 0, |
| 523 | .step = 1, |
| 524 | .menu_skip_mask = 0, |
| 525 | .flags = V4L2_CTRL_FLAG_READ_ONLY, |
| 526 | .qmenu = NULL, |
| 527 | }, |
| 528 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 529 | .id = V4L2_CID_MPEG_VIDC_VIDEO_ROTATION, |
| 530 | .name = "Rotation", |
| 531 | .type = V4L2_CTRL_TYPE_MENU, |
| 532 | .minimum = V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_NONE, |
| 533 | .maximum = V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_270, |
| 534 | .default_value = V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_NONE, |
| 535 | .menu_skip_mask = ~( |
| 536 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_NONE) | |
| 537 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_90) | |
| 538 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_180) | |
| 539 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_270) |
| 540 | ), |
| 541 | .qmenu = mpeg_video_rotation, |
| 542 | }, |
| 543 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 544 | .id = V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE, |
| 545 | .name = "Slice Mode", |
| 546 | .type = V4L2_CTRL_TYPE_MENU, |
| 547 | .minimum = V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE, |
| 548 | .maximum = V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES, |
| 549 | .default_value = V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE, |
| 550 | .menu_skip_mask = ~( |
| 551 | (1 << V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE) | |
| 552 | (1 << V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB) | |
| 553 | (1 << V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES) |
| 554 | ), |
| 555 | }, |
| 556 | { |
| 557 | .id = V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES, |
| 558 | .name = "Slice Byte Size", |
| 559 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 560 | .minimum = MIN_SLICE_BYTE_SIZE, |
| 561 | .maximum = MAX_SLICE_BYTE_SIZE, |
| 562 | .default_value = MIN_SLICE_BYTE_SIZE, |
| 563 | .step = 1, |
| 564 | .menu_skip_mask = 0, |
| 565 | .qmenu = NULL, |
| 566 | }, |
| 567 | { |
| 568 | .id = V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB, |
| 569 | .name = "Slice MB Size", |
| 570 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 571 | .minimum = 1, |
| 572 | .maximum = MAX_SLICE_MB_SIZE, |
| 573 | .default_value = 1, |
| 574 | .step = 1, |
| 575 | .menu_skip_mask = 0, |
| 576 | .qmenu = NULL, |
| 577 | }, |
| 578 | { |
| 579 | .id = V4L2_CID_MPEG_VIDEO_MULTI_SLICE_DELIVERY_MODE, |
| 580 | .name = "Slice delivery mode", |
| 581 | .type = V4L2_CTRL_TYPE_BUTTON, |
| 582 | .minimum = 0, |
| 583 | .maximum = 1, |
| 584 | .default_value = 0, |
| 585 | .step = 1, |
| 586 | .menu_skip_mask = 0, |
| 587 | .qmenu = NULL, |
| 588 | }, |
| 589 | { |
| 590 | .id = V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_MODE, |
| 591 | .name = "Intra Refresh Mode", |
| 592 | .type = V4L2_CTRL_TYPE_MENU, |
| 593 | .minimum = V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_NONE, |
| 594 | .maximum = V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_RANDOM, |
| 595 | .default_value = V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_NONE, |
| 596 | .menu_skip_mask = ~( |
| 597 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_NONE) | |
| 598 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_CYCLIC) | |
| 599 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_RANDOM) |
| 600 | ), |
| 601 | .qmenu = intra_refresh_modes, |
| 602 | }, |
| 603 | { |
| 604 | .id = V4L2_CID_MPEG_VIDC_VIDEO_IR_MBS, |
| 605 | .name = "Intra Refresh AIR MBS", |
| 606 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 607 | .minimum = 0, |
| 608 | .maximum = MAX_INTRA_REFRESH_MBS, |
| 609 | .default_value = 0, |
| 610 | .step = 1, |
| 611 | .menu_skip_mask = 0, |
| 612 | .qmenu = NULL, |
| 613 | }, |
| 614 | { |
| 615 | .id = V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA, |
| 616 | .name = "H.264 Loop Filter Alpha Offset", |
| 617 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 618 | .minimum = -6, |
| 619 | .maximum = 6, |
| 620 | .default_value = 0, |
| 621 | .step = 1, |
| 622 | .menu_skip_mask = 0, |
| 623 | .qmenu = NULL, |
| 624 | }, |
| 625 | { |
| 626 | .id = V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA, |
| 627 | .name = "H.264 Loop Filter Beta Offset", |
| 628 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 629 | .minimum = -6, |
| 630 | .maximum = 6, |
| 631 | .default_value = 0, |
| 632 | .step = 1, |
| 633 | .menu_skip_mask = 0, |
| 634 | .qmenu = NULL, |
| 635 | }, |
| 636 | { |
| 637 | .id = V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE, |
| 638 | .name = "H.264 Loop Filter Mode", |
| 639 | .type = V4L2_CTRL_TYPE_MENU, |
| 640 | .minimum = V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED, |
| 641 | .maximum = L_MODE, |
| 642 | .default_value = V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED, |
| 643 | .menu_skip_mask = ~( |
| 644 | (1 << V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED) | |
| 645 | (1 << V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED) | |
| 646 | (1 << L_MODE) |
| 647 | ), |
| 648 | }, |
| 649 | { |
| 650 | .id = V4L2_CID_MPEG_VIDEO_HEADER_MODE, |
| 651 | .name = "Sequence Header Mode", |
| 652 | .type = V4L2_CTRL_TYPE_MENU, |
| 653 | .minimum = V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE, |
| 654 | .maximum = V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME, |
| 655 | .default_value = |
| 656 | V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME, |
| 657 | .menu_skip_mask = ~( |
| 658 | (1 << V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) | |
| 659 | (1 << V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME) |
| 660 | ), |
| 661 | }, |
| 662 | { |
| 663 | .id = V4L2_CID_MPEG_VIDC_VIDEO_SECURE, |
| 664 | .name = "Secure mode", |
| 665 | .type = V4L2_CTRL_TYPE_BUTTON, |
| 666 | .minimum = 0, |
| 667 | .maximum = 0, |
| 668 | .default_value = 0, |
| 669 | .step = 0, |
| 670 | .menu_skip_mask = 0, |
| 671 | .qmenu = NULL, |
| 672 | }, |
| 673 | { |
| 674 | .id = V4L2_CID_MPEG_VIDC_VIDEO_EXTRADATA, |
| 675 | .name = "Extradata Type", |
| 676 | .type = V4L2_CTRL_TYPE_MENU, |
| 677 | .minimum = V4L2_MPEG_VIDC_EXTRADATA_NONE, |
Maheshwar Ajja | 5ebc266 | 2017-11-02 20:55:54 -0700 | [diff] [blame] | 678 | .maximum = V4L2_MPEG_VIDC_EXTRADATA_ROI_QP, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 679 | .default_value = V4L2_MPEG_VIDC_EXTRADATA_NONE, |
| 680 | .menu_skip_mask = ~( |
| 681 | (1 << V4L2_MPEG_VIDC_EXTRADATA_NONE) | |
| 682 | (1 << V4L2_MPEG_VIDC_EXTRADATA_MB_QUANTIZATION) | |
| 683 | (1 << V4L2_MPEG_VIDC_EXTRADATA_INTERLACE_VIDEO) | |
| 684 | (1 << V4L2_MPEG_VIDC_EXTRADATA_TIMESTAMP) | |
| 685 | (1 << V4L2_MPEG_VIDC_EXTRADATA_S3D_FRAME_PACKING) | |
| 686 | (1 << V4L2_MPEG_VIDC_EXTRADATA_FRAME_RATE) | |
| 687 | (1 << V4L2_MPEG_VIDC_EXTRADATA_PANSCAN_WINDOW) | |
| 688 | (1 << V4L2_MPEG_VIDC_EXTRADATA_RECOVERY_POINT_SEI) | |
| 689 | (1 << V4L2_MPEG_VIDC_EXTRADATA_MULTISLICE_INFO) | |
| 690 | (1 << V4L2_MPEG_VIDC_EXTRADATA_NUM_CONCEALED_MB) | |
| 691 | (1 << V4L2_MPEG_VIDC_EXTRADATA_METADATA_FILLER) | |
| 692 | (1 << V4L2_MPEG_VIDC_EXTRADATA_INPUT_CROP) | |
| 693 | (1 << V4L2_MPEG_VIDC_EXTRADATA_DIGITAL_ZOOM) | |
| 694 | (1 << V4L2_MPEG_VIDC_EXTRADATA_ASPECT_RATIO) | |
| 695 | (1 << V4L2_MPEG_VIDC_EXTRADATA_LTR) | |
| 696 | (1 << V4L2_MPEG_VIDC_EXTRADATA_METADATA_MBI) | |
| 697 | (1 << V4L2_MPEG_VIDC_EXTRADATA_YUV_STATS)| |
Maheshwar Ajja | 5ebc266 | 2017-11-02 20:55:54 -0700 | [diff] [blame] | 698 | (1 << V4L2_MPEG_VIDC_EXTRADATA_ROI_QP) |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 699 | ), |
| 700 | .qmenu = mpeg_video_vidc_extradata, |
| 701 | }, |
| 702 | { |
| 703 | .id = V4L2_CID_MPEG_VIDC_VIDEO_VUI_TIMING_INFO, |
| 704 | .name = "H264 VUI Timing Info", |
| 705 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 706 | .minimum = V4L2_MPEG_VIDC_VIDEO_VUI_TIMING_INFO_DISABLED, |
| 707 | .maximum = V4L2_MPEG_VIDC_VIDEO_VUI_TIMING_INFO_ENABLED, |
| 708 | .default_value = |
| 709 | V4L2_MPEG_VIDC_VIDEO_VUI_TIMING_INFO_DISABLED, |
| 710 | .step = 1, |
| 711 | }, |
| 712 | { |
| 713 | .id = V4L2_CID_MPEG_VIDC_VIDEO_AU_DELIMITER, |
Umesh Pandey | 7fce7ee | 2017-03-13 17:59:48 -0700 | [diff] [blame] | 714 | .name = "AU Delimiter", |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 715 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 716 | .minimum = V4L2_MPEG_VIDC_VIDEO_AU_DELIMITER_DISABLED, |
| 717 | .maximum = V4L2_MPEG_VIDC_VIDEO_AU_DELIMITER_ENABLED, |
| 718 | .step = 1, |
| 719 | .default_value = |
| 720 | V4L2_MPEG_VIDC_VIDEO_AU_DELIMITER_DISABLED, |
| 721 | }, |
| 722 | { |
| 723 | .id = V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB, |
| 724 | .name = "Intra Refresh CIR MBS", |
| 725 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 726 | .minimum = 0, |
| 727 | .maximum = MAX_INTRA_REFRESH_MBS, |
| 728 | .default_value = 0, |
| 729 | .step = 1, |
| 730 | .menu_skip_mask = 0, |
| 731 | .qmenu = NULL, |
| 732 | }, |
| 733 | { |
| 734 | .id = V4L2_CID_MPEG_VIDC_VIDEO_PRESERVE_TEXT_QUALITY, |
| 735 | .name = "Preserve Text Qualty", |
| 736 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 737 | .minimum = V4L2_MPEG_VIDC_VIDEO_PRESERVE_TEXT_QUALITY_DISABLED, |
| 738 | .maximum = V4L2_MPEG_VIDC_VIDEO_PRESERVE_TEXT_QUALITY_ENABLED, |
| 739 | .default_value = |
| 740 | V4L2_MPEG_VIDC_VIDEO_PRESERVE_TEXT_QUALITY_DISABLED, |
| 741 | .step = 1, |
| 742 | }, |
| 743 | { |
| 744 | .id = V4L2_CID_MPEG_VIDC_VIDEO_USELTRFRAME, |
| 745 | .name = "H264 Use LTR", |
| 746 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 747 | .minimum = 0, |
| 748 | .maximum = (MAX_LTR_FRAME_COUNT - 1), |
| 749 | .default_value = 0, |
| 750 | .step = 1, |
| 751 | .qmenu = NULL, |
| 752 | }, |
| 753 | { |
| 754 | .id = V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT, |
| 755 | .name = "Ltr Count", |
| 756 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 757 | .minimum = 0, |
| 758 | .maximum = MAX_LTR_FRAME_COUNT, |
| 759 | .default_value = 0, |
| 760 | .step = 1, |
| 761 | .qmenu = NULL, |
| 762 | }, |
| 763 | { |
| 764 | .id = V4L2_CID_MPEG_VIDC_VIDEO_LTRMODE, |
| 765 | .name = "Ltr Mode", |
| 766 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 767 | .minimum = V4L2_MPEG_VIDC_VIDEO_LTR_MODE_DISABLE, |
| 768 | .maximum = V4L2_MPEG_VIDC_VIDEO_LTR_MODE_MANUAL, |
| 769 | .default_value = V4L2_MPEG_VIDC_VIDEO_LTR_MODE_DISABLE, |
| 770 | .step = 1, |
| 771 | .qmenu = NULL, |
| 772 | }, |
| 773 | { |
| 774 | .id = V4L2_CID_MPEG_VIDC_VIDEO_MARKLTRFRAME, |
| 775 | .name = "H264 Mark LTR", |
| 776 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 777 | .minimum = 0, |
| 778 | .maximum = (MAX_LTR_FRAME_COUNT - 1), |
| 779 | .default_value = 0, |
| 780 | .step = 1, |
| 781 | .qmenu = NULL, |
| 782 | }, |
| 783 | { |
| 784 | .id = V4L2_CID_MPEG_VIDC_VIDEO_HIER_P_NUM_LAYERS, |
| 785 | .name = "Set Hier P num layers", |
| 786 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 787 | .minimum = 0, |
| 788 | .maximum = 6, |
| 789 | .default_value = 0, |
| 790 | .step = 1, |
| 791 | .qmenu = NULL, |
| 792 | }, |
| 793 | { |
| 794 | .id = V4L2_CID_MPEG_VIDC_VIDEO_VPX_ERROR_RESILIENCE, |
| 795 | .name = "VP8 Error Resilience mode", |
| 796 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 797 | .minimum = V4L2_MPEG_VIDC_VIDEO_VPX_ERROR_RESILIENCE_DISABLED, |
| 798 | .maximum = V4L2_MPEG_VIDC_VIDEO_VPX_ERROR_RESILIENCE_ENABLED, |
| 799 | .default_value = |
| 800 | V4L2_MPEG_VIDC_VIDEO_VPX_ERROR_RESILIENCE_DISABLED, |
| 801 | .step = 1, |
| 802 | .qmenu = NULL, |
| 803 | }, |
| 804 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 805 | .id = V4L2_CID_MPEG_VIDC_VIDEO_HIER_B_NUM_LAYERS, |
| 806 | .name = "Set Hier B num layers", |
| 807 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 808 | .minimum = 0, |
| 809 | .maximum = 3, |
| 810 | .default_value = 0, |
| 811 | .step = 1, |
| 812 | .qmenu = NULL, |
| 813 | }, |
| 814 | { |
| 815 | .id = V4L2_CID_MPEG_VIDC_VIDEO_HYBRID_HIERP_MODE, |
| 816 | .name = "Set Hybrid Hier P mode", |
| 817 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 818 | .minimum = 0, |
| 819 | .maximum = 5, |
| 820 | .default_value = 0, |
| 821 | .step = 1, |
| 822 | .qmenu = NULL, |
| 823 | }, |
| 824 | { |
| 825 | .id = V4L2_CID_VIDC_QBUF_MODE, |
| 826 | .name = "Allows batching of buffers for power savings", |
| 827 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 828 | .minimum = V4L2_VIDC_QBUF_STANDARD, |
| 829 | .maximum = V4L2_VIDC_QBUF_BATCHED, |
| 830 | .default_value = V4L2_VIDC_QBUF_STANDARD, |
| 831 | .step = 1, |
| 832 | }, |
| 833 | { |
| 834 | .id = V4L2_CID_MPEG_VIDC_VIDEO_MAX_HIERP_LAYERS, |
| 835 | .name = "Set Max Hier P num layers sessions", |
| 836 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 837 | .minimum = 0, |
| 838 | .maximum = 6, |
| 839 | .default_value = 0, |
| 840 | .step = 1, |
| 841 | .qmenu = NULL, |
| 842 | }, |
| 843 | { |
| 844 | .id = V4L2_CID_MPEG_VIDC_VIDEO_BASELAYER_ID, |
| 845 | .name = "Set Base Layer ID for Hier-P", |
| 846 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 847 | .minimum = 0, |
| 848 | .maximum = 6, |
| 849 | .default_value = 0, |
| 850 | .step = 1, |
| 851 | .qmenu = NULL, |
| 852 | }, |
| 853 | { |
Vaibhav Deshu Venkatesh | d0792bc | 2017-03-16 14:55:51 -0700 | [diff] [blame] | 854 | .id = V4L2_CID_MPEG_VIDC_VIDEO_LAYER_ID, |
| 855 | .name = "Layer ID for different settings", |
| 856 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 857 | .minimum = 0, |
Vaibhav Deshu Venkatesh | ea0a6a6 | 2017-04-20 13:16:44 -0700 | [diff] [blame] | 858 | .maximum = MSM_VIDC_ALL_LAYER_ID, |
Vaibhav Deshu Venkatesh | d0792bc | 2017-03-16 14:55:51 -0700 | [diff] [blame] | 859 | .default_value = 0, |
| 860 | .step = 1, |
| 861 | .qmenu = NULL, |
| 862 | }, |
| 863 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 864 | .id = V4L2_CID_MPEG_VIDC_VENC_PARAM_SAR_WIDTH, |
| 865 | .name = "SAR Width", |
| 866 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 867 | .minimum = 1, |
| 868 | .maximum = 4096, |
| 869 | .default_value = 1, |
| 870 | .step = 1, |
| 871 | .qmenu = NULL, |
| 872 | }, |
| 873 | { |
| 874 | .id = V4L2_CID_MPEG_VIDC_VENC_PARAM_SAR_HEIGHT, |
| 875 | .name = "SAR Height", |
| 876 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 877 | .minimum = 1, |
| 878 | .maximum = 2160, |
| 879 | .default_value = 1, |
| 880 | .step = 1, |
| 881 | .qmenu = NULL, |
| 882 | }, |
| 883 | { |
| 884 | .id = V4L2_CID_MPEG_VIDC_VIDEO_PRIORITY, |
| 885 | .name = "Session Priority", |
| 886 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 887 | .minimum = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_ENABLE, |
| 888 | .maximum = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_DISABLE, |
| 889 | .default_value = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_DISABLE, |
| 890 | .step = 1, |
| 891 | }, |
| 892 | { |
| 893 | .id = V4L2_CID_MPEG_VIDC_VIDEO_VQZIP_SEI, |
| 894 | .name = "VQZIP SEI", |
| 895 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 896 | .minimum = V4L2_CID_MPEG_VIDC_VIDEO_VQZIP_SEI_DISABLE, |
| 897 | .maximum = V4L2_CID_MPEG_VIDC_VIDEO_VQZIP_SEI_ENABLE, |
| 898 | .default_value = V4L2_CID_MPEG_VIDC_VIDEO_VQZIP_SEI_DISABLE, |
| 899 | .step = 1, |
| 900 | }, |
| 901 | { |
| 902 | .id = V4L2_CID_MPEG_VIDC_VENC_PARAM_LAYER_BITRATE, |
| 903 | .name = "Layer wise bitrate for H264/H265 Hybrid HP", |
| 904 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 905 | .minimum = MIN_BIT_RATE, |
| 906 | .maximum = MAX_BIT_RATE, |
| 907 | .default_value = DEFAULT_BIT_RATE, |
| 908 | .step = BIT_RATE_STEP, |
| 909 | .menu_skip_mask = 0, |
| 910 | .qmenu = NULL, |
| 911 | }, |
| 912 | { |
| 913 | .id = V4L2_CID_MPEG_VIDC_VIDEO_OPERATING_RATE, |
| 914 | .name = "Set Encoder Operating rate", |
| 915 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 916 | .minimum = 0, |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 917 | .maximum = INT_MAX, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 918 | .default_value = 0, |
Saurabh Kothawade | 501be79 | 2017-08-29 11:41:38 -0700 | [diff] [blame] | 919 | .step = 1, |
| 920 | }, |
| 921 | { |
| 922 | .id = V4L2_CID_MPEG_VIDC_VIDEO_FRAME_RATE, |
| 923 | .name = "Set Encoder Frame rate", |
| 924 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 925 | .minimum = 0, |
| 926 | .maximum = INT_MAX, |
| 927 | .default_value = 0, |
| 928 | .step = 1, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 929 | }, |
| 930 | { |
| 931 | .id = V4L2_CID_MPEG_VIDC_VIDEO_VENC_BITRATE_TYPE, |
| 932 | .name = "BITRATE TYPE", |
| 933 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 934 | .minimum = V4L2_CID_MPEG_VIDC_VIDEO_VENC_BITRATE_DISABLE, |
| 935 | .maximum = V4L2_CID_MPEG_VIDC_VIDEO_VENC_BITRATE_ENABLE, |
| 936 | .default_value = V4L2_CID_MPEG_VIDC_VIDEO_VENC_BITRATE_ENABLE, |
| 937 | .step = 1, |
| 938 | }, |
| 939 | { |
| 940 | .id = V4L2_CID_MPEG_VIDC_VIDEO_VPE_CSC, |
| 941 | .name = "Set VPE Color space conversion coefficients", |
| 942 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 943 | .minimum = V4L2_CID_MPEG_VIDC_VIDEO_VPE_CSC_DISABLE, |
| 944 | .maximum = V4L2_CID_MPEG_VIDC_VIDEO_VPE_CSC_ENABLE, |
| 945 | .default_value = V4L2_CID_MPEG_VIDC_VIDEO_VPE_CSC_DISABLE, |
| 946 | .step = 1, |
| 947 | }, |
| 948 | { |
| 949 | .id = V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_MODE, |
| 950 | .name = "Low Latency Mode", |
| 951 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 952 | .minimum = V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_DISABLE, |
| 953 | .maximum = V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_ENABLE, |
| 954 | .default_value = V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_DISABLE, |
| 955 | .step = 1, |
| 956 | }, |
| 957 | { |
| 958 | .id = V4L2_CID_MPEG_VIDC_VIDEO_BLUR_WIDTH, |
| 959 | .name = "Set Blur width", |
| 960 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 961 | .minimum = 0, |
| 962 | .maximum = 2048, |
| 963 | .default_value = 0, |
| 964 | .step = 1, |
| 965 | }, |
| 966 | { |
| 967 | .id = V4L2_CID_MPEG_VIDC_VIDEO_BLUR_HEIGHT, |
| 968 | .name = "Set Blur height", |
| 969 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 970 | .minimum = 0, |
| 971 | .maximum = 2048, |
| 972 | .default_value = 0, |
| 973 | .step = 1, |
| 974 | }, |
| 975 | { |
| 976 | .id = V4L2_CID_MPEG_VIDC_VIDEO_H264_TRANSFORM_8x8, |
| 977 | .name = "Transform 8x8", |
| 978 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 979 | .minimum = V4L2_MPEG_VIDC_VIDEO_H264_TRANSFORM_8x8_DISABLE, |
| 980 | .maximum = V4L2_MPEG_VIDC_VIDEO_H264_TRANSFORM_8x8_ENABLE, |
| 981 | .default_value = V4L2_MPEG_VIDC_VIDEO_H264_TRANSFORM_8x8_ENABLE, |
| 982 | .step = 1, |
| 983 | }, |
| 984 | { |
| 985 | .id = V4L2_CID_MPEG_VIDC_VIDEO_COLOR_SPACE, |
| 986 | .name = "Set Color space", |
| 987 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 988 | .minimum = MSM_VIDC_BT709_5, |
| 989 | .maximum = MSM_VIDC_BT2020, |
| 990 | .default_value = MSM_VIDC_BT601_6_625, |
| 991 | .step = 1, |
| 992 | .qmenu = NULL, |
| 993 | }, |
| 994 | { |
| 995 | .id = V4L2_CID_MPEG_VIDC_VIDEO_FULL_RANGE, |
| 996 | .name = "Set Color space range", |
| 997 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 998 | .minimum = V4L2_CID_MPEG_VIDC_VIDEO_FULL_RANGE_DISABLE, |
| 999 | .maximum = V4L2_CID_MPEG_VIDC_VIDEO_FULL_RANGE_ENABLE, |
| 1000 | .default_value = V4L2_CID_MPEG_VIDC_VIDEO_FULL_RANGE_DISABLE, |
| 1001 | .step = 1, |
| 1002 | }, |
| 1003 | { |
| 1004 | .id = V4L2_CID_MPEG_VIDC_VIDEO_TRANSFER_CHARS, |
| 1005 | .name = "Set Color space transfer characterstics", |
| 1006 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 1007 | .minimum = MSM_VIDC_TRANSFER_BT709_5, |
Umesh Pandey | f797f45 | 2017-06-15 16:52:38 -0700 | [diff] [blame] | 1008 | .maximum = MSM_VIDC_TRANSFER_HLG, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1009 | .default_value = MSM_VIDC_TRANSFER_601_6_625, |
| 1010 | .step = 1, |
| 1011 | .qmenu = NULL, |
| 1012 | }, |
| 1013 | { |
| 1014 | .id = V4L2_CID_MPEG_VIDC_VIDEO_MATRIX_COEFFS, |
| 1015 | .name = "Set Color space matrix coefficients", |
| 1016 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 1017 | .minimum = MSM_VIDC_MATRIX_BT_709_5, |
| 1018 | .maximum = MSM_VIDC_MATRIX_BT_2020_CONST, |
| 1019 | .default_value = MSM_VIDC_MATRIX_601_6_625, |
| 1020 | .step = 1, |
| 1021 | .qmenu = NULL, |
| 1022 | }, |
| 1023 | { |
| 1024 | .id = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_TYPE, |
| 1025 | .name = "Bounds of I-frame size", |
| 1026 | .type = V4L2_CTRL_TYPE_MENU, |
| 1027 | .minimum = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_DEFAULT, |
| 1028 | .maximum = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_UNLIMITED, |
| 1029 | .default_value = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_DEFAULT, |
| 1030 | .menu_skip_mask = ~( |
| 1031 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_DEFAULT) | |
| 1032 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_MEDIUM) | |
| 1033 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_HUGE) | |
| 1034 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_UNLIMITED)), |
| 1035 | .qmenu = iframe_sizes, |
| 1036 | }, |
Chinmay Sawarkar | 0f7cf2e | 2017-05-04 11:35:56 -0700 | [diff] [blame] | 1037 | { |
| 1038 | .id = V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE, |
| 1039 | .name = "Frame Rate based Rate Control", |
| 1040 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 1041 | .minimum = 0, |
| 1042 | .maximum = 1, |
| 1043 | .default_value = 0, |
| 1044 | .step = 1, |
| 1045 | }, |
Chinmay Sawarkar | ddd1d97 | 2017-08-15 10:10:06 -0700 | [diff] [blame] | 1046 | { |
| 1047 | .id = V4L2_CID_MPEG_VIDC_VIDEO_VPE_CSC_CUSTOM_MATRIX, |
| 1048 | .name = "Enable/Disable CSC Custom Matrix", |
| 1049 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 1050 | .minimum = 0, |
| 1051 | .maximum = 1, |
| 1052 | .default_value = 0, |
| 1053 | .step = 1, |
| 1054 | }, |
Chinmay Sawarkar | 8775427 | 2017-09-01 14:50:10 -0700 | [diff] [blame] | 1055 | { |
| 1056 | .id = V4L2_CID_MPEG_VIDC_VIDEO_FLIP, |
| 1057 | .name = "Flip", |
| 1058 | .type = V4L2_CTRL_TYPE_MENU, |
| 1059 | .minimum = V4L2_CID_MPEG_VIDC_VIDEO_FLIP_NONE, |
| 1060 | .maximum = V4L2_CID_MPEG_VIDC_VIDEO_FLIP_BOTH, |
| 1061 | .default_value = V4L2_CID_MPEG_VIDC_VIDEO_FLIP_NONE, |
| 1062 | .menu_skip_mask = ~( |
| 1063 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_FLIP_NONE) | |
| 1064 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_FLIP_HORI) | |
| 1065 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_FLIP_VERT) | |
| 1066 | (1 << V4L2_CID_MPEG_VIDC_VIDEO_FLIP_BOTH) |
| 1067 | ), |
| 1068 | .qmenu = mpeg_video_flip, |
| 1069 | }, |
Umesh Pandey | 3224e80 | 2017-10-12 20:18:58 -0700 | [diff] [blame] | 1070 | { |
| 1071 | .id = V4L2_CID_MPEG_VIDC_VENC_HDR_INFO, |
| 1072 | .name = "Enable/Disable HDR INFO", |
| 1073 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 1074 | .minimum = V4L2_MPEG_VIDC_VENC_HDR_INFO_DISABLED, |
| 1075 | .maximum = V4L2_MPEG_VIDC_VENC_HDR_INFO_ENABLED, |
| 1076 | .default_value = V4L2_MPEG_VIDC_VENC_HDR_INFO_DISABLED, |
| 1077 | .step = 1, |
| 1078 | }, |
| 1079 | { |
| 1080 | .id = V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_00, |
| 1081 | .name = "RGB PRIMARIES[0][0]", |
| 1082 | .type = V4L2_CTRL_TYPE_U32, |
| 1083 | .minimum = 0, |
| 1084 | .maximum = UINT_MAX, |
| 1085 | .default_value = 0, |
| 1086 | .step = 1, |
| 1087 | .qmenu = NULL, |
| 1088 | }, |
| 1089 | { |
| 1090 | .id = V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_01, |
| 1091 | .name = "RGB PRIMARIES[0][1]", |
| 1092 | .type = V4L2_CTRL_TYPE_U32, |
| 1093 | .minimum = 0, |
| 1094 | .maximum = UINT_MAX, |
| 1095 | .default_value = 0, |
| 1096 | .step = 1, |
| 1097 | .qmenu = NULL, |
| 1098 | }, |
| 1099 | { |
| 1100 | .id = V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_10, |
| 1101 | .name = "RGB PRIMARIES[1][0]", |
| 1102 | .type = V4L2_CTRL_TYPE_U32, |
| 1103 | .minimum = 0, |
| 1104 | .maximum = UINT_MAX, |
| 1105 | .default_value = 0, |
| 1106 | .step = 1, |
| 1107 | .qmenu = NULL, |
| 1108 | }, |
| 1109 | { |
| 1110 | .id = V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_11, |
| 1111 | .name = "RGB PRIMARIES[1][1]", |
| 1112 | .type = V4L2_CTRL_TYPE_U32, |
| 1113 | .minimum = 0, |
| 1114 | .maximum = UINT_MAX, |
| 1115 | .default_value = 0, |
| 1116 | .step = 1, |
| 1117 | .qmenu = NULL, |
| 1118 | }, |
| 1119 | { |
| 1120 | .id = V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_20, |
| 1121 | .name = "RGB PRIMARIES[2][0]", |
| 1122 | .type = V4L2_CTRL_TYPE_U32, |
| 1123 | .minimum = 0, |
| 1124 | .maximum = UINT_MAX, |
| 1125 | .default_value = 0, |
| 1126 | .step = 1, |
| 1127 | .qmenu = NULL, |
| 1128 | }, |
| 1129 | { |
| 1130 | .id = V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_21, |
| 1131 | .name = "RGB PRIMARIES[2][1]", |
| 1132 | .type = V4L2_CTRL_TYPE_U32, |
| 1133 | .minimum = 0, |
| 1134 | .maximum = UINT_MAX, |
| 1135 | .default_value = 0, |
| 1136 | .step = 1, |
| 1137 | .qmenu = NULL, |
| 1138 | }, |
| 1139 | { |
| 1140 | .id = V4L2_CID_MPEG_VIDC_VENC_WHITEPOINT_X, |
| 1141 | .name = "WHITE POINT X", |
| 1142 | .type = V4L2_CTRL_TYPE_U32, |
| 1143 | .minimum = 0, |
| 1144 | .maximum = UINT_MAX, |
| 1145 | .default_value = 0, |
| 1146 | .step = 1, |
| 1147 | .qmenu = NULL, |
| 1148 | }, |
| 1149 | { |
| 1150 | .id = V4L2_CID_MPEG_VIDC_VENC_WHITEPOINT_Y, |
| 1151 | .name = "WHITE POINT Y", |
| 1152 | .type = V4L2_CTRL_TYPE_U32, |
| 1153 | .minimum = 0, |
| 1154 | .maximum = UINT_MAX, |
| 1155 | .default_value = 0, |
| 1156 | .step = 1, |
| 1157 | .qmenu = NULL, |
| 1158 | }, |
| 1159 | { |
| 1160 | .id = V4L2_CID_MPEG_VIDC_VENC_MAX_DISP_LUM, |
| 1161 | .name = "MAX DISPLAY LUMINANCE", |
| 1162 | .type = V4L2_CTRL_TYPE_U32, |
| 1163 | .minimum = 0, |
| 1164 | .maximum = UINT_MAX, |
| 1165 | .default_value = 0, |
| 1166 | .step = 1, |
| 1167 | .qmenu = NULL, |
| 1168 | }, |
| 1169 | { |
| 1170 | .id = V4L2_CID_MPEG_VIDC_VENC_MIN_DISP_LUM, |
| 1171 | .name = "MIN DISPLAY LUMINANCE", |
| 1172 | .type = V4L2_CTRL_TYPE_U32, |
| 1173 | .minimum = 0, |
| 1174 | .maximum = UINT_MAX, |
| 1175 | .default_value = 0, |
| 1176 | .step = 1, |
| 1177 | .qmenu = NULL, |
| 1178 | }, |
| 1179 | { |
| 1180 | .id = V4L2_CID_MPEG_VIDC_VENC_MAX_CLL, |
| 1181 | .name = "MAX CLL", |
| 1182 | .type = V4L2_CTRL_TYPE_U32, |
| 1183 | .minimum = 0, |
| 1184 | .maximum = UINT_MAX, |
| 1185 | .default_value = 0, |
| 1186 | .step = 1, |
| 1187 | .qmenu = NULL, |
| 1188 | }, |
| 1189 | { |
| 1190 | .id = V4L2_CID_MPEG_VIDC_VENC_MAX_FLL, |
| 1191 | .name = "MAX FLL", |
| 1192 | .type = V4L2_CTRL_TYPE_U32, |
| 1193 | .minimum = 0, |
| 1194 | .maximum = UINT_MAX, |
| 1195 | .default_value = 0, |
| 1196 | .step = 1, |
| 1197 | .qmenu = NULL, |
| 1198 | }, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1199 | |
| 1200 | }; |
| 1201 | |
| 1202 | #define NUM_CTRLS ARRAY_SIZE(msm_venc_ctrls) |
| 1203 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1204 | static u32 get_frame_size_compressed(int plane, u32 height, u32 width) |
| 1205 | { |
| 1206 | int sz = ALIGN(height, 32) * ALIGN(width, 32) * 3 / 2; |
| 1207 | |
| 1208 | return ALIGN(sz, SZ_4K); |
| 1209 | } |
| 1210 | |
| 1211 | static struct msm_vidc_format venc_formats[] = { |
| 1212 | { |
| 1213 | .name = "YCbCr Semiplanar 4:2:0", |
| 1214 | .description = "Y/CbCr 4:2:0", |
| 1215 | .fourcc = V4L2_PIX_FMT_NV12, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1216 | .get_frame_size = get_frame_size_nv12, |
| 1217 | .type = OUTPUT_PORT, |
| 1218 | }, |
| 1219 | { |
| 1220 | .name = "UBWC YCbCr Semiplanar 4:2:0", |
| 1221 | .description = "UBWC Y/CbCr 4:2:0", |
| 1222 | .fourcc = V4L2_PIX_FMT_NV12_UBWC, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1223 | .get_frame_size = get_frame_size_nv12_ubwc, |
| 1224 | .type = OUTPUT_PORT, |
| 1225 | }, |
| 1226 | { |
| 1227 | .name = "RGBA 8:8:8:8", |
| 1228 | .description = "RGBA 8:8:8:8", |
| 1229 | .fourcc = V4L2_PIX_FMT_RGB32, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1230 | .get_frame_size = get_frame_size_rgba, |
| 1231 | .type = OUTPUT_PORT, |
| 1232 | }, |
| 1233 | { |
| 1234 | .name = "H264", |
| 1235 | .description = "H264 compressed format", |
| 1236 | .fourcc = V4L2_PIX_FMT_H264, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1237 | .get_frame_size = get_frame_size_compressed, |
| 1238 | .type = CAPTURE_PORT, |
| 1239 | }, |
| 1240 | { |
| 1241 | .name = "VP8", |
| 1242 | .description = "VP8 compressed format", |
| 1243 | .fourcc = V4L2_PIX_FMT_VP8, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1244 | .get_frame_size = get_frame_size_compressed, |
| 1245 | .type = CAPTURE_PORT, |
| 1246 | }, |
| 1247 | { |
| 1248 | .name = "HEVC", |
| 1249 | .description = "HEVC compressed format", |
| 1250 | .fourcc = V4L2_PIX_FMT_HEVC, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1251 | .get_frame_size = get_frame_size_compressed, |
| 1252 | .type = CAPTURE_PORT, |
| 1253 | }, |
| 1254 | { |
| 1255 | .name = "YCrCb Semiplanar 4:2:0", |
| 1256 | .description = "Y/CrCb 4:2:0", |
| 1257 | .fourcc = V4L2_PIX_FMT_NV21, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1258 | .get_frame_size = get_frame_size_nv21, |
| 1259 | .type = OUTPUT_PORT, |
| 1260 | }, |
Umesh Pandey | f2995f8 | 2017-05-01 16:44:45 -0700 | [diff] [blame] | 1261 | { |
| 1262 | .name = "TP10 UBWC 4:2:0", |
| 1263 | .description = "TP10 UBWC 4:2:0", |
| 1264 | .fourcc = V4L2_PIX_FMT_NV12_TP10_UBWC, |
| 1265 | .get_frame_size = get_frame_size_tp10_ubwc, |
| 1266 | .type = OUTPUT_PORT, |
| 1267 | }, |
Surajit Podder | e502daa | 2017-05-30 19:17:45 +0530 | [diff] [blame] | 1268 | { |
| 1269 | .name = "TME", |
| 1270 | .description = "TME MBI format", |
| 1271 | .fourcc = V4L2_PIX_FMT_TME, |
| 1272 | .get_frame_size = get_frame_size_compressed, |
| 1273 | .type = CAPTURE_PORT, |
| 1274 | }, |
Zhongbo Shi | 1079ebc | 2017-09-06 16:27:28 +0800 | [diff] [blame] | 1275 | { |
| 1276 | .name = "YCbCr Semiplanar 4:2:0 10bit", |
| 1277 | .description = "Y/CbCr 4:2:0 10bit", |
Zhongbo Shi | e4e1fbc | 2017-11-20 14:15:45 +0800 | [diff] [blame^] | 1278 | .fourcc = V4L2_PIX_FMT_SDE_Y_CBCR_H2V2_P010_VENUS, |
Zhongbo Shi | 1079ebc | 2017-09-06 16:27:28 +0800 | [diff] [blame] | 1279 | .get_frame_size = get_frame_size_p010, |
| 1280 | .type = OUTPUT_PORT, |
| 1281 | }, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1282 | }; |
| 1283 | |
Chinmay Sawarkar | ddd1d97 | 2017-08-15 10:10:06 -0700 | [diff] [blame] | 1284 | static int msm_venc_set_csc(struct msm_vidc_inst *inst, |
| 1285 | u32 color_primaries, u32 custom_matrix); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1286 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1287 | static int msm_venc_toggle_hier_p(struct msm_vidc_inst *inst, int layers) |
| 1288 | { |
| 1289 | int num_enh_layers = 0; |
| 1290 | u32 property_id = 0; |
| 1291 | struct hfi_device *hdev = NULL; |
| 1292 | int rc = 0; |
| 1293 | |
| 1294 | if (!inst || !inst->core || !inst->core->device) { |
| 1295 | dprintk(VIDC_ERR, "%s invalid parameters\n", __func__); |
| 1296 | return -EINVAL; |
| 1297 | } |
| 1298 | |
| 1299 | if (inst->fmts[CAPTURE_PORT].fourcc != V4L2_PIX_FMT_VP8) |
| 1300 | return 0; |
| 1301 | |
Chinmay Sawarkar | cbd3f59 | 2017-04-10 15:42:30 -0700 | [diff] [blame] | 1302 | num_enh_layers = layers ? layers : 0; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1303 | dprintk(VIDC_DBG, "%s Hier-P in firmware\n", |
| 1304 | num_enh_layers ? "Enable" : "Disable"); |
| 1305 | |
| 1306 | hdev = inst->core->device; |
| 1307 | property_id = HAL_PARAM_VENC_HIER_P_MAX_ENH_LAYERS; |
| 1308 | rc = call_hfi_op(hdev, session_set_property, |
| 1309 | (void *)inst->session, property_id, |
| 1310 | (void *)&num_enh_layers); |
| 1311 | if (rc) { |
| 1312 | dprintk(VIDC_ERR, |
| 1313 | "%s: failed with error = %d\n", __func__, rc); |
| 1314 | } |
| 1315 | return rc; |
| 1316 | } |
| 1317 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1318 | static struct v4l2_ctrl *get_ctrl_from_cluster(int id, |
| 1319 | struct v4l2_ctrl **cluster, int ncontrols) |
| 1320 | { |
| 1321 | int c; |
| 1322 | |
| 1323 | for (c = 0; c < ncontrols; ++c) |
| 1324 | if (cluster[c]->id == id) |
| 1325 | return cluster[c]; |
| 1326 | return NULL; |
| 1327 | } |
| 1328 | |
Praneeth Paladugu | be42cb2 | 2016-04-12 22:34:39 -0700 | [diff] [blame] | 1329 | int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1330 | { |
| 1331 | int rc = 0; |
| 1332 | struct hal_request_iframe request_iframe; |
| 1333 | struct hal_bitrate bitrate; |
| 1334 | struct hal_profile_level profile_level; |
| 1335 | struct hal_h264_entropy_control h264_entropy_control; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1336 | struct hal_intra_period intra_period; |
| 1337 | struct hal_idr_period idr_period; |
Chinmay Sawarkar | 582c72a | 2017-05-24 14:29:12 -0700 | [diff] [blame] | 1338 | struct hal_vpe_rotation vpe_rotation; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1339 | struct hal_intra_refresh intra_refresh; |
| 1340 | struct hal_multi_slice_control multi_slice_control; |
| 1341 | struct hal_h264_db_control h264_db_control; |
| 1342 | struct hal_enable enable; |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 1343 | struct hal_quantization quant; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1344 | struct hal_preserve_text_quality preserve_text_quality; |
| 1345 | u32 property_id = 0, property_val = 0; |
| 1346 | void *pdata = NULL; |
| 1347 | struct v4l2_ctrl *temp_ctrl = NULL; |
| 1348 | struct hfi_device *hdev; |
| 1349 | struct hal_extradata_enable extra; |
| 1350 | struct hal_ltr_use use_ltr; |
| 1351 | struct hal_ltr_mark mark_ltr; |
| 1352 | struct hal_hybrid_hierp hyb_hierp; |
Vaibhav Deshu Venkatesh | a2cf1b3 | 2017-03-30 17:40:48 -0700 | [diff] [blame] | 1353 | u32 hier_p_layers = 0; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1354 | int max_hierp_layers; |
| 1355 | int baselayerid = 0; |
| 1356 | struct hal_video_signal_info signal_info = {0}; |
Chinmay Sawarkar | d005462 | 2017-05-04 13:50:59 -0700 | [diff] [blame] | 1357 | struct hal_vui_timing_info vui_timing_info = {0}; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1358 | enum hal_iframesize_type iframesize_type = HAL_IFRAMESIZE_TYPE_DEFAULT; |
Chinmay Sawarkar | ddd1d97 | 2017-08-15 10:10:06 -0700 | [diff] [blame] | 1359 | u32 color_primaries, custom_matrix; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1360 | |
| 1361 | if (!inst || !inst->core || !inst->core->device) { |
| 1362 | dprintk(VIDC_ERR, "%s invalid parameters\n", __func__); |
| 1363 | return -EINVAL; |
| 1364 | } |
| 1365 | hdev = inst->core->device; |
| 1366 | |
| 1367 | /* Small helper macro for quickly getting a control and err checking */ |
| 1368 | #define TRY_GET_CTRL(__ctrl_id) ({ \ |
| 1369 | struct v4l2_ctrl *__temp; \ |
| 1370 | __temp = get_ctrl_from_cluster( \ |
| 1371 | __ctrl_id, \ |
| 1372 | ctrl->cluster, ctrl->ncontrols); \ |
| 1373 | if (!__temp) { \ |
| 1374 | dprintk(VIDC_ERR, "Can't find %s (%x) in cluster\n", \ |
| 1375 | #__ctrl_id, __ctrl_id); \ |
| 1376 | /* Clusters are hardcoded, if we can't find */ \ |
| 1377 | /* something then things are massively screwed up */ \ |
| 1378 | MSM_VIDC_ERROR(1); \ |
| 1379 | } \ |
| 1380 | __temp; \ |
| 1381 | }) |
| 1382 | |
| 1383 | /* |
| 1384 | * Unlock the control prior to setting to the hardware. Otherwise |
| 1385 | * lower level code that attempts to do a get_ctrl() will end up |
| 1386 | * deadlocking. |
| 1387 | */ |
| 1388 | v4l2_ctrl_unlock(ctrl); |
| 1389 | |
| 1390 | switch (ctrl->id) { |
| 1391 | case V4L2_CID_MPEG_VIDC_VIDEO_IDR_PERIOD: |
| 1392 | if (inst->fmts[CAPTURE_PORT].fourcc != V4L2_PIX_FMT_H264 && |
| 1393 | inst->fmts[CAPTURE_PORT].fourcc != |
| 1394 | V4L2_PIX_FMT_H264_NO_SC && |
| 1395 | inst->fmts[CAPTURE_PORT].fourcc != |
| 1396 | V4L2_PIX_FMT_HEVC) { |
| 1397 | dprintk(VIDC_ERR, |
| 1398 | "Control %#x only valid for H264 and HEVC\n", |
| 1399 | ctrl->id); |
| 1400 | rc = -ENOTSUPP; |
| 1401 | break; |
| 1402 | } |
| 1403 | |
| 1404 | property_id = HAL_CONFIG_VENC_IDR_PERIOD; |
| 1405 | idr_period.idr_period = ctrl->val; |
| 1406 | pdata = &idr_period; |
| 1407 | break; |
| 1408 | case V4L2_CID_MPEG_VIDC_VIDEO_NUM_B_FRAMES: |
| 1409 | case V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAMES: |
| 1410 | { |
| 1411 | int num_p, num_b; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1412 | |
| 1413 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_NUM_B_FRAMES); |
| 1414 | num_b = temp_ctrl->val; |
| 1415 | |
| 1416 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAMES); |
| 1417 | num_p = temp_ctrl->val; |
| 1418 | |
| 1419 | if (ctrl->id == V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAMES) |
| 1420 | num_p = ctrl->val; |
| 1421 | else if (ctrl->id == V4L2_CID_MPEG_VIDC_VIDEO_NUM_B_FRAMES) |
| 1422 | num_b = ctrl->val; |
| 1423 | |
Saurabh Kothawade | b11d81c | 2017-05-18 19:07:17 -0700 | [diff] [blame] | 1424 | if ((num_b < inst->capability.bframe.min) || |
| 1425 | (num_b > inst->capability.bframe.max)) { |
| 1426 | dprintk(VIDC_ERR, |
| 1427 | "Error setting num b frames %d min, max supported is %d, %d\n", |
| 1428 | num_b, inst->capability.bframe.min, |
| 1429 | inst->capability.bframe.max); |
| 1430 | rc = -ENOTSUPP; |
| 1431 | break; |
| 1432 | } |
| 1433 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1434 | property_id = HAL_CONFIG_VENC_INTRA_PERIOD; |
| 1435 | intra_period.pframes = num_p; |
| 1436 | intra_period.bframes = num_b; |
| 1437 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1438 | pdata = &intra_period; |
| 1439 | break; |
| 1440 | } |
| 1441 | case V4L2_CID_MPEG_VIDC_VIDEO_REQUEST_IFRAME: |
| 1442 | property_id = HAL_CONFIG_VENC_REQUEST_IFRAME; |
| 1443 | request_iframe.enable = true; |
| 1444 | pdata = &request_iframe; |
| 1445 | break; |
| 1446 | case V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL: |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1447 | { |
Saurabh Kothawade | 78ea664 | 2017-10-03 16:16:00 -0700 | [diff] [blame] | 1448 | struct v4l2_ctrl *hybrid_hp = TRY_GET_CTRL( |
| 1449 | V4L2_CID_MPEG_VIDC_VIDEO_HYBRID_HIERP_MODE); |
| 1450 | if ((ctrl->val == |
| 1451 | V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_CBR_VFR |
| 1452 | || ctrl->val == |
| 1453 | V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_VBR_VFR) |
| 1454 | && hybrid_hp->val) { |
| 1455 | dprintk(VIDC_ERR, |
| 1456 | "CBR_VFR/VBR_VFR not allowed with Hybrid HP\n"); |
| 1457 | rc = -ENOTSUPP; |
| 1458 | break; |
| 1459 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1460 | property_id = HAL_PARAM_VENC_RATE_CONTROL; |
Chinmay Sawarkar | 0a9cca3 | 2017-04-11 12:52:59 -0700 | [diff] [blame] | 1461 | property_val = ctrl->val; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1462 | pdata = &property_val; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1463 | break; |
| 1464 | } |
| 1465 | case V4L2_CID_MPEG_VIDEO_BITRATE: |
| 1466 | { |
| 1467 | property_id = HAL_CONFIG_VENC_TARGET_BITRATE; |
| 1468 | bitrate.bit_rate = ctrl->val; |
Vaibhav Deshu Venkatesh | 5115b46 | 2017-05-05 17:48:50 -0700 | [diff] [blame] | 1469 | bitrate.layer_id = MSM_VIDC_ALL_LAYER_ID; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1470 | pdata = &bitrate; |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 1471 | inst->clk_data.bitrate = ctrl->val; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1472 | break; |
| 1473 | } |
| 1474 | case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: |
| 1475 | { |
| 1476 | struct v4l2_ctrl *avg_bitrate = TRY_GET_CTRL( |
| 1477 | V4L2_CID_MPEG_VIDEO_BITRATE); |
| 1478 | |
| 1479 | if (ctrl->val < avg_bitrate->val) { |
| 1480 | dprintk(VIDC_ERR, |
| 1481 | "Peak bitrate (%d) is lower than average bitrate (%d)\n", |
| 1482 | ctrl->val, avg_bitrate->val); |
| 1483 | rc = -EINVAL; |
| 1484 | break; |
| 1485 | } else if (ctrl->val < avg_bitrate->val * 2) { |
| 1486 | dprintk(VIDC_WARN, |
| 1487 | "Peak bitrate (%d) ideally should be twice the average bitrate (%d)\n", |
| 1488 | ctrl->val, avg_bitrate->val); |
| 1489 | } |
| 1490 | |
| 1491 | property_id = HAL_CONFIG_VENC_MAX_BITRATE; |
| 1492 | bitrate.bit_rate = ctrl->val; |
Vaibhav Deshu Venkatesh | 5115b46 | 2017-05-05 17:48:50 -0700 | [diff] [blame] | 1493 | bitrate.layer_id = MSM_VIDC_ALL_LAYER_ID; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1494 | pdata = &bitrate; |
| 1495 | break; |
| 1496 | } |
| 1497 | case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE: |
| 1498 | temp_ctrl = TRY_GET_CTRL( |
| 1499 | V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL); |
| 1500 | |
| 1501 | property_id = HAL_PARAM_VENC_H264_ENTROPY_CONTROL; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1502 | h264_entropy_control.entropy_mode = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1503 | V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE, ctrl->val); |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1504 | h264_entropy_control.cabac_model = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1505 | V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL, |
| 1506 | temp_ctrl->val); |
| 1507 | pdata = &h264_entropy_control; |
| 1508 | break; |
| 1509 | case V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL: |
| 1510 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE); |
| 1511 | |
| 1512 | property_id = HAL_PARAM_VENC_H264_ENTROPY_CONTROL; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1513 | h264_entropy_control.cabac_model = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1514 | V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE, ctrl->val); |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1515 | h264_entropy_control.entropy_mode = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1516 | V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL, |
| 1517 | temp_ctrl->val); |
| 1518 | pdata = &h264_entropy_control; |
| 1519 | break; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1520 | case V4L2_CID_MPEG_VIDEO_H264_PROFILE: |
| 1521 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_H264_LEVEL); |
| 1522 | |
| 1523 | property_id = HAL_PARAM_PROFILE_LEVEL_CURRENT; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1524 | profile_level.profile = msm_comm_v4l2_to_hal(ctrl->id, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1525 | ctrl->val); |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1526 | profile_level.level = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1527 | V4L2_CID_MPEG_VIDEO_H264_LEVEL, |
| 1528 | temp_ctrl->val); |
| 1529 | pdata = &profile_level; |
| 1530 | dprintk(VIDC_DBG, "\nprofile: %d\n", |
| 1531 | profile_level.profile); |
| 1532 | break; |
| 1533 | case V4L2_CID_MPEG_VIDEO_H264_LEVEL: |
| 1534 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_H264_PROFILE); |
| 1535 | |
| 1536 | property_id = HAL_PARAM_PROFILE_LEVEL_CURRENT; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1537 | profile_level.level = msm_comm_v4l2_to_hal(ctrl->id, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1538 | ctrl->val); |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1539 | profile_level.profile = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1540 | V4L2_CID_MPEG_VIDEO_H264_PROFILE, |
| 1541 | temp_ctrl->val); |
| 1542 | pdata = &profile_level; |
| 1543 | dprintk(VIDC_DBG, "\nLevel: %d\n", |
| 1544 | profile_level.level); |
| 1545 | break; |
| 1546 | case V4L2_CID_MPEG_VIDC_VIDEO_VP8_PROFILE_LEVEL: |
| 1547 | property_id = HAL_PARAM_PROFILE_LEVEL_CURRENT; |
Vaibhav Deshu Venkatesh | 0ad53f0 | 2017-08-07 13:21:47 -0700 | [diff] [blame] | 1548 | profile_level.profile = HAL_VP8_PROFILE_MAIN; |
Chinmay Sawarkar | 7f1cc15 | 2017-05-05 18:16:36 -0700 | [diff] [blame] | 1549 | profile_level.level = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1550 | V4L2_CID_MPEG_VIDC_VIDEO_VP8_PROFILE_LEVEL, |
| 1551 | ctrl->val); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1552 | pdata = &profile_level; |
| 1553 | break; |
| 1554 | case V4L2_CID_MPEG_VIDC_VIDEO_HEVC_PROFILE: |
| 1555 | temp_ctrl = |
| 1556 | TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_HEVC_TIER_LEVEL); |
| 1557 | |
| 1558 | property_id = HAL_PARAM_PROFILE_LEVEL_CURRENT; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1559 | profile_level.profile = msm_comm_v4l2_to_hal(ctrl->id, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1560 | ctrl->val); |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1561 | profile_level.level = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1562 | V4L2_CID_MPEG_VIDC_VIDEO_HEVC_TIER_LEVEL, |
| 1563 | temp_ctrl->val); |
| 1564 | pdata = &profile_level; |
| 1565 | break; |
| 1566 | case V4L2_CID_MPEG_VIDC_VIDEO_HEVC_TIER_LEVEL: |
| 1567 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_HEVC_PROFILE); |
| 1568 | |
| 1569 | property_id = HAL_PARAM_PROFILE_LEVEL_CURRENT; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1570 | profile_level.level = msm_comm_v4l2_to_hal(ctrl->id, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1571 | ctrl->val); |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1572 | profile_level.profile = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1573 | V4L2_CID_MPEG_VIDC_VIDEO_HEVC_PROFILE, |
| 1574 | temp_ctrl->val); |
| 1575 | pdata = &profile_level; |
| 1576 | break; |
Surajit Podder | e502daa | 2017-05-30 19:17:45 +0530 | [diff] [blame] | 1577 | case V4L2_CID_MPEG_VIDC_VIDEO_TME_PROFILE: |
| 1578 | temp_ctrl = |
| 1579 | TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_TME_LEVEL); |
| 1580 | |
| 1581 | property_id = HAL_PARAM_PROFILE_LEVEL_CURRENT; |
| 1582 | profile_level.profile = msm_comm_v4l2_to_hal(ctrl->id, |
| 1583 | ctrl->val); |
| 1584 | profile_level.level = msm_comm_v4l2_to_hal( |
| 1585 | V4L2_CID_MPEG_VIDC_VIDEO_TME_LEVEL, |
| 1586 | temp_ctrl->val); |
| 1587 | pdata = &profile_level; |
| 1588 | break; |
| 1589 | case V4L2_CID_MPEG_VIDC_VIDEO_TME_LEVEL: |
| 1590 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_TME_PROFILE); |
| 1591 | |
| 1592 | property_id = HAL_PARAM_PROFILE_LEVEL_CURRENT; |
| 1593 | profile_level.level = msm_comm_v4l2_to_hal(ctrl->id, |
| 1594 | ctrl->val); |
| 1595 | profile_level.profile = msm_comm_v4l2_to_hal( |
| 1596 | V4L2_CID_MPEG_VIDC_VIDEO_TME_PROFILE, |
| 1597 | temp_ctrl->val); |
| 1598 | pdata = &profile_level; |
| 1599 | break; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1600 | case V4L2_CID_MPEG_VIDC_VIDEO_ROTATION: |
| 1601 | { |
Chinmay Sawarkar | 8775427 | 2017-09-01 14:50:10 -0700 | [diff] [blame] | 1602 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_FLIP); |
Chinmay Sawarkar | 582c72a | 2017-05-24 14:29:12 -0700 | [diff] [blame] | 1603 | property_id = HAL_PARAM_VPE_ROTATION; |
| 1604 | vpe_rotation.rotate = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1605 | V4L2_CID_MPEG_VIDC_VIDEO_ROTATION, |
| 1606 | ctrl->val); |
Chinmay Sawarkar | 8775427 | 2017-09-01 14:50:10 -0700 | [diff] [blame] | 1607 | vpe_rotation.flip = msm_comm_v4l2_to_hal( |
| 1608 | V4L2_CID_MPEG_VIDC_VIDEO_FLIP, |
| 1609 | temp_ctrl->val); |
| 1610 | pdata = &vpe_rotation; |
| 1611 | break; |
| 1612 | } |
| 1613 | case V4L2_CID_MPEG_VIDC_VIDEO_FLIP: |
| 1614 | { |
| 1615 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_ROTATION); |
| 1616 | property_id = HAL_PARAM_VPE_ROTATION; |
| 1617 | vpe_rotation.rotate = msm_comm_v4l2_to_hal( |
| 1618 | V4L2_CID_MPEG_VIDC_VIDEO_ROTATION, |
| 1619 | temp_ctrl->val); |
| 1620 | vpe_rotation.flip = msm_comm_v4l2_to_hal( |
| 1621 | V4L2_CID_MPEG_VIDC_VIDEO_FLIP, |
| 1622 | ctrl->val); |
Chinmay Sawarkar | 582c72a | 2017-05-24 14:29:12 -0700 | [diff] [blame] | 1623 | pdata = &vpe_rotation; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1624 | break; |
| 1625 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1626 | case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE: { |
| 1627 | int temp = 0; |
| 1628 | |
| 1629 | switch (ctrl->val) { |
| 1630 | case V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB: |
| 1631 | temp = V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB; |
| 1632 | break; |
| 1633 | case V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES: |
| 1634 | temp = V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES; |
| 1635 | break; |
| 1636 | case V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE: |
| 1637 | default: |
| 1638 | temp = 0; |
| 1639 | break; |
| 1640 | } |
| 1641 | |
| 1642 | if (temp) |
| 1643 | temp_ctrl = TRY_GET_CTRL(temp); |
| 1644 | |
| 1645 | property_id = HAL_PARAM_VENC_MULTI_SLICE_CONTROL; |
| 1646 | multi_slice_control.multi_slice = ctrl->val; |
| 1647 | multi_slice_control.slice_size = temp ? temp_ctrl->val : 0; |
| 1648 | |
| 1649 | pdata = &multi_slice_control; |
| 1650 | break; |
| 1651 | } |
| 1652 | case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES: |
| 1653 | case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB: |
| 1654 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE); |
| 1655 | |
| 1656 | property_id = HAL_PARAM_VENC_MULTI_SLICE_CONTROL; |
| 1657 | multi_slice_control.multi_slice = temp_ctrl->val; |
| 1658 | multi_slice_control.slice_size = ctrl->val; |
| 1659 | pdata = &multi_slice_control; |
| 1660 | break; |
| 1661 | case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_DELIVERY_MODE: { |
Qiwei Liu | e4e50ca | 2017-07-24 15:47:25 +0800 | [diff] [blame] | 1662 | bool codecs_supported = |
| 1663 | inst->fmts[CAPTURE_PORT].fourcc == V4L2_PIX_FMT_HEVC || |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1664 | inst->fmts[CAPTURE_PORT].fourcc == V4L2_PIX_FMT_H264 || |
| 1665 | inst->fmts[CAPTURE_PORT].fourcc == |
| 1666 | V4L2_PIX_FMT_H264_NO_SC; |
| 1667 | |
| 1668 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE); |
Qiwei Liu | e4e50ca | 2017-07-24 15:47:25 +0800 | [diff] [blame] | 1669 | if (codecs_supported && temp_ctrl->val == |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1670 | V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB) { |
| 1671 | property_id = HAL_PARAM_VENC_SLICE_DELIVERY_MODE; |
| 1672 | enable.enable = true; |
| 1673 | } else { |
| 1674 | dprintk(VIDC_WARN, |
| 1675 | "Failed : slice delivery mode is not valid\n"); |
| 1676 | enable.enable = false; |
| 1677 | } |
| 1678 | pdata = &enable; |
| 1679 | break; |
| 1680 | } |
Saurabh Kothawade | abed16c | 2017-03-22 17:06:40 -0700 | [diff] [blame] | 1681 | case V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_MODE: |
| 1682 | { |
| 1683 | struct v4l2_ctrl *ir_mbs; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1684 | |
Saurabh Kothawade | abed16c | 2017-03-22 17:06:40 -0700 | [diff] [blame] | 1685 | ir_mbs = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_IR_MBS); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1686 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1687 | property_id = HAL_PARAM_VENC_INTRA_REFRESH; |
| 1688 | |
Saurabh Kothawade | abed16c | 2017-03-22 17:06:40 -0700 | [diff] [blame] | 1689 | intra_refresh.mode = ctrl->val; |
| 1690 | intra_refresh.ir_mbs = ir_mbs->val; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1691 | |
| 1692 | pdata = &intra_refresh; |
| 1693 | break; |
| 1694 | } |
Saurabh Kothawade | abed16c | 2017-03-22 17:06:40 -0700 | [diff] [blame] | 1695 | case V4L2_CID_MPEG_VIDC_VIDEO_IR_MBS: |
| 1696 | { |
| 1697 | struct v4l2_ctrl *ir_mode; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1698 | |
| 1699 | ir_mode = TRY_GET_CTRL( |
| 1700 | V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_MODE); |
| 1701 | |
| 1702 | property_id = HAL_PARAM_VENC_INTRA_REFRESH; |
| 1703 | |
Saurabh Kothawade | abed16c | 2017-03-22 17:06:40 -0700 | [diff] [blame] | 1704 | intra_refresh.mode = ir_mode->val; |
| 1705 | intra_refresh.ir_mbs = ctrl->val; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1706 | |
| 1707 | pdata = &intra_refresh; |
| 1708 | break; |
| 1709 | } |
| 1710 | case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE: |
| 1711 | { |
| 1712 | struct v4l2_ctrl *alpha, *beta; |
| 1713 | |
| 1714 | alpha = TRY_GET_CTRL( |
| 1715 | V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA); |
| 1716 | beta = TRY_GET_CTRL( |
| 1717 | V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA); |
| 1718 | |
| 1719 | property_id = HAL_PARAM_VENC_H264_DEBLOCK_CONTROL; |
| 1720 | h264_db_control.slice_alpha_offset = alpha->val; |
| 1721 | h264_db_control.slice_beta_offset = beta->val; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1722 | h264_db_control.mode = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1723 | V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE, |
| 1724 | ctrl->val); |
| 1725 | pdata = &h264_db_control; |
| 1726 | break; |
| 1727 | } |
| 1728 | case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA: |
| 1729 | { |
| 1730 | struct v4l2_ctrl *mode, *beta; |
| 1731 | |
| 1732 | mode = TRY_GET_CTRL( |
| 1733 | V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE); |
| 1734 | beta = TRY_GET_CTRL( |
| 1735 | V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA); |
| 1736 | |
| 1737 | property_id = HAL_PARAM_VENC_H264_DEBLOCK_CONTROL; |
| 1738 | h264_db_control.slice_alpha_offset = ctrl->val; |
| 1739 | h264_db_control.slice_beta_offset = beta->val; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1740 | h264_db_control.mode = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1741 | V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE, |
| 1742 | mode->val); |
| 1743 | pdata = &h264_db_control; |
| 1744 | break; |
| 1745 | } |
| 1746 | case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA: |
| 1747 | { |
| 1748 | struct v4l2_ctrl *mode, *alpha; |
| 1749 | |
| 1750 | mode = TRY_GET_CTRL( |
| 1751 | V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE); |
| 1752 | alpha = TRY_GET_CTRL( |
| 1753 | V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA); |
| 1754 | property_id = HAL_PARAM_VENC_H264_DEBLOCK_CONTROL; |
| 1755 | h264_db_control.slice_alpha_offset = alpha->val; |
| 1756 | h264_db_control.slice_beta_offset = ctrl->val; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1757 | h264_db_control.mode = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1758 | V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE, |
| 1759 | mode->val); |
| 1760 | pdata = &h264_db_control; |
| 1761 | break; |
| 1762 | } |
| 1763 | case V4L2_CID_MPEG_VIDEO_HEADER_MODE: |
| 1764 | property_id = HAL_PARAM_VENC_SYNC_FRAME_SEQUENCE_HEADER; |
| 1765 | |
| 1766 | switch (ctrl->val) { |
| 1767 | case V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE: |
| 1768 | enable.enable = 0; |
| 1769 | break; |
| 1770 | case V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME: |
Saurabh Kothawade | 846b753 | 2017-03-29 17:17:19 -0700 | [diff] [blame] | 1771 | enable.enable = 1; |
Saurabh Kothawade | f4b7ff0 | 2017-04-04 17:24:04 -0700 | [diff] [blame] | 1772 | break; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1773 | default: |
| 1774 | rc = -ENOTSUPP; |
| 1775 | break; |
| 1776 | } |
| 1777 | pdata = &enable; |
| 1778 | break; |
| 1779 | case V4L2_CID_MPEG_VIDC_VIDEO_SECURE: |
| 1780 | inst->flags |= VIDC_SECURE; |
Karthikeyan Periasamy | a0e4bad | 2017-04-26 12:51:10 -0700 | [diff] [blame] | 1781 | property_id = HAL_PARAM_SECURE; |
| 1782 | property_val = !!(inst->flags & VIDC_SECURE); |
| 1783 | pdata = &property_val; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1784 | dprintk(VIDC_INFO, "Setting secure mode to: %d\n", |
| 1785 | !!(inst->flags & VIDC_SECURE)); |
| 1786 | break; |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 1787 | case V4L2_CID_MPEG_VIDC_VIDEO_EXTRADATA: { |
| 1788 | struct hal_buffer_requirements *buff_req_buffer = NULL; |
| 1789 | int extra_idx = 0; |
| 1790 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1791 | property_id = HAL_PARAM_INDEX_EXTRADATA; |
| 1792 | extra.index = msm_comm_get_hal_extradata_index(ctrl->val); |
| 1793 | extra.enable = 1; |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 1794 | |
| 1795 | switch (ctrl->val) { |
| 1796 | case V4L2_MPEG_VIDC_EXTRADATA_INPUT_CROP: |
| 1797 | case V4L2_MPEG_VIDC_EXTRADATA_DIGITAL_ZOOM: |
| 1798 | case V4L2_MPEG_VIDC_EXTRADATA_ASPECT_RATIO: |
| 1799 | case V4L2_MPEG_VIDC_EXTRADATA_YUV_STATS: |
| 1800 | case V4L2_MPEG_VIDC_EXTRADATA_ROI_QP: |
| 1801 | case V4L2_MPEG_VIDC_EXTRADATA_PQ_INFO: |
| 1802 | inst->bufq[OUTPUT_PORT].num_planes = 2; |
| 1803 | break; |
| 1804 | case V4L2_MPEG_VIDC_EXTRADATA_MULTISLICE_INFO: |
| 1805 | case V4L2_MPEG_VIDC_EXTRADATA_LTR: |
| 1806 | case V4L2_MPEG_VIDC_EXTRADATA_METADATA_MBI: |
| 1807 | inst->bufq[CAPTURE_PORT].num_planes = 2; |
| 1808 | break; |
| 1809 | default: |
| 1810 | rc = -ENOTSUPP; |
| 1811 | break; |
| 1812 | } |
| 1813 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1814 | pdata = &extra; |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 1815 | rc = call_hfi_op(hdev, session_set_property, |
| 1816 | (void *)inst->session, property_id, pdata); |
| 1817 | |
| 1818 | rc = msm_comm_try_get_bufreqs(inst); |
| 1819 | if (rc) { |
| 1820 | dprintk(VIDC_ERR, |
| 1821 | "Failed to get buffer requirements: %d\n", rc); |
| 1822 | break; |
| 1823 | } |
| 1824 | |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 1825 | extra_idx = EXTRADATA_IDX(inst->bufq[OUTPUT_PORT].num_planes); |
Vikash Garodia | cd22b23 | 2017-07-26 20:41:40 +0530 | [diff] [blame] | 1826 | if (extra_idx && (extra_idx < VIDEO_MAX_PLANES)) { |
| 1827 | buff_req_buffer = get_buff_req_buffer(inst, |
| 1828 | HAL_BUFFER_EXTRADATA_INPUT); |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 1829 | |
Vikash Garodia | cd22b23 | 2017-07-26 20:41:40 +0530 | [diff] [blame] | 1830 | inst->bufq[OUTPUT_PORT].plane_sizes[extra_idx] = |
| 1831 | buff_req_buffer ? |
| 1832 | buff_req_buffer->buffer_size : 0; |
| 1833 | } |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 1834 | |
| 1835 | extra_idx = EXTRADATA_IDX(inst->bufq[CAPTURE_PORT].num_planes); |
Vikash Garodia | cd22b23 | 2017-07-26 20:41:40 +0530 | [diff] [blame] | 1836 | if (extra_idx && (extra_idx < VIDEO_MAX_PLANES)) { |
| 1837 | buff_req_buffer = get_buff_req_buffer(inst, |
| 1838 | HAL_BUFFER_EXTRADATA_OUTPUT); |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 1839 | |
Vikash Garodia | cd22b23 | 2017-07-26 20:41:40 +0530 | [diff] [blame] | 1840 | inst->bufq[CAPTURE_PORT].plane_sizes[extra_idx] = |
| 1841 | buff_req_buffer ? |
| 1842 | buff_req_buffer->buffer_size : 0; |
| 1843 | } |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 1844 | property_id = 0; |
| 1845 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1846 | break; |
| 1847 | case V4L2_CID_MPEG_VIDC_VIDEO_AU_DELIMITER: |
Umesh Pandey | 7fce7ee | 2017-03-13 17:59:48 -0700 | [diff] [blame] | 1848 | property_id = HAL_PARAM_VENC_GENERATE_AUDNAL; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1849 | |
| 1850 | switch (ctrl->val) { |
| 1851 | case V4L2_MPEG_VIDC_VIDEO_AU_DELIMITER_DISABLED: |
| 1852 | enable.enable = 0; |
| 1853 | break; |
| 1854 | case V4L2_MPEG_VIDC_VIDEO_AU_DELIMITER_ENABLED: |
| 1855 | enable.enable = 1; |
| 1856 | break; |
| 1857 | default: |
| 1858 | rc = -ENOTSUPP; |
| 1859 | break; |
| 1860 | } |
| 1861 | |
| 1862 | pdata = &enable; |
| 1863 | break; |
| 1864 | case V4L2_CID_MPEG_VIDC_VIDEO_PRESERVE_TEXT_QUALITY: |
| 1865 | property_id = HAL_PARAM_VENC_PRESERVE_TEXT_QUALITY; |
| 1866 | preserve_text_quality.enable = ctrl->val; |
| 1867 | pdata = &preserve_text_quality; |
| 1868 | break; |
| 1869 | case V4L2_CID_MPEG_VIDC_VIDEO_USELTRFRAME: |
| 1870 | property_id = HAL_CONFIG_VENC_USELTRFRAME; |
Chinmay Sawarkar | 73d6fbb | 2017-08-03 19:07:52 -0700 | [diff] [blame] | 1871 | use_ltr.ref_ltr = 0x1 << ctrl->val; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1872 | use_ltr.use_constraint = false; |
| 1873 | use_ltr.frames = 0; |
| 1874 | pdata = &use_ltr; |
| 1875 | break; |
| 1876 | case V4L2_CID_MPEG_VIDC_VIDEO_MARKLTRFRAME: |
| 1877 | property_id = HAL_CONFIG_VENC_MARKLTRFRAME; |
| 1878 | mark_ltr.mark_frame = ctrl->val; |
| 1879 | pdata = &mark_ltr; |
| 1880 | break; |
| 1881 | case V4L2_CID_MPEG_VIDC_VIDEO_HIER_P_NUM_LAYERS: |
| 1882 | property_id = HAL_CONFIG_VENC_HIER_P_NUM_FRAMES; |
| 1883 | hier_p_layers = ctrl->val; |
| 1884 | if (hier_p_layers > inst->capability.hier_p.max) { |
| 1885 | dprintk(VIDC_ERR, |
| 1886 | "Error setting hier p num layers %d max supported is %d\n", |
| 1887 | hier_p_layers, inst->capability.hier_p.max); |
| 1888 | rc = -ENOTSUPP; |
| 1889 | break; |
| 1890 | } |
| 1891 | pdata = &hier_p_layers; |
| 1892 | break; |
| 1893 | case V4L2_CID_MPEG_VIDC_VIDEO_VPX_ERROR_RESILIENCE: |
| 1894 | property_id = HAL_PARAM_VENC_VPX_ERROR_RESILIENCE_MODE; |
| 1895 | enable.enable = ctrl->val; |
| 1896 | pdata = &enable; |
| 1897 | break; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1898 | case V4L2_CID_MPEG_VIDC_VIDEO_HYBRID_HIERP_MODE: |
Saurabh Kothawade | 78ea664 | 2017-10-03 16:16:00 -0700 | [diff] [blame] | 1899 | { |
| 1900 | struct v4l2_ctrl *rate_control; |
| 1901 | |
| 1902 | rate_control = |
| 1903 | TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL); |
| 1904 | if ((rate_control->val == |
| 1905 | V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_CBR_VFR || |
| 1906 | rate_control->val == |
| 1907 | V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_VBR_VFR) |
| 1908 | && ctrl->val) { |
| 1909 | dprintk(VIDC_ERR, |
| 1910 | "Hybrid HP not allowed with CBR_VFR/VBR_VFR\n"); |
| 1911 | rc = -ENOTSUPP; |
| 1912 | break; |
| 1913 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1914 | property_id = HAL_PARAM_VENC_HIER_P_HYBRID_MODE; |
| 1915 | hyb_hierp.layers = ctrl->val; |
| 1916 | pdata = &hyb_hierp; |
| 1917 | break; |
Saurabh Kothawade | 78ea664 | 2017-10-03 16:16:00 -0700 | [diff] [blame] | 1918 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1919 | case V4L2_CID_VIDC_QBUF_MODE: |
| 1920 | property_id = HAL_PARAM_SYNC_BASED_INTERRUPT; |
| 1921 | enable.enable = ctrl->val == V4L2_VIDC_QBUF_BATCHED; |
| 1922 | pdata = &enable; |
| 1923 | break; |
| 1924 | case V4L2_CID_MPEG_VIDC_VIDEO_MAX_HIERP_LAYERS: |
| 1925 | property_id = HAL_PARAM_VENC_HIER_P_MAX_ENH_LAYERS; |
| 1926 | max_hierp_layers = ctrl->val; |
| 1927 | if (max_hierp_layers > inst->capability.hier_p.max) { |
| 1928 | dprintk(VIDC_ERR, |
| 1929 | "Error max HP layers(%d)>max supported(%d)\n", |
| 1930 | max_hierp_layers, inst->capability.hier_p.max); |
| 1931 | rc = -ENOTSUPP; |
| 1932 | break; |
| 1933 | } |
| 1934 | pdata = &max_hierp_layers; |
| 1935 | break; |
| 1936 | case V4L2_CID_MPEG_VIDC_VIDEO_BASELAYER_ID: |
| 1937 | property_id = HAL_CONFIG_VENC_BASELAYER_PRIORITYID; |
| 1938 | baselayerid = ctrl->val; |
| 1939 | pdata = &baselayerid; |
| 1940 | break; |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 1941 | case V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP: { |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 1942 | struct v4l2_ctrl *qpp, *qpb, *mask; |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 1943 | |
| 1944 | property_id = HAL_CONFIG_VENC_FRAME_QP; |
| 1945 | qpp = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_P_FRAME_QP); |
| 1946 | qpb = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_B_FRAME_QP); |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 1947 | mask = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_QP_MASK); |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 1948 | |
| 1949 | quant.qpi = ctrl->val; |
| 1950 | quant.qpp = qpp->val; |
| 1951 | quant.qpb = qpb->val; |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 1952 | quant.enable = mask->val; |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 1953 | quant.layer_id = MSM_VIDC_ALL_LAYER_ID; |
| 1954 | pdata = &quant; |
| 1955 | break; |
| 1956 | } |
| 1957 | case V4L2_CID_MPEG_VIDC_VIDEO_P_FRAME_QP: { |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 1958 | struct v4l2_ctrl *qpi, *qpb, *mask; |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 1959 | |
| 1960 | property_id = HAL_CONFIG_VENC_FRAME_QP; |
| 1961 | qpi = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP); |
| 1962 | qpb = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_B_FRAME_QP); |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 1963 | mask = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_QP_MASK); |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 1964 | |
| 1965 | quant.qpp = ctrl->val; |
| 1966 | quant.qpi = qpi->val; |
| 1967 | quant.qpb = qpb->val; |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 1968 | quant.enable = mask->val; |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 1969 | quant.layer_id = MSM_VIDC_ALL_LAYER_ID; |
| 1970 | pdata = &quant; |
| 1971 | break; |
| 1972 | } |
| 1973 | case V4L2_CID_MPEG_VIDC_VIDEO_B_FRAME_QP: { |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 1974 | struct v4l2_ctrl *qpp, *qpi, *mask; |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 1975 | |
| 1976 | property_id = HAL_CONFIG_VENC_FRAME_QP; |
| 1977 | qpp = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_P_FRAME_QP); |
| 1978 | qpi = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP); |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 1979 | mask = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_QP_MASK); |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 1980 | |
| 1981 | quant.qpb = ctrl->val; |
| 1982 | quant.qpp = qpp->val; |
| 1983 | quant.qpi = qpi->val; |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 1984 | quant.enable = mask->val; |
| 1985 | quant.layer_id = MSM_VIDC_ALL_LAYER_ID; |
| 1986 | pdata = &quant; |
| 1987 | break; |
| 1988 | } |
| 1989 | case V4L2_CID_MPEG_VIDC_VIDEO_QP_MASK: { |
| 1990 | struct v4l2_ctrl *qpi, *qpp, *qpb; |
| 1991 | |
| 1992 | property_id = HAL_CONFIG_VENC_FRAME_QP; |
| 1993 | qpi = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP); |
| 1994 | qpp = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_P_FRAME_QP); |
| 1995 | qpb = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_B_FRAME_QP); |
| 1996 | |
| 1997 | quant.qpi = qpi->val; |
| 1998 | quant.qpp = qpp->val; |
| 1999 | quant.qpb = qpb->val; |
| 2000 | quant.enable = ctrl->val; |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 2001 | quant.layer_id = MSM_VIDC_ALL_LAYER_ID; |
| 2002 | pdata = &quant; |
| 2003 | break; |
| 2004 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2005 | case V4L2_CID_MPEG_VIDC_VIDEO_VQZIP_SEI: |
| 2006 | property_id = HAL_PARAM_VENC_VQZIP_SEI; |
| 2007 | enable.enable = ctrl->val; |
| 2008 | pdata = &enable; |
| 2009 | break; |
| 2010 | case V4L2_CID_MPEG_VIDC_VIDEO_PRIORITY: |
| 2011 | property_id = HAL_CONFIG_REALTIME; |
| 2012 | /* firmware has inverted values for realtime and |
| 2013 | * non-realtime priority |
| 2014 | */ |
| 2015 | enable.enable = !(ctrl->val); |
| 2016 | pdata = &enable; |
| 2017 | switch (ctrl->val) { |
| 2018 | case V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_DISABLE: |
| 2019 | inst->flags &= ~VIDC_REALTIME; |
| 2020 | break; |
| 2021 | case V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_ENABLE: |
| 2022 | inst->flags |= VIDC_REALTIME; |
| 2023 | break; |
| 2024 | default: |
| 2025 | dprintk(VIDC_WARN, |
| 2026 | "inst(%pK) invalid priority ctrl value %#x\n", |
| 2027 | inst, ctrl->val); |
| 2028 | break; |
| 2029 | } |
| 2030 | break; |
| 2031 | case V4L2_CID_MPEG_VIDC_VIDEO_OPERATING_RATE: |
Saurabh Kothawade | 501be79 | 2017-08-29 11:41:38 -0700 | [diff] [blame] | 2032 | if (((ctrl->val >> 16) < inst->capability.frame_rate.min || |
| 2033 | (ctrl->val >> 16) > inst->capability.frame_rate.max) && |
| 2034 | ctrl->val != INT_MAX) { |
| 2035 | dprintk(VIDC_ERR, "Invalid operating rate %u\n", |
| 2036 | (ctrl->val >> 16)); |
| 2037 | rc = -ENOTSUPP; |
| 2038 | } else if (ctrl->val == INT_MAX) { |
| 2039 | dprintk(VIDC_DBG, "inst(%pK) Request for turbo mode\n", |
| 2040 | inst); |
| 2041 | inst->clk_data.turbo_mode = true; |
| 2042 | } else if (msm_vidc_validate_operating_rate(inst, ctrl->val)) { |
| 2043 | dprintk(VIDC_ERR, "Failed to set operating rate\n"); |
| 2044 | rc = -ENOTSUPP; |
| 2045 | } else { |
| 2046 | dprintk(VIDC_DBG, |
| 2047 | "inst(%pK) operating rate changed from %d to %d\n", |
| 2048 | inst, inst->clk_data.operating_rate >> 16, |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 2049 | ctrl->val >> 16); |
Saurabh Kothawade | 501be79 | 2017-08-29 11:41:38 -0700 | [diff] [blame] | 2050 | inst->clk_data.operating_rate = ctrl->val; |
| 2051 | inst->clk_data.turbo_mode = false; |
| 2052 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2053 | break; |
| 2054 | case V4L2_CID_MPEG_VIDC_VIDEO_VENC_BITRATE_TYPE: |
| 2055 | { |
| 2056 | property_id = HAL_PARAM_VENC_BITRATE_TYPE; |
| 2057 | enable.enable = ctrl->val; |
| 2058 | pdata = &enable; |
| 2059 | break; |
| 2060 | } |
| 2061 | case V4L2_CID_MPEG_VIDC_VIDEO_COLOR_SPACE: |
| 2062 | { |
| 2063 | signal_info.color_space = ctrl->val; |
| 2064 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_FULL_RANGE); |
| 2065 | signal_info.full_range = temp_ctrl ? temp_ctrl->val : 0; |
| 2066 | temp_ctrl = |
| 2067 | TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_TRANSFER_CHARS); |
| 2068 | signal_info.transfer_chars = temp_ctrl ? temp_ctrl->val : 0; |
| 2069 | temp_ctrl = |
| 2070 | TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_MATRIX_COEFFS); |
| 2071 | signal_info.matrix_coeffs = temp_ctrl ? temp_ctrl->val : 0; |
| 2072 | property_id = HAL_PARAM_VENC_VIDEO_SIGNAL_INFO; |
| 2073 | pdata = &signal_info; |
| 2074 | break; |
| 2075 | } |
| 2076 | case V4L2_CID_MPEG_VIDC_VIDEO_FULL_RANGE: |
| 2077 | { |
| 2078 | signal_info.full_range = ctrl->val; |
| 2079 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_COLOR_SPACE); |
| 2080 | signal_info.color_space = temp_ctrl ? temp_ctrl->val : 0; |
| 2081 | temp_ctrl = |
| 2082 | TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_TRANSFER_CHARS); |
| 2083 | signal_info.transfer_chars = temp_ctrl ? temp_ctrl->val : 0; |
| 2084 | temp_ctrl = |
| 2085 | TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_MATRIX_COEFFS); |
| 2086 | signal_info.matrix_coeffs = temp_ctrl ? temp_ctrl->val : 0; |
| 2087 | property_id = HAL_PARAM_VENC_VIDEO_SIGNAL_INFO; |
| 2088 | pdata = &signal_info; |
| 2089 | break; |
| 2090 | } |
| 2091 | case V4L2_CID_MPEG_VIDC_VIDEO_TRANSFER_CHARS: |
| 2092 | { |
| 2093 | signal_info.transfer_chars = ctrl->val; |
| 2094 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_FULL_RANGE); |
| 2095 | signal_info.full_range = temp_ctrl ? temp_ctrl->val : 0; |
| 2096 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_COLOR_SPACE); |
| 2097 | signal_info.color_space = temp_ctrl ? temp_ctrl->val : 0; |
| 2098 | temp_ctrl = |
| 2099 | TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_MATRIX_COEFFS); |
| 2100 | signal_info.matrix_coeffs = temp_ctrl ? temp_ctrl->val : 0; |
| 2101 | property_id = HAL_PARAM_VENC_VIDEO_SIGNAL_INFO; |
| 2102 | pdata = &signal_info; |
| 2103 | break; |
| 2104 | } |
| 2105 | case V4L2_CID_MPEG_VIDC_VIDEO_MATRIX_COEFFS: |
| 2106 | { |
| 2107 | signal_info.matrix_coeffs = ctrl->val; |
| 2108 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_FULL_RANGE); |
| 2109 | signal_info.full_range = temp_ctrl ? temp_ctrl->val : 0; |
| 2110 | temp_ctrl = |
| 2111 | TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_TRANSFER_CHARS); |
| 2112 | signal_info.transfer_chars = temp_ctrl ? temp_ctrl->val : 0; |
| 2113 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_COLOR_SPACE); |
| 2114 | signal_info.color_space = temp_ctrl ? temp_ctrl->val : 0; |
| 2115 | property_id = HAL_PARAM_VENC_VIDEO_SIGNAL_INFO; |
| 2116 | pdata = &signal_info; |
| 2117 | break; |
| 2118 | } |
| 2119 | case V4L2_CID_MPEG_VIDC_VIDEO_VPE_CSC: |
Chinmay Sawarkar | ddd1d97 | 2017-08-15 10:10:06 -0700 | [diff] [blame] | 2120 | if (ctrl->val != V4L2_CID_MPEG_VIDC_VIDEO_VPE_CSC_ENABLE) |
| 2121 | break; |
| 2122 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_COLOR_SPACE); |
| 2123 | color_primaries = temp_ctrl->val; |
| 2124 | temp_ctrl = |
| 2125 | TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_VPE_CSC_CUSTOM_MATRIX); |
| 2126 | custom_matrix = temp_ctrl->val; |
| 2127 | rc = msm_venc_set_csc(inst, color_primaries, custom_matrix); |
| 2128 | if (rc) |
| 2129 | dprintk(VIDC_ERR, "fail to set csc: %d\n", rc); |
| 2130 | break; |
| 2131 | case V4L2_CID_MPEG_VIDC_VIDEO_VPE_CSC_CUSTOM_MATRIX: |
| 2132 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_COLOR_SPACE); |
| 2133 | color_primaries = temp_ctrl->val; |
| 2134 | rc = msm_venc_set_csc(inst, color_primaries, ctrl->val); |
| 2135 | if (rc) |
| 2136 | dprintk(VIDC_ERR, "fail to set csc: %d\n", rc); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2137 | break; |
| 2138 | case V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_MODE: |
| 2139 | { |
| 2140 | property_id = HAL_PARAM_VENC_LOW_LATENCY; |
| 2141 | if (ctrl->val == |
| 2142 | V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_ENABLE) |
| 2143 | enable.enable = 1; |
| 2144 | else |
| 2145 | enable.enable = 0; |
| 2146 | pdata = &enable; |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 2147 | inst->clk_data.low_latency_mode = (bool) enable.enable; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2148 | break; |
| 2149 | } |
| 2150 | case V4L2_CID_MPEG_VIDC_VIDEO_H264_TRANSFORM_8x8: |
| 2151 | property_id = HAL_PARAM_VENC_H264_TRANSFORM_8x8; |
| 2152 | switch (ctrl->val) { |
| 2153 | case V4L2_MPEG_VIDC_VIDEO_H264_TRANSFORM_8x8_ENABLE: |
| 2154 | enable.enable = 1; |
| 2155 | break; |
| 2156 | case V4L2_MPEG_VIDC_VIDEO_H264_TRANSFORM_8x8_DISABLE: |
| 2157 | enable.enable = 0; |
| 2158 | break; |
| 2159 | default: |
| 2160 | dprintk(VIDC_ERR, |
| 2161 | "Invalid H264 8x8 transform control value %d\n", |
| 2162 | ctrl->val); |
| 2163 | rc = -ENOTSUPP; |
| 2164 | break; |
| 2165 | } |
| 2166 | pdata = &enable; |
| 2167 | break; |
| 2168 | case V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_TYPE: |
| 2169 | property_id = HAL_PARAM_VENC_IFRAMESIZE_TYPE; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 2170 | iframesize_type = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2171 | V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_TYPE, |
| 2172 | ctrl->val); |
| 2173 | pdata = &iframesize_type; |
| 2174 | break; |
Chinmay Sawarkar | 0f7cf2e | 2017-05-04 11:35:56 -0700 | [diff] [blame] | 2175 | case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE: |
| 2176 | { |
| 2177 | property_id = HAL_PARAM_VENC_DISABLE_RC_TIMESTAMP; |
| 2178 | enable.enable = ctrl->val; |
| 2179 | pdata = &enable; |
| 2180 | break; |
| 2181 | } |
Chinmay Sawarkar | d005462 | 2017-05-04 13:50:59 -0700 | [diff] [blame] | 2182 | case V4L2_CID_MPEG_VIDC_VIDEO_VUI_TIMING_INFO: |
| 2183 | { |
| 2184 | struct v4l2_ctrl *rc_mode; |
| 2185 | bool cfr = false; |
| 2186 | |
| 2187 | property_id = HAL_PARAM_VENC_VUI_TIMING_INFO; |
| 2188 | pdata = &vui_timing_info; |
| 2189 | |
| 2190 | if (ctrl->val != V4L2_MPEG_VIDC_VIDEO_VUI_TIMING_INFO_ENABLED) { |
| 2191 | vui_timing_info.enable = 0; |
| 2192 | break; |
| 2193 | } |
| 2194 | |
| 2195 | rc_mode = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL); |
| 2196 | |
| 2197 | switch (rc_mode->val) { |
| 2198 | case V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_VBR_CFR: |
| 2199 | case V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_CBR_CFR: |
| 2200 | case V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_MBR_CFR: |
| 2201 | cfr = true; |
| 2202 | break; |
| 2203 | default: |
| 2204 | cfr = false; |
| 2205 | } |
| 2206 | |
| 2207 | vui_timing_info.enable = 1; |
| 2208 | vui_timing_info.fixed_frame_rate = cfr; |
| 2209 | vui_timing_info.time_scale = NSEC_PER_SEC; |
| 2210 | break; |
| 2211 | } |
Maheshwar Ajja | 850be3c | 2017-07-06 17:47:40 -0700 | [diff] [blame] | 2212 | case V4L2_CID_MPEG_VIDC_VIDEO_LTRMODE: |
| 2213 | case V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT: |
| 2214 | case V4L2_CID_MPEG_VIDC_VENC_PARAM_SAR_WIDTH: |
| 2215 | case V4L2_CID_MPEG_VIDC_VENC_PARAM_SAR_HEIGHT: |
| 2216 | case V4L2_CID_MPEG_VIDC_VIDEO_BLUR_WIDTH: |
| 2217 | case V4L2_CID_MPEG_VIDC_VIDEO_BLUR_HEIGHT: |
| 2218 | case V4L2_CID_MPEG_VIDC_VIDEO_LAYER_ID: |
| 2219 | case V4L2_CID_MPEG_VIDC_VENC_PARAM_LAYER_BITRATE: |
| 2220 | case V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP_MIN: |
| 2221 | case V4L2_CID_MPEG_VIDC_VIDEO_P_FRAME_QP_MIN: |
| 2222 | case V4L2_CID_MPEG_VIDC_VIDEO_B_FRAME_QP_MIN: |
| 2223 | case V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP_MAX: |
| 2224 | case V4L2_CID_MPEG_VIDC_VIDEO_P_FRAME_QP_MAX: |
| 2225 | case V4L2_CID_MPEG_VIDC_VIDEO_B_FRAME_QP_MAX: |
Umesh Pandey | 3224e80 | 2017-10-12 20:18:58 -0700 | [diff] [blame] | 2226 | case V4L2_CID_MPEG_VIDC_VENC_HDR_INFO: |
| 2227 | case V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_00: |
| 2228 | case V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_01: |
| 2229 | case V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_10: |
| 2230 | case V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_11: |
| 2231 | case V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_20: |
| 2232 | case V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_21: |
| 2233 | case V4L2_CID_MPEG_VIDC_VENC_WHITEPOINT_X: |
| 2234 | case V4L2_CID_MPEG_VIDC_VENC_WHITEPOINT_Y: |
| 2235 | case V4L2_CID_MPEG_VIDC_VENC_MAX_DISP_LUM: |
| 2236 | case V4L2_CID_MPEG_VIDC_VENC_MIN_DISP_LUM: |
| 2237 | case V4L2_CID_MPEG_VIDC_VENC_MAX_CLL: |
| 2238 | case V4L2_CID_MPEG_VIDC_VENC_MAX_FLL: |
Maheshwar Ajja | 850be3c | 2017-07-06 17:47:40 -0700 | [diff] [blame] | 2239 | dprintk(VIDC_DBG, "Set the control : %#x using ext ctrl\n", |
| 2240 | ctrl->id); |
| 2241 | break; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2242 | default: |
| 2243 | dprintk(VIDC_ERR, "Unsupported index: %x\n", ctrl->id); |
| 2244 | rc = -ENOTSUPP; |
| 2245 | break; |
| 2246 | } |
| 2247 | |
| 2248 | v4l2_ctrl_lock(ctrl); |
| 2249 | #undef TRY_GET_CTRL |
| 2250 | |
| 2251 | if (!rc && property_id) { |
Praneeth Paladugu | 92fc3b0 | 2017-05-02 15:35:17 -0700 | [diff] [blame] | 2252 | dprintk(VIDC_DBG, |
| 2253 | "Control: Name = %s, ID = 0x%x Value = %d\n", |
| 2254 | ctrl->name, ctrl->id, ctrl->val); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2255 | rc = call_hfi_op(hdev, session_set_property, |
| 2256 | (void *)inst->session, property_id, pdata); |
| 2257 | } |
| 2258 | |
| 2259 | return rc; |
| 2260 | } |
| 2261 | |
Praneeth Paladugu | be42cb2 | 2016-04-12 22:34:39 -0700 | [diff] [blame] | 2262 | int msm_venc_s_ext_ctrl(struct msm_vidc_inst *inst, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2263 | struct v4l2_ext_controls *ctrl) |
| 2264 | { |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2265 | int rc = 0, i; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2266 | struct v4l2_ext_control *control; |
| 2267 | struct hfi_device *hdev; |
| 2268 | struct hal_ltr_mode ltr_mode; |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 2269 | u32 property_id = 0; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2270 | void *pdata = NULL; |
| 2271 | struct msm_vidc_capability *cap = NULL; |
| 2272 | struct hal_aspect_ratio sar; |
| 2273 | struct hal_bitrate bitrate; |
| 2274 | struct hal_frame_size blur_res; |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 2275 | struct hal_quantization_range qp_range; |
| 2276 | struct hal_quantization qp; |
Umesh Pandey | 3224e80 | 2017-10-12 20:18:58 -0700 | [diff] [blame] | 2277 | struct hal_hdr10_pq_sei hdr10_sei_params; |
| 2278 | struct msm_vidc_mastering_display_colour_sei_payload *mdisp_sei |
| 2279 | = &(hdr10_sei_params.disp_color_sei); |
| 2280 | struct msm_vidc_content_light_level_sei_payload *cll_sei |
| 2281 | = &(hdr10_sei_params.cll_sei); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2282 | |
| 2283 | if (!inst || !inst->core || !inst->core->device || !ctrl) { |
| 2284 | dprintk(VIDC_ERR, "%s invalid parameters\n", __func__); |
| 2285 | return -EINVAL; |
| 2286 | } |
| 2287 | |
Vaibhav Deshu Venkatesh | d0792bc | 2017-03-16 14:55:51 -0700 | [diff] [blame] | 2288 | /* This will check the range for contols and clip if necessary */ |
| 2289 | v4l2_try_ext_ctrls(&inst->ctrl_handler, ctrl); |
| 2290 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2291 | hdev = inst->core->device; |
| 2292 | cap = &inst->capability; |
| 2293 | |
| 2294 | control = ctrl->controls; |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 2295 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2296 | for (i = 0; i < ctrl->count; i++) { |
| 2297 | switch (control[i].id) { |
| 2298 | case V4L2_CID_MPEG_VIDC_VIDEO_LTRMODE: |
| 2299 | if (control[i].value != |
| 2300 | V4L2_MPEG_VIDC_VIDEO_LTR_MODE_DISABLE) { |
| 2301 | rc = msm_venc_toggle_hier_p(inst, false); |
| 2302 | if (rc) |
| 2303 | break; |
| 2304 | } |
| 2305 | ltr_mode.mode = control[i].value; |
| 2306 | ltr_mode.trust_mode = 1; |
| 2307 | property_id = HAL_PARAM_VENC_LTRMODE; |
| 2308 | pdata = <r_mode; |
| 2309 | break; |
| 2310 | case V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT: |
| 2311 | ltr_mode.count = control[i].value; |
| 2312 | if (ltr_mode.count > cap->ltr_count.max) { |
| 2313 | dprintk(VIDC_ERR, |
| 2314 | "Invalid LTR count %d. Supported max: %d\n", |
| 2315 | ltr_mode.count, |
| 2316 | cap->ltr_count.max); |
| 2317 | /* |
| 2318 | * FIXME: Return an error (-EINVALID) |
| 2319 | * here once VP8 supports LTR count |
| 2320 | * capability |
| 2321 | */ |
| 2322 | ltr_mode.count = 1; |
| 2323 | } |
| 2324 | ltr_mode.trust_mode = 1; |
| 2325 | property_id = HAL_PARAM_VENC_LTRMODE; |
| 2326 | pdata = <r_mode; |
| 2327 | break; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2328 | case V4L2_CID_MPEG_VIDC_VENC_PARAM_SAR_WIDTH: |
| 2329 | sar.aspect_width = control[i].value; |
| 2330 | property_id = HAL_PROPERTY_PARAM_VENC_ASPECT_RATIO; |
| 2331 | pdata = &sar; |
| 2332 | break; |
| 2333 | case V4L2_CID_MPEG_VIDC_VENC_PARAM_SAR_HEIGHT: |
| 2334 | sar.aspect_height = control[i].value; |
| 2335 | property_id = HAL_PROPERTY_PARAM_VENC_ASPECT_RATIO; |
| 2336 | pdata = &sar; |
| 2337 | break; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2338 | case V4L2_CID_MPEG_VIDC_VIDEO_BLUR_WIDTH: |
| 2339 | property_id = HAL_CONFIG_VENC_BLUR_RESOLUTION; |
| 2340 | blur_res.width = control[i].value; |
| 2341 | blur_res.buffer_type = HAL_BUFFER_INPUT; |
| 2342 | property_id = HAL_CONFIG_VENC_BLUR_RESOLUTION; |
| 2343 | pdata = &blur_res; |
| 2344 | break; |
| 2345 | case V4L2_CID_MPEG_VIDC_VIDEO_BLUR_HEIGHT: |
| 2346 | blur_res.height = control[i].value; |
| 2347 | blur_res.buffer_type = HAL_BUFFER_INPUT; |
| 2348 | property_id = HAL_CONFIG_VENC_BLUR_RESOLUTION; |
| 2349 | pdata = &blur_res; |
| 2350 | break; |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 2351 | case V4L2_CID_MPEG_VIDC_VIDEO_LAYER_ID: |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 2352 | qp.layer_id = control[i].value; |
| 2353 | /* Enable QP for all frame types by default */ |
| 2354 | qp.enable = 7; |
| 2355 | qp_range.layer_id = control[i].value; |
Vaibhav Deshu Venkatesh | b494b81 | 2017-05-03 16:32:25 -0700 | [diff] [blame] | 2356 | bitrate.layer_id = control[i].value; |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2357 | i++; |
| 2358 | while (i < ctrl->count) { |
| 2359 | switch (control[i].id) { |
| 2360 | case V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP: |
| 2361 | qp.qpi = control[i].value; |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2362 | property_id = |
| 2363 | HAL_CONFIG_VENC_FRAME_QP; |
| 2364 | pdata = &qp; |
| 2365 | break; |
| 2366 | case V4L2_CID_MPEG_VIDC_VIDEO_P_FRAME_QP: |
| 2367 | qp.qpp = control[i].value; |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2368 | property_id = |
| 2369 | HAL_CONFIG_VENC_FRAME_QP; |
| 2370 | pdata = &qp; |
| 2371 | break; |
| 2372 | case V4L2_CID_MPEG_VIDC_VIDEO_B_FRAME_QP: |
| 2373 | qp.qpb = control[i].value; |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 2374 | property_id = |
| 2375 | HAL_CONFIG_VENC_FRAME_QP; |
| 2376 | pdata = &qp; |
| 2377 | break; |
| 2378 | case V4L2_CID_MPEG_VIDC_VIDEO_QP_MASK: |
| 2379 | qp.enable = control[i].value; |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2380 | property_id = |
| 2381 | HAL_CONFIG_VENC_FRAME_QP; |
| 2382 | pdata = &qp; |
| 2383 | break; |
| 2384 | case V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP_MIN: |
| 2385 | qp_range.qpi_min = control[i].value; |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2386 | property_id = |
| 2387 | HAL_PARAM_VENC_SESSION_QP_RANGE; |
| 2388 | pdata = &qp_range; |
| 2389 | break; |
| 2390 | case V4L2_CID_MPEG_VIDC_VIDEO_P_FRAME_QP_MIN: |
| 2391 | qp_range.qpp_min = control[i].value; |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2392 | property_id = |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 2393 | HAL_PARAM_VENC_SESSION_QP_RANGE; |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2394 | pdata = &qp_range; |
| 2395 | break; |
| 2396 | case V4L2_CID_MPEG_VIDC_VIDEO_B_FRAME_QP_MIN: |
| 2397 | qp_range.qpb_min = control[i].value; |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2398 | property_id = |
| 2399 | HAL_PARAM_VENC_SESSION_QP_RANGE; |
| 2400 | pdata = &qp_range; |
| 2401 | break; |
| 2402 | case V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP_MAX: |
| 2403 | qp_range.qpi_max = control[i].value; |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2404 | property_id = |
| 2405 | HAL_PARAM_VENC_SESSION_QP_RANGE; |
| 2406 | pdata = &qp_range; |
| 2407 | break; |
| 2408 | case V4L2_CID_MPEG_VIDC_VIDEO_P_FRAME_QP_MAX: |
| 2409 | qp_range.qpp_max = control[i].value; |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2410 | property_id = |
| 2411 | HAL_PARAM_VENC_SESSION_QP_RANGE; |
| 2412 | pdata = &qp_range; |
| 2413 | break; |
| 2414 | case V4L2_CID_MPEG_VIDC_VIDEO_B_FRAME_QP_MAX: |
| 2415 | qp_range.qpb_max = control[i].value; |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2416 | property_id = |
| 2417 | HAL_PARAM_VENC_SESSION_QP_RANGE; |
| 2418 | pdata = &qp_range; |
| 2419 | break; |
| 2420 | case V4L2_CID_MPEG_VIDC_VENC_PARAM_LAYER_BITRATE: |
| 2421 | bitrate.bit_rate = control[i].value; |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2422 | property_id = |
| 2423 | HAL_CONFIG_VENC_TARGET_BITRATE; |
| 2424 | pdata = &bitrate; |
| 2425 | break; |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 2426 | } |
Vaibhav Deshu Venkatesh | 2c07253 | 2017-04-07 17:50:18 -0700 | [diff] [blame] | 2427 | i++; |
| 2428 | } |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 2429 | break; |
Umesh Pandey | 3224e80 | 2017-10-12 20:18:58 -0700 | [diff] [blame] | 2430 | case V4L2_CID_MPEG_VIDC_VENC_HDR_INFO: |
| 2431 | if (control[i].value == |
| 2432 | V4L2_MPEG_VIDC_VENC_HDR_INFO_DISABLED) |
| 2433 | break; |
| 2434 | memset(&hdr10_sei_params, 0, sizeof(hdr10_sei_params)); |
| 2435 | i++; |
| 2436 | while (i < ctrl->count) { |
| 2437 | switch (control[i].id) { |
| 2438 | case V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_00: |
| 2439 | mdisp_sei->nDisplayPrimariesX[0] = |
| 2440 | control[i].value; |
| 2441 | break; |
| 2442 | case V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_01: |
| 2443 | mdisp_sei->nDisplayPrimariesY[0] = |
| 2444 | control[i].value; |
| 2445 | break; |
| 2446 | case V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_10: |
| 2447 | mdisp_sei->nDisplayPrimariesX[1] = |
| 2448 | control[i].value; |
| 2449 | break; |
| 2450 | case V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_11: |
| 2451 | mdisp_sei->nDisplayPrimariesY[1] = |
| 2452 | control[i].value; |
| 2453 | break; |
| 2454 | case V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_20: |
| 2455 | mdisp_sei->nDisplayPrimariesX[2] = |
| 2456 | control[i].value; |
| 2457 | break; |
| 2458 | case V4L2_CID_MPEG_VIDC_VENC_RGB_PRIMARY_21: |
| 2459 | mdisp_sei->nDisplayPrimariesY[2] = |
| 2460 | control[i].value; |
| 2461 | break; |
| 2462 | case V4L2_CID_MPEG_VIDC_VENC_WHITEPOINT_X: |
| 2463 | mdisp_sei->nWhitePointX = |
| 2464 | control[i].value; |
| 2465 | break; |
| 2466 | case V4L2_CID_MPEG_VIDC_VENC_WHITEPOINT_Y: |
| 2467 | mdisp_sei->nWhitePointY = |
| 2468 | control[i].value; |
| 2469 | break; |
| 2470 | case V4L2_CID_MPEG_VIDC_VENC_MAX_DISP_LUM: |
| 2471 | mdisp_sei-> |
| 2472 | nMaxDisplayMasteringLuminance = |
| 2473 | control[i].value; |
| 2474 | break; |
| 2475 | case V4L2_CID_MPEG_VIDC_VENC_MIN_DISP_LUM: |
| 2476 | mdisp_sei-> |
| 2477 | nMinDisplayMasteringLuminance = |
| 2478 | control[i].value; |
| 2479 | break; |
| 2480 | case V4L2_CID_MPEG_VIDC_VENC_MAX_CLL: |
| 2481 | cll_sei->nMaxContentLight = |
| 2482 | control[i].value; |
| 2483 | break; |
| 2484 | case V4L2_CID_MPEG_VIDC_VENC_MAX_FLL: |
| 2485 | cll_sei->nMaxPicAverageLight = |
| 2486 | control[i].value; |
| 2487 | break; |
| 2488 | default: |
| 2489 | dprintk(VIDC_ERR, |
| 2490 | "Unknown Ctrl:%d, not part of HDR Info", |
| 2491 | control[i].id); |
| 2492 | } |
| 2493 | i++; |
| 2494 | } |
| 2495 | property_id = |
| 2496 | HAL_PARAM_VENC_HDR10_PQ_SEI; |
| 2497 | pdata = &hdr10_sei_params; |
| 2498 | break; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2499 | default: |
| 2500 | dprintk(VIDC_ERR, "Invalid id set: %d\n", |
| 2501 | control[i].id); |
| 2502 | rc = -ENOTSUPP; |
| 2503 | break; |
| 2504 | } |
| 2505 | if (rc) |
| 2506 | break; |
| 2507 | } |
| 2508 | |
| 2509 | if (!rc && property_id) { |
| 2510 | dprintk(VIDC_DBG, "Control: HAL property=%x\n", property_id); |
| 2511 | rc = call_hfi_op(hdev, session_set_property, |
| 2512 | (void *)inst->session, property_id, pdata); |
| 2513 | } |
| 2514 | return rc; |
| 2515 | } |
| 2516 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2517 | int msm_venc_inst_init(struct msm_vidc_inst *inst) |
| 2518 | { |
| 2519 | int rc = 0; |
Praneeth Paladugu | a6b6aa4 | 2017-05-16 13:33:01 -0700 | [diff] [blame] | 2520 | struct msm_vidc_format *fmt = NULL; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2521 | |
| 2522 | if (!inst) { |
| 2523 | dprintk(VIDC_ERR, "Invalid input = %pK\n", inst); |
| 2524 | return -EINVAL; |
| 2525 | } |
| 2526 | inst->prop.height[CAPTURE_PORT] = DEFAULT_HEIGHT; |
| 2527 | inst->prop.width[CAPTURE_PORT] = DEFAULT_WIDTH; |
| 2528 | inst->prop.height[OUTPUT_PORT] = DEFAULT_HEIGHT; |
| 2529 | inst->prop.width[OUTPUT_PORT] = DEFAULT_WIDTH; |
| 2530 | inst->capability.height.min = MIN_SUPPORTED_HEIGHT; |
| 2531 | inst->capability.height.max = DEFAULT_HEIGHT; |
| 2532 | inst->capability.width.min = MIN_SUPPORTED_WIDTH; |
| 2533 | inst->capability.width.max = DEFAULT_WIDTH; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2534 | inst->capability.secure_output2_threshold.min = 0; |
| 2535 | inst->capability.secure_output2_threshold.max = 0; |
Chinmay Sawarkar | 2de3f77 | 2017-02-07 12:03:44 -0800 | [diff] [blame] | 2536 | inst->buffer_mode_set[OUTPUT_PORT] = HAL_BUFFER_MODE_DYNAMIC; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2537 | inst->buffer_mode_set[CAPTURE_PORT] = HAL_BUFFER_MODE_STATIC; |
| 2538 | inst->prop.fps = DEFAULT_FPS; |
| 2539 | inst->capability.pixelprocess_capabilities = 0; |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 2540 | /* To start with, both ports are 1 plane each */ |
| 2541 | inst->bufq[OUTPUT_PORT].num_planes = 1; |
| 2542 | inst->bufq[CAPTURE_PORT].num_planes = 1; |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 2543 | inst->clk_data.operating_rate = 0; |
Praneeth Paladugu | be42cb2 | 2016-04-12 22:34:39 -0700 | [diff] [blame] | 2544 | |
Praneeth Paladugu | 6e63747 | 2017-05-16 16:06:46 -0700 | [diff] [blame] | 2545 | inst->buff_req.buffer[1].buffer_type = HAL_BUFFER_INPUT; |
| 2546 | inst->buff_req.buffer[1].buffer_count_min_host = |
| 2547 | inst->buff_req.buffer[1].buffer_count_actual = |
| 2548 | MIN_NUM_ENC_OUTPUT_BUFFERS; |
| 2549 | inst->buff_req.buffer[2].buffer_type = HAL_BUFFER_OUTPUT; |
| 2550 | inst->buff_req.buffer[2].buffer_count_min_host = |
| 2551 | inst->buff_req.buffer[2].buffer_count_actual = |
| 2552 | MIN_NUM_ENC_CAPTURE_BUFFERS; |
| 2553 | |
Praneeth Paladugu | a6b6aa4 | 2017-05-16 13:33:01 -0700 | [diff] [blame] | 2554 | /* By default, initialize OUTPUT port to UBWC YUV format */ |
| 2555 | fmt = msm_comm_get_pixel_fmt_fourcc(venc_formats, |
| 2556 | ARRAY_SIZE(venc_formats), V4L2_PIX_FMT_NV12_UBWC, |
| 2557 | OUTPUT_PORT); |
| 2558 | if (!fmt || fmt->type != OUTPUT_PORT) { |
| 2559 | dprintk(VIDC_ERR, |
| 2560 | "venc_formats corrupted\n"); |
| 2561 | return -EINVAL; |
| 2562 | } |
| 2563 | memcpy(&inst->fmts[fmt->type], fmt, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2564 | sizeof(struct msm_vidc_format)); |
Praneeth Paladugu | a6b6aa4 | 2017-05-16 13:33:01 -0700 | [diff] [blame] | 2565 | |
| 2566 | /* By default, initialize CAPTURE port to H264 encoder */ |
| 2567 | fmt = msm_comm_get_pixel_fmt_fourcc(venc_formats, |
| 2568 | ARRAY_SIZE(venc_formats), V4L2_PIX_FMT_H264, |
| 2569 | CAPTURE_PORT); |
| 2570 | if (!fmt || fmt->type != CAPTURE_PORT) { |
| 2571 | dprintk(VIDC_ERR, |
| 2572 | "venc_formats corrupted\n"); |
| 2573 | return -EINVAL; |
| 2574 | } |
| 2575 | memcpy(&inst->fmts[fmt->type], fmt, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2576 | sizeof(struct msm_vidc_format)); |
Praneeth Paladugu | a6b6aa4 | 2017-05-16 13:33:01 -0700 | [diff] [blame] | 2577 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2578 | return rc; |
| 2579 | } |
| 2580 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2581 | int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) |
| 2582 | { |
| 2583 | const struct msm_vidc_format *fmt = NULL; |
| 2584 | int rc = 0; |
| 2585 | |
| 2586 | if (!inst || !f) { |
| 2587 | dprintk(VIDC_ERR, |
| 2588 | "Invalid input, inst = %pK, f = %pK\n", inst, f); |
| 2589 | return -EINVAL; |
| 2590 | } |
| 2591 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
| 2592 | fmt = msm_comm_get_pixel_fmt_index(venc_formats, |
| 2593 | ARRAY_SIZE(venc_formats), f->index, CAPTURE_PORT); |
| 2594 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
| 2595 | fmt = msm_comm_get_pixel_fmt_index(venc_formats, |
| 2596 | ARRAY_SIZE(venc_formats), f->index, OUTPUT_PORT); |
| 2597 | f->flags = V4L2_FMT_FLAG_COMPRESSED; |
| 2598 | } |
| 2599 | |
| 2600 | memset(f->reserved, 0, sizeof(f->reserved)); |
| 2601 | if (fmt) { |
| 2602 | strlcpy(f->description, fmt->description, |
| 2603 | sizeof(f->description)); |
| 2604 | f->pixelformat = fmt->fourcc; |
| 2605 | } else { |
| 2606 | dprintk(VIDC_DBG, "No more formats found\n"); |
| 2607 | rc = -EINVAL; |
| 2608 | } |
| 2609 | return rc; |
| 2610 | } |
| 2611 | |
Chinmay Sawarkar | ddd1d97 | 2017-08-15 10:10:06 -0700 | [diff] [blame] | 2612 | static int msm_venc_set_csc(struct msm_vidc_inst *inst, |
| 2613 | u32 color_primaries, u32 custom_matrix) |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2614 | { |
| 2615 | int rc = 0; |
| 2616 | int count = 0; |
| 2617 | struct hal_vpe_color_space_conversion vpe_csc; |
Chinmay Sawarkar | ddd1d97 | 2017-08-15 10:10:06 -0700 | [diff] [blame] | 2618 | struct msm_vidc_platform_resources *resources; |
| 2619 | u32 *bias_coeff = NULL; |
| 2620 | u32 *csc_limit = NULL; |
| 2621 | u32 *csc_matrix = NULL; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2622 | |
Chinmay Sawarkar | ddd1d97 | 2017-08-15 10:10:06 -0700 | [diff] [blame] | 2623 | resources = &(inst->core->resources); |
| 2624 | bias_coeff = |
| 2625 | resources->csc_coeff_data->vpe_csc_custom_bias_coeff; |
| 2626 | csc_limit = |
| 2627 | resources->csc_coeff_data->vpe_csc_custom_limit_coeff; |
| 2628 | csc_matrix = |
| 2629 | resources->csc_coeff_data->vpe_csc_custom_matrix_coeff; |
| 2630 | |
| 2631 | vpe_csc.input_color_primaries = color_primaries; |
| 2632 | /* Custom bias, matrix & limit */ |
| 2633 | vpe_csc.custom_matrix_enabled = custom_matrix; |
| 2634 | |
| 2635 | if (vpe_csc.custom_matrix_enabled && bias_coeff != NULL |
| 2636 | && csc_limit != NULL && csc_matrix != NULL) { |
| 2637 | while (count < HAL_MAX_MATRIX_COEFFS) { |
| 2638 | if (count < HAL_MAX_BIAS_COEFFS) |
| 2639 | vpe_csc.csc_bias[count] = |
| 2640 | bias_coeff[count]; |
| 2641 | if (count < HAL_MAX_LIMIT_COEFFS) |
| 2642 | vpe_csc.csc_limit[count] = |
| 2643 | csc_limit[count]; |
| 2644 | vpe_csc.csc_matrix[count] = |
| 2645 | csc_matrix[count]; |
| 2646 | count = count + 1; |
| 2647 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2648 | } |
| 2649 | rc = msm_comm_try_set_prop(inst, |
| 2650 | HAL_PARAM_VPE_COLOR_SPACE_CONVERSION, &vpe_csc); |
| 2651 | if (rc) |
| 2652 | dprintk(VIDC_ERR, "Setting VPE coefficients failed\n"); |
| 2653 | |
| 2654 | return rc; |
| 2655 | } |
| 2656 | |
| 2657 | int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) |
| 2658 | { |
| 2659 | struct msm_vidc_format *fmt = NULL; |
| 2660 | int rc = 0; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2661 | struct hfi_device *hdev; |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 2662 | int extra_idx = 0, i = 0; |
| 2663 | struct hal_buffer_requirements *buff_req_buffer; |
Praneeth Paladugu | 1f9d1d9 | 2017-04-11 10:36:16 -0700 | [diff] [blame] | 2664 | struct hal_frame_size frame_sz; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2665 | |
| 2666 | if (!inst || !f) { |
| 2667 | dprintk(VIDC_ERR, |
| 2668 | "Invalid input, inst = %pK, format = %pK\n", inst, f); |
| 2669 | return -EINVAL; |
| 2670 | } |
| 2671 | |
| 2672 | if (!inst->core || !inst->core->device) { |
| 2673 | dprintk(VIDC_ERR, "%s invalid parameters\n", __func__); |
| 2674 | return -EINVAL; |
| 2675 | } |
| 2676 | hdev = inst->core->device; |
| 2677 | |
| 2678 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 2679 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2680 | fmt = msm_comm_get_pixel_fmt_fourcc(venc_formats, |
| 2681 | ARRAY_SIZE(venc_formats), f->fmt.pix_mp.pixelformat, |
| 2682 | CAPTURE_PORT); |
| 2683 | if (!fmt || fmt->type != CAPTURE_PORT) { |
| 2684 | dprintk(VIDC_ERR, |
| 2685 | "Format: %d not supported on CAPTURE port\n", |
| 2686 | f->fmt.pix_mp.pixelformat); |
| 2687 | rc = -EINVAL; |
| 2688 | goto exit; |
| 2689 | } |
| 2690 | |
| 2691 | memcpy(&inst->fmts[fmt->type], fmt, |
| 2692 | sizeof(struct msm_vidc_format)); |
| 2693 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2694 | rc = msm_comm_try_state(inst, MSM_VIDC_OPEN_DONE); |
| 2695 | if (rc) { |
| 2696 | dprintk(VIDC_ERR, "Failed to open instance\n"); |
| 2697 | goto exit; |
| 2698 | } |
| 2699 | |
| 2700 | inst->prop.width[CAPTURE_PORT] = f->fmt.pix_mp.width; |
| 2701 | inst->prop.height[CAPTURE_PORT] = f->fmt.pix_mp.height; |
Maheshwar Ajja | 3cff01f | 2017-09-03 14:22:54 -0700 | [diff] [blame] | 2702 | rc = msm_vidc_check_session_supported(inst); |
| 2703 | if (rc) { |
| 2704 | dprintk(VIDC_ERR, |
| 2705 | "%s: session not supported\n", __func__); |
| 2706 | goto exit; |
| 2707 | } |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 2708 | |
Praneeth Paladugu | 1f9d1d9 | 2017-04-11 10:36:16 -0700 | [diff] [blame] | 2709 | frame_sz.buffer_type = HAL_BUFFER_OUTPUT; |
| 2710 | frame_sz.width = inst->prop.width[CAPTURE_PORT]; |
| 2711 | frame_sz.height = inst->prop.height[CAPTURE_PORT]; |
| 2712 | dprintk(VIDC_DBG, "CAPTURE port width = %d, height = %d\n", |
| 2713 | frame_sz.width, frame_sz.height); |
| 2714 | rc = call_hfi_op(hdev, session_set_property, (void *) |
| 2715 | inst->session, HAL_PARAM_FRAME_SIZE, &frame_sz); |
| 2716 | if (rc) { |
| 2717 | dprintk(VIDC_ERR, |
| 2718 | "Failed to set framesize for CAPTURE port\n"); |
| 2719 | goto exit; |
| 2720 | } |
| 2721 | |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 2722 | rc = msm_comm_try_get_bufreqs(inst); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2723 | if (rc) { |
| 2724 | dprintk(VIDC_ERR, |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 2725 | "Failed to get buffer requirements: %d\n", rc); |
| 2726 | return rc; |
| 2727 | } |
| 2728 | |
| 2729 | /* |
| 2730 | * Get CAPTURE plane size from HW. This may change based on |
| 2731 | * settings like Slice delivery mode. HW should decide howmuch |
| 2732 | * it needs. |
| 2733 | */ |
| 2734 | |
| 2735 | buff_req_buffer = get_buff_req_buffer(inst, |
| 2736 | HAL_BUFFER_OUTPUT); |
| 2737 | |
| 2738 | f->fmt.pix_mp.plane_fmt[0].sizeimage = buff_req_buffer ? |
| 2739 | buff_req_buffer->buffer_size : 0; |
| 2740 | |
| 2741 | /* |
| 2742 | * Get CAPTURE plane Extradata size from HW. This may change |
| 2743 | * with no of Extradata's enabled. HW should decide howmuch |
| 2744 | * it needs. |
| 2745 | */ |
| 2746 | |
| 2747 | extra_idx = EXTRADATA_IDX(inst->bufq[fmt->type].num_planes); |
| 2748 | if (extra_idx && extra_idx < VIDEO_MAX_PLANES) { |
| 2749 | buff_req_buffer = get_buff_req_buffer(inst, |
| 2750 | HAL_BUFFER_EXTRADATA_OUTPUT); |
| 2751 | f->fmt.pix_mp.plane_fmt[extra_idx].sizeimage = |
| 2752 | buff_req_buffer ? |
| 2753 | buff_req_buffer->buffer_size : 0; |
| 2754 | } |
| 2755 | |
| 2756 | f->fmt.pix_mp.num_planes = inst->bufq[fmt->type].num_planes; |
| 2757 | for (i = 0; i < inst->bufq[fmt->type].num_planes; i++) { |
| 2758 | inst->bufq[fmt->type].plane_sizes[i] = |
| 2759 | f->fmt.pix_mp.plane_fmt[i].sizeimage; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2760 | } |
Prateek Shrivastava | a02f33f | 2017-11-03 19:56:28 +0530 | [diff] [blame] | 2761 | /* |
| 2762 | * Input extradata buffer size may change upon updating |
| 2763 | * CAPTURE plane buffer size. |
| 2764 | */ |
| 2765 | |
| 2766 | extra_idx = EXTRADATA_IDX(inst->bufq[OUTPUT_PORT].num_planes); |
| 2767 | if (extra_idx && extra_idx < VIDEO_MAX_PLANES) { |
| 2768 | buff_req_buffer = get_buff_req_buffer(inst, |
| 2769 | HAL_BUFFER_EXTRADATA_INPUT); |
| 2770 | inst->bufq[OUTPUT_PORT].plane_sizes[extra_idx] = |
| 2771 | buff_req_buffer ? |
| 2772 | buff_req_buffer->buffer_size : 0; |
| 2773 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2774 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
| 2775 | struct hal_frame_size frame_sz; |
| 2776 | |
| 2777 | inst->prop.width[OUTPUT_PORT] = f->fmt.pix_mp.width; |
| 2778 | inst->prop.height[OUTPUT_PORT] = f->fmt.pix_mp.height; |
Maheshwar Ajja | 3cff01f | 2017-09-03 14:22:54 -0700 | [diff] [blame] | 2779 | rc = msm_vidc_check_session_supported(inst); |
| 2780 | if (rc) { |
| 2781 | dprintk(VIDC_ERR, |
| 2782 | "%s: session not supported\n", __func__); |
| 2783 | goto exit; |
| 2784 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2785 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2786 | frame_sz.buffer_type = HAL_BUFFER_INPUT; |
| 2787 | frame_sz.width = inst->prop.width[OUTPUT_PORT]; |
| 2788 | frame_sz.height = inst->prop.height[OUTPUT_PORT]; |
Praneeth Paladugu | 1f9d1d9 | 2017-04-11 10:36:16 -0700 | [diff] [blame] | 2789 | dprintk(VIDC_DBG, "OUTPUT port width = %d, height = %d\n", |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2790 | frame_sz.width, frame_sz.height); |
| 2791 | rc = call_hfi_op(hdev, session_set_property, (void *) |
| 2792 | inst->session, HAL_PARAM_FRAME_SIZE, &frame_sz); |
| 2793 | if (rc) { |
| 2794 | dprintk(VIDC_ERR, |
| 2795 | "Failed to set framesize for Output port\n"); |
| 2796 | goto exit; |
| 2797 | } |
| 2798 | |
| 2799 | fmt = msm_comm_get_pixel_fmt_fourcc(venc_formats, |
| 2800 | ARRAY_SIZE(venc_formats), f->fmt.pix_mp.pixelformat, |
| 2801 | OUTPUT_PORT); |
| 2802 | if (!fmt || fmt->type != OUTPUT_PORT) { |
| 2803 | dprintk(VIDC_ERR, |
| 2804 | "Format: %d not supported on OUTPUT port\n", |
| 2805 | f->fmt.pix_mp.pixelformat); |
| 2806 | rc = -EINVAL; |
| 2807 | goto exit; |
| 2808 | } |
Praneeth Paladugu | 7722b4e | 2017-07-07 11:01:56 -0700 | [diff] [blame] | 2809 | inst->clk_data.opb_fourcc = f->fmt.pix_mp.pixelformat; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2810 | memcpy(&inst->fmts[fmt->type], fmt, |
| 2811 | sizeof(struct msm_vidc_format)); |
| 2812 | |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 2813 | f->fmt.pix_mp.plane_fmt[0].sizeimage = |
| 2814 | inst->fmts[fmt->type].get_frame_size(0, |
| 2815 | f->fmt.pix_mp.height, f->fmt.pix_mp.width); |
| 2816 | |
| 2817 | rc = msm_comm_try_get_bufreqs(inst); |
| 2818 | if (rc) { |
| 2819 | dprintk(VIDC_ERR, |
| 2820 | "Failed to get buffer requirements: %d\n", rc); |
| 2821 | return rc; |
| 2822 | } |
| 2823 | |
| 2824 | /* |
| 2825 | * Get OUTPUT plane Extradata size from HW. This may change |
| 2826 | * with no of Extradata's enabled. HW should decide howmuch |
| 2827 | * it needs. |
| 2828 | */ |
| 2829 | |
| 2830 | extra_idx = EXTRADATA_IDX(inst->bufq[fmt->type].num_planes); |
| 2831 | if (extra_idx && extra_idx < VIDEO_MAX_PLANES) { |
| 2832 | buff_req_buffer = get_buff_req_buffer(inst, |
| 2833 | HAL_BUFFER_EXTRADATA_INPUT); |
| 2834 | f->fmt.pix_mp.plane_fmt[extra_idx].sizeimage = |
| 2835 | buff_req_buffer ? |
| 2836 | buff_req_buffer->buffer_size : 0; |
| 2837 | } |
| 2838 | |
| 2839 | f->fmt.pix_mp.num_planes = inst->bufq[fmt->type].num_planes; |
| 2840 | |
| 2841 | for (i = 0; i < inst->bufq[fmt->type].num_planes; i++) { |
| 2842 | inst->bufq[fmt->type].plane_sizes[i] = |
| 2843 | f->fmt.pix_mp.plane_fmt[i].sizeimage; |
| 2844 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2845 | |
| 2846 | msm_comm_set_color_format(inst, HAL_BUFFER_INPUT, fmt->fourcc); |
| 2847 | } else { |
| 2848 | dprintk(VIDC_ERR, "%s - Unsupported buf type: %d\n", |
| 2849 | __func__, f->type); |
| 2850 | rc = -EINVAL; |
| 2851 | goto exit; |
| 2852 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2853 | exit: |
| 2854 | return rc; |
| 2855 | } |
| 2856 | |
Praneeth Paladugu | be42cb2 | 2016-04-12 22:34:39 -0700 | [diff] [blame] | 2857 | int msm_venc_ctrl_init(struct msm_vidc_inst *inst, |
| 2858 | const struct v4l2_ctrl_ops *ctrl_ops) |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2859 | { |
| 2860 | return msm_comm_ctrl_init(inst, msm_venc_ctrls, |
Praneeth Paladugu | be42cb2 | 2016-04-12 22:34:39 -0700 | [diff] [blame] | 2861 | ARRAY_SIZE(msm_venc_ctrls), ctrl_ops); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 2862 | } |