summaryrefslogtreecommitdiff
path: root/src/bin/ecore_buffer/bq_mgr_protocol.h
blob: b2d7bcc775ff5324e6e9a0381352ebc3230b91f9 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#ifndef BQ_MGR_SERVER_PROTOCOL_H
#define BQ_MGR_SERVER_PROTOCOL_H

#ifdef  __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <stddef.h>
#include "wayland-server.h"

struct wl_client;
struct wl_resource;

struct bq_mgr;
struct bq_consumer;
struct bq_provider;
struct bq_buffer;

extern const struct wl_interface bq_mgr_interface;
extern const struct wl_interface bq_consumer_interface;
extern const struct wl_interface bq_provider_interface;
extern const struct wl_interface bq_buffer_interface;

#ifndef BQ_MGR_ERROR_ENUM
#define BQ_MGR_ERROR_ENUM
enum bq_mgr_error {
	BQ_MGR_ERROR_INVALID_PERMISSION = 0,
	BQ_MGR_ERROR_INVALID_NAME = 1,
	BQ_MGR_ERROR_ALREADY_USED = 2,
};
#endif /* BQ_MGR_ERROR_ENUM */

struct bq_mgr_interface {
	/**
	 * create_consumer - (none)
	 * @id: (none)
	 * @name: (none)
	 * @queue_size: (none)
	 * @width: (none)
	 * @height: (none)
	 */
	void (*create_consumer)(struct wl_client *client,
				struct wl_resource *resource,
				uint32_t id,
				const char *name,
				int32_t queue_size,
				int32_t width,
				int32_t height);
	/**
	 * create_provider - (none)
	 * @id: (none)
	 * @name: (none)
	 */
	void (*create_provider)(struct wl_client *client,
				struct wl_resource *resource,
				uint32_t id,
				const char *name);
};


struct bq_consumer_interface {
	/**
	 * release_buffer - (none)
	 * @buffer: (none)
	 */
	void (*release_buffer)(struct wl_client *client,
			       struct wl_resource *resource,
			       struct wl_resource *buffer);
};

#define BQ_CONSUMER_CONNECTED	0
#define BQ_CONSUMER_DISCONNECTED	1
#define BQ_CONSUMER_BUFFER_ATTACHED	2
#define BQ_CONSUMER_SET_BUFFER_ID	3
#define BQ_CONSUMER_SET_BUFFER_FD	4
#define BQ_CONSUMER_BUFFER_DETACHED	5
#define BQ_CONSUMER_ADD_BUFFER	6

#define BQ_CONSUMER_CONNECTED_SINCE_VERSION	1
#define BQ_CONSUMER_DISCONNECTED_SINCE_VERSION	1
#define BQ_CONSUMER_BUFFER_ATTACHED_SINCE_VERSION	1
#define BQ_CONSUMER_SET_BUFFER_ID_SINCE_VERSION	1
#define BQ_CONSUMER_SET_BUFFER_FD_SINCE_VERSION	1
#define BQ_CONSUMER_BUFFER_DETACHED_SINCE_VERSION	1
#define BQ_CONSUMER_ADD_BUFFER_SINCE_VERSION	1

static inline void
bq_consumer_send_connected(struct wl_resource *resource_)
{
	wl_resource_post_event(resource_, BQ_CONSUMER_CONNECTED);
}

static inline void
bq_consumer_send_disconnected(struct wl_resource *resource_)
{
	wl_resource_post_event(resource_, BQ_CONSUMER_DISCONNECTED);
}

static inline void
bq_consumer_send_buffer_attached(struct wl_resource *resource_, struct wl_resource *buffer, const char *engine, int32_t width, int32_t height, int32_t format, uint32_t flags)
{
	wl_resource_post_event(resource_, BQ_CONSUMER_BUFFER_ATTACHED, buffer, engine, width, height, format, flags);
}

static inline void
bq_consumer_send_set_buffer_id(struct wl_resource *resource_, struct wl_resource *buffer, int32_t id, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2)
{
	wl_resource_post_event(resource_, BQ_CONSUMER_SET_BUFFER_ID, buffer, id, offset0, stride0, offset1, stride1, offset2, stride2);
}

static inline void
bq_consumer_send_set_buffer_fd(struct wl_resource *resource_, struct wl_resource *buffer, int32_t fd, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2)
{
	wl_resource_post_event(resource_, BQ_CONSUMER_SET_BUFFER_FD, buffer, fd, offset0, stride0, offset1, stride1, offset2, stride2);
}

