diff options
Diffstat (limited to 'libraries/evas/src/modules/engines/fb/evas_engine.c')
-rw-r--r-- | libraries/evas/src/modules/engines/fb/evas_engine.c | 310 |
1 files changed, 0 insertions, 310 deletions
diff --git a/libraries/evas/src/modules/engines/fb/evas_engine.c b/libraries/evas/src/modules/engines/fb/evas_engine.c deleted file mode 100644 index e15c02b..0000000 --- a/libraries/evas/src/modules/engines/fb/evas_engine.c +++ /dev/null | |||
@@ -1,310 +0,0 @@ | |||
1 | #include "evas_common.h" | ||
2 | #include "evas_private.h" | ||
3 | #include "evas_engine.h" | ||
4 | #include "Evas_Engine_FB.h" | ||
5 | |||
6 | int _evas_engine_fb_log_dom = -1; | ||
7 | |||
8 | /* function tables - filled in later (func and parent func) */ | ||
9 | static Evas_Func func, pfunc; | ||
10 | |||
11 | /* engine struct data */ | ||
12 | typedef struct _Render_Engine Render_Engine; | ||
13 | |||
14 | struct _Render_Engine | ||
15 | { | ||
16 | Tilebuf *tb; | ||
17 | Outbuf *ob; | ||
18 | Tilebuf_Rect *rects; | ||
19 | Eina_Inlist *cur_rect; | ||
20 | int end : 1; | ||
21 | }; | ||
22 | |||
23 | /* prototypes we will use here */ | ||
24 | static void *_output_setup(int w, int h, int rot, int vt, int dev, int refresh); | ||
25 | |||
26 | static void *eng_info(Evas *e); | ||
27 | static void eng_info_free(Evas *e, void *info); | ||
28 | static int eng_setup(Evas *e, void *info); | ||
29 | static void eng_output_free(void *data); | ||
30 | static void eng_output_resize(void *data, int w, int h); | ||
31 | static void eng_output_tile_size_set(void *data, int w, int h); | ||
32 | static void eng_output_redraws_rect_add(void *data, int x, int y, int w, int h); | ||
33 | static void eng_output_redraws_rect_del(void *data, int x, int y, int w, int h); | ||
34 | static void eng_output_redraws_clear(void *data); | ||
35 | 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); | ||
36 | static void eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h); | ||
37 | static void eng_output_flush(void *data); | ||
38 | static void eng_output_idle_flush(void *data); | ||
39 | |||
40 | /* internal engine routines */ | ||
41 | static void * | ||
42 | _output_setup(int w, int h, int rot, int vt, int dev, int refresh) | ||
43 | { | ||
44 | Render_Engine *re; | ||
45 | |||
46 | re = calloc(1, sizeof(Render_Engine)); | ||
47 | if (!re) | ||
48 | return NULL; | ||
49 | /* if we haven't initialized - init (automatic abort if already done) */ | ||
50 | evas_common_cpu_init(); | ||
51 | |||
52 | evas_common_blend_init(); | ||
53 | evas_common_image_init(); | ||
54 | evas_common_convert_init(); | ||
55 | evas_common_scale_init(); | ||
56 | evas_common_rectangle_init(); | ||
57 | evas_common_polygon_init(); | ||
58 | evas_common_line_init(); | ||
59 | evas_common_font_init(); | ||
60 | evas_common_draw_init(); | ||
61 | evas_common_tilebuf_init(); | ||
62 | |||
63 | evas_fb_outbuf_fb_init(); | ||
64 | |||
65 | /* get any stored performance metrics from device (xserver) */ | ||
66 | re->ob = evas_fb_outbuf_fb_setup_fb(w, h, rot, OUTBUF_DEPTH_INHERIT, vt, dev, refresh); | ||
67 | re->tb = evas_common_tilebuf_new(evas_fb_outbuf_fb_get_width(re->ob), evas_fb_outbuf_fb_get_height(re->ob)); | ||
68 | /* no backbuf! */ | ||
69 | evas_fb_outbuf_fb_set_have_backbuf(re->ob, 0); | ||
70 | /* in preliminary tests 16x16 gave highest framerates */ | ||
71 | evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); | ||
72 | return re; | ||
73 | } | ||
74 | |||
75 | /* engine api this module provides */ | ||
76 | static void * | ||
77 | eng_info(Evas *e __UNUSED__) | ||
78 | { | ||
79 | Evas_Engine_Info_FB *info; | ||
80 | info = calloc(1, sizeof(Evas_Engine_Info_FB)); | ||
81 | if (!info) return NULL; | ||
82 | info->magic.magic = rand(); | ||
83 | info->render_mode = EVAS_RENDER_MODE_BLOCKING; | ||
84 | return info; | ||
85 | } | ||
86 | |||
87 | static void | ||
88 | eng_info_free(Evas *e __UNUSED__, void *info) | ||
89 | { | ||
90 | Evas_Engine_Info_FB *in; | ||
91 | in = (Evas_Engine_Info_FB *)info; | ||
92 | free(in); | ||
93 | } | ||
94 | |||
95 | static int | ||
96 | eng_setup(Evas *e, void *in) | ||
97 | { | ||
98 | Render_Engine *re; | ||
99 | Evas_Engine_Info_FB *info; | ||
100 | |||
101 | info = (Evas_Engine_Info_FB *)in; | ||
102 | re = _output_setup(e->output.w, | ||
103 | e->output.h, | ||
104 | info->info.rotation, | ||
105 | info->info.virtual_terminal, | ||
106 | info->info.device_number, | ||
107 | info->info.refresh); | ||
108 | e->engine.data.output = re; | ||
109 | if (!e->engine.data.output) return 0; | ||
110 | e->engine.data.context = e->engine.func->context_new(e->engine.data.output); | ||
111 | |||
112 | return 1; | ||
113 | } | ||
114 | |||
115 | static void | ||
116 | eng_output_free(void *data) | ||
117 | { | ||
118 | Render_Engine *re; | ||
119 | |||
120 | re = (Render_Engine *)data; | ||
121 | evas_fb_outbuf_fb_free(re->ob); | ||
122 | evas_common_tilebuf_free(re->tb); | ||
123 | if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); | ||
124 | free(re); | ||
125 | |||
126 | evas_common_font_shutdown(); | ||
127 | evas_common_image_shutdown(); | ||
128 | } | ||
129 | |||
130 | static void | ||
131 | eng_output_resize(void *data, int w, int h) | ||
132 | { | ||
133 | Render_Engine *re; | ||
134 | |||
135 | re = (Render_Engine *)data; | ||
136 | evas_fb_outbuf_fb_reconfigure(re->ob, w, h, | ||
137 | evas_fb_outbuf_fb_get_rot(re->ob), | ||
138 | OUTBUF_DEPTH_INHERIT); | ||
139 | evas_common_tilebuf_free(re->tb); | ||
140 | re->tb = evas_common_tilebuf_new(w, h); | ||
141 | if (re->tb) | ||
142 | evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); | ||
143 | } | ||
144 | |||
145 | static void | ||
146 | eng_output_tile_size_set(void *data, int w, int h) | ||
147 | { | ||
148 | Render_Engine *re; | ||
149 | |||
150 | re = (Render_Engine *)data; | ||
151 | evas_common_tilebuf_set_tile_size(re->tb, w, h); | ||
152 | } | ||
153 | |||
154 | static void | ||
155 | eng_output_redraws_rect_add(void *data, int x, int y, int w, int h) | ||
156 | { | ||
157 | Render_Engine *re; | ||
158 | |||
159 | re = (Render_Engine *)data; | ||
160 | evas_common_tilebuf_add_redraw(re->tb, x, y, w, h); | ||
161 | } | ||
162 | |||
163 | static void | ||
164 | eng_output_redraws_rect_del(void *data, int x, int y, int w, int h) | ||
165 | { | ||
166 | Render_Engine *re; | ||
167 | |||
168 | re = (Render_Engine *)data; | ||
169 | evas_common_tilebuf_del_redraw(re->tb, x, y, w, h); | ||
170 | } | ||
171 | |||
172 | static void | ||
173 | eng_output_redraws_clear(void *data) | ||
174 | { | ||
175 | Render_Engine *re; | ||
176 | |||
177 | re = (Render_Engine *)data; | ||
178 | evas_common_tilebuf_clear(re->tb); | ||
179 | } | ||
180 | |||
181 | static void * | ||
182 | eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch) | ||
183 | { | ||
184 | Render_Engine *re; | ||
185 | RGBA_Image *surface; | ||
186 | Tilebuf_Rect *rect; | ||
187 | int ux, uy, uw, uh; | ||
188 | |||
189 | re = (Render_Engine *)data; | ||
190 | if (re->end) | ||
191 | { | ||
192 | re->end = 0; | ||
193 | return NULL; | ||
194 | } | ||
195 | if (!re->rects) | ||
196 | { | ||
197 | re->rects = evas_common_tilebuf_get_render_rects(re->tb); | ||
198 | re->cur_rect = EINA_INLIST_GET(re->rects); | ||
199 | } | ||
200 | if (!re->cur_rect) return NULL; | ||
201 | rect = (Tilebuf_Rect *)re->cur_rect; | ||
202 | ux = rect->x; uy = rect->y; uw = rect->w; uh = rect->h; | ||
203 | re->cur_rect = re->cur_rect->next; | ||
204 | if (!re->cur_rect) | ||
205 | { | ||
206 | evas_common_tilebuf_free_render_rects(re->rects); | ||
207 | re->rects = NULL; | ||
208 | re->end = 1; | ||
209 | } | ||
210 | |||
211 | surface = evas_fb_outbuf_fb_new_region_for_update(re->ob, | ||
212 | ux, uy, uw, uh, | ||
213 | cx, cy, cw, ch); | ||
214 | *x = ux; *y = uy; *w = uw; *h = uh; | ||
215 | return surface; | ||
216 | } | ||
217 | |||
218 | static void | ||
219 | eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h) | ||
220 | { | ||
221 | Render_Engine *re; | ||
222 | |||
223 | re = (Render_Engine *)data; | ||
224 | #ifdef BUILD_PIPE_RENDER | ||
225 | evas_common_pipe_map_begin(surface); | ||
226 | #endif | ||
227 | evas_fb_outbuf_fb_push_updated_region(re->ob, surface, x, y, w, h); | ||
228 | evas_fb_outbuf_fb_free_region_for_update(re->ob, surface); | ||
229 | evas_common_cpu_end_opt(); | ||
230 | } | ||
231 | |||
232 | static void | ||
233 | eng_output_flush(void *data __UNUSED__) | ||
234 | { | ||
235 | } | ||
236 | |||
237 | static void | ||
238 | eng_output_idle_flush(void *data __UNUSED__) | ||
239 | { | ||
240 | } | ||
241 | |||
242 | static Eina_Bool | ||
243 | eng_canvas_alpha_get(void *data, void *context __UNUSED__) | ||
244 | { | ||
245 | Render_Engine *re; | ||
246 | |||
247 | re = (Render_Engine *)data; | ||
248 | return (re->ob->priv.fb.fb->fb_var.transp.length > 0); | ||
249 | } | ||
250 | |||
251 | /* module advertising code */ | ||
252 | static int | ||
253 | module_open(Evas_Module *em) | ||
254 | { | ||
255 | if (!em) return 0; | ||
256 | /* get whatever engine module we inherit from */ | ||
257 | if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0; | ||
258 | _evas_engine_fb_log_dom = eina_log_domain_register | ||
259 | ("evas-fb", EVAS_DEFAULT_LOG_COLOR); | ||
260 | if (_evas_engine_fb_log_dom < 0) | ||
261 | { | ||
262 | EINA_LOG_ERR("Can not create a module log domain."); | ||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | /* store it for later use */ | ||
267 | func = pfunc; | ||
268 | /* now to override methods */ | ||
269 | #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_) | ||
270 | ORD(info); | ||
271 | ORD(info_free); | ||
272 | ORD(setup); | ||
273 | ORD(canvas_alpha_get); | ||
274 | ORD(output_free); | ||
275 | ORD(output_resize); | ||
276 | ORD(output_tile_size_set); | ||
277 | ORD(output_redraws_rect_add); | ||
278 | ORD(output_redraws_rect_del); | ||
279 | ORD(output_redraws_clear); | ||
280 | ORD(output_redraws_next_update_get); | ||
281 | ORD(output_redraws_next_update_push); | ||
282 | ORD(output_flush); | ||
283 | ORD(output_idle_flush); | ||
284 | /* now advertise out own api */ | ||
285 | em->functions = (void *)(&func); | ||
286 | return 1; | ||
287 | } | ||
288 | |||
289 | static void | ||
290 | module_close(Evas_Module *em __UNUSED__) | ||
291 | { | ||
292 | eina_log_domain_unregister(_evas_engine_fb_log_dom); | ||
293 | } | ||
294 | |||
295 | static Evas_Module_Api evas_modapi = | ||
296 | { | ||
297 | EVAS_MODULE_API_VERSION, | ||
298 | "fb", | ||
299 | "none", | ||
300 | { | ||
301 | module_open, | ||
302 | module_close | ||
303 | } | ||
304 | }; | ||
305 | |||
306 | EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, fb); | ||
307 | |||
308 | #ifndef EVAS_STATIC_BUILD_FB | ||
309 | EVAS_EINA_MODULE_DEFINE(engine, fb); | ||
310 | #endif | ||