summaryrefslogtreecommitdiff
path: root/src/bin/ecore_buffer/bq_mgr_protocol.h
diff options
context:
space:
mode:
authorSeunghun Lee <beauty.positive3@gmail.com>2015-06-22 10:23:54 -0400
committerChris Michael <cp.michael@samsung.com>2015-06-22 10:31:42 -0400
commit8b621775619b9959fe952b095b3baaa7aaa99572 (patch)
tree99059a841a79729cac4687ea41f3abf672e6e455 /src/bin/ecore_buffer/bq_mgr_protocol.h
parent3671506ad39d2a956e388e151bd20f1b9ffd62a5 (diff)
ecore-buffer: Add ecore_buffer library to EFL.
Summary: Ecore_Buffer is abstraction of graphic buffer. it supports backend of shm, x11_dri2 and x11_dri3 for now, and this library also provides method to share buffers between processes. Ecore_Buffer_Provider and Ecore_Buffer_Consumer is for this, sharing buffer. provider draws something in to Ecore_Buffer, and consumer receives and displays it. the binary, bq_mgr is a connection maker for buffer provider and consumer. it can be included Enlightenment as a deamon later. @feature Test Plan: 1. Configure with --enable-ecore-buffer and --enable-always-build-examples to build examples. 2. Run bq_mgr, it connects consumer and provider. 3. Run ecore_buffer_provider_example and ecore_buffer_consumer_example Reviewers: lsj119, gwanglim, cedric, zmike, jpeg, raster, devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2197
Diffstat (limited to '')
-rw-r--r--src/bin/ecore_buffer/bq_mgr_protocol.h247
1 files changed, 247 insertions, 0 deletions
diff --git a/src/bin/ecore_buffer/bq_mgr_protocol.h b/src/bin/ecore_buffer/bq_mgr_protocol.h
new file mode 100644
index 0000000000..b2d7bcc775
--- /dev/null
+++ b/src/bin/ecore_buffer/bq_mgr_protocol.h
@@ -0,0 +1,247 @@
1#ifndef BQ_MGR_SERVER_PROTOCOL_H
2#define BQ_MGR_SERVER_PROTOCOL_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdint.h>
9#include <stddef.h>
10#include "wayland-server.h"
11
12struct wl_client;
13struct wl_resource;
14
15struct bq_mgr;
16struct bq_consumer;
17struct bq_provider;
18struct bq_buffer;
19
20extern const struct wl_interface bq_mgr_interface;
21extern const struct wl_interface bq_consumer_interface;
22extern const struct wl_interface bq_provider_interface;
23extern const struct wl_interface bq_buffer_interface;
24
25#ifndef BQ_MGR_ERROR_ENUM
26#define BQ_MGR_ERROR_ENUM
27enum bq_mgr_error {
28 BQ_MGR_ERROR_INVALID_PERMISSION = 0,
29 BQ_MGR_ERROR_INVALID_NAME = 1,
30 BQ_MGR_ERROR_ALREADY_USED = 2,
31};
32#endif /* BQ_MGR_ERROR_ENUM */
33
34struct bq_mgr_interface {
35 /**
36 * create_consumer - (none)
37 * @id: (none)
38 * @name: (none)
39 * @queue_size: (none)
40 * @width: (none)
41 * @height: (none)
42 */
43 void (*create_consumer)(struct wl_client *client,
44 struct wl_resource *resource,
45 uint32_t id,
46 const char *name,
47 int32_t queue_size,
48 int32_t width,
49 int32_t height);
50 /**
51 * create_provider - (none)
52 * @id: (none)
53 * @name: (none)
54 */
55 void (*create_provider)(struct wl_client *client,
56 struct wl_resource *resource,
57 uint32_t id,
58 const char *name);
59};
60
61
62struct bq_consumer_interface {
63 /**
64 * release_buffer - (none)
65 * @buffer: (none)
66 */
67 void (*release_buffer)(struct wl_client *client,
68 struct wl_resource *resource,
69 struct wl_resource *buffer);
70};
71
72#define BQ_CONSUMER_CONNECTED 0
73#define BQ_CONSUMER_DISCONNECTED 1
74#define BQ_CONSUMER_BUFFER_ATTACHED 2
75#define BQ_CONSUMER_SET_BUFFER_ID 3
76#define BQ_CONSUMER_SET_BUFFER_FD 4
77#define BQ_CONSUMER_BUFFER_DETACHED 5
78#define BQ_CONSUMER_ADD_BUFFER 6
79
80#define BQ_CONSUMER_CONNECTED_SINCE_VERSION 1
81#define BQ_CONSUMER_DISCONNECTED_SINCE_VERSION 1
82#define BQ_CONSUMER_BUFFER_ATTACHED_SINCE_VERSION 1
83#define BQ_CONSUMER_SET_BUFFER_ID_SINCE_VERSION 1
84#define BQ_CONSUMER_SET_BUFFER_FD_SINCE_VERSION 1
85#define BQ_CONSUMER_BUFFER_DETACHED_SINCE_VERSION 1
86#define BQ_CONSUMER_ADD_BUFFER_SINCE_VERSION 1
87
88static inline void
89bq_consumer_send_connected(struct wl_resource *resource_)
90{
91 wl_resource_post_event(resource_, BQ_CONSUMER_CONNECTED);
92}
93
94static inline void
95bq_consumer_send_disconnected(struct wl_resource *resource_)
96{
97 wl_resource_post_event(resource_, BQ_CONSUMER_DISCONNECTED);
98}
99
100static inline void
101bq_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)
102{
103 wl_resource_post_event(resource_, BQ_CONSUMER_BUFFER_ATTACHED, buffer, engine, width, height, format, flags);
104}
105
106static inline void
107bq_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)
108{
109 wl_resource_post_event(resource_, BQ_CONSUMER_SET_BUFFER_ID, buffer, id, offset0, stride0, offset1, stride1, offset2, stride2);
110}
111
112static inline void
113bq_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)
114{
115 wl_resource_post_event(resource_, BQ_CONSUMER_SET_BUFFER_FD, buffer, fd, offset0, stride0, offset1, stride1, offset2, stride2);
116}
117
118static inline void
119bq_consumer_send_buffer_detached(struct wl_resource *resource_, struct wl_resource *buffer)
120{
121 wl_resource_post_event(resource_, BQ_CONSUMER_BUFFER_DETACHED, buffer);
122}
123
124static inline void
125bq_consumer_send_add_buffer(struct wl_resource *resource_, struct wl_resource *buffer, uint32_t serial)
126{
127 wl_resource_post_event(resource_, BQ_CONSUMER_ADD_BUFFER, buffer, serial);
128}
129
130#ifndef BQ_PROVIDER_ERROR_ENUM
131#define BQ_PROVIDER_ERROR_ENUM
132enum bq_provider_error {
133 BQ_PROVIDER_ERROR_OVERFLOW_QUEUE_SIZE = 0,
134 BQ_PROVIDER_ERROR_CONNECTION = 1,
135};
136#endif /* BQ_PROVIDER_ERROR_ENUM */
137
138struct bq_provider_interface {
139 /**
140 * attach_buffer - (none)
141 * @buffer: (none)
142 * @engine: (none)
143 * @width: (none)
144 * @height: (none)
145 * @format: (none)
146 * @flags: (none)
147 */
148 void (*attach_buffer)(struct wl_client *client,
149 struct wl_resource *resource,
150 uint32_t buffer,
151 const char *engine,
152 int32_t width,
153 int32_t height,
154 int32_t format,
155 uint32_t flags);
156 /**
157 * set_buffer_id - (none)
158 * @buffer: (none)
159 * @id: (none)
160 * @offset0: (none)
161 * @stride0: (none)
162 * @offset1: (none)
163 * @stride1: (none)
164 * @offset2: (none)
165 * @stride2: (none)
166 */
167 void (*set_buffer_id)(struct wl_client *client,
168 struct wl_resource *resource,
169 struct wl_resource *buffer,
170 int32_t id,
171 int32_t offset0,
172 int32_t stride0,
173 int32_t offset1,
174 int32_t stride1,
175 int32_t offset2,
176 int32_t stride2);
177 /**
178 * set_buffer_fd - (none)
179 * @buffer: (none)
180 * @fd: (none)
181 * @offset0: (none)
182 * @stride0: (none)
183 * @offset1: (none)
184 * @stride1: (none)
185 * @offset2: (none)
186 * @stride2: (none)
187 */
188 void (*set_buffer_fd)(struct wl_client *client,
189 struct wl_resource *resource,
190 struct wl_resource *buffer,
191 int32_t fd,
192 int32_t offset0,
193 int32_t stride0,
194 int32_t offset1,
195 int32_t stride1,
196 int32_t offset2,
197 int32_t stride2);
198 /**
199 * detach_buffer - (none)
200 * @buffer: (none)
201 */
202 void (*detach_buffer)(struct wl_client *client,
203 struct wl_resource *resource,
204 struct wl_resource *buffer);
205 /**
206 * enqueue_buffer - (none)
207 * @buffer: (none)
208 * @serial: (none)
209 */
210 void (*enqueue_buffer)(struct wl_client *client,
211 struct wl_resource *resource,
212 struct wl_resource *buffer,
213 uint32_t serial);
214};
215
216#define BQ_PROVIDER_CONNECTED 0
217#define BQ_PROVIDER_DISCONNECTED 1
218#define BQ_PROVIDER_ADD_BUFFER 2
219
220#define BQ_PROVIDER_CONNECTED_SINCE_VERSION 1
221#define BQ_PROVIDER_DISCONNECTED_SINCE_VERSION 1
222#define BQ_PROVIDER_ADD_BUFFER_SINCE_VERSION 1
223
224static inline void
225bq_provider_send_connected(struct wl_resource *resource_, int32_t queue_size, int32_t width, int32_t height)
226{
227 wl_resource_post_event(resource_, BQ_PROVIDER_CONNECTED, queue_size, width, height);
228}
229
230static inline void
231bq_provider_send_disconnected(struct wl_resource *resource_)
232{
233 wl_resource_post_event(resource_, BQ_PROVIDER_DISCONNECTED);
234}
235
236static inline void
237bq_provider_send_add_buffer(struct wl_resource *resource_, struct wl_resource *buffer, uint32_t serial)
238{
239 wl_resource_post_event(resource_, BQ_PROVIDER_ADD_BUFFER, buffer, serial);
240}
241
242
243#ifdef __cplusplus
244}
245#endif
246
247#endif