static inline void
bq_consumer_send_buffer_detached(struct wl_resource *resource_, struct wl_resource *buffer)
{
	wl_resource_post_event(resource_, BQ_CONSUMER_BUFFER_DETACHED, buffer);
}

static inline void
bq_consumer_send_add_buffer(struct wl_resource *resource_, struct wl_resource *buffer, uint32_t serial)
{
	wl_resource_post_event(resource_, BQ_CONSUMER_ADD_BUFFER, buffer, serial);
}

#ifndef BQ_PROVIDER_ERROR_ENUM
#define BQ_PROVIDER_ERROR_ENUM
enum bq_provider_error {
	BQ_PROVIDER_ERROR_OVERFLOW_QUEUE_SIZE = 0,
	BQ_PROVIDER_ERROR_CONNECTION = 1,
};
#endif /* BQ_PROVIDER_ERROR_ENUM */

struct bq_provider_interface {
	/**
	 * attach_buffer - (none)
	 * @buffer: (none)
	 * @engine: (none)
	 * @width: (none)
	 * @height: (none)
	 * @format: (none)
	 * @flags: (none)
	 */
	void (*attach_buffer)(struct wl_client *client,
			      struct wl_resource *resource,
			      uint32_t buffer,
			      const char *engine,
			      int32_t width,
			      int32_t height,
			      int32_t format,
			      uint32_t flags);
	/**
	 * set_buffer_id - (none)
	 * @buffer: (none)
	 * @id: (none)
	 * @offset0: (none)
	 * @stride0: (none)
	 * @offset1: (none)
	 * @stride1: (none)
	 * @offset2: (none)
	 * @stride2: (none)
	 */
	void (*set_buffer_id)(struct wl_client *client,
			      struct wl_resource *resource,
			      struct wl_resource *buffer,
			      int32_t id,
			      int32_t offset0,
			      int32_t stride0,
			      int32_t offset1,
			      int32_t stride1,
			      int32_t offset2,
			      int32_t stride2);
	/**
	 * set_buffer_fd - (none)
	 * @buffer: (none)
	 * @fd: (none)
	 * @offset0: (none)
	 * @stride0: (none)
	 * @offset1: (none)
	 * @stride1: (none)
	 * @offset2: (none)
	 * @stride2: (none)
	 */
	void (*set_buffer_fd)(struct wl_client *client,
			      struct wl_resource *resource,
			      struct wl_resource *buffer,
			      int32_t fd,
			      int32_t offset0,
			      int32_t stride0,
			      int32_t offset1,
			      int32_t stride1,
			      int32_t offset2,
			      int32_t stride2);
	/**
	 * detach_buffer - (none)
	 * @buffer: (none)
	 */
	void (*detach_buffer)(struct wl_client *client,
			      struct wl_resource *resource,
			      struct wl_resource *buffer);
	/**
	 * enqueue_buffer - (none)
	 * @buffer: (none)
	 * @serial: (none)
	 */
	void (*enqueue_buffer)(struct wl_client *client,
			       struct wl_resource *resource,
			       struct wl_resource *buffer,
			       uint32_t serial);
};

#define BQ_PROVIDER_CONNECTED	0
#define BQ_PROVIDER_DISCONNECTED	1
#define BQ_PROVIDER_ADD_BUFFER	2

#define BQ_PROVIDER_CONNECTED_SINCE_VERSION	1
#define BQ_PROVIDER_DISCONNECTED_SINCE_VERSION	1
#define BQ_PROVIDER_ADD_BUFFER_SINCE_VERSION	1

static inline void
bq_provider_send_connected(struct wl_resource *resource_, int32_t queue_size, int32_t width, int32_t height)
{
	wl_resource_post_event(resource_, BQ_PROVIDER_CONNECTED, queue_size, width, height);
}

static inline void
bq_provider_send_disconnected(struct wl_resource *resource_)
{
	wl_resource_post_event(resource_, BQ_PROVIDER_DISCONNECTED);
}

static inline void
bq_provider_send_add_buffer(struct wl_resource *resource_, struct wl_resource *buffer, uint32_t serial)
{
	wl_resource_post_event(resource_, BQ_PROVIDER_ADD_BUFFER, buffer, serial);
}


#ifdef  __cplusplus
}
#endif

#endif