summaryrefstree
path: root/kernel/drivers/vision/vpu/testapp/test-client.h
blob: 0ba84df0d8cfd171f916cdadd5445f196e690db3 (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 * Samsung Exynos SoC series VPU driver
 *
 * Copyright (c) 2015 Samsung Electronics Co., Ltd
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef VPU_TEST_CLIENT_H_
#define VPU_TEST_CLIENT_H_

#include <stdio.h>
#include <vs4l.h>
#include <pthread.h>

#include "ion.h"
#include "test-list.h"

#define GRAPH_IOSET_MAX_CNT		100
/* #define GRAPH_ION_CACHE */

struct client_config {
	struct vs4l_format_list		flist;
	struct vs4l_container_list	*clist;
	int				blist_cnt[50];
};

struct client_graph_io {
	struct list_head		list;
	struct list_head		chain_list;
	int				direction;
	int				pu_id;
	int				chain_id;
	int				pu_index;
	int				chain_index;
	int				target;
	int				width;
	int				height;
	int				pixel_bytes;
	int				format;
	int				flags;

	int				buffer_cnt;
	int				map_index[6];
	struct vpul_memory_map_desc     *map_desc;
	unsigned int			*ext_desc;

	int				fd;
	unsigned long			va;
};

struct client_chain {
	int				in_cnt;
	struct list_head		in_list;
	int				ot_cnt;
	struct list_head		ot_list;
};

struct client_graph_info {
	struct vpul_task		*task;

	int				in_cnt;
	struct list_head		in_list;
	int				ot_cnt;
	struct list_head		ot_list;
	int				im_cnt;
	struct list_head		im_list;
	int				io_cnt;
	struct client_graph_io		ioset[GRAPH_IOSET_MAX_CNT];

	int				chain_cnt;
	struct client_chain		chainset[GRAPH_IOSET_MAX_CNT];
};

struct client {
	int 				fd;
	int				id;
	int				fcount;
	int				str_loop;
	int				end_loop;

	int				chain_cnt;
	int				pu_cnt;
	struct vpul_vertex		*vertex_array;
	struct vpul_subchain		*chain_array;
	struct vpul_pu			*pu_array;
	short				*td_binary;
	int				td_size;

	pthread_t			thread;
	pthread_mutex_t 		mutex;
	ion_client			iclient;

	int				buffer_cnt;
	struct vs4l_graph		graph;
	struct client_config		incfg;
	struct client_config		otcfg;

	struct client_graph_info	ginfo;
};

int vpu_open(struct client *client);
int vpu_close(struct client *client);
int vpu_s_graph(struct client *client, struct vs4l_graph *graph);
int vpu_s_format(struct client *client, struct vs4l_format_list *flist);
int vpu_s_param(struct client *client, struct vs4l_param_list *plist);
int vpu_s_ctrl(struct client *client, struct vs4l_ctrl *ctrl);
int vpu_stream_on(struct client *client);
int vpu_stream_off(struct client *client);
int vpu_poll(struct client *client);
int vpu_qbuf(struct client *client, struct vs4l_container_list *c);
int vpu_dqbuf(struct client *client, struct vs4l_container_list *c);

int client_g_size(struct vs4l_format *format);
int client_compare_io(char *in, char *ot, int size);

int client_s_ginfo(struct client *client, struct vpul_task *task);
int client_s_format(struct client *client);
int client_s_buffer(struct client *client);
int client_p_buffer(struct client *client);
int client_s_intermediate(struct client *client);

struct vs4l_buffer * find_target_buffer(struct vs4l_container_list *clist, int target, int index);
struct vs4l_format * find_target_format(struct vs4l_format_list *flist, int target);
#endif