blob: 7534593e8a3c359546d8aacef022c943be58dfd1 [file] [log] [blame]
Praneeth Paladugu6e6fbdb2017-01-16 15:43:01 -08001/* 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"
17struct vb2_buf_entry {
18 struct list_head list;
19 struct vb2_buffer *vb;
20};
21
22extern const char *const mpeg_video_vidc_extradata[];
23
24enum 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
31struct msm_vidc_core *get_vidc_core(int core_id);
32const struct msm_vidc_format *msm_comm_get_pixel_fmt_index(
33 const struct msm_vidc_format fmt[], int size, int index, int fmt_type);
34struct msm_vidc_format *msm_comm_get_pixel_fmt_fourcc(
35 struct msm_vidc_format fmt[], int size, int fourcc, int fmt_type);
36struct buf_queue *msm_comm_get_vb2q(
37 struct msm_vidc_inst *inst, enum v4l2_buf_type type);
38int msm_comm_try_state(struct msm_vidc_inst *inst, int state);
39int msm_comm_try_get_bufreqs(struct msm_vidc_inst *inst);
40int msm_comm_try_set_prop(struct msm_vidc_inst *inst,
41 enum hal_property ptype, void *pdata);
42int msm_comm_try_get_prop(struct msm_vidc_inst *inst,
43 enum hal_property ptype, union hal_get_property *hprop);
44int msm_comm_set_scratch_buffers(struct msm_vidc_inst *inst);
45int msm_comm_set_persist_buffers(struct msm_vidc_inst *inst);
46int msm_comm_set_output_buffers(struct msm_vidc_inst *inst);
47int msm_comm_queue_output_buffers(struct msm_vidc_inst *inst);
48int msm_comm_qbuf(struct msm_vidc_inst *inst, struct vb2_buffer *vb);
Praneeth Paladugu6e6fbdb2017-01-16 15:43:01 -080049void msm_comm_flush_dynamic_buffers(struct msm_vidc_inst *inst);
50int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags);
51int msm_comm_release_scratch_buffers(struct msm_vidc_inst *inst,
52 bool check_for_reuse);
53int msm_comm_release_persist_buffers(struct msm_vidc_inst *inst);
Vaibhav Deshu Venkatesh8c9b6db2017-02-08 11:22:36 -080054int msm_comm_release_output_buffers(struct msm_vidc_inst *inst,
55 bool force_release);
56void msm_comm_validate_output_buffers(struct msm_vidc_inst *inst);
Praneeth Paladugu6e6fbdb2017-01-16 15:43:01 -080057int msm_comm_force_cleanup(struct msm_vidc_inst *inst);
58int msm_comm_suspend(int core_id);
59enum hal_extradata_id msm_comm_get_hal_extradata_index(
60 enum v4l2_mpeg_vidc_extradata index);
61struct hal_buffer_requirements *get_buff_req_buffer(
62 struct msm_vidc_inst *inst, u32 buffer_type);
63#define IS_PRIV_CTRL(idx) (\
Maheshwar Ajja1f801492017-05-10 16:55:26 -070064 (V4L2_CTRL_ID2WHICH(idx) == V4L2_CTRL_CLASS_MPEG) && \
Praneeth Paladugu6e6fbdb2017-01-16 15:43:01 -080065 V4L2_CTRL_DRIVER_PRIV(idx))
66void msm_comm_session_clean(struct msm_vidc_inst *inst);
67int msm_comm_kill_session(struct msm_vidc_inst *inst);
68enum multi_stream msm_comm_get_stream_output_mode(struct msm_vidc_inst *inst);
69enum hal_buffer msm_comm_get_hal_output_buffer(struct msm_vidc_inst *inst);
70struct 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);
73void msm_comm_smem_free(struct msm_vidc_inst *inst, struct msm_smem *mem);
74int msm_comm_smem_cache_operations(struct msm_vidc_inst *inst,
75 struct msm_smem *mem, enum smem_cache_ops cache_ops);
76struct msm_smem *msm_comm_smem_user_to_kernel(struct msm_vidc_inst *inst,
77 int fd, u32 offset, enum hal_buffer buffer_type);
78enum hal_video_codec get_hal_codec(int fourcc);
79enum hal_domain get_hal_domain(int session_type);
80int msm_comm_check_core_init(struct msm_vidc_core *core);
81int msm_comm_get_inst_load(struct msm_vidc_inst *inst,
82 enum load_calc_quirks quirks);
83int msm_comm_get_load(struct msm_vidc_core *core,
84 enum session_type type, enum load_calc_quirks quirks);
85int msm_comm_set_color_format(struct msm_vidc_inst *inst,
86 enum hal_buffer buffer_type, int fourcc);
87int msm_comm_g_ctrl(struct msm_vidc_inst *inst, struct v4l2_control *ctrl);
88int msm_comm_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_control *ctrl);
89int msm_comm_g_ctrl_for_id(struct msm_vidc_inst *inst, int id);
90int 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);
93int msm_comm_ctrl_deinit(struct msm_vidc_inst *inst);
94void msm_comm_cleanup_internal_buffers(struct msm_vidc_inst *inst);
95int msm_vidc_comm_s_parm(struct msm_vidc_inst *inst, struct v4l2_streamparm *a);
96bool msm_comm_turbo_session(struct msm_vidc_inst *inst);
97void msm_comm_print_inst_info(struct msm_vidc_inst *inst);
Chinmay Sawarkarb3c6ccb2017-02-23 18:01:32 -080098int msm_comm_v4l2_to_hal(int id, int value);
99int msm_comm_hal_to_v4l2(int id, int value);
Umesh Pandeybb3fad02017-03-31 16:49:42 -0700100int msm_comm_session_continue(void *instance);
Umesh Pandeyf2995f82017-05-01 16:44:45 -0700101u32 get_frame_size_nv12(int plane, u32 height, u32 width);
102u32 get_frame_size_nv12_ubwc(int plane, u32 height, u32 width);
103u32 get_frame_size_rgba(int plane, u32 height, u32 width);
104u32 get_frame_size_nv21(int plane, u32 height, u32 width);
105u32 get_frame_size_tp10_ubwc(int plane, u32 height, u32 width);
Shivendra Kakraniac1f60e02017-04-13 00:07:26 -0700106void msm_comm_set_use_sys_cache(struct msm_vidc_inst *inst);
Praneeth Paladugu6e6fbdb2017-01-16 15:43:01 -0800107#endif