From: Cedric BAIL Date: Fri, 25 Aug 2017 17:49:06 +0000 (-0700) Subject: evas: reduce duplication of merge_mode getenv logic. X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~2995 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f4afd5f1bd27323ac579dc41da8a12293f798a67;p=platform%2Fupstream%2Fefl.git evas: reduce duplication of merge_mode getenv logic. --- diff --git a/src/modules/evas/engines/eglfs/evas_engine.c b/src/modules/evas/engines/eglfs/evas_engine.c index b951bab..dfbaed8 100644 --- a/src/modules/evas/engines/eglfs/evas_engine.c +++ b/src/modules/evas/engines/eglfs/evas_engine.c @@ -684,7 +684,6 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in Evas_Engine_Info_Eglfs *info = in; Render_Engine *re = NULL; Outbuf *ob = NULL; - Render_Engine_Merge_Mode merge_mode = MERGE_BOUNDING; Render_Engine_Swap_Mode swap_mode; swap_mode = evas_render_engine_gl_swap_mode_get(info->info.swap_mode); @@ -725,16 +724,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in gl_wins++; - s = getenv("EVAS_GL_PARTIAL_MERGE"); - if (s) - { - if ((!strcmp(s, "bounding")) || (!strcmp(s, "b"))) - merge_mode = MERGE_BOUNDING; - else if ((!strcmp(s, "full")) || (!strcmp(s, "f"))) - merge_mode = MERGE_FULL; - } - - evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode); + evas_render_engine_software_generic_merge_mode_set(&re->generic.software); evas_outbuf_use(eng_get_ob(re)); diff --git a/src/modules/evas/engines/gl_drm/evas_engine.c b/src/modules/evas/engines/gl_drm/evas_engine.c index 2072284..28b21d2 100644 --- a/src/modules/evas/engines/gl_drm/evas_engine.c +++ b/src/modules/evas/engines/gl_drm/evas_engine.c @@ -899,26 +899,6 @@ eng_output_info_setup(void *info) einfo->render_mode = EVAS_RENDER_MODE_BLOCKING; } -static Render_Engine_Merge_Mode -_eng_merge_mode_get(void) -{ - Render_Engine_Merge_Mode merge_mode = MERGE_SMART; - const char *s; - - s = getenv("EVAS_GL_PARTIAL_MERGE"); - if (s) - { - if ((!strcmp(s, "bounding")) || (!strcmp(s, "b"))) - merge_mode = MERGE_BOUNDING; - else if ((!strcmp(s, "full")) || (!strcmp(s, "f"))) - merge_mode = MERGE_FULL; - else if ((!strcmp(s, "smart")) || (!strcmp(s, "s"))) - merge_mode = MERGE_SMART; - } - - return merge_mode; -} - static void * eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h) { @@ -926,10 +906,8 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in Render_Engine *re = NULL; Outbuf *ob; Render_Engine_Swap_Mode swap_mode; - Render_Engine_Merge_Mode merge_mode; swap_mode = evas_render_engine_gl_swap_mode_get(info->info.swap_mode); - merge_mode = _eng_merge_mode_get(); if (!initted) { @@ -984,7 +962,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in gl_wins++; - evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode); + evas_render_engine_software_generic_merge_mode_set(&re->generic.software); if (!initted) { diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c index b64733b..924bb5a 100644 --- a/src/modules/evas/engines/gl_x11/evas_engine.c +++ b/src/modules/evas/engines/gl_x11/evas_engine.c @@ -1581,9 +1581,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in Evas_Engine_Info_GL_X11 *info = in; Render_Engine *re = NULL; Outbuf *ob = NULL; - Render_Engine_Merge_Mode merge_mode = MERGE_SMART; Render_Engine_Swap_Mode swap_mode; - const char *s; swap_mode = evas_render_engine_gl_swap_mode_get(info->swap_mode); @@ -1669,20 +1667,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned in gl_wins++; - if ((s = getenv("EVAS_GL_PARTIAL_MERGE"))) - { - if ((!strcmp(s, "bounding")) || - (!strcmp(s, "b"))) - merge_mode = MERGE_BOUNDING; - else if ((!strcmp(s, "full")) || - (!strcmp(s, "f"))) - merge_mode = MERGE_FULL; - else if ((!strcmp(s, "smart")) || - (!strcmp(s, "s"))) - merge_mode = MERGE_SMART; - } - - evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode); + evas_render_engine_software_generic_merge_mode_set(&re->generic.software); if (!initted) { 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 5db2a94..bf859dc 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 @@ -27,9 +27,9 @@ typedef enum _Outbuf_Depth typedef enum { - MERGE_BOUNDING, - MERGE_FULL, - MERGE_SMART + MERGE_BOUNDING = 1, + MERGE_FULL = 2, + MERGE_SMART = 4 } Render_Engine_Merge_Mode; typedef struct _Render_Output_Software_Generic Render_Output_Software_Generic; @@ -150,9 +150,22 @@ evas_render_engine_software_generic_clean(Render_Output_Software_Generic *re) } static inline void -evas_render_engine_software_generic_merge_mode_set(Render_Output_Software_Generic *re, - Render_Engine_Merge_Mode merge_mode) +evas_render_engine_software_generic_merge_mode_set(Render_Output_Software_Generic *re) { + Render_Engine_Merge_Mode merge_mode = MERGE_SMART; + const char *s; + + s = getenv("EVAS_GL_PARTIAL_MERGE"); + if (s) + { + if ((!strcmp(s, "bounding")) || (!strcmp(s, "b"))) + merge_mode = MERGE_BOUNDING; + else if ((!strcmp(s, "full")) || (!strcmp(s, "f"))) + merge_mode = MERGE_FULL; + else if ((!strcmp(s, "smart")) || (!strcmp(s, "s"))) + merge_mode = MERGE_SMART; + } + re->merge_mode = merge_mode; } diff --git a/src/modules/evas/engines/software_x11/evas_engine.c b/src/modules/evas/engines/software_x11/evas_engine.c index c2b2ec9..c1cab73 100644 --- a/src/modules/evas/engines/software_x11/evas_engine.c +++ b/src/modules/evas/engines/software_x11/evas_engine.c @@ -71,8 +71,6 @@ _output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw, { Render_Engine *re; Outbuf *ob; - Render_Engine_Merge_Mode merge_mode = MERGE_SMART; - const char *s; if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL; @@ -113,20 +111,7 @@ _output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw, w, h)) goto on_error; - if ((s = getenv("EVAS_SOFTWARE_PARTIAL_MERGE"))) - { - if ((!strcmp(s, "bounding")) || - (!strcmp(s, "b"))) - merge_mode = MERGE_BOUNDING; - else if ((!strcmp(s, "full")) || - (!strcmp(s, "f"))) - merge_mode = MERGE_FULL; - else if ((!strcmp(s, "smart")) || - (!strcmp(s, "s"))) - merge_mode = MERGE_SMART; - } - - evas_render_engine_software_generic_merge_mode_set(&re->generic, merge_mode); + evas_render_engine_software_generic_merge_mode_set(&re->generic); return re; diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c b/src/modules/evas/engines/wayland_egl/evas_engine.c index 28c6203..f615acb 100644 --- a/src/modules/evas/engines/wayland_egl/evas_engine.c +++ b/src/modules/evas/engines/wayland_egl/evas_engine.c @@ -545,25 +545,6 @@ _eng_swap_mode_get(void) return swap_mode; } -static Render_Engine_Merge_Mode -_eng_merge_mode_get(void) -{ - Render_Engine_Merge_Mode merge = MERGE_SMART; - const char *s; - - if ((s = getenv("EVAS_GL_PARTIAL_MERGE"))) - { - if ((!strcmp(s, "bounding")) || (!strcmp(s, "b"))) - merge = MERGE_BOUNDING; - else if ((!strcmp(s, "full")) || (!strcmp(s, "f"))) - merge = MERGE_FULL; - else if ((!strcmp(s, "smart")) || (!strcmp(s, "s"))) - merge = MERGE_SMART; - } - - return merge; -} - static void * eng_output_setup(void *engine EINA_UNUSED, void *info, unsigned int w, unsigned int h) { @@ -571,10 +552,8 @@ eng_output_setup(void *engine EINA_UNUSED, void *info, unsigned int w, unsigned Render_Engine *re; Outbuf *ob; Render_Engine_Swap_Mode swap_mode; - Render_Engine_Merge_Mode merge; swap_mode = _eng_swap_mode_get(); - merge = _eng_merge_mode_get(); /* FIXME: Remove this line as soon as eglGetDisplay() autodetection * gets fixed. Currently it is incorrectly detecting wl_display and @@ -624,7 +603,7 @@ eng_output_setup(void *engine EINA_UNUSED, void *info, unsigned int w, unsigned gl_wins++; - evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge); + evas_render_engine_software_generic_merge_mode_set(&re->generic.software); if (!initted) { diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.c b/src/modules/evas/engines/wayland_shm/evas_engine.c index e9ca14a..c82eb6a 100644 --- a/src/modules/evas/engines/wayland_shm/evas_engine.c +++ b/src/modules/evas/engines/wayland_shm/evas_engine.c @@ -33,8 +33,6 @@ _render_engine_swapbuf_setup(int w, int h, Evas_Engine_Info_Wayland *einfo) { Render_Engine *re; Outbuf *ob; - Render_Engine_Merge_Mode merge_mode = MERGE_SMART; - const char *s; LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -60,18 +58,7 @@ _render_engine_swapbuf_setup(int w, int h, Evas_Engine_Info_Wayland *einfo) w, h)) goto err; - s = getenv("EVAS_WAYLAND_PARTIAL_MERGE"); - if (s) - { - if ((!strcmp(s, "bounding")) || (!strcmp(s, "b"))) - merge_mode = MERGE_BOUNDING; - else if ((!strcmp(s, "full")) || (!strcmp(s, "f"))) - merge_mode = MERGE_FULL; - else if ((!strcmp(s, "smart")) || (!strcmp(s, "s"))) - merge_mode = MERGE_SMART; - } - - evas_render_engine_software_generic_merge_mode_set(&re->generic, merge_mode); + evas_render_engine_software_generic_merge_mode_set(&re->generic); re->generic.ob->info = einfo;