summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-09-26 10:03:49 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-09-26 10:03:49 +0000
commit5ed4f6900bc4c0e09d19595ad499d4e93adf3b14 (patch)
treee3d518a031a87db928ab07cd7d11a604d02d46a4 /legacy
parent53518723b8b998c2be9511d8db4565fa259aa165 (diff)
fill in some more egl sw engine theory.
SVN revision: 77078
Diffstat (limited to 'legacy')
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_engine.c115
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_x_egl.c23
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_x_egl.h8
3 files changed, 113 insertions, 33 deletions
diff --git a/legacy/evas/src/modules/engines/software_x11/evas_engine.c b/legacy/evas/src/modules/engines/software_x11/evas_engine.c
index 21c80acc35..090d4ad988 100644
--- a/legacy/evas/src/modules/engines/software_x11/evas_engine.c
+++ b/legacy/evas/src/modules/engines/software_x11/evas_engine.c
@@ -41,6 +41,12 @@ struct _Render_Engine
41 void (*outbuf_flush)(Outbuf *ob); 41 void (*outbuf_flush)(Outbuf *ob);
42 void (*outbuf_idle_flush)(Outbuf *ob); 42 void (*outbuf_idle_flush)(Outbuf *ob);
43 Eina_Bool (*outbuf_alpha_get)(Outbuf *ob); 43 Eina_Bool (*outbuf_alpha_get)(Outbuf *ob);
44
45 struct {
46 void *disp;
47 void *config;
48 void *surface;
49 } egl;
44}; 50};
45 51
46/* prototypes we will use here */ 52/* prototypes we will use here */
@@ -73,30 +79,70 @@ _output_egl_setup(int w, int h, int rot, Display *disp, Drawable draw,
73 int shape_dither, int destination_alpha) 79 int shape_dither, int destination_alpha)
74{ 80{
75 Render_Engine *re; 81 Render_Engine *re;
76 82 void *ptr;
83 int stride = 0;
84
85 if (depth != 32) return NULL;
86 if (mask) return NULL;
77 if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL; 87 if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL;
78 // _egl_x_disp_get() 88 re->egl.disp = _egl_x_disp_get(disp);
79 // then 89 if (!re->egl.disp)
80 // _egl_x_disp_init() 90 {
81 // then 91 free(re);
82 // _egl_x_disp_choose_config() 92 return NULL;
83 // then 93 }
84 // _egl_x_win_surf_new() 94 re->egl.config = _egl_x_disp_choose_config(re->egl.disp);
85 // 95 if (!re->egl.config)
86 // and on cleaup 96 {
87 // 97 _egl_x_disp_terminate(re->egl.disp);
88 // _egl_x_win_surf_free() 98 free(re);
89 // 99 return NULL;
90 // to access pixels 100 }
91 // 101 re->egl.surface = _egl_x_win_surf_new(re->egl.disp, draw, re->egl.config);
92 // _egl_x_map_surf() 102 if (!re->egl.surface)
93 // 103 {
94 // to give back pixels 104 _egl_x_disp_terminate(re->egl.disp);
95 // 105 free(re);
96 // _egl_x_unmap_surf() 106 return NULL;
107 }
108 ptr = _egl_x_surf_map(re->egl.disp, re->egl.surface, &stride);
109 if (!ptr)
110 {
111 _egl_x_win_surf_free(re->egl.disp, re->egl.surface);
112 _egl_x_disp_terminate(re->egl.disp);
113 free(re);
114 return NULL;
115 }
116 _egl_x_surf_unmap(re->egl.disp, re->egl.surface);
117
118 re->ob =
119 evas_software_egl_outbuf_setup_x(w, h, rot, OUTBUF_DEPTH_INHERIT, disp,
120 draw, vis, cmap, depth, grayscale,
121 max_colors, mask, shape_dither,
122 destination_alpha);
123
124 re->tb = evas_common_tilebuf_new(w, h);
125 if (!re->tb)
126 {
127 evas_software_xlib_outbuf_free(re->ob);
128 free(re);
129 return NULL;
130 }
131
132 /* in preliminary tests 16x16 gave highest framerates */
133 evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
134
97 return re; 135 return re;
98} 136}
99 137
138static void
139_output_egl_shutdown(Render_Engine *re)
140{
141 if (!re->egl.disp) return;
142 _egl_x_win_surf_free(re->egl.disp, re->egl.surface);
143 _egl_x_disp_terminate(re->egl.disp);
144}
145
100static void * 146static void *
101_output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw, 147_output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw,
102 Visual *vis, Colormap cmap, int depth, int debug, 148 Visual *vis, Colormap cmap, int depth, int debug,
@@ -361,15 +407,25 @@ eng_setup(Evas *e, void *in)
361#ifdef BUILD_ENGINE_SOFTWARE_XLIB 407#ifdef BUILD_ENGINE_SOFTWARE_XLIB
362 if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB) 408 if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
363 { 409 {
364 re = _output_xlib_setup(e->output.w, e->output.h, 410 re = _output_egl_setup(e->output.w, e->output.h,
365 info->info.rotation, info->info.connection, 411 info->info.rotation, info->info.connection,
366 info->info.drawable, info->info.visual, 412 info->info.drawable, info->info.visual,
367 info->info.colormap, 413 info->info.colormap,
368 info->info.depth, info->info.debug, 414 info->info.depth, info->info.debug,
369 info->info.alloc_grayscale, 415 info->info.alloc_grayscale,
370 info->info.alloc_colors_max, 416 info->info.alloc_colors_max,
371 info->info.mask, info->info.shape_dither, 417 info->info.mask, info->info.shape_dither,
372 info->info.destination_alpha); 418 info->info.destination_alpha);
419 if (!re)
420 re = _output_xlib_setup(e->output.w, e->output.h,
421 info->info.rotation, info->info.connection,
422 info->info.drawable, info->info.visual,
423 info->info.colormap,
424 info->info.depth, info->info.debug,
425 info->info.alloc_grayscale,
426 info->info.alloc_colors_max,
427 info->info.mask, info->info.shape_dither,
428 info->info.destination_alpha);
373 429
374 re->outbuf_free = evas_software_xlib_outbuf_free; 430 re->outbuf_free = evas_software_xlib_outbuf_free;
375 re->outbuf_reconfigure = evas_software_xlib_outbuf_reconfigure; 431 re->outbuf_reconfigure = evas_software_xlib_outbuf_reconfigure;
@@ -493,6 +549,7 @@ eng_output_free(void *data)
493 re->outbuf_free(re->ob); 549 re->outbuf_free(re->ob);
494 evas_common_tilebuf_free(re->tb); 550 evas_common_tilebuf_free(re->tb);
495 if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); 551 if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
552 _output_egl_shutdown(re);
496 free(re); 553 free(re);
497 } 554 }
498 555
diff --git a/legacy/evas/src/modules/engines/software_x11/evas_x_egl.c b/legacy/evas/src/modules/engines/software_x11/evas_x_egl.c
index 5ea22aa338..7f259a7c1f 100644
--- a/legacy/evas/src/modules/engines/software_x11/evas_x_egl.c
+++ b/legacy/evas/src/modules/engines/software_x11/evas_x_egl.c
@@ -31,8 +31,6 @@
31#define EGL_FALSE 0 31#define EGL_FALSE 0
32#define EGL_TRUE 1 32#define EGL_TRUE 1
33 33
34#define EGL_NATIVE_BIT 0x0010
35
36#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 34#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
37#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 35#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
38#define EGL_MATCH_FORMAT_KHR 0x3043 36#define EGL_MATCH_FORMAT_KHR 0x3043
@@ -133,6 +131,15 @@ _egl_x_disp_get(void *d)
133#endif 131#endif
134} 132}
135 133
134void
135_egl_x_disp_terminate(void *ed)
136{
137#ifdef BUILD_ENGINE_SOFTWARE_XLIB
138 if (!_egl_find()) return;
139 egl.Terminate(ed);
140#endif
141}
142
136int 143int
137_egl_x_disp_init(void *ed) 144_egl_x_disp_init(void *ed)
138{ 145{
@@ -156,8 +163,6 @@ _egl_x_disp_choose_config(void *ed)
156 if (!_egl_find()) return NULL; 163 if (!_egl_find()) return NULL;
157 config_attrs[n++] = EGL_SURFACE_TYPE; 164 config_attrs[n++] = EGL_SURFACE_TYPE;
158 config_attrs[n++] = EGL_WINDOW_BIT; 165 config_attrs[n++] = EGL_WINDOW_BIT;
159 config_attrs[n++] = EGL_RENDERABLE_TYPE;
160 config_attrs[n++] = EGL_NATIVE_BIT;
161 config_attrs[n++] = EGL_RED_SIZE; 166 config_attrs[n++] = EGL_RED_SIZE;
162 config_attrs[n++] = 8; 167 config_attrs[n++] = 8;
163 config_attrs[n++] = EGL_GREEN_SIZE; 168 config_attrs[n++] = EGL_GREEN_SIZE;
@@ -264,3 +269,13 @@ _egl_x_surf_swap(void *ed, void *surf, int vsync)
264 egl.SwapBuffers(ed, surf); 269 egl.SwapBuffers(ed, surf);
265#endif 270#endif
266} 271}
272
273Outbuf *
274evas_software_egl_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
275 Display *disp, Drawable draw, Visual *vis,
276 Colormap cmap, int x_depth,
277 int grayscale, int max_colors, Pixmap mask,
278 int shape_dither, int destination_alpha)
279{
280 return NULL;
281}
diff --git a/legacy/evas/src/modules/engines/software_x11/evas_x_egl.h b/legacy/evas/src/modules/engines/software_x11/evas_x_egl.h
index 6c7d860dbd..3807b03762 100644
--- a/legacy/evas/src/modules/engines/software_x11/evas_x_egl.h
+++ b/legacy/evas/src/modules/engines/software_x11/evas_x_egl.h
@@ -4,6 +4,7 @@
4#include "evas_engine.h" 4#include "evas_engine.h"
5 5
6void *_egl_x_disp_get(void *d); 6void *_egl_x_disp_get(void *d);
7void _egl_x_disp_terminate(void *ed);
7int _egl_x_disp_init(void *ed); 8int _egl_x_disp_init(void *ed);
8void *_egl_x_disp_choose_config(void *ed); 9void *_egl_x_disp_choose_config(void *ed);
9void *_egl_x_win_surf_new(void *ed, Window win, void *config); 10void *_egl_x_win_surf_new(void *ed, Window win, void *config);
@@ -12,4 +13,11 @@ void *_egl_x_surf_map(void *ed, void *surf, int *stride);
12void _egl_x_surf_unmap(void *ed, void *surf); 13void _egl_x_surf_unmap(void *ed, void *surf);
13void _egl_x_surf_swap(void *ed, void *surf, int vsync); 14void _egl_x_surf_swap(void *ed, void *surf, int vsync);
14 15
16Outbuf *
17evas_software_egl_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
18 Display *disp, Drawable draw, Visual *vis,
19 Colormap cmap, int x_depth,
20 int grayscale, int max_colors, Pixmap mask,
21 int shape_dither, int destination_alpha);
22
15#endif 23#endif