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_COMMON_H_ |
| 15 | #define _MSM_VIDC_COMMON_H_ |
| 16 | #include "msm_vidc_internal.h" |
| 17 | struct vb2_buf_entry { |
| 18 | struct list_head list; |
| 19 | struct vb2_buffer *vb; |
| 20 | }; |
| 21 | |
| 22 | extern const char *const mpeg_video_vidc_extradata[]; |
| 23 | |
| 24 | enum load_calc_quirks { |
| 25 | LOAD_CALC_NO_QUIRKS = 0, |
| 26 | LOAD_CALC_IGNORE_TURBO_LOAD = 1 << 0, |
| 27 | LOAD_CALC_IGNORE_THUMBNAIL_LOAD = 1 << 1, |
| 28 | LOAD_CALC_IGNORE_NON_REALTIME_LOAD = 1 << 2, |
| 29 | }; |
| 30 | |
| 31 | struct msm_vidc_core *get_vidc_core(int core_id); |
| 32 | const struct msm_vidc_format *msm_comm_get_pixel_fmt_index( |
| 33 | const struct msm_vidc_format fmt[], int size, int index, int fmt_type); |
| 34 | struct msm_vidc_format *msm_comm_get_pixel_fmt_fourcc( |
| 35 | struct msm_vidc_format fmt[], int size, int fourcc, int fmt_type); |
| 36 | struct buf_queue *msm_comm_get_vb2q( |
| 37 | struct msm_vidc_inst *inst, enum v4l2_buf_type type); |
| 38 | int msm_comm_try_state(struct msm_vidc_inst *inst, int state); |
| 39 | int msm_comm_try_get_bufreqs(struct msm_vidc_inst *inst); |
| 40 | int msm_comm_try_set_prop(struct msm_vidc_inst *inst, |
| 41 | enum hal_property ptype, void *pdata); |
| 42 | int msm_comm_try_get_prop(struct msm_vidc_inst *inst, |
| 43 | enum hal_property ptype, union hal_get_property *hprop); |
| 44 | int msm_comm_set_scratch_buffers(struct msm_vidc_inst *inst); |
| 45 | int msm_comm_set_persist_buffers(struct msm_vidc_inst *inst); |
| 46 | int msm_comm_set_output_buffers(struct msm_vidc_inst *inst); |
| 47 | int msm_comm_queue_output_buffers(struct msm_vidc_inst *inst); |
| 48 | int msm_comm_qbuf(struct msm_vidc_inst *inst, struct vb2_buffer *vb); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 49 | void msm_comm_flush_dynamic_buffers(struct msm_vidc_inst *inst); |
| 50 | int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags); |
| 51 | int msm_comm_release_scratch_buffers(struct msm_vidc_inst *inst, |
| 52 | bool check_for_reuse); |
| 53 | int msm_comm_release_persist_buffers(struct msm_vidc_inst *inst); |
Vaibhav Deshu Venkatesh | 8c9b6db | 2017-02-08 11:22:36 -0800 | [diff] [blame] | 54 | int msm_comm_release_output_buffers(struct msm_vidc_inst *inst, |
| 55 | bool force_release); |
| 56 | void msm_comm_validate_output_buffers(struct msm_vidc_inst *inst); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 57 | int msm_comm_force_cleanup(struct msm_vidc_inst *inst); |
| 58 | int msm_comm_suspend(int core_id); |
| 59 | enum hal_extradata_id msm_comm_get_hal_extradata_index( |
| 60 | enum v4l2_mpeg_vidc_extradata index); |
| 61 | struct hal_buffer_requirements *get_buff_req_buffer( |
| 62 | struct msm_vidc_inst *inst, u32 buffer_type); |
| 63 | #define IS_PRIV_CTRL(idx) (\ |
Maheshwar Ajja | 1f80149 | 2017-05-10 16:55:26 -0700 | [diff] [blame] | 64 | (V4L2_CTRL_ID2WHICH(idx) == V4L2_CTRL_CLASS_MPEG) && \ |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 65 | V4L2_CTRL_DRIVER_PRIV(idx)) |
| 66 | void msm_comm_session_clean(struct msm_vidc_inst *inst); |
| 67 | int msm_comm_kill_session(struct msm_vidc_inst *inst); |
| 68 | enum multi_stream msm_comm_get_stream_output_mode(struct msm_vidc_inst *inst); |
| 69 | enum hal_buffer msm_comm_get_hal_output_buffer(struct msm_vidc_inst *inst); |
| 70 | struct msm_smem *msm_comm_smem_alloc(struct msm_vidc_inst *inst, |
| 71 | size_t size, u32 align, u32 flags, |
| 72 | enum hal_buffer buffer_type, int map_kernel); |
| 73 | void msm_comm_smem_free(struct msm_vidc_inst *inst, struct msm_smem *mem); |
| 74 | int msm_comm_smem_cache_operations(struct msm_vidc_inst *inst, |
| 75 | struct msm_smem *mem, enum smem_cache_ops cache_ops); |
| 76 | struct msm_smem *msm_comm_smem_user_to_kernel(struct msm_vidc_inst *inst, |
| 77 | int fd, u32 offset, enum hal_buffer buffer_type); |
| 78 | enum hal_video_codec get_hal_codec(int fourcc); |
| 79 | enum hal_domain get_hal_domain(int session_type); |
| 80 | int msm_comm_check_core_init(struct msm_vidc_core *core); |
| 81 | int msm_comm_get_inst_load(struct msm_vidc_inst *inst, |
| 82 | enum load_calc_quirks quirks); |
| 83 | int msm_comm_get_load(struct msm_vidc_core *core, |
| 84 | enum session_type type, enum load_calc_quirks quirks); |
| 85 | int msm_comm_set_color_format(struct msm_vidc_inst *inst, |
| 86 | enum hal_buffer buffer_type, int fourcc); |
| 87 | int msm_comm_g_ctrl(struct msm_vidc_inst *inst, struct v4l2_control *ctrl); |
| 88 | int msm_comm_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_control *ctrl); |
| 89 | int msm_comm_g_ctrl_for_id(struct msm_vidc_inst *inst, int id); |
| 90 | int msm_comm_ctrl_init(struct msm_vidc_inst *inst, |
| 91 | struct msm_vidc_ctrl *drv_ctrls, u32 num_ctrls, |
| 92 | const struct v4l2_ctrl_ops *ctrl_ops); |
| 93 | int msm_comm_ctrl_deinit(struct msm_vidc_inst *inst); |
| 94 | void msm_comm_cleanup_internal_buffers(struct msm_vidc_inst *inst); |
| 95 | int msm_vidc_comm_s_parm(struct msm_vidc_inst *inst, struct v4l2_streamparm *a); |
| 96 | bool msm_comm_turbo_session(struct msm_vidc_inst *inst); |
| 97 | void msm_comm_print_inst_info(struct msm_vidc_inst *inst); |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 98 | int msm_comm_v4l2_to_hal(int id, int value); |
| 99 | int msm_comm_hal_to_v4l2(int id, int value); |
Umesh Pandey | bb3fad0 | 2017-03-31 16:49:42 -0700 | [diff] [blame] | 100 | int msm_comm_session_continue(void *instance); |
Umesh Pandey | f2995f8 | 2017-05-01 16:44:45 -0700 | [diff] [blame] | 101 | u32 get_frame_size_nv12(int plane, u32 height, u32 width); |
| 102 | u32 get_frame_size_nv12_ubwc(int plane, u32 height, u32 width); |
| 103 | u32 get_frame_size_rgba(int plane, u32 height, u32 width); |
| 104 | u32 get_frame_size_nv21(int plane, u32 height, u32 width); |
| 105 | u32 get_frame_size_tp10_ubwc(int plane, u32 height, u32 width); |
Shivendra Kakrania | c1f60e0 | 2017-04-13 00:07:26 -0700 | [diff] [blame^] | 106 | void msm_comm_set_use_sys_cache(struct msm_vidc_inst *inst); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 107 | #endif |