aboutsummaryrefslogtreecommitdiff
path: root/include/media/msm/vidc_init.h
blob: d58be338082f872edc97a5b7faf31e984d5ebc23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef VIDC_INIT_H
#define VIDC_INIT_H
#include <linux/msm_ion.h>
#include <media/msm/vidc_type.h>
#include <media/msm/vcd_property.h>

#define VIDC_MAX_NUM_CLIENTS 4
#define MAX_VIDEO_NUM_OF_BUFF 100
#define MAX_META_BUFFERS 32
#define MAX_MV_BUFFERS 32

enum buffer_dir {
	BUFFER_TYPE_INPUT,
	BUFFER_TYPE_OUTPUT
};

struct buf_addr_table {
	unsigned long user_vaddr;
	unsigned long kernel_vaddr;
	unsigned long phy_addr;
	unsigned long buff_ion_flag;
	struct ion_handle *buff_ion_handle;
	int pmem_fd;
	struct file *file;
	unsigned long dev_addr;
	void *client_data;
};

struct meta_buffer_addr_table {
	u8 *kernel_vir_addr;
	u8 *kernel_vir_addr_iommu;
};

struct video_client_ctx {
	void *vcd_handle;
	u32 num_of_input_buffers;
	u32 num_of_output_buffers;
	struct buf_addr_table input_buf_addr_table[MAX_VIDEO_NUM_OF_BUFF];
	struct buf_addr_table output_buf_addr_table[MAX_VIDEO_NUM_OF_BUFF];
	struct list_head msg_queue;
	struct mutex msg_queue_lock;
	struct mutex enrty_queue_lock;
	wait_queue_head_t msg_wait;
	struct completion event;
	struct vcd_property_h264_mv_buffer vcd_h264_mv_buffer;
	struct vcd_property_meta_buffer vcd_meta_buffer;
	struct vcd_property_enc_recon_buffer recon_buffer[4];
	u32 event_status;
	u32 seq_header_set;
	u32 stop_msg;
	u32 stop_called;
	u32 stop_sync_cb;
	size_t meta_buf_size;
	struct ion_client *user_ion_client;
	struct ion_handle *seq_hdr_ion_handle;
	struct ion_handle *h264_mv_ion_handle;
	struct ion_handle *recon_buffer_ion_handle[4];
	struct ion_handle *meta_buffer_ion_handle;
	struct ion_handle *meta_buffer_iommu_ion_handle;
	u32 dmx_disable;
	struct meta_buffer_addr_table meta_addr_table[MAX_META_BUFFERS];
};

void __iomem *vidc_get_ioaddr(void);
int vidc_load_firmware(void);
void vidc_release_firmware(void);
u32 vidc_get_fd_info(struct video_client_ctx *client_ctx,
		enum buffer_dir buffer, int pmem_fd,
		unsigned long kvaddr, int index,
		struct ion_handle **buff_handle);
u32 vidc_lookup_addr_table(struct video_client_ctx *client_ctx,
	enum buffer_dir buffer, u32 search_with_user_vaddr,
	unsigned long *user_vaddr, unsigned long *kernel_vaddr,
	unsigned long *phy_addr, int *pmem_fd, struct file **file,
	s32 *buffer_index);
u32 vidc_insert_addr_table(struct video_client_ctx *client_ctx,
	enum buffer_dir buffer, unsigned long user_vaddr,
	unsigned long *kernel_vaddr, int pmem_fd,
	unsigned long buffer_addr_offset,
	unsigned int max_num_buffers, unsigned long length);
u32 vidc_insert_addr_table_kernel(struct video_client_ctx *client_ctx,
	enum buffer_dir buffer, unsigned long user_vaddr,
	unsigned long kernel_vaddr, unsigned long phys_addr,
	unsigned int max_num_buffers,
	unsigned long length);
u32 vidc_delete_addr_table(struct video_client_ctx *client_ctx,
	enum buffer_dir buffer, unsigned long user_vaddr,
	unsigned long *kernel_vaddr);
void vidc_cleanup_addr_table(struct video_client_ctx *client_ctx,
		enum buffer_dir buffer);

u32 vidc_timer_create(void (*timer_handler)(void *),
	void *user_data, void **timer_handle);
void  vidc_timer_release(void *timer_handle);
void  vidc_timer_start(void *timer_handle, u32 time_out);
void  vidc_timer_stop(void *timer_handle);


#endif