Srinu Gorle | cf8c675 | 2018-01-19 18:36:13 +0530 | [diff] [blame] | 1 | /*Copyright (c) 2012-2016, 2018 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); |
| 49 | void msm_comm_scale_clocks_and_bus(struct msm_vidc_inst *inst); |
| 50 | int msm_comm_scale_clocks(struct msm_vidc_core *core); |
| 51 | int msm_comm_scale_clocks_load(struct msm_vidc_core *core, |
| 52 | int num_mbs_per_sec, enum load_calc_quirks quirks); |
| 53 | void msm_comm_flush_dynamic_buffers(struct msm_vidc_inst *inst); |
| 54 | int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags); |
| 55 | int msm_comm_release_scratch_buffers(struct msm_vidc_inst *inst, |
| 56 | bool check_for_reuse); |
| 57 | int msm_comm_release_persist_buffers(struct msm_vidc_inst *inst); |
| 58 | int msm_comm_release_output_buffers(struct msm_vidc_inst *inst); |
| 59 | int msm_comm_force_cleanup(struct msm_vidc_inst *inst); |
| 60 | int msm_comm_suspend(int core_id); |
| 61 | enum hal_extradata_id msm_comm_get_hal_extradata_index( |
| 62 | enum v4l2_mpeg_vidc_extradata index); |
| 63 | enum hal_buffer_layout_type msm_comm_get_hal_buffer_layout( |
| 64 | enum v4l2_mpeg_vidc_video_mvc_layout index); |
| 65 | struct hal_buffer_requirements *get_buff_req_buffer( |
| 66 | struct msm_vidc_inst *inst, u32 buffer_type); |
| 67 | #define IS_PRIV_CTRL(idx) (\ |
| 68 | (V4L2_CTRL_ID2WHICH(idx) == V4L2_CTRL_CLASS_MPEG) && \ |
| 69 | V4L2_CTRL_DRIVER_PRIV(idx)) |
| 70 | void msm_comm_session_clean(struct msm_vidc_inst *inst); |
| 71 | int msm_comm_kill_session(struct msm_vidc_inst *inst); |
| 72 | enum multi_stream msm_comm_get_stream_output_mode(struct msm_vidc_inst *inst); |
| 73 | enum hal_buffer msm_comm_get_hal_output_buffer(struct msm_vidc_inst *inst); |
| 74 | struct msm_smem *msm_comm_smem_alloc(struct msm_vidc_inst *inst, |
| 75 | size_t size, u32 align, u32 flags, |
| 76 | enum hal_buffer buffer_type, int map_kernel); |
| 77 | void msm_comm_smem_free(struct msm_vidc_inst *inst, struct msm_smem *mem); |
| 78 | int msm_comm_smem_cache_operations(struct msm_vidc_inst *inst, |
| 79 | struct msm_smem *mem, enum smem_cache_ops cache_ops); |
| 80 | struct msm_smem *msm_comm_smem_user_to_kernel(struct msm_vidc_inst *inst, |
| 81 | int fd, u32 offset, enum hal_buffer buffer_type); |
| 82 | enum hal_video_codec get_hal_codec(int fourcc); |
| 83 | enum hal_domain get_hal_domain(int session_type); |
| 84 | int msm_comm_check_core_init(struct msm_vidc_core *core); |
| 85 | int msm_comm_get_inst_load(struct msm_vidc_inst *inst, |
| 86 | enum load_calc_quirks quirks); |
| 87 | int msm_comm_get_load(struct msm_vidc_core *core, |
| 88 | enum session_type type, enum load_calc_quirks quirks); |
| 89 | int msm_comm_set_color_format(struct msm_vidc_inst *inst, |
| 90 | enum hal_buffer buffer_type, int fourcc); |
| 91 | int msm_comm_g_ctrl(struct msm_vidc_inst *inst, struct v4l2_control *ctrl); |
| 92 | int msm_comm_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_control *ctrl); |
| 93 | int msm_comm_g_ctrl_for_id(struct msm_vidc_inst *inst, int id); |
| 94 | int msm_comm_ctrl_init(struct msm_vidc_inst *inst, |
| 95 | struct msm_vidc_ctrl *drv_ctrls, u32 num_ctrls, |
| 96 | const struct v4l2_ctrl_ops *ctrl_ops); |
| 97 | int msm_comm_ctrl_deinit(struct msm_vidc_inst *inst); |
| 98 | void msm_comm_cleanup_internal_buffers(struct msm_vidc_inst *inst); |
| 99 | int msm_vidc_comm_s_parm(struct msm_vidc_inst *inst, struct v4l2_streamparm *a); |
| 100 | bool msm_comm_turbo_session(struct msm_vidc_inst *inst); |
| 101 | struct msm_vidc_inst *get_inst(struct msm_vidc_core *core, void *session_id); |
| 102 | void put_inst(struct msm_vidc_inst *inst); |
| 103 | #endif |