aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2016-12-08 15:04:11 -0800
committerCedric Bail <cedric@osg.samsung.com>2016-12-08 15:06:25 -0800
commit7316bda15096841ef3564647b92304736d5387f3 (patch)
tree01854f8d5cb788b3bc8f16dabd1c6576d97921b2
parentevas-gl_cocoa: fix complete b0rkage of the engine (diff)
downloadefl-7316bda15096841ef3564647b92304736d5387f3.tar.gz
evas: refactor swap mode info get.
-rw-r--r--src/modules/evas/engines/eglfs/Evas_Engine_Eglfs.h12
-rw-r--r--src/modules/evas/engines/eglfs/evas_engine.c65
-rw-r--r--src/modules/evas/engines/gl_drm/Evas_Engine_GL_Drm.h16
-rw-r--r--src/modules/evas/engines/gl_drm/evas_engine.c67
-rw-r--r--src/modules/evas/engines/gl_generic/Evas_Engine_GL_Generic.h2
-rw-r--r--src/modules/evas/engines/gl_x11/Evas_Engine_GL_X11.h14
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c71
-rw-r--r--src/modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h12
8 files changed, 18 insertions, 241 deletions
diff --git a/src/modules/evas/engines/eglfs/Evas_Engine_Eglfs.h b/src/modules/evas/engines/eglfs/Evas_Engine_Eglfs.h
index 7472c7b306..abbc18a216 100644
--- a/src/modules/evas/engines/eglfs/Evas_Engine_Eglfs.h
+++ b/src/modules/evas/engines/eglfs/Evas_Engine_Eglfs.h
@@ -1,15 +1,7 @@
#ifndef _EVAS_ENGINE_EGLFS_H
# define _EVAS_ENGINE_EGLFS_H
-typedef enum _Evas_Engine_Info_Eglfs_Swap_Mode
-{
- EVAS_ENGINE_EGLFS_SWAP_MODE_AUTO = 0,
- EVAS_ENGINE_EGLFS_SWAP_MODE_FULL = 1,
- EVAS_ENGINE_EGLFS_SWAP_MODE_COPY = 2,
- EVAS_ENGINE_EGLFS_SWAP_MODE_DOUBLE = 3,
- EVAS_ENGINE_EGLFS_SWAP_MODE_TRIPLE = 4,
- EVAS_ENGINE_EGLFS_SWAP_MODE_QUADRUPLE = 5
-} Evas_Engine_Info_Eglfs_Swap_Mode;
+#include "../gl_generic/Evas_Engine_GL_Shared.h"
typedef struct _Evas_Engine_Info_Eglfs Evas_Engine_Info_Eglfs;
@@ -28,7 +20,7 @@ struct _Evas_Engine_Info_Eglfs
Eina_Bool destination_alpha : 1;
Eina_Bool vsync : 1;
Eina_Bool indirect : 1;
- unsigned char swap_mode : 4;
+ Evas_Engine_Info_Gl_Swap_Mode swap_mode : 4;
} info;
struct
diff --git a/src/modules/evas/engines/eglfs/evas_engine.c b/src/modules/evas/engines/eglfs/evas_engine.c
index d4eb3de3a1..3e5b7eecfd 100644
--- a/src/modules/evas/engines/eglfs/evas_engine.c
+++ b/src/modules/evas/engines/eglfs/evas_engine.c
@@ -690,69 +690,6 @@ eng_info_free(Evas *eo_e EINA_UNUSED, void *in)
free(info);
}
-static Render_Engine_Swap_Mode
-_eng_swapmode_get(void)
-{
- Render_Engine_Swap_Mode swap_mode = MODE_FULL;
- const char *s = NULL;
-
- s = getenv("EVAS_GL_SWAP_MODE");
- if (s)
- {
- if ((!strcasecmp(s, "full")) || (!strcasecmp(s, "f")))
- swap_mode = MODE_FULL;
- else if ((!strcasecmp(s, "copy")) || (!strcasecmp(s, "c")))
- swap_mode = MODE_COPY;
- else if ((!strcasecmp(s, "double")) ||
- (!strcasecmp(s, "d")) || (!strcasecmp(s, "2")))
- swap_mode = MODE_DOUBLE;
- else if ((!strcasecmp(s, "triple")) ||
- (!strcasecmp(s, "t")) || (!strcasecmp(s, "3")))
- swap_mode = MODE_TRIPLE;
- else if ((!strcasecmp(s, "quadruple")) ||
- (!strcasecmp(s, "q")) || (!strcasecmp(s, "4")))
- swap_mode = MODE_QUADRUPLE;
- }
- else
- {
-// in most gl implementations - egl and glx here that we care about the TEND
-// to either swap or copy backbuffer and front buffer, but strictly that is
-// not true. technically backbuffer content is totally undefined after a swap
-// and thus you MUST re-render all of it, thus MODE_FULL
- swap_mode = MODE_FULL;
-// BUT... reality is that lmost every implementation copies or swaps so
-// triple buffer mode can be used as it is a superset of double buffer and
-// copy (though using those explicitly is more efficient). so let's play with
-// triple buffer mdoe as a default and see.
-// re->mode = MODE_TRIPLE;
-// XXX: note - the above seems to break on some older intel chipsets and
-// drivers. it seems we CANT depend on backbuffer staying around. bugger!
- switch (info->info.swap_mode)
- {
- case EVAS_ENGINE_EGLFS_SWAP_MODE_FULL:
- swap_mode = MODE_FULL;
- break;
- case EVAS_ENGINE_EGLFS_SWAP_MODE_COPY:
- swap_mode = MODE_COPY;
- break;
- case EVAS_ENGINE_EGLFS_SWAP_MODE_DOUBLE:
- swap_mode = MODE_DOUBLE;
- break;
- case EVAS_ENGINE_EGLFS_SWAP_MODE_TRIPLE:
- swap_mode = MODE_TRIPLE;
- break;
- case EVAS_ENGINE_EGLFS_SWAP_MODE_QUADRUPLE:
- swap_mode = MODE_QUADRUPLE;
- break;
- default:
- swap_mode = MODE_AUTO;
- break;
- }
- }
-
- return swap_mode;
-}
-
static void *
eng_setup(void *in, unsigned int w, unsigned int h)
{
@@ -762,7 +699,7 @@ eng_setup(void *in, unsigned int w, unsigned int h)
Render_Engine_Merge_Mode merge_mode = MERGE_BOUNDING;
Render_Engine_Swap_Mode swap_mode;
- swap_mode = _eng_swapmode_get();
+ swap_mode = evas_render_engine_gl_swap_mode_get(info->info.swap_mode);
if (!initted)
{
diff --git a/src/modules/evas/engines/gl_drm/Evas_Engine_GL_Drm.h b/src/modules/evas/engines/gl_drm/Evas_Engine_GL_Drm.h
index 514aa80c09..9fd4b3c0e9 100644
--- a/src/modules/evas/engines/gl_drm/Evas_Engine_GL_Drm.h
+++ b/src/modules/evas/engines/gl_drm/Evas_Engine_GL_Drm.h
@@ -1,19 +1,11 @@
#ifndef _EVAS_ENGINE_GL_DRM_H
# define _EVAS_ENGINE_GL_DRM_H
+#include "../gl_generic/Evas_Engine_GL_Shared.h"
+
# include <Ecore_Drm2.h>
# include <gbm.h>
-typedef enum _Evas_Engine_Info_GL_Drm_Swap_Mode
-{
- EVAS_ENGINE_GL_DRM_SWAP_MODE_AUTO = 0,
- EVAS_ENGINE_GL_DRM_SWAP_MODE_FULL = 1,
- EVAS_ENGINE_GL_DRM_SWAP_MODE_COPY = 2,
- EVAS_ENGINE_GL_DRM_SWAP_MODE_DOUBLE = 3,
- EVAS_ENGINE_GL_DRM_SWAP_MODE_TRIPLE = 4,
- EVAS_ENGINE_GL_DRM_SWAP_MODE_QUADRUPLE = 5
-} Evas_Engine_Info_GL_Drm_Swap_Mode;
-
typedef struct _Evas_Engine_Info_GL_Drm Evas_Engine_Info_GL_Drm;
struct _Evas_Engine_Info_GL_Drm
@@ -22,7 +14,7 @@ struct _Evas_Engine_Info_GL_Drm
/* at you and make nasty noises */
Evas_Engine_Info magic;
- struct
+ struct
{
struct gbm_device *gbm;
@@ -35,7 +27,7 @@ struct _Evas_Engine_Info_GL_Drm
Eina_Bool destination_alpha : 1;
Eina_Bool vsync : 1;
Eina_Bool indirect : 1;
- unsigned char swap_mode : 4;
+ Evas_Engine_Info_Gl_Swap_Mode swap_mode : 4;
} info;
struct
diff --git a/src/modules/evas/engines/gl_drm/evas_engine.c b/src/modules/evas/engines/gl_drm/evas_engine.c
index 111c5ac75c..3ebe20992c 100644
--- a/src/modules/evas/engines/gl_drm/evas_engine.c
+++ b/src/modules/evas/engines/gl_drm/evas_engine.c
@@ -827,69 +827,6 @@ eng_info_free(Evas *eo_e EINA_UNUSED, void *in)
free(info);
}
-static Render_Engine_Swap_Mode
-_eng_swap_mode_get(Evas_Engine_Info_GL_Drm_Swap_Mode info_swap_mode)
-{
- Render_Engine_Swap_Mode swap_mode = MODE_FULL;
- const char *s;
-
- s = getenv("EVAS_GL_SWAP_MODE");
- if (s)
- {
- if ((!strcasecmp(s, "full")) || (!strcasecmp(s, "f")))
- swap_mode = MODE_FULL;
- else if ((!strcasecmp(s, "copy")) || (!strcasecmp(s, "c")))
- swap_mode = MODE_COPY;
- else if ((!strcasecmp(s, "double")) ||
- (!strcasecmp(s, "d")) || (!strcasecmp(s, "2")))
- swap_mode = MODE_DOUBLE;
- else if ((!strcasecmp(s, "triple")) ||
- (!strcasecmp(s, "t")) || (!strcasecmp(s, "3")))
- swap_mode = MODE_TRIPLE;
- else if ((!strcasecmp(s, "quadruple")) ||
- (!strcasecmp(s, "q")) || (!strcasecmp(s, "4")))
- swap_mode = MODE_QUADRUPLE;
- }
- else
- {
-// in most gl implementations - egl and glx here that we care about the TEND
-// to either swap or copy backbuffer and front buffer, but strictly that is
-// not true. technically backbuffer content is totally undefined after a swap
-// and thus you MUST re-render all of it, thus MODE_FULL
- swap_mode = MODE_FULL;
-// BUT... reality is that lmost every implementation copies or swaps so
-// triple buffer mode can be used as it is a superset of double buffer and
-// copy (though using those explicitly is more efficient). so let's play with
-// triple buffer mdoe as a default and see.
-// re->mode = MODE_TRIPLE;
-// XXX: note - the above seems to break on some older intel chipsets and
-// drivers. it seems we CANT depend on backbuffer staying around. bugger!
- switch (info_swap_mode)
- {
- case EVAS_ENGINE_GL_DRM_SWAP_MODE_FULL:
- swap_mode = MODE_FULL;
- break;
- case EVAS_ENGINE_GL_DRM_SWAP_MODE_COPY:
- swap_mode = MODE_COPY;
- break;
- case EVAS_ENGINE_GL_DRM_SWAP_MODE_DOUBLE:
- swap_mode = MODE_DOUBLE;
- break;
- case EVAS_ENGINE_GL_DRM_SWAP_MODE_TRIPLE:
- swap_mode = MODE_TRIPLE;
- break;
- case EVAS_ENGINE_GL_DRM_SWAP_MODE_QUADRUPLE:
- swap_mode = MODE_QUADRUPLE;
- break;
- default:
- swap_mode = MODE_AUTO;
- break;
- }
- }
-
- return swap_mode;
-}
-
static Render_Engine_Merge_Mode
_eng_merge_mode_get(void)
{
@@ -919,7 +856,7 @@ eng_setup(void *in, unsigned int w, unsigned int h)
Render_Engine_Swap_Mode swap_mode;
Render_Engine_Merge_Mode merge_mode;
- swap_mode = _eng_swap_mode_get(info->info.swap_mode);
+ swap_mode = evas_render_engine_gl_swap_mode_get(info->info.swap_mode);
merge_mode = _eng_merge_mode_get();
if (!initted)
@@ -1018,7 +955,7 @@ eng_update(void *data, void *in, unsigned int w, unsigned int h)
if (ob_old) evas_outbuf_free(ob_old);
- swap_mode = _eng_swap_mode_get(info->info.swap_mode);
+ swap_mode = evas_render_engine_gl_swap_mode_get(info->info.swap_mode);
ob = evas_outbuf_new(info, w, h, swap_mode);
if (!ob)
{
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 ace326dd5d..6ee302d400 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
@@ -2,6 +2,8 @@
# define EVAS_ENGINE_GL_GENERIC_H__
#include "../software_generic/Evas_Engine_Software_Generic.h"
+#include "Evas_Engine_GL_Shared.h"
+
#include "../gl_common/evas_gl_common.h"
#include "../gl_common/evas_gl_core.h"
#include "../gl_common/evas_gl_core_private.h"
diff --git a/src/modules/evas/engines/gl_x11/Evas_Engine_GL_X11.h b/src/modules/evas/engines/gl_x11/Evas_Engine_GL_X11.h
index ded7ca49d1..5122506d08 100644
--- a/src/modules/evas/engines/gl_x11/Evas_Engine_GL_X11.h
+++ b/src/modules/evas/engines/gl_x11/Evas_Engine_GL_X11.h
@@ -1,21 +1,13 @@
#ifndef _EVAS_ENGINE_GL_X11_H
#define _EVAS_ENGINE_GL_X11_H
+#include "../gl_generic/Evas_Engine_GL_Shared.h"
+
typedef struct _Evas_Engine_Info_GL_X11 Evas_Engine_Info_GL_X11;
/* have this feature */
#define EVAS_ENGINE_GL_X11_SWAP_MODE_EXISTS 1
-typedef enum _Evas_Engine_Info_GL_X11_Swap_Mode
-{
- EVAS_ENGINE_GL_X11_SWAP_MODE_AUTO = 0,
- EVAS_ENGINE_GL_X11_SWAP_MODE_FULL = 1,
- EVAS_ENGINE_GL_X11_SWAP_MODE_COPY = 2,
- EVAS_ENGINE_GL_X11_SWAP_MODE_DOUBLE = 3,
- EVAS_ENGINE_GL_X11_SWAP_MODE_TRIPLE = 4,
- EVAS_ENGINE_GL_X11_SWAP_MODE_QUADRUPLE = 5
-} Evas_Engine_Info_GL_X11_Swap_Mode;
-
struct _Evas_Engine_Info_GL_X11
{
/* PRIVATE - don't mess with this baby or evas will poke its tongue out */
@@ -53,7 +45,7 @@ struct _Evas_Engine_Info_GL_X11
unsigned char vsync : 1; // does nothing right now
unsigned char indirect : 1; // use indirect rendering
- unsigned char swap_mode : 4; // what swap mode to assume
+ Evas_Engine_Info_Gl_Swap_Mode swap_mode : 4; // what swap mode to assume
/* window surface should be made with these config */
int depth_bits;
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index df2910324c..5303549277 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -1614,73 +1614,6 @@ _re_winfree(Render_Engine *re)
eng_window_unsurf(eng_get_ob(re));
}
-static Render_Engine_Swap_Mode
-_eng_swap_mode_get(Evas_Engine_Info_GL_X11_Swap_Mode info_swap_mode)
-{
- Render_Engine_Swap_Mode swap_mode = MODE_FULL;
- const char *s;
-
- if ((s = getenv("EVAS_GL_SWAP_MODE")))
- {
- if ((!strcasecmp(s, "full")) ||
- (!strcasecmp(s, "f")))
- swap_mode = MODE_FULL;
- else if ((!strcasecmp(s, "copy")) ||
- (!strcasecmp(s, "c")))
- swap_mode = MODE_COPY;
- else if ((!strcasecmp(s, "double")) ||
- (!strcasecmp(s, "d")) ||
- (!strcasecmp(s, "2")))
- swap_mode = MODE_DOUBLE;
- else if ((!strcasecmp(s, "triple")) ||
- (!strcasecmp(s, "t")) ||
- (!strcasecmp(s, "3")))
- swap_mode = MODE_TRIPLE;
- else if ((!strcasecmp(s, "quadruple")) ||
- (!strcasecmp(s, "q")) ||
- (!strcasecmp(s, "4")))
- swap_mode = MODE_QUADRUPLE;
- }
- else
- {
-// in most gl implementations - egl and glx here that we care about the TEND
-// to either swap or copy backbuffer and front buffer, but strictly that is
-// not true. technically backbuffer content is totally undefined after a swap
-// and thus you MUST re-render all of it, thus MODE_FULL
- swap_mode = MODE_FULL;
-// BUT... reality is that lmost every implementation copies or swaps so
-// triple buffer mode can be used as it is a superset of double buffer and
-// copy (though using those explicitly is more efficient). so let's play with
-// triple buffer mdoe as a default and see.
-// re->mode = MODE_TRIPLE;
-// XXX: note - the above seems to break on some older intel chipsets and
-// drivers. it seems we CANT depend on backbuffer staying around. bugger!
- switch (info_swap_mode)
- {
- case EVAS_ENGINE_GL_X11_SWAP_MODE_FULL:
- swap_mode = MODE_FULL;
- break;
- case EVAS_ENGINE_GL_X11_SWAP_MODE_COPY:
- swap_mode = MODE_COPY;
- break;
- case EVAS_ENGINE_GL_X11_SWAP_MODE_DOUBLE:
- swap_mode = MODE_DOUBLE;
- break;
- case EVAS_ENGINE_GL_X11_SWAP_MODE_TRIPLE:
- swap_mode = MODE_TRIPLE;
- break;
- case EVAS_ENGINE_GL_X11_SWAP_MODE_QUADRUPLE:
- swap_mode = MODE_QUADRUPLE;
- break;
- default:
- swap_mode = MODE_AUTO;
- break;
- }
- }
-
- return swap_mode;
-}
-
static void *
eng_setup(void *in, unsigned int w, unsigned int h)
{
@@ -1691,7 +1624,7 @@ eng_setup(void *in, unsigned int w, unsigned int h)
Render_Engine_Swap_Mode swap_mode;
const char *s;
- swap_mode = _eng_swap_mode_get(info->swap_mode);
+ swap_mode = evas_render_engine_gl_swap_mode_get(info->swap_mode);
// Set this env var to dump files every frame
// Or set the global var in gdb to 1|0 to turn it on and off
@@ -1818,7 +1751,7 @@ eng_update(void *data, void *in, unsigned int w, unsigned int h)
Render_Engine *re = data;
Render_Engine_Swap_Mode swap_mode;
- swap_mode = _eng_swap_mode_get(info->swap_mode);
+ swap_mode = evas_render_engine_gl_swap_mode_get(info->swap_mode);
if (eng_get_ob(re) && _re_wincheck(eng_get_ob(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 05863cd336..ee85165856 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
@@ -1,6 +1,8 @@
#ifndef EVAS_ENGINE_SOFTWARE_GENERIC_H_
# define EVAS_ENGINE_SOFTWARE_GENERIC_H_
+#include "Evas_Engine_Software_Shared.h"
+
typedef enum _Outbuf_Depth
{
OUTBUF_DEPTH_NONE,
@@ -25,16 +27,6 @@ typedef enum _Outbuf_Depth
typedef enum
{
- MODE_FULL,
- MODE_COPY,
- MODE_DOUBLE,
- MODE_TRIPLE,
- MODE_QUADRUPLE,
- MODE_AUTO
-} Render_Engine_Swap_Mode;
-
-typedef enum
-{
MERGE_BOUNDING,
MERGE_FULL,
MERGE_SMART