evas: refactor initialisation and shutdown of evas_common.

This commit is contained in:
Cedric BAIL 2016-12-02 15:27:48 -08:00
parent 74914c0515
commit 6427c77707
15 changed files with 8 additions and 52 deletions

View File

@ -131,8 +131,8 @@ evas_shutdown(void)
return _evas_init_count;
eina_log_timing(_evas_log_dom_global,
EINA_LOG_STATE_START,
EINA_LOG_STATE_SHUTDOWN);
EINA_LOG_STATE_START,
EINA_LOG_STATE_SHUTDOWN);
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
@ -163,7 +163,6 @@ evas_shutdown(void)
evas_thread_shutdown();
_evas_preload_thread_shutdown();
evas_async_events_shutdown();
//evas_common_shutdown();
evas_module_shutdown();
#ifdef BUILD_LOADER_EET
@ -354,6 +353,8 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e)
e->engine.data.context);
e->engine.func->output_free(e->engine.data.output);
e->engine.func->info_free(eo_e, e->engine.info);
evas_common_shutdown();
}
for (i = 0; i < e->modifiers.mod.count; i++)
@ -425,7 +426,9 @@ _evas_canvas_engine_info_set(Eo *eo_e, Evas_Public_Data *e, Evas_Engine_Info *in
if (info->magic != e->engine.info_magic) return EINA_FALSE;
evas_canvas_async_block(e);
evas_common_init();
res = e->engine.func->setup(eo_e, info);
if (!res) evas_common_shutdown();
return res;
}

View File

@ -56,10 +56,7 @@ _output_setup(int w,
DATA32 color_key = 0;
re = calloc(1, sizeof(Render_Engine));
if (!re)
return NULL;
/* if we haven't initialized - init (automatic abort if already done) */
evas_common_init();
if (!re) return NULL;
evas_buffer_outbuf_buf_init();
@ -176,8 +173,6 @@ eng_output_free(void *data)
evas_render_engine_software_generic_clean(&re->generic);
free(re);
}
evas_common_shutdown();
}
static Eina_Bool

View File

@ -88,7 +88,6 @@ eng_setup(Evas *evas, void *einfo)
re = epd->engine.data.output;
if (!re)
{
evas_common_init();
re = _render_engine_setup(info, epd->output.w, epd->output.h);
if (!re) return 0;
@ -127,8 +126,6 @@ eng_output_free(void *data)
evas_render_engine_software_generic_clean(&re->generic);
free(re);
}
evas_common_shutdown();
}
static int

View File

@ -766,7 +766,6 @@ eng_setup(Evas *evas, void *in)
if (!initted)
{
evas_common_init();
glsym_evas_gl_preload_init();
}
@ -934,7 +933,6 @@ eng_output_free(void *data)
if ((initted == EINA_TRUE) && (gl_wins == 0))
{
glsym_evas_gl_preload_shutdown();
evas_common_shutdown();
initted = EINA_FALSE;
}
}

View File

@ -98,8 +98,6 @@ _output_setup(Evas *eo_e, int w, int h, int rot, int vt, int dev, int refresh,
re = calloc(1, sizeof(Render_Engine));
if (!re)
return NULL;
/* if we haven't initialized - init (automatic abort if already done) */
evas_common_init();
evas_fb_outbuf_fb_init();
@ -133,7 +131,6 @@ _output_setup(Evas *eo_e, int w, int h, int rot, int vt, int dev, int refresh,
on_error:
if (ob) evas_fb_outbuf_fb_free(ob);
free(re);
evas_common_shutdown();
return NULL;
}
@ -190,8 +187,6 @@ eng_output_free(void *data)
evas_render_engine_software_generic_clean(&re->generic);
free(re);
}
evas_common_shutdown();
}
static Eina_Bool

View File

@ -172,7 +172,6 @@ eng_setup(Evas *evas, void *in)
{
if (!_initted)
{
evas_common_init();
glsym_evas_gl_preload_init();
_initted = EINA_TRUE;
}
@ -259,7 +258,6 @@ eng_output_free(void *data)
if (_initted && (_gl_wins == 0))
{
glsym_evas_gl_preload_shutdown();
evas_common_shutdown();
_initted = EINA_FALSE;
}
}

View File

