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 | #ifndef _MSM_VIDC_INTERNAL_H_ |
| 15 | #define _MSM_VIDC_INTERNAL_H_ |
| 16 | |
| 17 | #include <linux/atomic.h> |
| 18 | #include <linux/list.h> |
| 19 | #include <linux/time.h> |
| 20 | #include <linux/types.h> |
| 21 | #include <linux/completion.h> |
| 22 | #include <linux/wait.h> |
| 23 | #include <linux/workqueue.h> |
| 24 | #include <linux/msm-bus.h> |
| 25 | #include <linux/msm-bus-board.h> |
| 26 | #include <linux/kref.h> |
| 27 | #include <media/v4l2-dev.h> |
| 28 | #include <media/v4l2-device.h> |
| 29 | #include <media/v4l2-ioctl.h> |
| 30 | #include <media/v4l2-event.h> |
| 31 | #include <media/v4l2-ctrls.h> |
| 32 | #include <media/videobuf2-core.h> |
| 33 | #include <media/videobuf2-v4l2.h> |
| 34 | #include <media/msm_vidc.h> |
| 35 | #include <media/msm_media_info.h> |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 36 | #include "vidc_hfi_api.h" |
| 37 | |
| 38 | #define MSM_VIDC_DRV_NAME "msm_vidc_driver" |
| 39 | #define MSM_VIDC_VERSION KERNEL_VERSION(0, 0, 1) |
| 40 | #define MAX_DEBUGFS_NAME 50 |
| 41 | #define DEFAULT_TIMEOUT 3 |
| 42 | #define DEFAULT_HEIGHT 1088 |
| 43 | #define DEFAULT_WIDTH 1920 |
| 44 | #define MIN_SUPPORTED_WIDTH 32 |
| 45 | #define MIN_SUPPORTED_HEIGHT 32 |
| 46 | #define DEFAULT_FPS 15 |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 47 | #define MIN_NUM_OUTPUT_BUFFERS 1 |
| 48 | #define MIN_NUM_CAPTURE_BUFFERS 1 |
| 49 | #define MAX_NUM_OUTPUT_BUFFERS VIDEO_MAX_FRAME // same as VB2_MAX_FRAME |
| 50 | #define MAX_NUM_CAPTURE_BUFFERS VIDEO_MAX_FRAME // same as VB2_MAX_FRAME |
| 51 | |
Karthikeyan Periasamy | 4b5e733 | 2017-07-28 12:07:42 -0700 | [diff] [blame] | 52 | #define MAX_SUPPORTED_INSTANCES 16 |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 53 | |
| 54 | /* Maintains the number of FTB's between each FBD over a window */ |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 55 | #define DCVS_FTB_WINDOW 16 |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 56 | |
| 57 | #define V4L2_EVENT_VIDC_BASE 10 |
| 58 | |
| 59 | #define SYS_MSG_START HAL_SYS_INIT_DONE |
| 60 | #define SYS_MSG_END HAL_SYS_ERROR |
| 61 | #define SESSION_MSG_START HAL_SESSION_EVENT_CHANGE |
| 62 | #define SESSION_MSG_END HAL_SESSION_ERROR |
| 63 | #define SYS_MSG_INDEX(__msg) (__msg - SYS_MSG_START) |
| 64 | #define SESSION_MSG_INDEX(__msg) (__msg - SESSION_MSG_START) |
| 65 | |
| 66 | |
| 67 | #define MAX_NAME_LENGTH 64 |
| 68 | |
| 69 | #define EXTRADATA_IDX(__num_planes) ((__num_planes) ? (__num_planes) - 1 : 0) |
| 70 | |
| 71 | #define NUM_MBS_PER_SEC(__height, __width, __fps) \ |
| 72 | (NUM_MBS_PER_FRAME(__height, __width) * __fps) |
| 73 | |
| 74 | #define NUM_MBS_PER_FRAME(__height, __width) \ |
| 75 | ((ALIGN(__height, 16) / 16) * (ALIGN(__width, 16) / 16)) |
| 76 | |
| 77 | enum vidc_ports { |
| 78 | OUTPUT_PORT, |
| 79 | CAPTURE_PORT, |
| 80 | MAX_PORT_NUM |
| 81 | }; |
| 82 | |
| 83 | enum vidc_core_state { |
| 84 | VIDC_CORE_UNINIT = 0, |
| 85 | VIDC_CORE_INIT, |
| 86 | VIDC_CORE_INIT_DONE, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | /* |
| 90 | * Do not change the enum values unless |
| 91 | * you know what you are doing |
| 92 | */ |
| 93 | enum instance_state { |
| 94 | MSM_VIDC_CORE_UNINIT_DONE = 0x0001, |
| 95 | MSM_VIDC_CORE_INIT, |
| 96 | MSM_VIDC_CORE_INIT_DONE, |
| 97 | MSM_VIDC_OPEN, |
| 98 | MSM_VIDC_OPEN_DONE, |
| 99 | MSM_VIDC_LOAD_RESOURCES, |
| 100 | MSM_VIDC_LOAD_RESOURCES_DONE, |
| 101 | MSM_VIDC_START, |
| 102 | MSM_VIDC_START_DONE, |
| 103 | MSM_VIDC_STOP, |
| 104 | MSM_VIDC_STOP_DONE, |
| 105 | MSM_VIDC_RELEASE_RESOURCES, |
| 106 | MSM_VIDC_RELEASE_RESOURCES_DONE, |
| 107 | MSM_VIDC_CLOSE, |
| 108 | MSM_VIDC_CLOSE_DONE, |
| 109 | MSM_VIDC_CORE_UNINIT, |
| 110 | MSM_VIDC_CORE_INVALID |
| 111 | }; |
| 112 | |
| 113 | struct buf_info { |
| 114 | struct list_head list; |
| 115 | struct vb2_buffer *buf; |
| 116 | }; |
| 117 | |
| 118 | struct msm_vidc_list { |
| 119 | struct list_head list; |
| 120 | struct mutex lock; |
| 121 | }; |
| 122 | |
| 123 | static inline void INIT_MSM_VIDC_LIST(struct msm_vidc_list *mlist) |
| 124 | { |
| 125 | mutex_init(&mlist->lock); |
| 126 | INIT_LIST_HEAD(&mlist->list); |
| 127 | } |
| 128 | |
| 129 | static inline void DEINIT_MSM_VIDC_LIST(struct msm_vidc_list *mlist) |
| 130 | { |
| 131 | mutex_destroy(&mlist->lock); |
| 132 | } |
| 133 | |
| 134 | enum buffer_owner { |
| 135 | DRIVER, |
| 136 | FIRMWARE, |
| 137 | CLIENT, |
| 138 | MAX_OWNER |
| 139 | }; |
| 140 | |
Praneeth Paladugu | b71968b | 2015-08-19 20:47:57 -0700 | [diff] [blame] | 141 | struct vidc_freq_data { |
| 142 | struct list_head list; |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 143 | u32 device_addr; |
Praneeth Paladugu | b71968b | 2015-08-19 20:47:57 -0700 | [diff] [blame] | 144 | unsigned long freq; |
| 145 | }; |
| 146 | |
Praneeth Paladugu | 319e792 | 2017-03-16 11:09:06 -0700 | [diff] [blame] | 147 | struct recon_buf { |
| 148 | struct list_head list; |
| 149 | u32 buffer_index; |
| 150 | u32 CR; |
| 151 | u32 CF; |
| 152 | }; |
| 153 | |
Praneeth Paladugu | f9ef817 | 2017-07-18 22:55:59 -0700 | [diff] [blame] | 154 | struct eos_buf { |
| 155 | struct list_head list; |
| 156 | struct msm_smem smem; |
| 157 | }; |
| 158 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 159 | struct internal_buf { |
| 160 | struct list_head list; |
| 161 | enum hal_buffer buffer_type; |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 162 | struct msm_smem smem; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 163 | enum buffer_owner buffer_ownership; |
| 164 | }; |
| 165 | |
Praneeth Paladugu | d5bf7bc | 2017-05-29 23:41:04 -0700 | [diff] [blame] | 166 | struct msm_vidc_common_data { |
| 167 | char key[128]; |
| 168 | int value; |
| 169 | }; |
| 170 | |
| 171 | struct msm_vidc_codec_data { |
| 172 | u32 fourcc; |
| 173 | enum session_type session_type; |
| 174 | int vpp_cycles; |
| 175 | int vsp_cycles; |
| 176 | int low_power_cycles; |
| 177 | }; |
| 178 | |
| 179 | struct msm_vidc_platform_data { |
| 180 | struct msm_vidc_common_data *common_data; |
| 181 | unsigned int common_data_length; |
| 182 | struct msm_vidc_codec_data *codec_data; |
| 183 | unsigned int codec_data_length; |
| 184 | }; |
| 185 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 186 | struct msm_vidc_format { |
| 187 | char name[MAX_NAME_LENGTH]; |
| 188 | u8 description[32]; |
| 189 | u32 fourcc; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 190 | int type; |
| 191 | u32 (*get_frame_size)(int plane, u32 height, u32 width); |
Vaibhav Deshu Venkatesh | 8c9b6db | 2017-02-08 11:22:36 -0800 | [diff] [blame] | 192 | bool defer_outputs; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 193 | }; |
| 194 | |
| 195 | struct msm_vidc_drv { |
| 196 | struct mutex lock; |
| 197 | struct list_head cores; |
| 198 | int num_cores; |
| 199 | struct dentry *debugfs_root; |
| 200 | int thermal_level; |
| 201 | u32 platform_version; |
| 202 | }; |
| 203 | |
| 204 | struct msm_video_device { |
| 205 | int type; |
| 206 | struct video_device vdev; |
| 207 | }; |
| 208 | |
Praneeth Paladugu | 520e9b2 | 2017-05-31 13:25:18 -0700 | [diff] [blame] | 209 | struct session_crop { |
| 210 | u32 left; |
| 211 | u32 top; |
| 212 | u32 width; |
| 213 | u32 height; |
| 214 | }; |
| 215 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 216 | struct session_prop { |
| 217 | u32 width[MAX_PORT_NUM]; |
| 218 | u32 height[MAX_PORT_NUM]; |
Praneeth Paladugu | 520e9b2 | 2017-05-31 13:25:18 -0700 | [diff] [blame] | 219 | struct session_crop crop_info; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 220 | u32 fps; |
| 221 | u32 bitrate; |
| 222 | }; |
| 223 | |
| 224 | struct buf_queue { |
| 225 | struct vb2_queue vb2_bufq; |
| 226 | struct mutex lock; |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 227 | unsigned int plane_sizes[VB2_MAX_PLANES]; |
| 228 | int num_planes; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 229 | }; |
| 230 | |
| 231 | enum profiling_points { |
| 232 | SYS_INIT = 0, |
| 233 | SESSION_INIT, |
| 234 | LOAD_RESOURCES, |
| 235 | FRAME_PROCESSING, |
| 236 | FW_IDLE, |
| 237 | MAX_PROFILING_POINTS, |
| 238 | }; |
| 239 | |
| 240 | struct buf_count { |
| 241 | int etb; |
| 242 | int ftb; |
| 243 | int fbd; |
| 244 | int ebd; |
| 245 | }; |
| 246 | |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 247 | struct clock_data { |
Praneeth Paladugu | 75cf18e | 2016-12-08 16:12:11 -0800 | [diff] [blame] | 248 | int buffer_counter; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 249 | int load; |
| 250 | int load_low; |
Praneeth Paladugu | 04e7772 | 2017-06-21 11:38:31 -0700 | [diff] [blame] | 251 | int load_norm; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 252 | int load_high; |
| 253 | int min_threshold; |
| 254 | int max_threshold; |
Praneeth Paladugu | 1f9d1d9 | 2017-04-11 10:36:16 -0700 | [diff] [blame] | 255 | unsigned int extra_capture_buffer_count; |
| 256 | unsigned int extra_output_buffer_count; |
Praneeth Paladugu | 75cf18e | 2016-12-08 16:12:11 -0800 | [diff] [blame] | 257 | enum hal_buffer buffer_type; |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 258 | bool dcvs_mode; |
| 259 | unsigned long bitrate; |
| 260 | unsigned long min_freq; |
| 261 | unsigned long curr_freq; |
| 262 | u32 operating_rate; |
Praneeth Paladugu | d5bf7bc | 2017-05-29 23:41:04 -0700 | [diff] [blame] | 263 | struct msm_vidc_codec_data *entry; |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 264 | u32 core_id; |
Praneeth Paladugu | 319e792 | 2017-03-16 11:09:06 -0700 | [diff] [blame] | 265 | u32 dpb_fourcc; |
| 266 | u32 opb_fourcc; |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 267 | enum hal_work_mode work_mode; |
| 268 | bool low_latency_mode; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 269 | }; |
| 270 | |
| 271 | struct profile_data { |
| 272 | int start; |
| 273 | int stop; |
| 274 | int cumulative; |
| 275 | char name[64]; |
| 276 | int sampling; |
| 277 | int average; |
| 278 | }; |
| 279 | |
| 280 | struct msm_vidc_debug { |
| 281 | struct profile_data pdata[MAX_PROFILING_POINTS]; |
| 282 | int profile; |
| 283 | int samples; |
| 284 | }; |
| 285 | |
| 286 | enum msm_vidc_modes { |
| 287 | VIDC_SECURE = BIT(0), |
| 288 | VIDC_TURBO = BIT(1), |
| 289 | VIDC_THUMBNAIL = BIT(2), |
| 290 | VIDC_LOW_POWER = BIT(3), |
| 291 | VIDC_REALTIME = BIT(4), |
| 292 | }; |
| 293 | |
| 294 | struct msm_vidc_core { |
| 295 | struct list_head list; |
| 296 | struct mutex lock; |
| 297 | int id; |
| 298 | struct hfi_device *device; |
Praneeth Paladugu | d5bf7bc | 2017-05-29 23:41:04 -0700 | [diff] [blame] | 299 | struct msm_vidc_platform_data *platform_data; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 300 | struct msm_video_device vdev[MSM_VIDC_MAX_DEVICES]; |
| 301 | struct v4l2_device v4l2_dev; |
| 302 | struct list_head instances; |
| 303 | struct dentry *debugfs_root; |
| 304 | enum vidc_core_state state; |
| 305 | struct completion completions[SYS_MSG_END - SYS_MSG_START + 1]; |
| 306 | enum msm_vidc_hfi_type hfi_type; |
| 307 | struct msm_vidc_platform_resources resources; |
| 308 | u32 enc_codec_supported; |
| 309 | u32 dec_codec_supported; |
| 310 | u32 codec_count; |
| 311 | struct msm_vidc_capability *capabilities; |
| 312 | struct delayed_work fw_unload_work; |
| 313 | bool smmu_fault_handled; |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 314 | unsigned long min_freq; |
| 315 | unsigned long curr_freq; |
Praneeth Paladugu | 319e792 | 2017-03-16 11:09:06 -0700 | [diff] [blame] | 316 | struct vidc_bus_vote_data *vote_data; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 317 | }; |
| 318 | |
| 319 | struct msm_vidc_inst { |
| 320 | struct list_head list; |
| 321 | struct mutex sync_lock, lock; |
| 322 | struct msm_vidc_core *core; |
| 323 | enum session_type session_type; |
| 324 | void *session; |
| 325 | struct session_prop prop; |
| 326 | enum instance_state state; |
| 327 | struct msm_vidc_format fmts[MAX_PORT_NUM]; |
| 328 | struct buf_queue bufq[MAX_PORT_NUM]; |
Praneeth Paladugu | b71968b | 2015-08-19 20:47:57 -0700 | [diff] [blame] | 329 | struct msm_vidc_list freqs; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 330 | struct msm_vidc_list scratchbufs; |
| 331 | struct msm_vidc_list persistbufs; |
| 332 | struct msm_vidc_list pending_getpropq; |
| 333 | struct msm_vidc_list outputbufs; |
Praneeth Paladugu | 319e792 | 2017-03-16 11:09:06 -0700 | [diff] [blame] | 334 | struct msm_vidc_list reconbufs; |
Praneeth Paladugu | f9ef817 | 2017-07-18 22:55:59 -0700 | [diff] [blame] | 335 | struct msm_vidc_list eosbufs; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 336 | struct msm_vidc_list registeredbufs; |
| 337 | struct buffer_requirements buff_req; |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 338 | struct smem_client *mem_client; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 339 | struct v4l2_ctrl_handler ctrl_handler; |
| 340 | struct completion completions[SESSION_MSG_END - SESSION_MSG_START + 1]; |
| 341 | struct v4l2_ctrl **cluster; |
| 342 | struct v4l2_fh event_handler; |
| 343 | struct msm_smem *extradata_handle; |
| 344 | bool in_reconfig; |
| 345 | u32 reconfig_width; |
| 346 | u32 reconfig_height; |
| 347 | struct dentry *debugfs_root; |
| 348 | void *priv; |
| 349 | struct msm_vidc_debug debug; |
| 350 | struct buf_count count; |
Praneeth Paladugu | e5fd087 | 2017-04-19 11:24:28 -0700 | [diff] [blame] | 351 | struct clock_data clk_data; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 352 | enum msm_vidc_modes flags; |
| 353 | struct msm_vidc_capability capability; |
| 354 | u32 buffer_size_limit; |
| 355 | enum buffer_mode_type buffer_mode_set[MAX_PORT_NUM]; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 356 | struct v4l2_ctrl **ctrls; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 357 | enum msm_vidc_pixel_depth bit_depth; |
| 358 | struct kref kref; |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 359 | bool in_flush; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 360 | u32 pic_struct; |
| 361 | u32 colour_space; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 362 | u32 profile; |
| 363 | u32 level; |
| 364 | u32 entropy_mode; |
Praneeth Paladugu | d5bf7bc | 2017-05-29 23:41:04 -0700 | [diff] [blame] | 365 | struct msm_vidc_codec_data *codec_data; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 366 | }; |
| 367 | |
| 368 | extern struct msm_vidc_drv *vidc_driver; |
| 369 | |
| 370 | struct msm_vidc_ctrl_cluster { |
| 371 | struct v4l2_ctrl **cluster; |
| 372 | struct list_head list; |
| 373 | }; |
| 374 | |
| 375 | struct msm_vidc_ctrl { |
| 376 | u32 id; |
| 377 | char name[MAX_NAME_LENGTH]; |
| 378 | enum v4l2_ctrl_type type; |
| 379 | s32 minimum; |
| 380 | s32 maximum; |
| 381 | s32 default_value; |
| 382 | u32 step; |
| 383 | u32 menu_skip_mask; |
| 384 | u32 flags; |
| 385 | const char * const *qmenu; |
| 386 | }; |
| 387 | |
| 388 | void handle_cmd_response(enum hal_command_response cmd, void *data); |
| 389 | int msm_vidc_trigger_ssr(struct msm_vidc_core *core, |
| 390 | enum hal_ssr_trigger_type type); |
| 391 | int msm_vidc_check_session_supported(struct msm_vidc_inst *inst); |
| 392 | int msm_vidc_check_scaling_supported(struct msm_vidc_inst *inst); |
| 393 | void msm_vidc_queue_v4l2_event(struct msm_vidc_inst *inst, int event_type); |
| 394 | |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 395 | struct msm_vidc_buffer { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 396 | struct list_head list; |
Maheshwar Ajja | cca0405 | 2017-07-12 17:59:45 -0700 | [diff] [blame] | 397 | struct kref kref; |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 398 | struct msm_smem smem[VIDEO_MAX_PLANES]; |
| 399 | struct vb2_v4l2_buffer vvb; |
| 400 | bool deferred; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 401 | }; |
| 402 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 403 | void msm_comm_handle_thermal_event(void); |
| 404 | void *msm_smem_new_client(enum smem_type mtype, |
| 405 | void *platform_resources, enum session_type stype); |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 406 | int msm_smem_alloc(struct smem_client *client, |
| 407 | size_t size, u32 align, u32 flags, enum hal_buffer buffer_type, |
| 408 | int map_kernel, struct msm_smem *smem); |
| 409 | int msm_smem_free(void *clt, struct msm_smem *mem); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 410 | void msm_smem_delete_client(void *clt); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 411 | struct context_bank_info *msm_smem_get_context_bank(void *clt, |
| 412 | bool is_secure, enum hal_buffer buffer_type); |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 413 | int msm_smem_map_dma_buf(struct msm_vidc_inst *inst, struct msm_smem *smem); |
| 414 | int msm_smem_unmap_dma_buf(struct msm_vidc_inst *inst, struct msm_smem *smem); |
| 415 | void *msm_smem_get_dma_buf(int fd); |
| 416 | void msm_smem_put_dma_buf(void *dma_buf); |
| 417 | void *msm_smem_get_handle(struct smem_client *client, void *dma_buf); |
| 418 | void msm_smem_put_handle(struct smem_client *client, void *handle); |
| 419 | int msm_smem_cache_operations(struct smem_client *client, |
| 420 | void *handle, unsigned long offset, unsigned long size, |
| 421 | enum smem_cache_ops cache_op); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 422 | void msm_vidc_fw_unload_handler(struct work_struct *work); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 423 | /* |
| 424 | * XXX: normally should be in msm_vidc.h, but that's meant for public APIs, |
| 425 | * whereas this is private |
| 426 | */ |
| 427 | int msm_vidc_destroy(struct msm_vidc_inst *inst); |
Praneeth Paladugu | d5bf7bc | 2017-05-29 23:41:04 -0700 | [diff] [blame] | 428 | void *vidc_get_drv_data(struct device *dev); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 429 | #endif |