forked from enlightenment/efl
ecore-evas-drm: Refactor _ecore_evas_new_internal
This patch does a small refactor of _ecore_evas_new_internal function to separate canvas setup for gl & software. This was done so that when we create a canvas on a per-output bases (multi-output support), the code inside _ecore_evas_new_internal will be cleaner and easier to follow. NB: No real functional changes here until muti-output lands Differential Revision: https://phab.enlightenment.org/D7679
This commit is contained in:
parent
8079d6d38a
commit
374373a370
|
@ -957,6 +957,51 @@ static Ecore_Evas_Engine_Func _ecore_evas_drm_engine_func =
|
||||||
_drm_last_tick_get,
|
_drm_last_tick_get,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef BUILD_ECORE_EVAS_GL_DRM
|
||||||
|
static void *
|
||||||
|
_drm_gl_canvas_setup(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata)
|
||||||
|
{
|
||||||
|
Evas_Engine_Info_GL_Drm *einfo;
|
||||||
|
char *num;
|
||||||
|
|
||||||
|
einfo = (Evas_Engine_Info_GL_Drm *)evas_engine_info_get(ee->evas);
|
||||||
|
if (!einfo) return NULL;
|
||||||
|
|
||||||
|
einfo->info.vsync = EINA_TRUE;
|
||||||
|
|
||||||
|
num = getenv("EVAS_DRM_VSYNC");
|
||||||
|
if ((num) && (!atoi(num)))
|
||||||
|
einfo->info.vsync = EINA_FALSE;
|
||||||
|
|
||||||
|
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 = edata->output;
|
||||||
|
|
||||||
|
return einfo;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void *
|
||||||
|
_drm_canvas_setup(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata)
|
||||||
|
{
|
||||||
|
Evas_Engine_Info_Drm *einfo;
|
||||||
|
|
||||||
|
einfo = (Evas_Engine_Info_Drm *)evas_engine_info_get(ee->evas);
|
||||||
|
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 = ee->rotation;
|
||||||
|
einfo->info.output = edata->output;
|
||||||
|
|
||||||
|
return einfo;
|
||||||
|
}
|
||||||
|
|
||||||
static Ecore_Evas *
|
static Ecore_Evas *
|
||||||
_ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bool gl)
|
_ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bool gl)
|
||||||
{
|
{
|
||||||
|
@ -1044,48 +1089,23 @@ _ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bo
|
||||||
evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST,
|
evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST,
|
||||||
_drm_render_updates, ee);
|
_drm_render_updates, ee);
|
||||||
|
|
||||||
tinfo = evas_engine_info_get(ee->evas);
|
|
||||||
#ifdef BUILD_ECORE_EVAS_GL_DRM
|
#ifdef BUILD_ECORE_EVAS_GL_DRM
|
||||||
if (tinfo && gl)
|
if (gl)
|
||||||
{
|
tinfo = _drm_gl_canvas_setup(ee, edata);
|
||||||
char *num;
|
|
||||||
Evas_Engine_Info_GL_Drm *einfo = tinfo;
|
|
||||||
|
|
||||||
einfo->info.vsync = EINA_TRUE;
|
|
||||||
|
|
||||||
num = getenv("EVAS_DRM_VSYNC");
|
|
||||||
if ((num) && (!atoi(num)))
|
|
||||||
einfo->info.vsync = EINA_FALSE;
|
|
||||||
|
|
||||||
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 = edata->output;
|
|
||||||
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
||||||
{
|
|
||||||
ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);
|
|
||||||
goto eng_err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (tinfo)
|
tinfo = _drm_canvas_setup(ee, edata);
|
||||||
{
|
|
||||||
Evas_Engine_Info_Drm *einfo = tinfo;
|
|
||||||
|
|
||||||
einfo->info.dev = edata->dev;
|
if (!tinfo)
|
||||||
einfo->info.bpp = edata->bpp;
|
{
|
||||||
einfo->info.depth = edata->depth;
|
ERR("evas_engine_info_get() for engine '%s' failed", ee->driver);
|
||||||
einfo->info.format = edata->format;
|
goto eng_err;
|
||||||
einfo->info.rotation = ee->rotation;
|
}
|
||||||
einfo->info.output = edata->output;
|
|
||||||
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)tinfo))
|
||||||
{
|
{
|
||||||
ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);
|
ERR("evas_engine_info_set() for engine '%s' failed", ee->driver);
|
||||||
goto eng_err;
|
goto eng_err;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ee->prop.window = ecore_drm2_output_crtc_get(edata->output);
|
ee->prop.window = ecore_drm2_output_crtc_get(edata->output);
|
||||||
|
|
Loading…
Reference in New Issue