@ -906,7 +906,6 @@ eng_setup(Evas *evas, void *in)
if (!initted)
{
evas_common_init();
glsym_evas_gl_preload_init();
}
@ -1090,7 +1089,6 @@ eng_output_free(void *data)
if ((initted == EINA_TRUE) && (gl_wins == 0))
{
glsym_evas_gl_preload_shutdown();
evas_common_shutdown();
initted = EINA_FALSE;
}
}

View File

@ -305,7 +305,6 @@ eng_setup(Evas *eo_e, void *in)
re = calloc(1, sizeof (Render_Engine));
if (!re) goto on_error;
if (!evas_render_engine_gl_generic_init(&re->generic, ob, NULL,
_outbuf_get_rot,
_outbuf_reconfigure,
@ -334,7 +333,6 @@ eng_setup(Evas *eo_e, void *in)
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
/* if we haven't initialized - init (automatic abort if already done) */
evas_common_init();
return 1;

View File

@ -1713,7 +1713,6 @@ eng_setup(Evas *eo_e, void *in)
if (!initted)
{
evas_common_init();
glsym_evas_gl_preload_init();
}
@ -1938,7 +1937,6 @@ eng_output_free(void *data)
if ((initted == 1) && (gl_wins == 0))
{
glsym_evas_gl_preload_shutdown();
evas_common_shutdown();
initted = 0;
}
}

View File

@ -107,9 +107,6 @@ _output_setup(int w, int h)
flipBuffer(re->context, MAX_BUFFERS - 1);
/* if we haven't initialized - init (automatic abort if already done) */
evas_common_init();
re->tb = evas_common_tilebuf_new(w, h);
/* in preliminary tests 16x16 gave highest framerates */
@ -201,8 +198,6 @@ eng_output_free(void *data)
evas_common_tilebuf_free_render_rects(re->rects);
free(re);
evas_common_shutdown();
}
static void

View File

@ -33,9 +33,6 @@ _output_setup(int width,
if (!re)
return NULL;
/* if we haven't initialized - init (automatic abort if already done) */
evas_common_init();
evas_software_ddraw_outbuf_init();
ob = evas_software_ddraw_outbuf_setup(width, height, rot,
@ -144,8 +141,6 @@ eng_output_free(void *data)
re = (Render_Engine *)data;
evas_render_engine_software_generic_clean(&re->generic);
free(re);
evas_common_shutdown();
}
static Eina_Bool

View File

@ -33,9 +33,6 @@ _output_setup(int width,
if (!re)
return NULL;
/* if we haven't initialized - init (automatic abort if already done) */
evas_common_init();
evas_software_gdi_outbuf_init();
if (width <= 0)
@ -152,8 +149,6 @@ eng_output_free(void *data)
re = (Render_Engine *)data;
evas_render_engine_software_generic_clean(&re->generic);
free(re);
evas_common_shutdown();
}
static Eina_Bool

View File

@ -328,7 +328,6 @@ eng_setup(Evas *eo_e, void *in)
if (!e->engine.data.output)
{
/* if we haven't initialized - init (automatic abort if already done) */
evas_common_init();
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
{
@ -455,8 +454,6 @@ eng_output_free(void *data)
_output_egl_shutdown(re);
free(re);
}
evas_common_shutdown();
}
static Eina_Bool

View File

@ -579,7 +579,6 @@ eng_setup(Evas *evas, void *info)
/* if we have not initialize gl & evas, do it */
if (!initted)
{
evas_common_init();
glsym_evas_gl_preload_init();
}
@ -758,7 +757,6 @@ eng_output_free(void *data)
if ((initted == EINA_TRUE) && (gl_wins == 0))
{
glsym_evas_gl_preload_shutdown();
evas_common_shutdown();
initted = EINA_FALSE;
}
}

View File

@ -153,7 +153,6 @@ eng_setup(Evas *eo_evas, void *info)
if (!(re = epd->engine.data.output))
{
/* if we have no engine data, assume we have not initialized yet */
evas_common_init();
re = _render_engine_swapbuf_setup(epd->output.w, epd->output.h, einfo);
@ -188,11 +187,10 @@ eng_setup(Evas *eo_evas, void *info)
return 1;
err:
evas_common_shutdown();
return 0;
}
static void
static void
eng_output_free(void *data)
{
Render_Engine *re;
@ -202,8 +200,6 @@ eng_output_free(void *data)
evas_render_engine_software_generic_clean(&re->generic);
free(re);
}
evas_common_shutdown();
}
static void