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 | |
| 14 | #include <linux/slab.h> |
| 15 | #include <soc/qcom/scm.h> |
| 16 | #include "msm_vidc_internal.h" |
| 17 | #include "msm_vidc_common.h" |
| 18 | #include "vidc_hfi_api.h" |
| 19 | #include "msm_vidc_debug.h" |
| 20 | #include "msm_vidc_clocks.h" |
| 21 | |
| 22 | #define MSM_VDEC_DVC_NAME "msm_vdec_8974" |
Praneeth Paladugu | 6e63747 | 2017-05-16 16:06:46 -0700 | [diff] [blame] | 23 | #define MIN_NUM_THUMBNAIL_MODE_OUTPUT_BUFFERS MIN_NUM_OUTPUT_BUFFERS |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 24 | #define MIN_NUM_THUMBNAIL_MODE_CAPTURE_BUFFERS MIN_NUM_CAPTURE_BUFFERS |
Praneeth Paladugu | 6e63747 | 2017-05-16 16:06:46 -0700 | [diff] [blame] | 25 | #define MIN_NUM_DEC_OUTPUT_BUFFERS 4 |
| 26 | #define MIN_NUM_DEC_CAPTURE_BUFFERS 4 |
Umesh Pandey | 42313a7 | 2017-07-05 18:20:06 -0700 | [diff] [blame] | 27 | // Y=16(0-9bits), Cb(10-19bits)=Cr(20-29bits)=128, black by default |
| 28 | #define DEFAULT_VIDEO_CONCEAL_COLOR_BLACK 0x8020010 |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 29 | #define MB_SIZE_IN_PIXEL (16 * 16) |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 30 | #define OPERATING_FRAME_RATE_STEP (1 << 16) |
| 31 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 32 | static const char *const mpeg_video_stream_format[] = { |
| 33 | "NAL Format Start Codes", |
| 34 | "NAL Format One NAL Per Buffer", |
| 35 | "NAL Format One Byte Length", |
| 36 | "NAL Format Two Byte Length", |
| 37 | "NAL Format Four Byte Length", |
| 38 | NULL |
| 39 | }; |
| 40 | static const char *const mpeg_video_output_order[] = { |
| 41 | "Display Order", |
| 42 | "Decode Order", |
| 43 | NULL |
| 44 | }; |
| 45 | static const char *const mpeg_vidc_video_alloc_mode_type[] = { |
| 46 | "Buffer Allocation Static", |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 47 | "Buffer Allocation Dynamic Buffer" |
| 48 | }; |
| 49 | |
| 50 | static const char *const perf_level[] = { |
| 51 | "Nominal", |
| 52 | "Performance", |
| 53 | "Turbo" |
| 54 | }; |
| 55 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 56 | static const char *const vp8_profile_level[] = { |
| 57 | "Unused", |
| 58 | "0.0", |
| 59 | "1.0", |
| 60 | "2.0", |
| 61 | "3.0", |
| 62 | }; |
| 63 | |
Vaibhav Deshu Venkatesh | b69518e | 2017-08-21 12:22:49 -0700 | [diff] [blame] | 64 | static const char *const vp9_profile[] = { |
| 65 | "Unused", |
| 66 | "0", |
| 67 | "2_10", |
| 68 | }; |
| 69 | |
| 70 | static const char *const vp9_level[] = { |
| 71 | "Unused", |
| 72 | "1.0", |
| 73 | "1.1", |
| 74 | "2.0", |
| 75 | "2.1", |
| 76 | "3.0", |
| 77 | "3.1", |
| 78 | "4.0", |
| 79 | "4.1", |
| 80 | "5.0", |
| 81 | "5.1", |
| 82 | }; |
| 83 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 84 | static const char *const mpeg2_profile[] = { |
| 85 | "Simple", |
| 86 | "Main", |
| 87 | "422", |
| 88 | "Snr Scalable", |
| 89 | "Spatial Scalable", |
| 90 | "High", |
| 91 | }; |
| 92 | |
| 93 | static const char *const mpeg2_level[] = { |
| 94 | "0", |
| 95 | "1", |
| 96 | "2", |
| 97 | "3", |
| 98 | }; |
| 99 | static const char *const mpeg_vidc_video_entropy_mode[] = { |
| 100 | "CAVLC Entropy Mode", |
| 101 | "CABAC Entropy Mode", |
| 102 | }; |
| 103 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 104 | static const char *const mpeg_vidc_video_dpb_color_format[] = { |
| 105 | "DPB Color Format None", |
| 106 | "DPB Color Format UBWC", |
| 107 | "DPB Color Format UBWC TP10", |
| 108 | }; |
| 109 | |
| 110 | static struct msm_vidc_ctrl msm_vdec_ctrls[] = { |
| 111 | { |
| 112 | .id = V4L2_CID_MPEG_VIDC_VIDEO_STREAM_FORMAT, |
| 113 | .name = "NAL Format", |
| 114 | .type = V4L2_CTRL_TYPE_MENU, |
| 115 | .minimum = V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_STARTCODES, |
| 116 | .maximum = V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_FOUR_BYTE_LENGTH, |
| 117 | .default_value = V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_STARTCODES, |
| 118 | .menu_skip_mask = ~( |
| 119 | (1 << V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_STARTCODES) | |
| 120 | (1 << V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_ONE_NAL_PER_BUFFER) | |
| 121 | (1 << V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_ONE_BYTE_LENGTH) | |
| 122 | (1 << V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_TWO_BYTE_LENGTH) | |
| 123 | (1 << V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_FOUR_BYTE_LENGTH) |
| 124 | ), |
| 125 | .qmenu = mpeg_video_stream_format, |
| 126 | }, |
| 127 | { |
| 128 | .id = V4L2_CID_MPEG_VIDC_VIDEO_OUTPUT_ORDER, |
| 129 | .name = "Output Order", |
| 130 | .type = V4L2_CTRL_TYPE_MENU, |
| 131 | .minimum = V4L2_MPEG_VIDC_VIDEO_OUTPUT_ORDER_DISPLAY, |
| 132 | .maximum = V4L2_MPEG_VIDC_VIDEO_OUTPUT_ORDER_DECODE, |
| 133 | .default_value = V4L2_MPEG_VIDC_VIDEO_OUTPUT_ORDER_DISPLAY, |
| 134 | .menu_skip_mask = ~( |
| 135 | (1 << V4L2_MPEG_VIDC_VIDEO_OUTPUT_ORDER_DISPLAY) | |
| 136 | (1 << V4L2_MPEG_VIDC_VIDEO_OUTPUT_ORDER_DECODE) |
| 137 | ), |
| 138 | .qmenu = mpeg_video_output_order, |
| 139 | }, |
| 140 | { |
| 141 | .id = V4L2_CID_MPEG_VIDC_VIDEO_PICTYPE_DEC_MODE, |
| 142 | .name = "Picture Type Decoding", |
| 143 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 144 | .minimum = 0, |
| 145 | .maximum = 1, |
| 146 | .default_value = 0, |
| 147 | .step = 1, |
| 148 | .menu_skip_mask = 0, |
| 149 | .qmenu = NULL, |
| 150 | }, |
| 151 | { |
| 152 | .id = V4L2_CID_MPEG_VIDC_VIDEO_SYNC_FRAME_DECODE, |
| 153 | .name = "Sync Frame Decode", |
| 154 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 155 | .minimum = V4L2_MPEG_VIDC_VIDEO_SYNC_FRAME_DECODE_DISABLE, |
| 156 | .maximum = V4L2_MPEG_VIDC_VIDEO_SYNC_FRAME_DECODE_ENABLE, |
| 157 | .default_value = V4L2_MPEG_VIDC_VIDEO_SYNC_FRAME_DECODE_DISABLE, |
| 158 | .step = 1, |
| 159 | }, |
| 160 | { |
| 161 | .id = V4L2_CID_MPEG_VIDC_VIDEO_SECURE, |
| 162 | .name = "Secure mode", |
| 163 | .type = V4L2_CTRL_TYPE_BUTTON, |
| 164 | .minimum = 0, |
| 165 | .maximum = 0, |
| 166 | .default_value = 0, |
| 167 | .step = 0, |
| 168 | .menu_skip_mask = 0, |
| 169 | .qmenu = NULL, |
| 170 | }, |
| 171 | { |
| 172 | .id = V4L2_CID_MPEG_VIDC_VIDEO_EXTRADATA, |
| 173 | .name = "Extradata Type", |
| 174 | .type = V4L2_CTRL_TYPE_MENU, |
| 175 | .minimum = V4L2_MPEG_VIDC_EXTRADATA_NONE, |
Praneeth Paladugu | a51b2c4 | 2017-06-23 12:48:06 -0700 | [diff] [blame] | 176 | .maximum = V4L2_MPEG_VIDC_EXTRADATA_UBWC_CR_STATS_INFO, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 177 | .default_value = V4L2_MPEG_VIDC_EXTRADATA_NONE, |
| 178 | .menu_skip_mask = ~( |
| 179 | (1 << V4L2_MPEG_VIDC_EXTRADATA_NONE) | |
| 180 | (1 << V4L2_MPEG_VIDC_EXTRADATA_MB_QUANTIZATION) | |
| 181 | (1 << V4L2_MPEG_VIDC_EXTRADATA_INTERLACE_VIDEO) | |
| 182 | (1 << V4L2_MPEG_VIDC_EXTRADATA_TIMESTAMP) | |
| 183 | (1 << V4L2_MPEG_VIDC_EXTRADATA_S3D_FRAME_PACKING) | |
| 184 | (1 << V4L2_MPEG_VIDC_EXTRADATA_FRAME_RATE) | |
| 185 | (1 << V4L2_MPEG_VIDC_EXTRADATA_PANSCAN_WINDOW) | |
| 186 | (1 << V4L2_MPEG_VIDC_EXTRADATA_RECOVERY_POINT_SEI) | |
| 187 | (1 << V4L2_MPEG_VIDC_EXTRADATA_MULTISLICE_INFO) | |
| 188 | (1 << V4L2_MPEG_VIDC_EXTRADATA_NUM_CONCEALED_MB) | |
| 189 | (1 << V4L2_MPEG_VIDC_EXTRADATA_METADATA_FILLER) | |
| 190 | (1 << V4L2_MPEG_VIDC_EXTRADATA_INPUT_CROP) | |
| 191 | (1 << V4L2_MPEG_VIDC_EXTRADATA_DIGITAL_ZOOM) | |
| 192 | (1 << V4L2_MPEG_VIDC_EXTRADATA_ASPECT_RATIO) | |
| 193 | (1 << V4L2_MPEG_VIDC_EXTRADATA_MPEG2_SEQDISP) | |
| 194 | (1 << V4L2_MPEG_VIDC_EXTRADATA_STREAM_USERDATA) | |
| 195 | (1 << V4L2_MPEG_VIDC_EXTRADATA_FRAME_QP) | |
| 196 | (1 << V4L2_MPEG_VIDC_EXTRADATA_FRAME_BITS_INFO) | |
| 197 | (1 << V4L2_MPEG_VIDC_EXTRADATA_VQZIP_SEI) | |
| 198 | (1 << V4L2_MPEG_VIDC_EXTRADATA_OUTPUT_CROP) | |
| 199 | (1 << V4L2_MPEG_VIDC_EXTRADATA_DISPLAY_COLOUR_SEI) | |
| 200 | (1 << |
| 201 | V4L2_MPEG_VIDC_EXTRADATA_CONTENT_LIGHT_LEVEL_SEI) | |
| 202 | (1 << V4L2_MPEG_VIDC_EXTRADATA_VUI_DISPLAY) | |
Praneeth Paladugu | a51b2c4 | 2017-06-23 12:48:06 -0700 | [diff] [blame] | 203 | (1 << V4L2_MPEG_VIDC_EXTRADATA_VPX_COLORSPACE) | |
| 204 | (1 << V4L2_MPEG_VIDC_EXTRADATA_UBWC_CR_STATS_INFO) |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 205 | ), |
| 206 | .qmenu = mpeg_video_vidc_extradata, |
| 207 | }, |
| 208 | { |
| 209 | .id = V4L2_CID_MPEG_VIDC_VIDEO_STREAM_OUTPUT_MODE, |
| 210 | .name = "Video decoder multi stream", |
| 211 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 212 | .minimum = |
| 213 | V4L2_CID_MPEG_VIDC_VIDEO_STREAM_OUTPUT_PRIMARY, |
| 214 | .maximum = |
| 215 | V4L2_CID_MPEG_VIDC_VIDEO_STREAM_OUTPUT_SECONDARY, |
| 216 | .default_value = |
| 217 | V4L2_CID_MPEG_VIDC_VIDEO_STREAM_OUTPUT_PRIMARY, |
| 218 | .menu_skip_mask = 0, |
| 219 | .step = 1, |
| 220 | .qmenu = NULL, |
| 221 | }, |
| 222 | { |
| 223 | .id = V4L2_CID_MPEG_VIDEO_H264_PROFILE, |
| 224 | .name = "H264 Profile", |
| 225 | .type = V4L2_CTRL_TYPE_MENU, |
| 226 | .maximum = V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH, |
| 227 | .default_value = V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE, |
| 228 | .menu_skip_mask = 0, |
| 229 | .flags = V4L2_CTRL_FLAG_VOLATILE, |
| 230 | .qmenu = NULL, |
| 231 | }, |
| 232 | { |
| 233 | .id = V4L2_CID_MPEG_VIDEO_H264_LEVEL, |
| 234 | .name = "H264 Level", |
| 235 | .type = V4L2_CTRL_TYPE_MENU, |
| 236 | .maximum = V4L2_MPEG_VIDEO_H264_LEVEL_5_2, |
| 237 | .default_value = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, |
| 238 | .menu_skip_mask = 0, |
| 239 | .flags = V4L2_CTRL_FLAG_VOLATILE, |
| 240 | .qmenu = NULL, |
| 241 | }, |
| 242 | { |
| 243 | .id = V4L2_CID_MPEG_VIDC_VIDEO_VP8_PROFILE_LEVEL, |
| 244 | .name = "VP8 Profile Level", |
| 245 | .type = V4L2_CTRL_TYPE_MENU, |
| 246 | .minimum = V4L2_MPEG_VIDC_VIDEO_VP8_UNUSED, |
Chinmay Sawarkar | 7f1cc15 | 2017-05-05 18:16:36 -0700 | [diff] [blame] | 247 | .maximum = V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_3, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 248 | .default_value = V4L2_MPEG_VIDC_VIDEO_VP8_VERSION_0, |
Chinmay Sawarkar | 7f1cc15 | 2017-05-05 18:16:36 -0700 | [diff] [blame] | 249 | .menu_skip_mask = 0, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 250 | .qmenu = vp8_profile_level, |
| 251 | .flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY, |
| 252 | }, |
| 253 | { |
Vaibhav Deshu Venkatesh | b69518e | 2017-08-21 12:22:49 -0700 | [diff] [blame] | 254 | .id = V4L2_CID_MPEG_VIDC_VIDEO_VP9_PROFILE, |
| 255 | .name = "VP9 Profile", |
| 256 | .type = V4L2_CTRL_TYPE_MENU, |
| 257 | .minimum = V4L2_MPEG_VIDC_VIDEO_VP9_PROFILE_UNUSED, |
| 258 | .maximum = V4L2_MPEG_VIDC_VIDEO_VP9_PROFILE_P2_10, |
| 259 | .default_value = V4L2_MPEG_VIDC_VIDEO_VP9_PROFILE_P0, |
| 260 | .menu_skip_mask = 0, |
| 261 | .qmenu = vp9_profile, |
| 262 | .flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY, |
| 263 | }, |
| 264 | { |
| 265 | .id = V4L2_CID_MPEG_VIDC_VIDEO_VP9_LEVEL, |
| 266 | .name = "VP9 Level", |
| 267 | .type = V4L2_CTRL_TYPE_MENU, |
| 268 | .minimum = V4L2_MPEG_VIDC_VIDEO_VP9_LEVEL_UNUSED, |
| 269 | .maximum = V4L2_MPEG_VIDC_VIDEO_VP9_LEVEL_51, |
| 270 | .default_value = V4L2_MPEG_VIDC_VIDEO_VP9_LEVEL_51, |
| 271 | .menu_skip_mask = 0, |
| 272 | .qmenu = vp9_level, |
| 273 | .flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY, |
| 274 | }, |
| 275 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 276 | .id = V4L2_CID_MPEG_VIDC_VIDEO_MPEG2_PROFILE, |
| 277 | .name = "MPEG2 Profile", |
| 278 | .type = V4L2_CTRL_TYPE_MENU, |
| 279 | .minimum = V4L2_MPEG_VIDC_VIDEO_MPEG2_PROFILE_SIMPLE, |
| 280 | .maximum = V4L2_MPEG_VIDC_VIDEO_MPEG2_PROFILE_HIGH, |
| 281 | .default_value = V4L2_MPEG_VIDC_VIDEO_MPEG2_PROFILE_SIMPLE, |
| 282 | .menu_skip_mask = ~( |
| 283 | (1 << V4L2_MPEG_VIDC_VIDEO_MPEG2_PROFILE_SIMPLE) | |
| 284 | (1 << V4L2_MPEG_VIDC_VIDEO_MPEG2_PROFILE_MAIN) | |
| 285 | (1 << V4L2_MPEG_VIDC_VIDEO_MPEG2_PROFILE_422) | |
| 286 | (1 << V4L2_MPEG_VIDC_VIDEO_MPEG2_PROFILE_SNR_SCALABLE) | |
| 287 | (1 << V4L2_MPEG_VIDC_VIDEO_MPEG2_PROFILE_SPATIAL_SCALABLE) | |
| 288 | (1 << V4L2_MPEG_VIDC_VIDEO_MPEG2_PROFILE_HIGH) |
| 289 | ), |
| 290 | .qmenu = mpeg2_profile, |
| 291 | .flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY, |
| 292 | }, |
| 293 | { |
| 294 | .id = V4L2_CID_MPEG_VIDC_VIDEO_MPEG2_LEVEL, |
| 295 | .name = "MPEG2 Level", |
| 296 | .type = V4L2_CTRL_TYPE_MENU, |
| 297 | .minimum = V4L2_MPEG_VIDC_VIDEO_MPEG2_LEVEL_0, |
| 298 | .maximum = V4L2_MPEG_VIDC_VIDEO_MPEG2_LEVEL_3, |
| 299 | .default_value = V4L2_MPEG_VIDC_VIDEO_MPEG2_LEVEL_0, |
| 300 | .menu_skip_mask = ~( |
| 301 | (1 << V4L2_MPEG_VIDC_VIDEO_MPEG2_LEVEL_0) | |
| 302 | (1 << V4L2_MPEG_VIDC_VIDEO_MPEG2_LEVEL_1) | |
| 303 | (1 << V4L2_MPEG_VIDC_VIDEO_MPEG2_LEVEL_2) | |
| 304 | (1 << V4L2_MPEG_VIDC_VIDEO_MPEG2_LEVEL_3) |
| 305 | ), |
| 306 | .qmenu = mpeg2_level, |
| 307 | .flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY, |
| 308 | }, |
| 309 | { |
Umesh Pandey | 42313a7 | 2017-07-05 18:20:06 -0700 | [diff] [blame] | 310 | .id = V4L2_CID_MPEG_VIDC_VIDEO_CONCEAL_COLOR_8BIT, |
| 311 | .name = "Picture concealed color 8bit", |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 312 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 313 | .minimum = 0x0, |
Umesh Pandey | 42313a7 | 2017-07-05 18:20:06 -0700 | [diff] [blame] | 314 | .maximum = 0xff3fcff, |
| 315 | .default_value = DEFAULT_VIDEO_CONCEAL_COLOR_BLACK, |
| 316 | .step = 1, |
| 317 | }, |
| 318 | { |
| 319 | .id = V4L2_CID_MPEG_VIDC_VIDEO_CONCEAL_COLOR_10BIT, |
| 320 | .name = "Picture concealed color 10bit", |
| 321 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 322 | .minimum = 0x0, |
| 323 | .maximum = 0x3fffffff, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 324 | .default_value = DEFAULT_VIDEO_CONCEAL_COLOR_BLACK, |
| 325 | .step = 1, |
| 326 | }, |
| 327 | { |
| 328 | .id = V4L2_CID_MPEG_VIDC_VIDEO_BUFFER_SIZE_LIMIT, |
| 329 | .name = "Buffer size limit", |
| 330 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 331 | .minimum = 0, |
| 332 | .maximum = INT_MAX, |
| 333 | .default_value = 0, |
| 334 | .step = 1, |
| 335 | .menu_skip_mask = 0, |
| 336 | .qmenu = NULL, |
| 337 | }, |
| 338 | { |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 339 | .id = V4L2_CID_MIN_BUFFERS_FOR_CAPTURE, |
| 340 | .name = "CAPTURE Count", |
| 341 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 342 | .minimum = MIN_NUM_CAPTURE_BUFFERS, |
| 343 | .maximum = MAX_NUM_CAPTURE_BUFFERS, |
| 344 | .default_value = MIN_NUM_CAPTURE_BUFFERS, |
| 345 | .step = 1, |
| 346 | .menu_skip_mask = 0, |
| 347 | .qmenu = NULL, |
| 348 | .flags = V4L2_CTRL_FLAG_VOLATILE, |
| 349 | }, |
| 350 | { |
| 351 | .id = V4L2_CID_MIN_BUFFERS_FOR_OUTPUT, |
| 352 | .name = "OUTPUT Count", |
| 353 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 354 | .minimum = MIN_NUM_OUTPUT_BUFFERS, |
| 355 | .maximum = MAX_NUM_OUTPUT_BUFFERS, |
| 356 | .default_value = MIN_NUM_OUTPUT_BUFFERS, |
| 357 | .step = 1, |
| 358 | .menu_skip_mask = 0, |
| 359 | .qmenu = NULL, |
| 360 | .flags = V4L2_CTRL_FLAG_VOLATILE, |
| 361 | }, |
| 362 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 363 | .id = V4L2_CID_MPEG_VIDC_VIDEO_DPB_COLOR_FORMAT, |
| 364 | .name = "Video decoder dpb color format", |
| 365 | .type = V4L2_CTRL_TYPE_MENU, |
| 366 | .minimum = V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_NONE, |
| 367 | .maximum = V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_TP10_UBWC, |
| 368 | .default_value = V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_NONE, |
| 369 | .menu_skip_mask = ~( |
| 370 | (1 << V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_NONE) | |
| 371 | (1 << V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_UBWC) | |
| 372 | (1 << V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_TP10_UBWC) |
| 373 | ), |
| 374 | .qmenu = mpeg_vidc_video_dpb_color_format, |
| 375 | }, |
| 376 | { |
| 377 | .id = V4L2_CID_VIDC_QBUF_MODE, |
| 378 | .name = "Allows batching of buffers for power savings", |
| 379 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 380 | .minimum = V4L2_VIDC_QBUF_STANDARD, |
| 381 | .maximum = V4L2_VIDC_QBUF_BATCHED, |
| 382 | .default_value = V4L2_VIDC_QBUF_STANDARD, |
| 383 | .step = 1, |
| 384 | }, |
| 385 | { |
| 386 | .id = V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE, |
| 387 | .name = "Entropy Mode", |
| 388 | .type = V4L2_CTRL_TYPE_MENU, |
| 389 | .minimum = V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC, |
| 390 | .maximum = V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC, |
| 391 | .default_value = V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC, |
| 392 | .step = 0, |
| 393 | .menu_skip_mask = ~( |
| 394 | (1 << V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC) | |
| 395 | (1 << V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC) |
| 396 | ), |
| 397 | .qmenu = mpeg_vidc_video_entropy_mode, |
| 398 | .flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY, |
| 399 | }, |
| 400 | { |
| 401 | .id = V4L2_CID_MPEG_VIDC_VIDEO_PRIORITY, |
| 402 | .name = "Session Priority", |
| 403 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 404 | .minimum = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_ENABLE, |
| 405 | .maximum = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_DISABLE, |
| 406 | .default_value = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_DISABLE, |
| 407 | .step = 1, |
| 408 | }, |
| 409 | { |
| 410 | .id = V4L2_CID_MPEG_VIDC_VIDEO_OPERATING_RATE, |
| 411 | .name = "Set Decoder Operating rate", |
| 412 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 413 | .minimum = 0, |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 414 | .maximum = INT_MAX, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 415 | .default_value = 0, |
Saurabh Kothawade | 501be79 | 2017-08-29 11:41:38 -0700 | [diff] [blame] | 416 | .step = 1, |
| 417 | }, |
| 418 | { |
| 419 | .id = V4L2_CID_MPEG_VIDC_VIDEO_FRAME_RATE, |
| 420 | .name = "Set Decoder Frame rate", |
| 421 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 422 | .minimum = 0, |
| 423 | .maximum = INT_MAX, |
| 424 | .default_value = 0, |
| 425 | .step = 1, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 426 | }, |
Saurabh Kothawade | c1cffa885 | 2017-08-18 12:20:38 -0700 | [diff] [blame] | 427 | { |
| 428 | .id = V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_MODE, |
| 429 | .name = "Low Latency Mode", |
| 430 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 431 | .minimum = V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_DISABLE, |
| 432 | .maximum = V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_ENABLE, |
| 433 | .default_value = V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_DISABLE, |
| 434 | .step = 1, |
| 435 | }, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 436 | }; |
| 437 | |
| 438 | #define NUM_CTRLS ARRAY_SIZE(msm_vdec_ctrls) |
| 439 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 440 | static u32 get_frame_size_compressed_full_yuv(int plane, |
| 441 | u32 max_mbs_per_frame, u32 size_per_mb) |
| 442 | { |
| 443 | return (max_mbs_per_frame * size_per_mb * 3 / 2); |
| 444 | } |
| 445 | |
| 446 | static u32 get_frame_size_compressed(int plane, |
| 447 | u32 max_mbs_per_frame, u32 size_per_mb) |
| 448 | { |
| 449 | return (max_mbs_per_frame * size_per_mb * 3/2)/2; |
| 450 | } |
| 451 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 452 | static u32 get_frame_size(struct msm_vidc_inst *inst, |
| 453 | const struct msm_vidc_format *fmt, |
| 454 | int fmt_type, int plane) |
| 455 | { |
| 456 | u32 frame_size = 0; |
| 457 | |
| 458 | if (fmt_type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
| 459 | frame_size = fmt->get_frame_size(plane, |
| 460 | inst->capability.mbs_per_frame.max, |
| 461 | MB_SIZE_IN_PIXEL); |
| 462 | if (inst->buffer_size_limit && |
| 463 | (inst->buffer_size_limit < frame_size)) { |
| 464 | frame_size = inst->buffer_size_limit; |
| 465 | dprintk(VIDC_DBG, "input buffer size limited to %d\n", |
| 466 | frame_size); |
| 467 | } else { |
| 468 | dprintk(VIDC_DBG, "set input buffer size to %d\n", |
| 469 | frame_size); |
| 470 | } |
| 471 | } else if (fmt_type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
| 472 | frame_size = fmt->get_frame_size(plane, |
| 473 | inst->capability.height.max, |
| 474 | inst->capability.width.max); |
| 475 | dprintk(VIDC_DBG, "set output buffer size to %d\n", |
| 476 | frame_size); |
| 477 | } else { |
| 478 | dprintk(VIDC_WARN, "Wrong format type\n"); |
| 479 | } |
| 480 | return frame_size; |
| 481 | } |
| 482 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 483 | struct msm_vidc_format vdec_formats[] = { |
| 484 | { |
| 485 | .name = "YCbCr Semiplanar 4:2:0", |
| 486 | .description = "Y/CbCr 4:2:0", |
| 487 | .fourcc = V4L2_PIX_FMT_NV12, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 488 | .get_frame_size = get_frame_size_nv12, |
| 489 | .type = CAPTURE_PORT, |
| 490 | }, |
| 491 | { |
Zhongbo Shi | 6bd5f5f | 2017-08-16 17:20:08 +0800 | [diff] [blame] | 492 | .name = "YCbCr Semiplanar 4:2:0 10bit", |
| 493 | .description = "Y/CbCr 4:2:0 10bit", |
| 494 | .fourcc = V4L2_PIX_FMT_SDE_Y_CBCR_H2V2_P010, |
| 495 | .get_frame_size = get_frame_size_p010, |
| 496 | .type = CAPTURE_PORT, |
| 497 | }, |
| 498 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 499 | .name = "UBWC YCbCr Semiplanar 4:2:0", |
| 500 | .description = "UBWC Y/CbCr 4:2:0", |
| 501 | .fourcc = V4L2_PIX_FMT_NV12_UBWC, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 502 | .get_frame_size = get_frame_size_nv12_ubwc, |
| 503 | .type = CAPTURE_PORT, |
| 504 | }, |
| 505 | { |
| 506 | .name = "UBWC YCbCr Semiplanar 4:2:0 10bit", |
| 507 | .description = "UBWC Y/CbCr 4:2:0 10bit", |
| 508 | .fourcc = V4L2_PIX_FMT_NV12_TP10_UBWC, |
Umesh Pandey | f2995f8 | 2017-05-01 16:44:45 -0700 | [diff] [blame] | 509 | .get_frame_size = get_frame_size_tp10_ubwc, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 510 | .type = CAPTURE_PORT, |
| 511 | }, |
| 512 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 513 | .name = "Mpeg2", |
| 514 | .description = "Mpeg2 compressed format", |
| 515 | .fourcc = V4L2_PIX_FMT_MPEG2, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 516 | .get_frame_size = get_frame_size_compressed, |
| 517 | .type = OUTPUT_PORT, |
Vaibhav Deshu Venkatesh | 8c9b6db | 2017-02-08 11:22:36 -0800 | [diff] [blame] | 518 | .defer_outputs = false, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 519 | }, |
| 520 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 521 | .name = "H264", |
| 522 | .description = "H264 compressed format", |
| 523 | .fourcc = V4L2_PIX_FMT_H264, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 524 | .get_frame_size = get_frame_size_compressed, |
| 525 | .type = OUTPUT_PORT, |
Vaibhav Deshu Venkatesh | 8c9b6db | 2017-02-08 11:22:36 -0800 | [diff] [blame] | 526 | .defer_outputs = false, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 527 | }, |
| 528 | { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 529 | .name = "HEVC", |
| 530 | .description = "HEVC compressed format", |
| 531 | .fourcc = V4L2_PIX_FMT_HEVC, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 532 | .get_frame_size = get_frame_size_compressed, |
| 533 | .type = OUTPUT_PORT, |
Vaibhav Deshu Venkatesh | 8c9b6db | 2017-02-08 11:22:36 -0800 | [diff] [blame] | 534 | .defer_outputs = false, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 535 | }, |
| 536 | { |
| 537 | .name = "VP8", |
| 538 | .description = "VP8 compressed format", |
| 539 | .fourcc = V4L2_PIX_FMT_VP8, |
Chinmay Sawarkar | c699405 | 2017-09-19 17:37:48 -0700 | [diff] [blame] | 540 | .get_frame_size = get_frame_size_compressed_full_yuv, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 541 | .type = OUTPUT_PORT, |
Vaibhav Deshu Venkatesh | 8c9b6db | 2017-02-08 11:22:36 -0800 | [diff] [blame] | 542 | .defer_outputs = false, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 543 | }, |
| 544 | { |
| 545 | .name = "VP9", |
| 546 | .description = "VP9 compressed format", |
| 547 | .fourcc = V4L2_PIX_FMT_VP9, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 548 | .get_frame_size = get_frame_size_compressed_full_yuv, |
| 549 | .type = OUTPUT_PORT, |
Vaibhav Deshu Venkatesh | 8c9b6db | 2017-02-08 11:22:36 -0800 | [diff] [blame] | 550 | .defer_outputs = true, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 551 | }, |
| 552 | }; |
| 553 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 554 | int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) |
| 555 | { |
| 556 | struct msm_vidc_format *fmt = NULL; |
| 557 | struct hal_frame_size frame_sz; |
| 558 | unsigned int extra_idx = 0; |
| 559 | int rc = 0; |
| 560 | int ret = 0; |
| 561 | int i; |
| 562 | int max_input_size = 0; |
| 563 | |
| 564 | if (!inst || !f) { |
| 565 | dprintk(VIDC_ERR, "%s invalid parameters\n", __func__); |
| 566 | return -EINVAL; |
| 567 | } |
| 568 | |
| 569 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
| 570 | fmt = msm_comm_get_pixel_fmt_fourcc(vdec_formats, |
| 571 | ARRAY_SIZE(vdec_formats), f->fmt.pix_mp.pixelformat, |
| 572 | CAPTURE_PORT); |
| 573 | if (!fmt || fmt->type != CAPTURE_PORT) { |
| 574 | dprintk(VIDC_ERR, |
| 575 | "Format: %d not supported on CAPTURE port\n", |
| 576 | f->fmt.pix_mp.pixelformat); |
| 577 | rc = -EINVAL; |
| 578 | goto err_invalid_fmt; |
| 579 | } |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 580 | |
| 581 | if (inst->fmts[fmt->type].fourcc == f->fmt.pix_mp.pixelformat && |
| 582 | inst->prop.width[CAPTURE_PORT] == f->fmt.pix_mp.width && |
| 583 | inst->prop.height[CAPTURE_PORT] == |
| 584 | f->fmt.pix_mp.height) { |
Praneeth Paladugu | 1f9d1d9 | 2017-04-11 10:36:16 -0700 | [diff] [blame] | 585 | dprintk(VIDC_DBG, "No change in CAPTURE port params\n"); |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 586 | return 0; |
| 587 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 588 | memcpy(&inst->fmts[fmt->type], fmt, |
| 589 | sizeof(struct msm_vidc_format)); |
| 590 | |
| 591 | inst->prop.width[CAPTURE_PORT] = f->fmt.pix_mp.width; |
| 592 | inst->prop.height[CAPTURE_PORT] = f->fmt.pix_mp.height; |
Maheshwar Ajja | 3cff01f | 2017-09-03 14:22:54 -0700 | [diff] [blame] | 593 | rc = msm_vidc_check_session_supported(inst); |
| 594 | if (rc) { |
| 595 | dprintk(VIDC_ERR, |
| 596 | "%s: session not supported\n", __func__); |
| 597 | goto err_invalid_fmt; |
| 598 | } |
| 599 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 600 | msm_comm_set_color_format(inst, |
| 601 | msm_comm_get_hal_output_buffer(inst), |
| 602 | f->fmt.pix_mp.pixelformat); |
| 603 | |
Praneeth Paladugu | 319e792 | 2017-03-16 11:09:06 -0700 | [diff] [blame] | 604 | inst->clk_data.opb_fourcc = f->fmt.pix_mp.pixelformat; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 605 | if (msm_comm_get_stream_output_mode(inst) == |
| 606 | HAL_VIDEO_DECODER_SECONDARY) { |
| 607 | frame_sz.buffer_type = HAL_BUFFER_OUTPUT2; |
| 608 | frame_sz.width = inst->prop.width[CAPTURE_PORT]; |
| 609 | frame_sz.height = inst->prop.height[CAPTURE_PORT]; |
| 610 | dprintk(VIDC_DBG, |
| 611 | "buffer type = %d width = %d, height = %d\n", |
| 612 | frame_sz.buffer_type, frame_sz.width, |
| 613 | frame_sz.height); |
| 614 | ret = msm_comm_try_set_prop(inst, |
| 615 | HAL_PARAM_FRAME_SIZE, &frame_sz); |
| 616 | } |
| 617 | |
| 618 | f->fmt.pix_mp.plane_fmt[0].sizeimage = |
| 619 | inst->fmts[fmt->type].get_frame_size(0, |
| 620 | f->fmt.pix_mp.height, f->fmt.pix_mp.width); |
| 621 | |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 622 | extra_idx = EXTRADATA_IDX(inst->bufq[fmt->type].num_planes); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 623 | if (extra_idx && extra_idx < VIDEO_MAX_PLANES) { |
| 624 | f->fmt.pix_mp.plane_fmt[extra_idx].sizeimage = |
| 625 | VENUS_EXTRADATA_SIZE( |
| 626 | inst->prop.height[CAPTURE_PORT], |
| 627 | inst->prop.width[CAPTURE_PORT]); |
| 628 | } |
| 629 | |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 630 | f->fmt.pix_mp.num_planes = inst->bufq[fmt->type].num_planes; |
| 631 | for (i = 0; i < inst->bufq[fmt->type].num_planes; i++) { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 632 | inst->bufq[CAPTURE_PORT].plane_sizes[i] = |
| 633 | f->fmt.pix_mp.plane_fmt[i].sizeimage; |
| 634 | } |
Praneeth Paladugu | bdf4a2f | 2017-04-21 13:32:49 -0700 | [diff] [blame] | 635 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 636 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 637 | |
| 638 | fmt = msm_comm_get_pixel_fmt_fourcc(vdec_formats, |
| 639 | ARRAY_SIZE(vdec_formats), |
| 640 | f->fmt.pix_mp.pixelformat, |
| 641 | OUTPUT_PORT); |
| 642 | if (!fmt || fmt->type != OUTPUT_PORT) { |
| 643 | dprintk(VIDC_ERR, |
| 644 | "Format: %d not supported on OUTPUT port\n", |
| 645 | f->fmt.pix_mp.pixelformat); |
| 646 | rc = -EINVAL; |
| 647 | goto err_invalid_fmt; |
| 648 | } |
| 649 | memcpy(&inst->fmts[fmt->type], fmt, |
| 650 | sizeof(struct msm_vidc_format)); |
| 651 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 652 | rc = msm_comm_try_state(inst, MSM_VIDC_OPEN_DONE); |
| 653 | if (rc) { |
| 654 | dprintk(VIDC_ERR, "Failed to open instance\n"); |
| 655 | goto err_invalid_fmt; |
| 656 | } |
| 657 | |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 658 | if (inst->fmts[fmt->type].fourcc == f->fmt.pix_mp.pixelformat && |
| 659 | inst->prop.width[OUTPUT_PORT] == f->fmt.pix_mp.width && |
| 660 | inst->prop.height[OUTPUT_PORT] == |
| 661 | f->fmt.pix_mp.height) { |
Praneeth Paladugu | 1f9d1d9 | 2017-04-11 10:36:16 -0700 | [diff] [blame] | 662 | dprintk(VIDC_DBG, "No change in OUTPUT port params\n"); |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 663 | return 0; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 664 | } |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 665 | inst->prop.width[OUTPUT_PORT] = f->fmt.pix_mp.width; |
| 666 | inst->prop.height[OUTPUT_PORT] = f->fmt.pix_mp.height; |
Maheshwar Ajja | 3cff01f | 2017-09-03 14:22:54 -0700 | [diff] [blame] | 667 | rc = msm_vidc_check_session_supported(inst); |
| 668 | if (rc) { |
| 669 | dprintk(VIDC_ERR, |
| 670 | "%s: session not supported\n", __func__); |
| 671 | goto err_invalid_fmt; |
| 672 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 673 | |
| 674 | frame_sz.buffer_type = HAL_BUFFER_INPUT; |
| 675 | frame_sz.width = inst->prop.width[OUTPUT_PORT]; |
| 676 | frame_sz.height = inst->prop.height[OUTPUT_PORT]; |
| 677 | dprintk(VIDC_DBG, |
| 678 | "buffer type = %d width = %d, height = %d\n", |
| 679 | frame_sz.buffer_type, frame_sz.width, |
| 680 | frame_sz.height); |
| 681 | msm_comm_try_set_prop(inst, HAL_PARAM_FRAME_SIZE, &frame_sz); |
| 682 | |
| 683 | max_input_size = get_frame_size( |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 684 | inst, &inst->fmts[fmt->type], f->type, 0); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 685 | if (f->fmt.pix_mp.plane_fmt[0].sizeimage > max_input_size || |
| 686 | !f->fmt.pix_mp.plane_fmt[0].sizeimage) { |
| 687 | f->fmt.pix_mp.plane_fmt[0].sizeimage = max_input_size; |
| 688 | } |
| 689 | |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 690 | f->fmt.pix_mp.num_planes = inst->bufq[fmt->type].num_planes; |
| 691 | for (i = 0; i < inst->bufq[fmt->type].num_planes; ++i) { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 692 | inst->bufq[OUTPUT_PORT].plane_sizes[i] = |
| 693 | f->fmt.pix_mp.plane_fmt[i].sizeimage; |
| 694 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 695 | } |
| 696 | err_invalid_fmt: |
| 697 | return rc; |
| 698 | } |
| 699 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 700 | int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) |
| 701 | { |
| 702 | const struct msm_vidc_format *fmt = NULL; |
| 703 | int rc = 0; |
| 704 | |
| 705 | if (!inst || !f) { |
| 706 | dprintk(VIDC_ERR, |
| 707 | "Invalid input, inst = %pK, f = %pK\n", inst, f); |
| 708 | return -EINVAL; |
| 709 | } |
| 710 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
| 711 | fmt = msm_comm_get_pixel_fmt_index(vdec_formats, |
| 712 | ARRAY_SIZE(vdec_formats), f->index, CAPTURE_PORT); |
| 713 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
| 714 | fmt = msm_comm_get_pixel_fmt_index(vdec_formats, |
| 715 | ARRAY_SIZE(vdec_formats), f->index, OUTPUT_PORT); |
| 716 | f->flags = V4L2_FMT_FLAG_COMPRESSED; |
| 717 | } |
| 718 | |
| 719 | memset(f->reserved, 0, sizeof(f->reserved)); |
| 720 | if (fmt) { |
| 721 | strlcpy(f->description, fmt->description, |
| 722 | sizeof(f->description)); |
| 723 | f->pixelformat = fmt->fourcc; |
| 724 | } else { |
| 725 | dprintk(VIDC_DBG, "No more formats found\n"); |
| 726 | rc = -EINVAL; |
| 727 | } |
| 728 | return rc; |
| 729 | } |
| 730 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 731 | int msm_vdec_inst_init(struct msm_vidc_inst *inst) |
| 732 | { |
| 733 | int rc = 0; |
Praneeth Paladugu | a6b6aa4 | 2017-05-16 13:33:01 -0700 | [diff] [blame] | 734 | struct msm_vidc_format *fmt = NULL; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 735 | |
| 736 | if (!inst) { |
| 737 | dprintk(VIDC_ERR, "Invalid input = %pK\n", inst); |
| 738 | return -EINVAL; |
| 739 | } |
| 740 | inst->prop.height[CAPTURE_PORT] = DEFAULT_HEIGHT; |
| 741 | inst->prop.width[CAPTURE_PORT] = DEFAULT_WIDTH; |
| 742 | inst->prop.height[OUTPUT_PORT] = DEFAULT_HEIGHT; |
| 743 | inst->prop.width[OUTPUT_PORT] = DEFAULT_WIDTH; |
| 744 | inst->capability.height.min = MIN_SUPPORTED_HEIGHT; |
| 745 | inst->capability.height.max = DEFAULT_HEIGHT; |
| 746 | inst->capability.width.min = MIN_SUPPORTED_WIDTH; |
| 747 | inst->capability.width.max = DEFAULT_WIDTH; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 748 | inst->capability.secure_output2_threshold.min = 0; |
| 749 | inst->capability.secure_output2_threshold.max = 0; |
| 750 | inst->buffer_mode_set[OUTPUT_PORT] = HAL_BUFFER_MODE_STATIC; |
Chinmay Sawarkar | 2de3f77 | 2017-02-07 12:03:44 -0800 | [diff] [blame] | 751 | inst->buffer_mode_set[CAPTURE_PORT] = HAL_BUFFER_MODE_DYNAMIC; |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 752 | /* To start with, both ports are 1 plane each */ |
| 753 | inst->bufq[OUTPUT_PORT].num_planes = 1; |
| 754 | inst->bufq[CAPTURE_PORT].num_planes = 1; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 755 | inst->prop.fps = DEFAULT_FPS; |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 756 | inst->clk_data.operating_rate = 0; |
Praneeth Paladugu | a6b6aa4 | 2017-05-16 13:33:01 -0700 | [diff] [blame] | 757 | |
| 758 | /* By default, initialize CAPTURE port to UBWC YUV format */ |
| 759 | fmt = msm_comm_get_pixel_fmt_fourcc(vdec_formats, |
| 760 | ARRAY_SIZE(vdec_formats), V4L2_PIX_FMT_NV12_UBWC, |
| 761 | CAPTURE_PORT); |
| 762 | if (!fmt || fmt->type != CAPTURE_PORT) { |
| 763 | dprintk(VIDC_ERR, |
| 764 | "vdec_formats corrupted\n"); |
| 765 | return -EINVAL; |
| 766 | } |
| 767 | memcpy(&inst->fmts[fmt->type], fmt, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 768 | sizeof(struct msm_vidc_format)); |
Praneeth Paladugu | a6b6aa4 | 2017-05-16 13:33:01 -0700 | [diff] [blame] | 769 | |
Praneeth Paladugu | 6e63747 | 2017-05-16 16:06:46 -0700 | [diff] [blame] | 770 | inst->buff_req.buffer[1].buffer_type = HAL_BUFFER_INPUT; |
| 771 | inst->buff_req.buffer[1].buffer_count_min_host = |
| 772 | inst->buff_req.buffer[1].buffer_count_actual = |
| 773 | MIN_NUM_DEC_OUTPUT_BUFFERS; |
| 774 | inst->buff_req.buffer[2].buffer_type = HAL_BUFFER_OUTPUT; |
| 775 | inst->buff_req.buffer[2].buffer_count_min_host = |
| 776 | inst->buff_req.buffer[2].buffer_count_actual = |
| 777 | MIN_NUM_DEC_CAPTURE_BUFFERS; |
| 778 | inst->buff_req.buffer[3].buffer_type = HAL_BUFFER_OUTPUT2; |
| 779 | inst->buff_req.buffer[3].buffer_count_min_host = |
| 780 | inst->buff_req.buffer[3].buffer_count_actual = |
| 781 | MIN_NUM_DEC_CAPTURE_BUFFERS; |
| 782 | |
Praneeth Paladugu | a6b6aa4 | 2017-05-16 13:33:01 -0700 | [diff] [blame] | 783 | /* By default, initialize OUTPUT port to H264 decoder */ |
| 784 | fmt = msm_comm_get_pixel_fmt_fourcc(vdec_formats, |
| 785 | ARRAY_SIZE(vdec_formats), V4L2_PIX_FMT_H264, |
| 786 | OUTPUT_PORT); |
| 787 | if (!fmt || fmt->type != OUTPUT_PORT) { |
| 788 | dprintk(VIDC_ERR, |
| 789 | "vdec_formats corrupted\n"); |
| 790 | return -EINVAL; |
| 791 | } |
| 792 | memcpy(&inst->fmts[fmt->type], fmt, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 793 | sizeof(struct msm_vidc_format)); |
Praneeth Paladugu | a6b6aa4 | 2017-05-16 13:33:01 -0700 | [diff] [blame] | 794 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 795 | return rc; |
| 796 | } |
| 797 | |
Praneeth Paladugu | be42cb2 | 2016-04-12 22:34:39 -0700 | [diff] [blame] | 798 | static struct v4l2_ctrl *get_ctrl_from_cluster(int id, |
| 799 | struct v4l2_ctrl **cluster, int ncontrols) |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 800 | { |
Praneeth Paladugu | be42cb2 | 2016-04-12 22:34:39 -0700 | [diff] [blame] | 801 | int c; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 802 | |
Praneeth Paladugu | be42cb2 | 2016-04-12 22:34:39 -0700 | [diff] [blame] | 803 | for (c = 0; c < ncontrols; ++c) |
| 804 | if (cluster[c]->id == id) |
| 805 | return cluster[c]; |
| 806 | return NULL; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 807 | } |
| 808 | |
Praneeth Paladugu | be42cb2 | 2016-04-12 22:34:39 -0700 | [diff] [blame] | 809 | int msm_vdec_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 810 | { |
Maheshwar Ajja | e1f2113 | 2017-10-26 11:49:54 -0700 | [diff] [blame] | 811 | int rc = 0, temp; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 812 | struct hal_nal_stream_format_supported stream_format; |
| 813 | struct hal_enable_picture enable_picture; |
| 814 | struct hal_enable hal_property; |
| 815 | enum hal_property property_id = 0; |
| 816 | u32 property_val = 0; |
| 817 | void *pdata = NULL; |
| 818 | struct hfi_device *hdev; |
| 819 | struct hal_extradata_enable extra; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 820 | struct hal_multi_stream multi_stream; |
| 821 | struct v4l2_ctrl *temp_ctrl = NULL; |
| 822 | struct hal_profile_level profile_level; |
| 823 | struct hal_frame_size frame_sz; |
Praneeth Paladugu | 6e63747 | 2017-05-16 16:06:46 -0700 | [diff] [blame] | 824 | struct hal_buffer_requirements *bufreq; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 825 | |
| 826 | if (!inst || !inst->core || !inst->core->device) { |
| 827 | dprintk(VIDC_ERR, "%s invalid parameters\n", __func__); |
| 828 | return -EINVAL; |
| 829 | } |
| 830 | hdev = inst->core->device; |
| 831 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 832 | /* Small helper macro for quickly getting a control and err checking */ |
| 833 | #define TRY_GET_CTRL(__ctrl_id) ({ \ |
| 834 | struct v4l2_ctrl *__temp; \ |
| 835 | __temp = get_ctrl_from_cluster( \ |
| 836 | __ctrl_id, \ |
| 837 | ctrl->cluster, ctrl->ncontrols); \ |
| 838 | if (!__temp) { \ |
| 839 | dprintk(VIDC_ERR, "Can't find %s (%x) in cluster\n", \ |
| 840 | #__ctrl_id, __ctrl_id); \ |
| 841 | /* Clusters are hardcoded, if we can't find */ \ |
| 842 | /* something then things are massively screwed up */ \ |
| 843 | MSM_VIDC_ERROR(1); \ |
| 844 | } \ |
| 845 | __temp; \ |
| 846 | }) |
| 847 | |
| 848 | v4l2_ctrl_unlock(ctrl); |
| 849 | |
| 850 | switch (ctrl->id) { |
| 851 | case V4L2_CID_MPEG_VIDC_VIDEO_STREAM_FORMAT: |
| 852 | property_id = HAL_PARAM_NAL_STREAM_FORMAT_SELECT; |
| 853 | stream_format.nal_stream_format_supported = BIT(ctrl->val); |
| 854 | pdata = &stream_format; |
| 855 | break; |
| 856 | case V4L2_CID_MPEG_VIDC_VIDEO_OUTPUT_ORDER: |
| 857 | property_id = HAL_PARAM_VDEC_OUTPUT_ORDER; |
| 858 | property_val = ctrl->val; |
| 859 | pdata = &property_val; |
| 860 | break; |
| 861 | case V4L2_CID_MPEG_VIDC_VIDEO_PICTYPE_DEC_MODE: |
| 862 | property_id = HAL_PARAM_VDEC_PICTURE_TYPE_DECODE; |
| 863 | if (ctrl->val == |
| 864 | V4L2_MPEG_VIDC_VIDEO_PICTYPE_DECODE_ON) |
| 865 | enable_picture.picture_type = HAL_PICTURE_I; |
| 866 | else |
| 867 | enable_picture.picture_type = HAL_PICTURE_I | |
| 868 | HAL_PICTURE_P | HAL_PICTURE_B | |
| 869 | HAL_PICTURE_IDR; |
| 870 | pdata = &enable_picture; |
| 871 | break; |
| 872 | case V4L2_CID_MPEG_VIDC_VIDEO_SYNC_FRAME_DECODE: |
| 873 | switch (ctrl->val) { |
| 874 | case V4L2_MPEG_VIDC_VIDEO_SYNC_FRAME_DECODE_DISABLE: |
| 875 | inst->flags &= ~VIDC_THUMBNAIL; |
| 876 | break; |
| 877 | case V4L2_MPEG_VIDC_VIDEO_SYNC_FRAME_DECODE_ENABLE: |
| 878 | inst->flags |= VIDC_THUMBNAIL; |
| 879 | break; |
| 880 | } |
| 881 | |
| 882 | property_id = HAL_PARAM_VDEC_SYNC_FRAME_DECODE; |
| 883 | hal_property.enable = ctrl->val; |
| 884 | pdata = &hal_property; |
Praneeth Paladugu | 75cf18e | 2016-12-08 16:12:11 -0800 | [diff] [blame] | 885 | msm_dcvs_try_enable(inst); |
Praneeth Paladugu | 6e63747 | 2017-05-16 16:06:46 -0700 | [diff] [blame] | 886 | |
| 887 | bufreq = get_buff_req_buffer(inst, |
| 888 | HAL_BUFFER_INPUT); |
| 889 | if (!bufreq) { |
| 890 | dprintk(VIDC_ERR, |
| 891 | "Failed : No buffer requirements : %x\n", |
| 892 | HAL_BUFFER_OUTPUT); |
| 893 | return -EINVAL; |
| 894 | } |
| 895 | bufreq->buffer_count_min = |
| 896 | MIN_NUM_THUMBNAIL_MODE_OUTPUT_BUFFERS; |
Karthikeyan Periasamy | ec339fd | 2017-07-11 16:45:08 -0700 | [diff] [blame] | 897 | bufreq->buffer_count_min_host = |
| 898 | MIN_NUM_THUMBNAIL_MODE_OUTPUT_BUFFERS; |
| 899 | bufreq->buffer_count_actual = |
| 900 | MIN_NUM_THUMBNAIL_MODE_OUTPUT_BUFFERS; |
Praneeth Paladugu | 6e63747 | 2017-05-16 16:06:46 -0700 | [diff] [blame] | 901 | |
| 902 | if (msm_comm_get_stream_output_mode(inst) == |
| 903 | HAL_VIDEO_DECODER_SECONDARY) { |
| 904 | |
| 905 | bufreq = get_buff_req_buffer(inst, |
| 906 | HAL_BUFFER_OUTPUT); |
| 907 | if (!bufreq) { |
| 908 | dprintk(VIDC_ERR, |
| 909 | "Failed : No buffer requirements: %x\n", |
| 910 | HAL_BUFFER_OUTPUT); |
| 911 | return -EINVAL; |
| 912 | } |
| 913 | |
| 914 | bufreq->buffer_count_min = |
| 915 | MIN_NUM_THUMBNAIL_MODE_CAPTURE_BUFFERS; |
Karthikeyan Periasamy | ec339fd | 2017-07-11 16:45:08 -0700 | [diff] [blame] | 916 | bufreq->buffer_count_min_host = |
| 917 | MIN_NUM_THUMBNAIL_MODE_OUTPUT_BUFFERS; |
| 918 | bufreq->buffer_count_actual = |
| 919 | MIN_NUM_THUMBNAIL_MODE_OUTPUT_BUFFERS; |
Praneeth Paladugu | 6e63747 | 2017-05-16 16:06:46 -0700 | [diff] [blame] | 920 | |
| 921 | bufreq = get_buff_req_buffer(inst, |
| 922 | HAL_BUFFER_OUTPUT2); |
| 923 | if (!bufreq) { |
| 924 | dprintk(VIDC_ERR, |
| 925 | "Failed : No buffer requirements: %x\n", |
| 926 | HAL_BUFFER_OUTPUT2); |
| 927 | return -EINVAL; |
| 928 | } |
| 929 | |
| 930 | bufreq->buffer_count_min = |
| 931 | MIN_NUM_THUMBNAIL_MODE_CAPTURE_BUFFERS; |
Karthikeyan Periasamy | ec339fd | 2017-07-11 16:45:08 -0700 | [diff] [blame] | 932 | bufreq->buffer_count_min_host = |
| 933 | MIN_NUM_THUMBNAIL_MODE_OUTPUT_BUFFERS; |
| 934 | bufreq->buffer_count_actual = |
| 935 | MIN_NUM_THUMBNAIL_MODE_OUTPUT_BUFFERS; |
| 936 | |
Praneeth Paladugu | 6e63747 | 2017-05-16 16:06:46 -0700 | [diff] [blame] | 937 | } else { |
| 938 | |
| 939 | bufreq = get_buff_req_buffer(inst, |
| 940 | HAL_BUFFER_OUTPUT); |
| 941 | if (!bufreq) { |
| 942 | dprintk(VIDC_ERR, |
| 943 | "Failed : No buffer requirements: %x\n", |
| 944 | HAL_BUFFER_OUTPUT); |
| 945 | return -EINVAL; |
| 946 | } |
| 947 | bufreq->buffer_count_min = |
| 948 | MIN_NUM_THUMBNAIL_MODE_CAPTURE_BUFFERS; |
Karthikeyan Periasamy | ec339fd | 2017-07-11 16:45:08 -0700 | [diff] [blame] | 949 | bufreq->buffer_count_min_host = |
| 950 | MIN_NUM_THUMBNAIL_MODE_OUTPUT_BUFFERS; |
| 951 | bufreq->buffer_count_actual = |
| 952 | MIN_NUM_THUMBNAIL_MODE_OUTPUT_BUFFERS; |
Praneeth Paladugu | 6e63747 | 2017-05-16 16:06:46 -0700 | [diff] [blame] | 953 | |
| 954 | } |
| 955 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 956 | break; |
| 957 | case V4L2_CID_MPEG_VIDC_VIDEO_SECURE: |
Karthikeyan Periasamy | a0e4bad | 2017-04-26 12:51:10 -0700 | [diff] [blame] | 958 | property_id = HAL_PARAM_SECURE; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 959 | inst->flags |= VIDC_SECURE; |
Karthikeyan Periasamy | a0e4bad | 2017-04-26 12:51:10 -0700 | [diff] [blame] | 960 | property_val = !!(inst->flags & VIDC_SECURE); |
| 961 | pdata = &property_val; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 962 | dprintk(VIDC_DBG, "Setting secure mode to: %d\n", |
| 963 | !!(inst->flags & VIDC_SECURE)); |
| 964 | break; |
| 965 | case V4L2_CID_MPEG_VIDC_VIDEO_EXTRADATA: |
| 966 | property_id = HAL_PARAM_INDEX_EXTRADATA; |
| 967 | extra.index = msm_comm_get_hal_extradata_index(ctrl->val); |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 968 | switch (ctrl->val) { |
| 969 | case V4L2_MPEG_VIDC_EXTRADATA_MB_QUANTIZATION: |
| 970 | case V4L2_MPEG_VIDC_EXTRADATA_INTERLACE_VIDEO: |
| 971 | case V4L2_MPEG_VIDC_EXTRADATA_TIMESTAMP: |
| 972 | case V4L2_MPEG_VIDC_EXTRADATA_S3D_FRAME_PACKING: |
| 973 | case V4L2_MPEG_VIDC_EXTRADATA_FRAME_RATE: |
| 974 | case V4L2_MPEG_VIDC_EXTRADATA_PANSCAN_WINDOW: |
| 975 | case V4L2_MPEG_VIDC_EXTRADATA_RECOVERY_POINT_SEI: |
| 976 | case V4L2_MPEG_VIDC_EXTRADATA_NUM_CONCEALED_MB: |
| 977 | case V4L2_MPEG_VIDC_EXTRADATA_ASPECT_RATIO: |
| 978 | case V4L2_MPEG_VIDC_EXTRADATA_MPEG2_SEQDISP: |
| 979 | case V4L2_MPEG_VIDC_EXTRADATA_STREAM_USERDATA: |
| 980 | case V4L2_MPEG_VIDC_EXTRADATA_FRAME_QP: |
| 981 | case V4L2_MPEG_VIDC_EXTRADATA_FRAME_BITS_INFO: |
| 982 | case V4L2_MPEG_VIDC_EXTRADATA_VQZIP_SEI: |
| 983 | case V4L2_MPEG_VIDC_EXTRADATA_OUTPUT_CROP: |
| 984 | case V4L2_MPEG_VIDC_EXTRADATA_DISPLAY_COLOUR_SEI: |
| 985 | case V4L2_MPEG_VIDC_EXTRADATA_CONTENT_LIGHT_LEVEL_SEI: |
| 986 | case V4L2_MPEG_VIDC_EXTRADATA_VUI_DISPLAY: |
| 987 | case V4L2_MPEG_VIDC_EXTRADATA_VPX_COLORSPACE: |
Praneeth Paladugu | a51b2c4 | 2017-06-23 12:48:06 -0700 | [diff] [blame] | 988 | case V4L2_MPEG_VIDC_EXTRADATA_UBWC_CR_STATS_INFO: |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 989 | inst->bufq[CAPTURE_PORT].num_planes = 2; |
| 990 | inst->bufq[CAPTURE_PORT].plane_sizes[EXTRADATA_IDX(2)] = |
| 991 | VENUS_EXTRADATA_SIZE( |
| 992 | inst->prop.height[CAPTURE_PORT], |
| 993 | inst->prop.width[CAPTURE_PORT]); |
| 994 | break; |
| 995 | default: |
| 996 | rc = -ENOTSUPP; |
| 997 | break; |
| 998 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 999 | extra.enable = 1; |
| 1000 | pdata = &extra; |
| 1001 | break; |
| 1002 | case V4L2_CID_MPEG_VIDC_VIDEO_STREAM_OUTPUT_MODE: |
| 1003 | if (ctrl->val && !(inst->capability.pixelprocess_capabilities & |
| 1004 | HAL_VIDEO_DECODER_MULTI_STREAM_CAPABILITY)) { |
| 1005 | dprintk(VIDC_ERR, "Downscaling not supported: %#x\n", |
| 1006 | ctrl->id); |
| 1007 | rc = -ENOTSUPP; |
| 1008 | break; |
| 1009 | } |
| 1010 | switch (ctrl->val) { |
| 1011 | case V4L2_CID_MPEG_VIDC_VIDEO_STREAM_OUTPUT_PRIMARY: |
| 1012 | multi_stream.buffer_type = HAL_BUFFER_OUTPUT; |
| 1013 | multi_stream.enable = true; |
| 1014 | pdata = &multi_stream; |
| 1015 | rc = call_hfi_op(hdev, session_set_property, (void *) |
| 1016 | inst->session, HAL_PARAM_VDEC_MULTI_STREAM, |
| 1017 | pdata); |
| 1018 | if (rc) { |
| 1019 | dprintk(VIDC_ERR, |
| 1020 | "Failed : Enabling OUTPUT port : %d\n", |
| 1021 | rc); |
| 1022 | break; |
| 1023 | } |
| 1024 | multi_stream.buffer_type = HAL_BUFFER_OUTPUT2; |
| 1025 | multi_stream.enable = false; |
| 1026 | pdata = &multi_stream; |
| 1027 | rc = call_hfi_op(hdev, session_set_property, (void *) |
| 1028 | inst->session, HAL_PARAM_VDEC_MULTI_STREAM, |
| 1029 | pdata); |
| 1030 | if (rc) |
| 1031 | dprintk(VIDC_ERR, |
| 1032 | "Failed:Disabling OUTPUT2 port : %d\n", |
| 1033 | rc); |
| 1034 | break; |
| 1035 | case V4L2_CID_MPEG_VIDC_VIDEO_STREAM_OUTPUT_SECONDARY: |
Maheshwar Ajja | e1f2113 | 2017-10-26 11:49:54 -0700 | [diff] [blame] | 1036 | temp_ctrl = TRY_GET_CTRL( |
| 1037 | V4L2_CID_MPEG_VIDC_VIDEO_DPB_COLOR_FORMAT); |
| 1038 | switch (temp_ctrl->val) { |
| 1039 | case V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_UBWC: |
| 1040 | temp = V4L2_PIX_FMT_NV12_UBWC; |
| 1041 | break; |
| 1042 | case V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_TP10_UBWC: |
| 1043 | temp = V4L2_PIX_FMT_NV12_TP10_UBWC; |
| 1044 | break; |
| 1045 | case V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_NONE: |
| 1046 | default: |
| 1047 | dprintk(VIDC_DBG, |
| 1048 | "set default dpb color format as NV12_UBWC\n"); |
| 1049 | temp = V4L2_PIX_FMT_NV12_UBWC; |
| 1050 | break; |
| 1051 | } |
| 1052 | rc = msm_comm_set_color_format(inst, |
| 1053 | HAL_BUFFER_OUTPUT, temp); |
| 1054 | if (rc) { |
| 1055 | dprintk(VIDC_ERR, |
| 1056 | "%s Failed setting output color format: %#x\n", |
| 1057 | __func__, rc); |
| 1058 | break; |
| 1059 | } |
| 1060 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1061 | multi_stream.buffer_type = HAL_BUFFER_OUTPUT2; |
| 1062 | multi_stream.enable = true; |
| 1063 | pdata = &multi_stream; |
| 1064 | rc = call_hfi_op(hdev, session_set_property, (void *) |
| 1065 | inst->session, HAL_PARAM_VDEC_MULTI_STREAM, |
| 1066 | pdata); |
| 1067 | if (rc) { |
| 1068 | dprintk(VIDC_ERR, |
| 1069 | "Failed :Enabling OUTPUT2 port : %d\n", |
| 1070 | rc); |
| 1071 | break; |
| 1072 | } |
| 1073 | multi_stream.buffer_type = HAL_BUFFER_OUTPUT; |
| 1074 | multi_stream.enable = false; |
| 1075 | pdata = &multi_stream; |
| 1076 | rc = call_hfi_op(hdev, session_set_property, (void *) |
| 1077 | inst->session, HAL_PARAM_VDEC_MULTI_STREAM, |
| 1078 | pdata); |
| 1079 | if (rc) { |
| 1080 | dprintk(VIDC_ERR, |
| 1081 | "Failed disabling OUTPUT port : %d\n", |
| 1082 | rc); |
| 1083 | break; |
| 1084 | } |
| 1085 | |
| 1086 | frame_sz.buffer_type = HAL_BUFFER_OUTPUT2; |
| 1087 | frame_sz.width = inst->prop.width[CAPTURE_PORT]; |
| 1088 | frame_sz.height = inst->prop.height[CAPTURE_PORT]; |
| 1089 | pdata = &frame_sz; |
| 1090 | dprintk(VIDC_DBG, |
| 1091 | "buffer type = %d width = %d, height = %d\n", |
| 1092 | frame_sz.buffer_type, frame_sz.width, |
| 1093 | frame_sz.height); |
| 1094 | rc = call_hfi_op(hdev, session_set_property, (void *) |
| 1095 | inst->session, HAL_PARAM_FRAME_SIZE, pdata); |
| 1096 | if (rc) |
| 1097 | dprintk(VIDC_ERR, |
| 1098 | "Failed setting OUTPUT2 size : %d\n", |
| 1099 | rc); |
| 1100 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1101 | break; |
| 1102 | default: |
| 1103 | dprintk(VIDC_ERR, |
| 1104 | "Failed : Unsupported multi stream setting\n"); |
| 1105 | rc = -ENOTSUPP; |
| 1106 | break; |
| 1107 | } |
| 1108 | break; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1109 | case V4L2_CID_MPEG_VIDEO_H264_PROFILE: |
| 1110 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_H264_LEVEL); |
| 1111 | property_id = |
| 1112 | HAL_PARAM_PROFILE_LEVEL_CURRENT; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1113 | profile_level.profile = msm_comm_v4l2_to_hal(ctrl->id, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1114 | ctrl->val); |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1115 | profile_level.level = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1116 | V4L2_CID_MPEG_VIDEO_H264_LEVEL, |
| 1117 | temp_ctrl->val); |
| 1118 | pdata = &profile_level; |
| 1119 | break; |
| 1120 | case V4L2_CID_MPEG_VIDEO_H264_LEVEL: |
| 1121 | temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_H264_PROFILE); |
| 1122 | property_id = |
| 1123 | HAL_PARAM_PROFILE_LEVEL_CURRENT; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1124 | profile_level.level = msm_comm_v4l2_to_hal(ctrl->id, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1125 | ctrl->val); |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1126 | profile_level.profile = msm_comm_v4l2_to_hal( |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1127 | V4L2_CID_MPEG_VIDEO_H264_PROFILE, |
| 1128 | temp_ctrl->val); |
| 1129 | pdata = &profile_level; |
| 1130 | break; |
| 1131 | case V4L2_CID_MPEG_VIDC_VIDEO_BUFFER_SIZE_LIMIT: |
| 1132 | dprintk(VIDC_DBG, |
| 1133 | "Limiting input buffer size from %u to %u\n", |
| 1134 | inst->buffer_size_limit, ctrl->val); |
| 1135 | inst->buffer_size_limit = ctrl->val; |
| 1136 | break; |
| 1137 | case V4L2_CID_VIDC_QBUF_MODE: |
| 1138 | property_id = HAL_PARAM_SYNC_BASED_INTERRUPT; |
| 1139 | hal_property.enable = ctrl->val == V4L2_VIDC_QBUF_BATCHED; |
| 1140 | pdata = &hal_property; |
| 1141 | break; |
| 1142 | case V4L2_CID_MPEG_VIDC_VIDEO_PRIORITY: |
| 1143 | property_id = HAL_CONFIG_REALTIME; |
| 1144 | /* firmware has inverted values for realtime and |
| 1145 | * non-realtime priority |
| 1146 | */ |
| 1147 | hal_property.enable = !(ctrl->val); |
| 1148 | pdata = &hal_property; |
| 1149 | switch (ctrl->val) { |
| 1150 | case V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_DISABLE: |
| 1151 | inst->flags &= ~VIDC_REALTIME; |
| 1152 | break; |
| 1153 | case V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_ENABLE: |
| 1154 | inst->flags |= VIDC_REALTIME; |
| 1155 | break; |
| 1156 | default: |
| 1157 | dprintk(VIDC_WARN, |
| 1158 | "inst(%pK) invalid priority ctrl value %#x\n", |
| 1159 | inst, ctrl->val); |
| 1160 | break; |
| 1161 | } |
| 1162 | break; |
| 1163 | case V4L2_CID_MPEG_VIDC_VIDEO_OPERATING_RATE: |
Saurabh Kothawade | 501be79 | 2017-08-29 11:41:38 -0700 | [diff] [blame] | 1164 | if (((ctrl->val >> 16) < inst->capability.frame_rate.min || |
| 1165 | (ctrl->val >> 16) > inst->capability.frame_rate.max) && |
| 1166 | ctrl->val != INT_MAX) { |
| 1167 | dprintk(VIDC_ERR, "Invalid operating rate %u\n", |
| 1168 | (ctrl->val >> 16)); |
| 1169 | rc = -ENOTSUPP; |
| 1170 | } else if (ctrl->val == INT_MAX) { |
| 1171 | dprintk(VIDC_DBG, |
| 1172 | "inst(%pK) Request for turbo mode\n", inst); |
| 1173 | inst->clk_data.turbo_mode = true; |
| 1174 | } else if (msm_vidc_validate_operating_rate(inst, ctrl->val)) { |
| 1175 | dprintk(VIDC_ERR, "Failed to set operating rate\n"); |
| 1176 | rc = -ENOTSUPP; |
| 1177 | } else { |
| 1178 | dprintk(VIDC_DBG, |
| 1179 | "inst(%pK) operating rate changed from %d to %d\n", |
| 1180 | inst, inst->clk_data.operating_rate >> 16, |
| 1181 | ctrl->val >> 16); |
| 1182 | inst->clk_data.operating_rate = ctrl->val; |
| 1183 | inst->clk_data.turbo_mode = false; |
| 1184 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1185 | break; |
Saurabh Kothawade | c1cffa885 | 2017-08-18 12:20:38 -0700 | [diff] [blame] | 1186 | case V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_MODE: |
| 1187 | if (ctrl->val == |
| 1188 | V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_ENABLE) |
| 1189 | hal_property.enable = 1; |
| 1190 | else |
| 1191 | hal_property.enable = 0; |
| 1192 | inst->clk_data.low_latency_mode = (bool) hal_property.enable; |
| 1193 | break; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1194 | default: |
| 1195 | break; |
| 1196 | } |
| 1197 | |
| 1198 | v4l2_ctrl_lock(ctrl); |
| 1199 | #undef TRY_GET_CTRL |
| 1200 | |
| 1201 | if (!rc && property_id) { |
| 1202 | dprintk(VIDC_DBG, |
Praneeth Paladugu | 92fc3b0 | 2017-05-02 15:35:17 -0700 | [diff] [blame] | 1203 | "Control: Name = %s, ID = 0x%x Value = %d\n", |
| 1204 | ctrl->name, ctrl->id, ctrl->val); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1205 | rc = call_hfi_op(hdev, session_set_property, (void *) |
| 1206 | inst->session, property_id, pdata); |
| 1207 | } |
| 1208 | |
| 1209 | return rc; |
| 1210 | } |
| 1211 | |
Praneeth Paladugu | be42cb2 | 2016-04-12 22:34:39 -0700 | [diff] [blame] | 1212 | int msm_vdec_s_ext_ctrl(struct msm_vidc_inst *inst, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1213 | struct v4l2_ext_controls *ctrl) |
| 1214 | { |
| 1215 | int rc = 0, i = 0, fourcc = 0; |
| 1216 | struct v4l2_ext_control *ext_control; |
| 1217 | struct v4l2_control control; |
Umesh Pandey | 42313a7 | 2017-07-05 18:20:06 -0700 | [diff] [blame] | 1218 | struct hal_conceal_color conceal_color = {0}; |
| 1219 | struct hfi_device *hdev; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1220 | |
Umesh Pandey | 42313a7 | 2017-07-05 18:20:06 -0700 | [diff] [blame] | 1221 | if (!inst || !inst->core || !inst->core->device || !ctrl) { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1222 | dprintk(VIDC_ERR, |
| 1223 | "%s invalid parameters\n", __func__); |
| 1224 | return -EINVAL; |
| 1225 | } |
| 1226 | |
Umesh Pandey | 42313a7 | 2017-07-05 18:20:06 -0700 | [diff] [blame] | 1227 | hdev = inst->core->device; |
| 1228 | |
| 1229 | v4l2_try_ext_ctrls(&inst->ctrl_handler, ctrl); |
| 1230 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1231 | ext_control = ctrl->controls; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1232 | |
| 1233 | for (i = 0; i < ctrl->count; i++) { |
| 1234 | switch (ext_control[i].id) { |
| 1235 | case V4L2_CID_MPEG_VIDC_VIDEO_STREAM_OUTPUT_MODE: |
| 1236 | control.value = ext_control[i].value; |
Umesh Pandey | 42313a7 | 2017-07-05 18:20:06 -0700 | [diff] [blame] | 1237 | control.id = |
| 1238 | V4L2_CID_MPEG_VIDC_VIDEO_STREAM_OUTPUT_MODE; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1239 | rc = msm_comm_s_ctrl(inst, &control); |
| 1240 | if (rc) |
| 1241 | dprintk(VIDC_ERR, |
| 1242 | "%s Failed setting stream output mode : %d\n", |
| 1243 | __func__, rc); |
Praneeth Paladugu | 86c7c24 | 2017-07-16 19:44:42 -0700 | [diff] [blame] | 1244 | rc = msm_vidc_update_host_buff_counts(inst); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1245 | break; |
| 1246 | case V4L2_CID_MPEG_VIDC_VIDEO_DPB_COLOR_FORMAT: |
Umesh Pandey | 42313a7 | 2017-07-05 18:20:06 -0700 | [diff] [blame] | 1247 | control.id = |
| 1248 | V4L2_CID_MPEG_VIDC_VIDEO_STREAM_OUTPUT_MODE; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1249 | switch (ext_control[i].value) { |
| 1250 | case V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_NONE: |
| 1251 | if (!msm_comm_g_ctrl_for_id(inst, control.id)) { |
| 1252 | rc = msm_comm_release_output_buffers( |
Vaibhav Deshu Venkatesh | 8c9b6db | 2017-02-08 11:22:36 -0800 | [diff] [blame] | 1253 | inst, false); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1254 | if (rc) |
| 1255 | dprintk(VIDC_ERR, |
| 1256 | "%s Release output buffers failed\n", |
| 1257 | __func__); |
| 1258 | } |
| 1259 | break; |
| 1260 | case V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_UBWC: |
| 1261 | case V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_TP10_UBWC: |
| 1262 | if (ext_control[i].value == |
| 1263 | V4L2_MPEG_VIDC_VIDEO_DPB_COLOR_FMT_UBWC) |
| 1264 | fourcc = V4L2_PIX_FMT_NV12_UBWC; |
| 1265 | else |
| 1266 | fourcc = V4L2_PIX_FMT_NV12_TP10_UBWC; |
| 1267 | if (msm_comm_g_ctrl_for_id(inst, control.id)) { |
| 1268 | rc = msm_comm_set_color_format(inst, |
| 1269 | HAL_BUFFER_OUTPUT, fourcc); |
| 1270 | if (rc) { |
| 1271 | dprintk(VIDC_ERR, |
| 1272 | "%s Failed setting output color format : %d\n", |
| 1273 | __func__, rc); |
| 1274 | break; |
| 1275 | } |
Chinmay Sawarkar | 02f8f85 | 2017-06-26 12:05:38 -0700 | [diff] [blame] | 1276 | rc = msm_comm_try_get_bufreqs(inst); |
| 1277 | if (rc) { |
| 1278 | dprintk(VIDC_ERR, |
| 1279 | "%s Failed to get buffer requirements : %d\n", |
| 1280 | __func__, rc); |
| 1281 | break; |
| 1282 | } |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1283 | } |
Praneeth Paladugu | 86c7c24 | 2017-07-16 19:44:42 -0700 | [diff] [blame] | 1284 | rc = msm_vidc_update_host_buff_counts(inst); |
Praneeth Paladugu | 319e792 | 2017-03-16 11:09:06 -0700 | [diff] [blame] | 1285 | inst->clk_data.dpb_fourcc = fourcc; |
Maheshwar Ajja | e1f2113 | 2017-10-26 11:49:54 -0700 | [diff] [blame] | 1286 | control.id = |
| 1287 | V4L2_CID_MPEG_VIDC_VIDEO_DPB_COLOR_FORMAT; |
| 1288 | control.value = ext_control[i].value; |
| 1289 | rc = msm_comm_s_ctrl(inst, &control); |
| 1290 | if (rc) |
| 1291 | dprintk(VIDC_ERR, |
| 1292 | "%s: set control dpb color format %d failed\n", |
| 1293 | __func__, control.value); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1294 | break; |
| 1295 | default: |
| 1296 | dprintk(VIDC_ERR, |
| 1297 | "%s Unsupported output color format\n", |
| 1298 | __func__); |
| 1299 | rc = -ENOTSUPP; |
| 1300 | break; |
| 1301 | } |
| 1302 | break; |
Umesh Pandey | 42313a7 | 2017-07-05 18:20:06 -0700 | [diff] [blame] | 1303 | case V4L2_CID_MPEG_VIDC_VIDEO_CONCEAL_COLOR_8BIT: |
| 1304 | conceal_color.conceal_color_8bit = ext_control[i].value; |
| 1305 | i++; |
| 1306 | switch (ext_control[i].id) { |
| 1307 | case V4L2_CID_MPEG_VIDC_VIDEO_CONCEAL_COLOR_10BIT: |
| 1308 | conceal_color.conceal_color_10bit = |
| 1309 | ext_control[i].value; |
| 1310 | dprintk(VIDC_DBG, |
| 1311 | "conceal color: 8bit=0x%x 10bit=0x%x", |
| 1312 | conceal_color.conceal_color_8bit, |
| 1313 | conceal_color.conceal_color_10bit); |
| 1314 | rc = call_hfi_op(hdev, session_set_property, |
| 1315 | inst->session, |
| 1316 | HAL_PARAM_VDEC_CONCEAL_COLOR, |
| 1317 | &conceal_color); |
| 1318 | if (rc) { |
| 1319 | dprintk(VIDC_ERR, |
| 1320 | "%s Failed setting conceal color", |
| 1321 | __func__); |
| 1322 | } |
| 1323 | break; |
| 1324 | default: |
| 1325 | dprintk(VIDC_ERR, |
| 1326 | "%s Could not find CONCEAL_COLOR_10BIT ext_control", |
| 1327 | __func__); |
| 1328 | rc = -ENOTSUPP; |
| 1329 | break; |
| 1330 | } |
| 1331 | |
| 1332 | break; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1333 | default: |
| 1334 | dprintk(VIDC_ERR |
| 1335 | , "%s Unsupported set control %d", |
| 1336 | __func__, ext_control[i].id); |
| 1337 | rc = -ENOTSUPP; |
| 1338 | break; |
| 1339 | } |
| 1340 | } |
| 1341 | |
| 1342 | return rc; |
| 1343 | } |
| 1344 | |
Praneeth Paladugu | be42cb2 | 2016-04-12 22:34:39 -0700 | [diff] [blame] | 1345 | int msm_vdec_ctrl_init(struct msm_vidc_inst *inst, |
| 1346 | const struct v4l2_ctrl_ops *ctrl_ops) |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1347 | { |
| 1348 | return msm_comm_ctrl_init(inst, msm_vdec_ctrls, |
Praneeth Paladugu | be42cb2 | 2016-04-12 22:34:39 -0700 | [diff] [blame] | 1349 | ARRAY_SIZE(msm_vdec_ctrls), ctrl_ops); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1350 | } |