diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/evas/src/modules/engines/wayland_shm/evas_engine.c | 372 |
1 files changed, 0 insertions, 372 deletions
diff --git a/libraries/evas/src/modules/engines/wayland_shm/evas_engine.c b/libraries/evas/src/modules/engines/wayland_shm/evas_engine.c deleted file mode 100644 index 17b17bf..0000000 --- a/libraries/evas/src/modules/engines/wayland_shm/evas_engine.c +++ /dev/null | |||
@@ -1,372 +0,0 @@ | |||
1 | #include "evas_common.h" | ||
2 | #include "evas_private.h" | ||
3 | #include "evas_engine.h" | ||
4 | #include "Evas_Engine_Wayland_Shm.h" | ||
5 | |||
6 | /* local structures */ | ||
7 | typedef struct _Render_Engine Render_Engine; | ||
8 | struct _Render_Engine | ||
9 | { | ||
10 | Tilebuf *tb; | ||
11 | Tilebuf_Rect *rects; | ||
12 | Outbuf *ob; | ||
13 | Eina_Inlist *cur_rect; | ||
14 | |||
15 | Eina_Bool end : 1; | ||
16 | |||
17 | void (*outbuf_free)(Outbuf *ob); | ||
18 | void (*outbuf_resize)(Outbuf *ob, int w, int h); | ||
19 | RGBA_Image *(*outbuf_new_region_for_update)(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch); | ||
20 | void (*outbuf_push_updated_region)(Outbuf *ob, RGBA_Image *surface, int x, int y, int w, int h); | ||
21 | void (*outbuf_free_region_for_update)(Outbuf *ob, RGBA_Image *update); | ||
22 | }; | ||
23 | |||
24 | /* local variables */ | ||
25 | static Evas_Func func, pfunc; | ||
26 | |||
27 | /* external variables */ | ||
28 | int _evas_engine_way_shm_log_dom = -1; | ||
29 | |||
30 | /* local function prototypes */ | ||
31 | static void *_output_setup(int w, int h, int rotation, Eina_Bool alpha, void *dest); | ||
32 | |||
33 | /* engine function prototypes */ | ||
34 | static void *eng_info(Evas *evas __UNUSED__); | ||
35 | static void eng_info_free(Evas *evas __UNUSED__, void *info); | ||
36 | static int eng_setup(Evas *evas, void *info); | ||
37 | static void eng_output_free(void *data); | ||
38 | static void eng_output_resize(void *data, int w, int h); | ||
39 | static void eng_output_tile_size_set(void *data, int w, int h); | ||
40 | static void eng_output_redraws_rect_add(void *data, int x, int y, int w, int h); | ||
41 | static void eng_output_redraws_rect_del(void *data, int x, int y, int w, int h); | ||
42 | static void eng_output_redraws_clear(void *data); | ||
43 | static void *eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch); | ||
44 | static void eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h); | ||
45 | static void eng_output_flush(void *data); | ||
46 | static void eng_output_idle_flush(void *data); | ||
47 | static Eina_Bool eng_canvas_alpha_get(void *data, void *context __UNUSED__); | ||
48 | |||
49 | /* local functions */ | ||
50 | static void * | ||
51 | _output_setup(int w, int h, int rotation, Eina_Bool alpha, void *dest) | ||
52 | { | ||
53 | Render_Engine *re = NULL; | ||
54 | |||
55 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
56 | |||
57 | if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL; | ||
58 | |||
59 | if (!(re->ob = evas_outbuf_setup(w, h, rotation, alpha, dest))) | ||
60 | { | ||
61 | free(re); | ||
62 | return NULL; | ||
63 | } | ||
64 | |||
65 | if (!(re->tb = evas_common_tilebuf_new(w, h))) | ||
66 | { | ||
67 | evas_outbuf_free(re->ob); | ||
68 | free(re); | ||
69 | return NULL; | ||
70 | } | ||
71 | |||
72 | evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); | ||
73 | return re; | ||
74 | } | ||
75 | |||
76 | /* engine functions */ | ||
77 | static void * | ||
78 | eng_info(Evas *evas __UNUSED__) | ||
79 | { | ||
80 | Evas_Engine_Info_Wayland_Shm *info; | ||
81 | |||
82 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
83 | |||
84 | if (!(info = calloc(1, sizeof(Evas_Engine_Info_Wayland_Shm)))) | ||
85 | return NULL; | ||
86 | |||
87 | info->magic.magic = rand(); | ||
88 | info->info.debug = EINA_FALSE; | ||
89 | info->render_mode = EVAS_RENDER_MODE_BLOCKING; | ||
90 | |||
91 | return info; | ||
92 | } | ||
93 | |||
94 | static void | ||
95 | eng_info_free(Evas *evas __UNUSED__, void *info) | ||
96 | { | ||
97 | Evas_Engine_Info_Wayland_Shm *in; | ||
98 | |||
99 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
100 | |||
101 | if (!(in = (Evas_Engine_Info_Wayland_Shm *)info)) return; | ||
102 | free(in); | ||
103 | } | ||
104 | |||
105 | static int | ||
106 | eng_setup(Evas *evas, void *info) | ||
107 | { | ||
108 | Evas_Engine_Info_Wayland_Shm *in; | ||
109 | Render_Engine *re = NULL; | ||
110 | |||
111 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
112 | |||
113 | if (!(in = (Evas_Engine_Info_Wayland_Shm *)info)) return 0; | ||
114 | |||
115 | if (!evas->engine.data.output) | ||
116 | { | ||
117 | evas_common_cpu_init(); | ||
118 | evas_common_blend_init(); | ||
119 | evas_common_image_init(); | ||
120 | evas_common_convert_init(); | ||
121 | evas_common_scale_init(); | ||
122 | evas_common_rectangle_init(); | ||
123 | evas_common_polygon_init(); | ||
124 | evas_common_line_init(); | ||
125 | evas_common_font_init(); | ||
126 | evas_common_draw_init(); | ||
127 | evas_common_tilebuf_init(); | ||
128 | |||
129 | re = _output_setup(evas->output.w, evas->output.h, | ||
130 | in->info.rotation, in->info.destination_alpha, | ||
131 | in->info.dest); | ||
132 | if (!re) return 0; | ||
133 | |||
134 | re->outbuf_free = evas_outbuf_free; | ||
135 | re->outbuf_resize = evas_outbuf_resize; | ||
136 | re->outbuf_new_region_for_update = evas_outbuf_new_region_for_update; | ||
137 | re->outbuf_push_updated_region = evas_outbuf_push_updated_region; | ||
138 | re->outbuf_free_region_for_update = evas_outbuf_free_region_for_update; | ||
139 | } | ||
140 | else | ||
141 | { | ||
142 | if (!(re = evas->engine.data.output)) return 0; | ||
143 | if (re->ob) re->outbuf_free(re->ob); | ||
144 | re->ob = evas_outbuf_setup(evas->output.w, evas->output.h, | ||
145 | in->info.rotation, | ||
146 | in->info.destination_alpha, in->info.dest); | ||
147 | if (re->tb) evas_common_tilebuf_free(re->tb); | ||
148 | if ((re->tb = evas_common_tilebuf_new(evas->output.w, evas->output.h))) | ||
149 | evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); | ||
150 | } | ||
151 | |||
152 | evas->engine.data.output = re; | ||
153 | |||
154 | if (!evas->engine.data.context) | ||
155 | { | ||
156 | evas->engine.data.context = | ||
157 | evas->engine.func->context_new(evas->engine.data.output); | ||
158 | } | ||
159 | |||
160 | return 1; | ||
161 | } | ||
162 | |||
163 | static void | ||
164 | eng_output_free(void *data) | ||
165 | { | ||
166 | Render_Engine *re = NULL; | ||
167 | |||
168 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
169 | |||
170 | if ((re = (Render_Engine *)data)) | ||
171 | { | ||
172 | if (re->ob) re->outbuf_free(re->ob); | ||
173 | if (re->tb) evas_common_tilebuf_free(re->tb); | ||
174 | if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); | ||
175 | free(re); | ||
176 | } | ||
177 | evas_common_font_shutdown(); | ||
178 | evas_common_image_shutdown(); | ||
179 | } | ||
180 | |||
181 | static void | ||
182 | eng_output_resize(void *data, int w, int h) | ||
183 | { | ||
184 | Render_Engine *re = NULL; | ||
185 | |||
186 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
187 | |||
188 | if (!(re = (Render_Engine *)data)) return; | ||
189 | |||
190 | if (re->ob) re->outbuf_resize(re->ob, w, h); | ||
191 | if (re->tb) evas_common_tilebuf_free(re->tb); | ||
192 | if ((re->tb = evas_common_tilebuf_new(w, h))) | ||
193 | evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); | ||
194 | } | ||
195 | |||
196 | static void | ||
197 | eng_output_tile_size_set(void *data, int w, int h) | ||
198 | { | ||
199 | Render_Engine *re = NULL; | ||
200 | |||
201 | if (!(re = (Render_Engine *)data)) return; | ||
202 | if (re->tb) evas_common_tilebuf_set_tile_size(re->tb, w, h); | ||
203 | } | ||
204 | |||
205 | static void | ||
206 | eng_output_redraws_rect_add(void *data, int x, int y, int w, int h) | ||
207 | { | ||
208 | Render_Engine *re = NULL; | ||
209 | |||
210 | if (!(re = (Render_Engine *)data)) return; | ||
211 | if (re->tb) evas_common_tilebuf_add_redraw(re->tb, x, y, w, h); | ||
212 | } | ||
213 | |||
214 | static void | ||
215 | eng_output_redraws_rect_del(void *data, int x, int y, int w, int h) | ||
216 | { | ||
217 | Render_Engine *re = NULL; | ||
218 | |||
219 | if (!(re = (Render_Engine *)data)) return; | ||
220 | if (re->tb) evas_common_tilebuf_del_redraw(re->tb, x, y, w, h); | ||
221 | } | ||
222 | |||
223 | static void | ||
224 | eng_output_redraws_clear(void *data) | ||
225 | { | ||
226 | Render_Engine *re = NULL; | ||
227 | |||
228 | if (!(re = (Render_Engine *)data)) return; | ||
229 | if (re->tb) evas_common_tilebuf_clear(re->tb); | ||
230 | } | ||
231 | |||
232 | static void * | ||
233 | eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch) | ||
234 | { | ||
235 | Render_Engine *re = NULL; | ||
236 | RGBA_Image *surface; | ||
237 | Tilebuf_Rect *rect; | ||
238 | int ux = 0, uy = 0, uw = 0, uh = 0; | ||
239 | |||
240 | if (!(re = (Render_Engine *)data)) return NULL; | ||
241 | if (re->end) | ||
242 | { | ||
243 | re->end = EINA_FALSE; | ||
244 | return NULL; | ||
245 | } | ||
246 | if (!re->rects) | ||
247 | { | ||
248 | re->rects = evas_common_tilebuf_get_render_rects(re->tb); | ||
249 | re->cur_rect = EINA_INLIST_GET(re->rects); | ||
250 | } | ||
251 | if (!re->cur_rect) return NULL; | ||
252 | rect = (Tilebuf_Rect *)re->cur_rect; | ||
253 | ux = rect->x; | ||
254 | uy = rect->y; | ||
255 | uw = rect->w; | ||
256 | uh = rect->h; | ||
257 | re->cur_rect = re->cur_rect->next; | ||
258 | if (!re->cur_rect) | ||
259 | { | ||
260 | evas_common_tilebuf_free_render_rects(re->rects); | ||
261 | re->rects = NULL; | ||
262 | re->end = EINA_TRUE; | ||
263 | } | ||
264 | if ((ux + uw) > re->ob->w) uw = re->ob->w - ux; | ||
265 | if ((uy + uh) > re->ob->h) uh = re->ob->h - uy; | ||
266 | if ((uw <= 0) || (uh <= 0)) return NULL; | ||
267 | surface = | ||
268 | re->outbuf_new_region_for_update(re->ob, ux, uy, uw, uh, cx, cy, cw, ch); | ||
269 | if (x) *x = ux; | ||
270 | if (y) *y = uy; | ||
271 | if (w) *w = uw; | ||
272 | if (h) *h = uh; | ||
273 | return surface; | ||
274 | } | ||
275 | |||
276 | static void | ||
277 | eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h) | ||
278 | { | ||
279 | Render_Engine *re = NULL; | ||
280 | |||
281 | if (!(re = (Render_Engine *)data)) return; | ||
282 | #ifdef BUILD_PIPE_RENDER | ||
283 | evas_common_pipe_map_begin(surface); | ||
284 | #endif | ||
285 | if (re->ob) | ||
286 | { | ||
287 | re->outbuf_push_updated_region(re->ob, surface, x, y, w, h); | ||
288 | re->outbuf_free_region_for_update(re->ob, surface); | ||
289 | } | ||
290 | evas_common_cpu_end_opt(); | ||
291 | } | ||
292 | |||
293 | static void | ||
294 | eng_output_flush(void *data) | ||
295 | { | ||
296 | Render_Engine *re = NULL; | ||
297 | |||
298 | if (!(re = (Render_Engine *)data)) return; | ||
299 | } | ||
300 | |||
301 | static void | ||
302 | eng_output_idle_flush(void *data) | ||
303 | { | ||
304 | Render_Engine *re = NULL; | ||
305 | |||
306 | if (!(re = (Render_Engine *)data)) return; | ||
307 | } | ||
308 | |||
309 | static Eina_Bool | ||
310 | eng_canvas_alpha_get(void *data, void *context __UNUSED__) | ||
311 | { | ||
312 | Render_Engine *re = NULL; | ||
313 | |||
314 | if (!(re = (Render_Engine *)data)) return EINA_FALSE; | ||
315 | return EINA_TRUE; | ||
316 | } | ||
317 | |||
318 | /* module functions */ | ||
319 | static int | ||
320 | module_open(Evas_Module *em) | ||
321 | { | ||
322 | if (!em) return 0; | ||
323 | |||
324 | if (!_evas_module_engine_inherit(&pfunc, "software_generic")) | ||
325 | return 0; | ||
326 | |||
327 | _evas_engine_way_shm_log_dom = | ||
328 | eina_log_domain_register("evas-wayland_shm", EVAS_DEFAULT_LOG_COLOR); | ||
329 | if (_evas_engine_way_shm_log_dom < 0) | ||
330 | { | ||
331 | EINA_LOG_ERR("Could not create a module log domain."); | ||
332 | return 0; | ||
333 | } | ||
334 | |||
335 | func = pfunc; | ||
336 | |||
337 | #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_) | ||
338 | ORD(info); | ||
339 | ORD(info_free); | ||
340 | ORD(setup); | ||
341 | ORD(canvas_alpha_get); | ||
342 | ORD(output_free); | ||
343 | ORD(output_resize); | ||
344 | ORD(output_tile_size_set); | ||
345 | ORD(output_redraws_rect_add); | ||
346 | ORD(output_redraws_rect_del); | ||
347 | ORD(output_redraws_clear); | ||
348 | ORD(output_redraws_next_update_get); | ||
349 | ORD(output_redraws_next_update_push); | ||
350 | ORD(output_flush); | ||
351 | ORD(output_idle_flush); | ||
352 | |||
353 | em->functions = (void *)(&func); | ||
354 | return 1; | ||
355 | } | ||
356 | |||
357 | static void | ||
358 | module_close(Evas_Module *em __UNUSED__) | ||
359 | { | ||
360 | eina_log_domain_unregister(_evas_engine_way_shm_log_dom); | ||
361 | } | ||
362 | |||
363 | static Evas_Module_Api evas_modapi = | ||
364 | { | ||
365 | EVAS_MODULE_API_VERSION, "wayland_shm", "none", {module_open, module_close} | ||
366 | }; | ||
367 | |||
368 | EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, wayland_shm); | ||
369 | |||
370 | #ifndef EVAS_STATIC_BUILD_WAYLAND_SHM | ||
371 | EVAS_EINA_MODULE_DEFINE(engine, wayland_shm); | ||
372 | #endif | ||