aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-11-20 11:59:38 -0500
committerChris Michael <cp.michael@samsung.com>2018-01-31 11:18:02 -0500
commit2b4fcd8855c28edc6d42270f8fdad857c92898d7 (patch)
tree7e29f5b34ffa78be94c75d5675d875fb1ef25883
parentevas-gl-drm: Fix variable type for 'output' (diff)
downloadefl-2b4fcd8855c28edc6d42270f8fdad857c92898d7.tar.gz
ecore-evas-drm: Fix gl_drm segfault on startup with multiple outputs
Since the gl_drm and drm evas engines use a slightly different Engine_Info structure, we need to set those up separately else we end up with a segfault when starting with the GL engine. Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/modules/ecore_evas/engines/drm/ecore_evas_drm.c69
1 files changed, 51 insertions, 18 deletions
diff --git a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
index be7cae7a3c..d7d0171087 100644
--- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
+++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
@@ -77,6 +77,51 @@ static Eina_List *handlers;
static Eina_List *canvases;
static Eina_List *outputs;
+static void *
+_drm_gl_canvas_setup(Efl_Canvas_Output *eout, Ecore_Evas_Engine_Drm_Data *edata, Ecore_Drm2_Output *output, int rotation)
+{
+#ifdef BUILD_ECORE_EVAS_GL_DRM
+ Evas_Engine_Info_GL_Drm *einfo;
+ char *num;
+
+ einfo = (Evas_Engine_Info_GL_Drm *)efl_canvas_output_engine_info_get(eout);
+ if (!einfo) return NULL;
+
+ einfo->info.dev = edata->dev;
+ einfo->info.bpp = edata->bpp;
+ einfo->info.depth = edata->depth;
+ einfo->info.format = edata->format;
+ einfo->info.rotation = rotation;
+ einfo->info.output = output;
+
+ num = getenv("EVAS_DRM_VSYNC");
+ if ((num) && (!atoi(num)))
+ einfo->info.vsync = EINA_FALSE;
+
+ return einfo;
+#else
+ return NULL;
+#endif
+}
+
+static void *
+_drm_canvas_setup(Efl_Canvas_Output *eout, Ecore_Evas_Engine_Drm_Data *edata, Ecore_Drm2_Output *output, int rotation)
+{
+ Evas_Engine_Info_Drm *einfo;
+
+ einfo = (Evas_Engine_Info_Drm *)efl_canvas_output_engine_info_get(eout);
+ if (!einfo) return NULL;
+
+ einfo->info.dev = edata->dev;
+ einfo->info.bpp = edata->bpp;
+ einfo->info.depth = edata->depth;
+ einfo->info.format = edata->format;
+ einfo->info.rotation = rotation;
+ einfo->info.output = output;
+
+ return einfo;
+}
+
static Ecore_Evas_Engine_Drm_Tick *
_drm_tick_find(Ecore_Evas_Engine_Drm_Data *edata, Ecore_Drm2_Output *output)
{
@@ -1131,7 +1176,7 @@ _ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bo
EINA_LIST_FOREACH(outs, l, output)
{
Efl_Canvas_Output *eout;
- Evas_Engine_Info_Drm *einfo;
+ void *einfo;
Ecore_Evas_Engine_Drm_Tick *etick;
int ox, oy, ow, oh;
@@ -1143,29 +1188,17 @@ _ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bo
eout = efl_canvas_output_add(ee->evas);
if (!eout) continue;
- einfo = (Evas_Engine_Info_Drm *)efl_canvas_output_engine_info_get(eout);
+ if (gl)
+ einfo = _drm_gl_canvas_setup(eout, edata, output, ee->rotation);
+ else
+ einfo = _drm_canvas_setup(eout, edata, output, ee->rotation);
+
if (!einfo)
{
efl_canvas_output_del(eout);
continue;
}
- einfo->info.dev = edata->dev;
- einfo->info.bpp = edata->bpp;
- einfo->info.depth = edata->depth;
- einfo->info.format = edata->format;
- einfo->info.rotation = ee->rotation;
- einfo->info.output = output;
-
- if (gl)
- {
- char *num;
-
- num = getenv("EVAS_DRM_VSYNC");
- if ((num) && (!atoi(num)))
- einfo->info.vsync = EINA_FALSE;
- }
-
ecore_drm2_output_info_get(output, &ox, &oy, &ow, &oh, NULL);
efl_canvas_output_view_set(eout, ox, oy, ow, oh);