diff options
author | Cedric Bail <cedric@osg.samsung.com> | 2017-08-01 17:39:00 -0700 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2017-08-24 10:31:09 -0700 |
commit | 8243e0b9c6876c573c7d846737bb02dcaf408ef2 (patch) | |
tree | 6361c08779abd81dbd812f7a3a49ec0ad2b1f5bf | |
parent | ae1847d170a2f4a40b59974b3472354f7bf205fc (diff) | |
download | efl-8243e0b9c6876c573c7d846737bb02dcaf408ef2.tar.gz |
evas: differentiate engine from output.
21 files changed, 146 insertions, 93 deletions
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c index f72f0d71f1..043133ab30 100644 --- a/src/lib/evas/canvas/evas_main.c +++ b/src/lib/evas/canvas/evas_main.c @@ -378,7 +378,9 @@ next_zombie: evas_event_callback_all_del(eo_e); evas_event_callback_cleanup(eo_e); + /* cleanup engine backend */ EINA_LIST_FREE(e->outputs, evo) efl_canvas_output_del(evo); + e->engine.func->engine_free(e->backend); if (e->common_init) { @@ -1037,6 +1039,10 @@ evas_output_method_set(Evas *eo_e, int render_method) if (e->engine.module) evas_module_unref(e->engine.module); e->engine.module = em; evas_module_ref(em); + + /* Initialize the engine first */ + e->backend = e->engine.func->engine_new(); + /* get the engine info struct */ if (e->engine.func->info_size) { diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index a237da4ea4..ea824aca86 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -738,7 +738,7 @@ evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *eo_obj, in obj->cur->cache.clip.w, obj->cur->cache.clip.h); if ((w > 0) && (h > 0)) - obj->layer->evas->engine.func->output_redraws_rect_add(ENC, ENDT, + obj->layer->evas->engine.func->output_redraws_rect_add(ENC, x + e->framespace.x, y + e->framespace.y, w, h); @@ -753,7 +753,7 @@ evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *eo_obj, in obj->prev->cache.clip.w, obj->prev->cache.clip.h); if ((w > 0) && (h > 0)) - obj->layer->evas->engine.func->output_redraws_rect_add(ENC, ENDT, + obj->layer->evas->engine.func->output_redraws_rect_add(ENC, x + e->framespace.x, y + e->framespace.y, w, h); @@ -776,7 +776,7 @@ evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *eo_obj, in obj->cur->cache.clip.w, obj->cur->cache.clip.h); if ((w > 0) && (h > 0)) - obj->layer->evas->engine.func->output_redraws_rect_add(ENC, ENDT, + obj->layer->evas->engine.func->output_redraws_rect_add(ENC, x + e->framespace.x, y + e->framespace.y, w, h); @@ -788,7 +788,7 @@ evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *eo_obj, in obj->prev->cache.clip.w, obj->prev->cache.clip.h); if ((w > 0) && (h > 0)) - obj->layer->evas->engine.func->output_redraws_rect_add(ENC, ENDT, + obj->layer->evas->engine.func->output_redraws_rect_add(ENC, x + e->framespace.x, y + e->framespace.y, w, h); diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c index 4c2dca9536..5d2495c4ff 100644 --- a/src/lib/evas/canvas/evas_render.c +++ b/src/lib/evas/canvas/evas_render.c @@ -303,12 +303,12 @@ static void _evas_render_prev_cur_clip_cache_add(Evas_Public_Data *evas, Evas_Object_Protected_Data *obj) { // FIXME: Iterate over each output - ENFN->output_redraws_rect_add(ENC, ENDT, + ENFN->output_redraws_rect_add(ENC, obj->prev->cache.clip.x + evas->framespace.x, obj->prev->cache.clip.y + evas->framespace.y, obj->prev->cache.clip.w, obj->prev->cache.clip.h); - ENFN->output_redraws_rect_add(ENC, ENDT, + ENFN->output_redraws_rect_add(ENC, obj->cur->cache.clip.x + evas->framespace.x, obj->cur->cache.clip.y + evas->framespace.y, obj->cur->cache.clip.w, @@ -556,7 +556,7 @@ _evas_render_object_map_change_update(Evas_Public_Data *evas, obj->prev->clipper->prev->cache.clip.w, obj->prev->clipper->prev->cache.clip.h); } - ENFN->output_redraws_rect_add(ENC, ENDT, x + fx, y + fy, w, h); + ENFN->output_redraws_rect_add(ENC, x + fx, y + fy, w, h); x = obj->map->cur.map->normal_geometry.x; y = obj->map->cur.map->normal_geometry.y; w = obj->map->cur.map->normal_geometry.w; @@ -569,7 +569,7 @@ _evas_render_object_map_change_update(Evas_Public_Data *evas, obj->cur->clipper->cur->cache.clip.w, obj->cur->clipper->cur->cache.clip.h); } - ENFN->output_redraws_rect_add(ENC, ENDT, x + fx, y + fy, w, h); + ENFN->output_redraws_rect_add(ENC, x + fx, y + fy, w, h); } else if (hmap) { @@ -585,7 +585,7 @@ _evas_render_object_map_change_update(Evas_Public_Data *evas, obj->prev->clipper->prev->cache.clip.w, obj->prev->clipper->prev->cache.clip.h); } - ENFN->output_redraws_rect_add(ENC, ENDT, x + fx, y + fy, w, h); + ENFN->output_redraws_rect_add(ENC, x + fx, y + fy, w, h); x = obj->cur->cache.clip.x; y = obj->cur->cache.clip.y; w = obj->cur->cache.clip.w; @@ -598,7 +598,7 @@ _evas_render_object_map_change_update(Evas_Public_Data *evas, obj->cur->clipper->cur->cache.clip.w, obj->cur->clipper->cur->cache.clip.h); } - ENFN->output_redraws_rect_add(ENC, ENDT, x + fx, y + fy, w, h); + ENFN->output_redraws_rect_add(ENC, x + fx, y + fy, w, h); } } @@ -626,7 +626,7 @@ evas_render_update_del(Evas_Public_Data *evas, int x, int y, int w, int h) // FIXME: handle multiple output if (EINA_LIKELY((evas->update_del_redirect_array == NULL))) { - ENFN->output_redraws_rect_del(ENC, ENDT, x, y, w, h); + ENFN->output_redraws_rect_del(ENC, x, y, w, h); } else { @@ -2853,7 +2853,7 @@ skip_obscures: { // FIXME: Only add necessary rects (if object itself hasn't changed) // FIXME: handle multiple output - ENFN->output_redraws_rect_add(ENC, ENDT, x, y, w, h); + ENFN->output_redraws_rect_add(ENC, x, y, w, h); } end: @@ -3238,7 +3238,7 @@ evas_render_updates_internal(Evas *eo_e, eina_evlog("+render_phase3", eo_e, 0.0, NULL); EINA_LIST_FREE(e->damages, r) { - ENFN->output_redraws_rect_add(ENC, ENDT, r->x, r->y, r->w, r->h); + ENFN->output_redraws_rect_add(ENC, r->x, r->y, r->w, r->h); eina_rectangle_free(r); } eina_evlog("-render_phase3", eo_e, 0.0, NULL); @@ -3247,12 +3247,12 @@ evas_render_updates_internal(Evas *eo_e, eina_evlog("+render_phase4", eo_e, 0.0, NULL); if (e->viewport.changed) { - ENFN->output_redraws_rect_add(ENC, ENDT, 0, 0, e->output.w, e->output.h); + ENFN->output_redraws_rect_add(ENC, 0, 0, e->output.w, e->output.h); } if (e->output.changed) { ENFN->output_resize(ENC, ENDT, e->output.w, e->output.h); - ENFN->output_redraws_rect_add(ENC, ENDT, 0, 0, e->output.w, e->output.h); + ENFN->output_redraws_rect_add(ENC, 0, 0, e->output.w, e->output.h); } if ((e->output.w != e->viewport.w) || (e->output.h != e->viewport.h)) { @@ -3265,14 +3265,14 @@ evas_render_updates_internal(Evas *eo_e, * which covers the Whole viewport. This is because 'framespace' is * defined as "the space IN the viewport which is Occupied by the * window frame" */ - ENFN->output_redraws_rect_add(ENC, ENDT, + ENFN->output_redraws_rect_add(ENC, e->viewport.x, e->viewport.y, e->viewport.w, e->viewport.h); } if (redraw_all) { - ENFN->output_redraws_rect_add(ENC, ENDT, 0, 0, e->output.w, e->output.h); + ENFN->output_redraws_rect_add(ENC, 0, 0, e->output.w, e->output.h); } eina_evlog("-render_phase4", eo_e, 0.0, NULL); diff --git a/src/lib/evas/include/evas_inline.x b/src/lib/evas/include/evas_inline.x index 74eb25a7f9..7886a0fa03 100644 --- a/src/lib/evas/include/evas_inline.x +++ b/src/lib/evas/include/evas_inline.x @@ -359,13 +359,7 @@ _evas_default_output_get(Evas_Public_Data *e) static inline void * _evas_engine_context(Evas_Public_Data *e) { - // Need to split between engine context - // and output context, use one for now. - Efl_Canvas_Output *output; - - if (!e->outputs) return NULL; - output = eina_list_data_get(e->outputs); - return output->output; + return e->backend; } #define _EVAS_COLOR_CLAMP(x, y) do { \ diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 1765464cb3..b1ae9c7c65 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -963,6 +963,7 @@ struct _Evas_Public_Data Eina_List *devices; Eina_Array *cur_device; + void *backend; Eina_List *outputs; Evas_Device *default_seat; @@ -1394,14 +1395,19 @@ struct _Evas_Object_Func struct _Evas_Func { + void *(*engine_new) (void); + void (*engine_free) (void *engine); + void (*output_info_setup) (void *info); void *(*output_setup) (void *engine, void *info, unsigned int w, unsigned int h); int (*output_update) (void *engine, void *data, void *info, unsigned int w, unsigned int h); - void (*output_free) (void *engine, void *data); void (*output_resize) (void *engine, void *data, int w, int h); - void (*output_redraws_rect_add) (void *engine, void *data, int x, int y, int w, int h); - void (*output_redraws_rect_del) (void *engine, void *data, int x, int y, int w, int h); + + /* The redraws are automatically propagated on all output */ + void (*output_redraws_rect_add) (void *engine, int x, int y, int w, int h); + void (*output_redraws_rect_del) (void *engine, int x, int y, int w, int h); + void (*output_redraws_clear) (void *engine, void *data); void *(*output_redraws_next_update_get) (void *engine, void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch); void (*output_redraws_next_update_push) (void *engine, void *data, void *surface, int x, int y, int w, int h, Evas_Render_Mode render_mode); diff --git a/src/modules/evas/engines/buffer/evas_engine.c b/src/modules/evas/engines/buffer/evas_engine.c index 7ece6c62b3..68af1773b4 100644 --- a/src/modules/evas/engines/buffer/evas_engine.c +++ b/src/modules/evas/engines/buffer/evas_engine.c @@ -24,7 +24,7 @@ static void eng_output_free(void *engine EINA_UNUSED, void *data); /* engine api this module provides */ static void * -eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h) { Evas_Engine_Info_Buffer *info = in; Outbuf *ob; @@ -74,7 +74,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in info->info.switch_data); if (!ob) goto on_error; - if (!evas_render_engine_software_generic_init(re, ob, + if (!evas_render_engine_software_generic_init(engine, re, ob, evas_buffer_outbuf_buf_swap_mode_get, evas_buffer_outbuf_buf_rot_get, evas_buffer_outbuf_reconfigure, @@ -106,13 +106,13 @@ eng_output_info_setup(void *info) } static void -eng_output_free(void *engine EINA_UNUSED, void *data) +eng_output_free(void *engine, void *data) { Render_Engine *re; if ((re = (Render_Engine *)data)) { - evas_render_engine_software_generic_clean(re); + evas_render_engine_software_generic_clean(engine, re); free(re); } } diff --git a/src/modules/evas/engines/drm/evas_engine.c b/src/modules/evas/engines/drm/evas_engine.c index ca05530ba3..5cbd5e14ba 100644 --- a/src/modules/evas/engines/drm/evas_engine.c +++ b/src/modules/evas/engines/drm/evas_engine.c @@ -19,7 +19,7 @@ static Evas_Func func, pfunc; int _evas_engine_drm_log_dom; static void * -eng_output_setup(void *engine EINA_UNUSED, void *einfo, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *einfo, unsigned int w, unsigned int h) { Evas_Engine_Info_Drm *info = einfo; Render_Engine *re; @@ -33,7 +33,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *einfo, unsigned int w, unsigned re->dev = info->info.dev; - if (!evas_render_engine_software_generic_init(&re->generic, ob, + if (!evas_render_engine_software_generic_init(engine, &re->generic, ob, _outbuf_state_get, _outbuf_rotation_get, _outbuf_reconfigure, @@ -52,7 +52,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *einfo, unsigned int w, unsigned return re; init_err: - evas_render_engine_software_generic_clean(&re->generic); + evas_render_engine_software_generic_clean(engine, &re->generic); err: free(re); return NULL; @@ -82,11 +82,11 @@ eng_output_update(void *engine EINA_UNUSED, void *data, void *einfo, unsigned in } static void -eng_output_free(void *engine EINA_UNUSED, void *data) +eng_output_free(void *engine, void *data) { Render_Engine *re = data; - evas_render_engine_software_generic_clean(&re->generic); + evas_render_engine_software_generic_clean(engine, &re->generic); free(re); } diff --git a/src/modules/evas/engines/eglfs/evas_engine.c b/src/modules/evas/engines/eglfs/evas_engine.c index e33c52b054..88321d81f0 100644 --- a/src/modules/evas/engines/eglfs/evas_engine.c +++ b/src/modules/evas/engines/eglfs/evas_engine.c @@ -679,7 +679,7 @@ eng_output_info_setup(void *info) } static void * -eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h) { Evas_Engine_Info_Eglfs *info = in; Render_Engine *re = NULL; @@ -701,7 +701,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in ob->evas = evas; - if (!evas_render_engine_gl_generic_init(&re->generic, ob, + if (!evas_render_engine_gl_generic_init(engine, &re->generic, ob, evas_outbuf_buffer_state_get, evas_outbuf_rot_get, evas_outbuf_reconfigure, @@ -796,7 +796,7 @@ eng_output_update(void *engine EINA_UNUSED, void *data, void *info, unsigned int } static void -eng_output_free(void *engine EINA_UNUSED, void *data) +eng_output_free(void *engine, void *data) { Render_Engine *re; @@ -808,7 +808,7 @@ eng_output_free(void *engine EINA_UNUSED, void *data) if (gl_wins == 1) glsym_evgl_engine_shutdown(re); /* NB: evas_render_engine_software_generic_clean() frees ob */ - evas_render_engine_software_generic_clean(&re->generic.software); + evas_render_engine_software_generic_clean(engine, &re->generic.software); gl_wins--; diff --git a/src/modules/evas/engines/fb/evas_engine.c b/src/modules/evas/engines/fb/evas_engine.c index 635d1ae1f2..c29e8f2cb8 100644 --- a/src/modules/evas/engines/fb/evas_engine.c +++ b/src/modules/evas/engines/fb/evas_engine.c @@ -18,7 +18,7 @@ typedef Render_Output_Software_Generic Render_Engine; /* engine api this module provides */ static void * -eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h) { Evas_Engine_Info_FB *info = in; Render_Engine *re; @@ -38,7 +38,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in info->info.refresh); if (!ob) goto on_error; - if (!evas_render_engine_software_generic_init(re, ob, NULL, + if (!evas_render_engine_software_generic_init(engine, re, ob, NULL, evas_fb_outbuf_fb_get_rot, evas_fb_outbuf_fb_reconfigure, NULL, @@ -74,7 +74,7 @@ eng_output_info_setup(void *info) } static void -eng_output_free(void *engine EINA_UNUSED, void *data) +eng_output_free(void *engine, void *data) { Render_Engine *re; @@ -82,7 +82,7 @@ eng_output_free(void *engine EINA_UNUSED, void *data) if (re) { _outbufs = eina_list_remove(_outbufs, re->ob); - evas_render_engine_software_generic_clean(re); + evas_render_engine_software_generic_clean(engine, re); free(re); } } diff --git a/src/modules/evas/engines/gl_cocoa/evas_engine.c b/src/modules/evas/engines/gl_cocoa/evas_engine.c index 92fcb319ea..61430176e7 100644 --- a/src/modules/evas/engines/gl_cocoa/evas_engine.c +++ b/src/modules/evas/engines/gl_cocoa/evas_engine.c @@ -126,7 +126,7 @@ static const EVGL_Interface evgl_funcs = }; static void * -eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h) { Evas_Engine_Info_GL_Cocoa *const info = in; Render_Engine *re; @@ -157,7 +157,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in info->view = ob->ns_gl_view; - chk = evas_render_engine_gl_generic_init(&re->generic, ob, + chk = evas_render_engine_gl_generic_init(engine, &re->generic, ob, evas_outbuf_buffer_state_get, evas_outbuf_rot_get, evas_outbuf_reconfigure, diff --git a/src/modules/evas/engines/gl_drm/evas_engine.c b/src/modules/evas/engines/gl_drm/evas_engine.c index ce5358f4a6..1993a98449 100644 --- a/src/modules/evas/engines/gl_drm/evas_engine.c +++ b/src/modules/evas/engines/gl_drm/evas_engine.c @@ -900,7 +900,7 @@ eng_output_info_setup(void *info) } static void * -eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h) { Evas_Engine_Info_GL_Drm *info = in; Render_Engine *re = NULL; @@ -933,7 +933,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in return NULL; } - if (!evas_render_engine_gl_generic_init(&re->generic, ob, + if (!evas_render_engine_gl_generic_init(engine, &re->generic, ob, evas_outbuf_buffer_state_get, evas_outbuf_rot_get, evas_outbuf_reconfigure, @@ -1028,7 +1028,7 @@ eng_output_update(void *engine EINA_UNUSED, void *data, void *in, unsigned int w } static void -eng_output_free(void *engine EINA_UNUSED, void *data) +eng_output_free(void *engine, void *data) { Render_Engine *re; @@ -1043,7 +1043,7 @@ eng_output_free(void *engine EINA_UNUSED, void *data) info = eng_get_ob(re)->info; /* NB: evas_render_engine_software_generic_clean() frees ob */ - evas_render_engine_software_generic_clean(&re->generic.software); + evas_render_engine_software_generic_clean(engine, &re->generic.software); eng_gbm_shutdown(info); gl_wins--; diff --git a/src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h b/src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h index 89bcbf6b8a..7fdcea535f 100644 --- a/src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h +++ b/src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h @@ -41,7 +41,8 @@ struct _Render_Output_GL_Generic }; static inline Eina_Bool -evas_render_engine_gl_generic_init(Render_Output_GL_Generic *re, +evas_render_engine_gl_generic_init(Render_Engine_Software_Generic *engine, + Render_Output_GL_Generic *re, Outbuf *ob, Outbuf_Swap_Mode_Get outbuf_swap_mode_get, Outbuf_Get_Rot outbuf_get_rot, @@ -63,7 +64,7 @@ evas_render_engine_gl_generic_init(Render_Output_GL_Generic *re, const EVGL_Interface *evgl_funcs, int w, int h) { - if (!evas_render_engine_software_generic_init(&re->software, ob, + if (!evas_render_engine_software_generic_init(engine, &re->software, ob, outbuf_swap_mode_get, outbuf_get_rot, outbuf_reconfigure, diff --git a/src/modules/evas/engines/gl_sdl/evas_engine.c b/src/modules/evas/engines/gl_sdl/evas_engine.c index bec11894e7..847ecc6725 100644 --- a/src/modules/evas/engines/gl_sdl/evas_engine.c +++ b/src/modules/evas/engines/gl_sdl/evas_engine.c @@ -267,7 +267,7 @@ static const EVGL_Interface evgl_funcs = }; static void * -eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h) { Render_Engine *re = NULL; Outbuf *ob = NULL; @@ -282,7 +282,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in re = calloc(1, sizeof (Render_Engine)); if (!re) goto on_error; - if (!evas_render_engine_gl_generic_init(&re->generic, ob, NULL, + if (!evas_render_engine_gl_generic_init(engine, &re->generic, ob, NULL, _outbuf_get_rot, _outbuf_reconfigure, _outbuf_region_first_rect, @@ -313,11 +313,11 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in } static void -eng_output_free(void *engine EINA_UNUSED, void *data) +eng_output_free(void *engine, void *data) { Render_Engine *re = data; - evas_render_engine_software_generic_clean(&re->generic.software); + evas_render_engine_software_generic_clean(engine, &re->generic.software); } static void diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c index cb3ca43e4b..c88535304a 100644 --- a/src/modules/evas/engines/gl_x11/evas_engine.c +++ b/src/modules/evas/engines/gl_x11/evas_engine.c @@ -1576,7 +1576,7 @@ _re_winfree(Render_Engine *re) } static void * -eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h) { Evas_Engine_Info_GL_X11 *info = in; Render_Engine *re = NULL; @@ -1639,7 +1639,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in info->msaa_bits); if (!ob) goto on_error; - if (!evas_render_engine_gl_generic_init(&re->generic, ob, + if (!evas_render_engine_gl_generic_init(engine, &re->generic, ob, eng_outbuf_swap_mode, eng_outbuf_get_rot, eng_outbuf_reconfigure, @@ -1751,7 +1751,7 @@ eng_output_update(void *engine EINA_UNUSED, void *data, void *in, unsigned int w } static void -eng_output_free(void *engine EINA_UNUSED, void *data) +eng_output_free(void *engine, void *data) { Render_Engine *re; @@ -1780,7 +1780,7 @@ eng_output_free(void *engine EINA_UNUSED, void *data) if (gl_wins == 1) glsym_evgl_engine_shutdown(re); - evas_render_engine_software_generic_clean(&re->generic.software); + evas_render_engine_software_generic_clean(engine, &re->generic.software); #ifndef GL_GLES if (glsym_glXReleaseBuffersMESA) diff --git a/src/modules/evas/engines/software_ddraw/evas_engine.c b/src/modules/evas/engines/software_ddraw/evas_engine.c index a9359226ca..f8882e8c39 100644 --- a/src/modules/evas/engines/software_ddraw/evas_engine.c +++ b/src/modules/evas/engines/software_ddraw/evas_engine.c @@ -21,7 +21,7 @@ int _evas_log_dom_module = -1; /* engine api this module provides */ static void * -eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h) { Evas_Engine_Info_Software_DDraw *info = in; Render_Engine *re; @@ -40,7 +40,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in info->info.fullscreen); if (!ob) goto on_error; - if (!evas_render_engine_software_generic_init(&re->generic, ob, NULL, + if (!evas_render_engine_software_generic_init(engine, &re->generic, ob, NULL, evas_software_ddraw_outbuf_rot_get, evas_software_ddraw_outbuf_reconfigure, NULL, @@ -72,14 +72,14 @@ eng_output_info_setup(void *info) } static void -eng_output_free(void *engine EINA_UNUSED, void *data) +eng_output_free(void *engine, void *data) { Render_Engine *re; if (!data) return; re = (Render_Engine *)data; - evas_render_engine_software_generic_clean(&re->generic); + evas_render_engine_software_generic_clean(engine, &re->generic); free(re); } diff --git a/src/modules/evas/engines/software_gdi/evas_engine.c b/src/modules/evas/engines/software_gdi/evas_engine.c index 462a37942e..10562d3189 100644 --- a/src/modules/evas/engines/software_gdi/evas_engine.c +++ b/src/modules/evas/engines/software_gdi/evas_engine.c @@ -17,7 +17,7 @@ struct _Render_Engine /* engine api this module provides */ static void * -eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h) { Evas_Engine_Info_Software_Gdi *info = in; Render_Engine *re; @@ -44,7 +44,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in 0, 0); if (!ob) goto on_error; - if (!evas_render_engine_software_generic_init(&re->generic, ob, NULL, + if (!evas_render_engine_software_generic_init(engine, &re->generic, ob, NULL, evas_software_gdi_outbuf_rot_get, evas_software_gdi_outbuf_reconfigure, NULL, @@ -97,14 +97,14 @@ eng_output_update(void *engine EINA_UNUSED, void *data, void *in, unsigned int w } static void -eng_output_free(void *engine EINA_UNUSED, void *data) +eng_output_free(void *engine, void *data) { Render_Engine *re; if (!data) return; re = (Render_Engine *)data; - evas_render_engine_software_generic_clean(&re->generic); + evas_render_engine_software_generic_clean(engine, &re->generic); free(re); } diff --git a/src/modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h b/src/modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h index d563b56122..48ab0614d3 100644 --- a/src/modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h +++ b/src/modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h @@ -32,6 +32,7 @@ typedef enum MERGE_SMART = 4 } Render_Output_Merge_Mode; +typedef struct _Render_Engine_Software_Generic Render_Engine_Software_Generic; typedef struct _Render_Output_Software_Generic Render_Output_Software_Generic; typedef struct _Outbuf Outbuf; @@ -79,8 +80,19 @@ struct _Render_Output_Software_Generic unsigned char tile_strict : 1; }; +struct _Render_Engine_Software_Generic +{ + Eina_List *outputs; + + struct { + int w, h; + Eina_Bool strict; + } tile; +}; + static inline Eina_Bool -evas_render_engine_software_generic_init(Render_Output_Software_Generic *re, +evas_render_engine_software_generic_init(Render_Engine_Software_Generic *engine, + Render_Output_Software_Generic *re, Outbuf *ob, Outbuf_Swap_Mode_Get outbuf_swap_mode_get, Outbuf_Get_Rot outbuf_get_rot, @@ -131,11 +143,14 @@ evas_render_engine_software_generic_init(Render_Output_Software_Generic *re, /* in preliminary tests 16x16 gave highest framerates */ evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); + engine->outputs = eina_list_append(engine->outputs, re); + return EINA_TRUE; } static inline void -evas_render_engine_software_generic_clean(Render_Output_Software_Generic *re) +evas_render_engine_software_generic_clean(Render_Engine_Software_Generic *engine, + Render_Output_Software_Generic *re) { if (re->tb) evas_common_tilebuf_free(re->tb); if (re->ob) re->outbuf_free(re->ob); @@ -146,6 +161,8 @@ evas_render_engine_software_generic_clean(Render_Output_Software_Generic *re) if (re->rects_prev[2]) evas_common_tilebuf_free_render_rects(re->rects_prev[2]); if (re->rects_prev[3]) evas_common_tilebuf_free_render_rects(re->rects_prev[3]); + engine->outputs = eina_list_remove(engine->outputs, re); + memset(re, 0, sizeof (Render_Output_Software_Generic)); } diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c index 3ea6c719fc..af80a9b7a4 100644 --- a/src/modules/evas/engines/software_generic/evas_engine.c +++ b/src/modules/evas/engines/software_generic/evas_engine.c @@ -3897,6 +3897,29 @@ eng_gl_rotation_angle_get(void *data EINA_UNUSED) initialized by evas_render_engine_software_generic_init(). */ +static void * +eng_engine_new(void) +{ + Render_Engine_Software_Generic *engine; + + engine = calloc(1, sizeof (Render_Engine_Software_Generic)); + if (!engine) return NULL; + + return engine; +} + +static void +eng_engine_free(void *engine) +{ + Render_Engine_Software_Generic *e = engine; + Render_Output_Software_Generic *output; + + EINA_LIST_FREE(e->outputs, output) + ERR("Output %p not properly cleaned before engine destruction.", output); + + free(e); +} + static void eng_output_resize(void *engine EINA_UNUSED, void *data, int w, int h) { @@ -3917,21 +3940,25 @@ eng_output_resize(void *engine EINA_UNUSED, void *data, int w, int h) } static void -eng_output_redraws_rect_add(void *engine EINA_UNUSED, void *data, int x, int y, int w, int h) +eng_output_redraws_rect_add(void *engine, int x, int y, int w, int h) { + Render_Engine_Software_Generic *backend = engine; Render_Output_Software_Generic *re; + Eina_List *l; - re = (Render_Output_Software_Generic *)data; - evas_common_tilebuf_add_redraw(re->tb, x, y, w, h); + EINA_LIST_FOREACH(backend->outputs, l, re) + evas_common_tilebuf_add_redraw(re->tb, x, y, w, h); } static void -eng_output_redraws_rect_del(void *engine EINA_UNUSED, void *data, int x, int y, int w, int h) +eng_output_redraws_rect_del(void *engine, int x, int y, int w, int h) { + Render_Engine_Software_Generic *backend = engine; Render_Output_Software_Generic *re; + Eina_List *l; - re = (Render_Output_Software_Generic *)data; - evas_common_tilebuf_del_redraw(re->tb, x, y, w, h); + EINA_LIST_FOREACH(backend->outputs, l, re) + evas_common_tilebuf_del_redraw(re->tb, x, y, w, h); } static void @@ -4659,6 +4686,8 @@ eng_gfx_filter_process(void *data EINA_UNUSED, Evas_Filter_Command *cmd) static Evas_Func func = { + eng_engine_new, + eng_engine_free, NULL, // eng_info_setup NULL, // eng_setup NULL, // eng_update diff --git a/src/modules/evas/engines/software_x11/evas_engine.c b/src/modules/evas/engines/software_x11/evas_engine.c index c1cab73ec3..49f3683757 100644 --- a/src/modules/evas/engines/software_x11/evas_engine.c +++ b/src/modules/evas/engines/software_x11/evas_engine.c @@ -64,7 +64,7 @@ _output_egl_shutdown(Render_Engine *re) } static void * -_output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw, +_output_xlib_setup(void *engine, int w, int h, int rot, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int depth, int debug, int grayscale, int max_colors, Pixmap mask, int shape_dither, int destination_alpha) @@ -96,7 +96,7 @@ _output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw, // re->ob->onebuf = 1; evas_software_xlib_outbuf_debug_set(ob, debug); - if (!evas_render_engine_software_generic_init(&re->generic, ob, NULL, + if (!evas_render_engine_software_generic_init(engine, &re->generic, ob, NULL, evas_software_xlib_outbuf_get_rot, evas_software_xlib_outbuf_reconfigure, NULL, @@ -122,7 +122,7 @@ on_error: } static void * -_output_swapbuf_setup(int w, int h, int rot, Display *disp, Drawable draw, +_output_swapbuf_setup(void *engine, int w, int h, int rot, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int depth, int debug EINA_UNUSED, int grayscale, int max_colors, Pixmap mask, @@ -144,7 +144,7 @@ _output_swapbuf_setup(int w, int h, int rot, Display *disp, Drawable draw, destination_alpha); if (!ob) goto on_error; - if (!evas_render_engine_software_generic_init(&re->generic, ob, + if (!evas_render_engine_software_generic_init(engine, &re->generic, ob, evas_software_xlib_swapbuf_buffer_state_get, evas_software_xlib_swapbuf_get_rot, evas_software_xlib_swapbuf_reconfigure, @@ -231,7 +231,7 @@ eng_output_info_setup(void *info) } static void * -eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h) { Evas_Engine_Info_Software_X11 *info = in; Render_Engine *re = NULL; @@ -252,7 +252,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in } if (try_swapbuf) - re = _output_swapbuf_setup(w, h, + re = _output_swapbuf_setup(engine, w, h, info->info.rotation, info->info.connection, info->info.drawable, info->info.visual, info->info.colormap, @@ -264,7 +264,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in if (re) re->outbuf_alpha_get = evas_software_xlib_swapbuf_alpha_get; else { - re = _output_xlib_setup(w, h, + re = _output_xlib_setup(engine, w, h, info->info.rotation, info->info.connection, info->info.drawable, info->info.visual, info->info.colormap, @@ -341,14 +341,14 @@ eng_output_update(void *engine EINA_UNUSED, void *data, void *in, unsigned int w } static void -eng_output_free(void *engine EINA_UNUSED, void *data) +eng_output_free(void *engine, void *data) { Render_Engine *re; if ((re = (Render_Engine *)data)) { _outbufs = eina_list_remove(_outbufs, re->generic.ob); - evas_render_engine_software_generic_clean(&re->generic); + evas_render_engine_software_generic_clean(engine, &re->generic); _output_egl_shutdown(re); free(re); } diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c b/src/modules/evas/engines/wayland_egl/evas_engine.c index 0630daf73e..be5095256e 100644 --- a/src/modules/evas/engines/wayland_egl/evas_engine.c +++ b/src/modules/evas/engines/wayland_egl/evas_engine.c @@ -546,7 +546,7 @@ _eng_swap_mode_get(void) } static void * -eng_output_setup(void *engine EINA_UNUSED, void *info, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *info, unsigned int w, unsigned int h) { Evas_Engine_Info_Wayland *inf = info; Render_Engine *re; @@ -576,7 +576,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *info, unsigned int w, unsigned ob = eng_window_new(inf, w, h, swap_mode); if (!ob) goto ob_err; - if (!evas_render_engine_gl_generic_init(&re->generic, ob, + if (!evas_render_engine_gl_generic_init(engine, &re->generic, ob, eng_outbuf_swap_mode_get, eng_outbuf_rotation_get, eng_outbuf_reconfigure, @@ -719,7 +719,7 @@ eng_canvas_alpha_get(void *engine) } static void -eng_output_free(void *engine EINA_UNUSED, void *data) +eng_output_free(void *engine, void *data) { Render_Engine *re; @@ -729,7 +729,7 @@ eng_output_free(void *engine EINA_UNUSED, void *data) if (gl_wins == 1) glsym_evgl_engine_shutdown(re); - evas_render_engine_software_generic_clean(&re->generic.software); + evas_render_engine_software_generic_clean(engine, &re->generic.software); gl_wins--; diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.c b/src/modules/evas/engines/wayland_shm/evas_engine.c index b2cbb75874..e74cc2fcbb 100644 --- a/src/modules/evas/engines/wayland_shm/evas_engine.c +++ b/src/modules/evas/engines/wayland_shm/evas_engine.c @@ -28,7 +28,7 @@ struct _Render_Engine }; static void * -eng_output_setup(void *engine EINA_UNUSED, void *info, unsigned int w, unsigned int h) +eng_output_setup(void *engine, void *info, unsigned int w, unsigned int h) { Evas_Engine_Info_Wayland *einfo = info; Render_Engine *re; @@ -42,7 +42,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *info, unsigned int w, unsigned ob = _evas_outbuf_setup(w, h, einfo); if (!ob) goto err; - if (!evas_render_engine_software_generic_init(&re->generic, ob, + if (!evas_render_engine_software_generic_init(engine, &re->generic, ob, _evas_outbuf_swap_mode_get, _evas_outbuf_rotation_get, NULL, @@ -145,13 +145,13 @@ eng_output_update(void *engine, void *data, void *info, unsigned int w, unsigned } static void -eng_output_free(void *engine EINA_UNUSED, void *data) +eng_output_free(void *engine, void *data) { Render_Engine *re; if ((re = (Render_Engine *)data)) { - evas_render_engine_software_generic_clean(&re->generic); + evas_render_engine_software_generic_clean(engine, &re->generic); free(re); } } |