return "";
}
+static Eina_Bool
+_e_comp_screen_can_hwc(E_Comp *comp)
+{
+ const char *name;
+ name = ecore_evas_engine_name_get(comp->ee);
+
+ if(!strcmp(name, "gl_drm"))
+ return EINA_TRUE;
+ else if(!strcmp(name, "drm_tbm"))
+ return EINA_TRUE;
+
+ return EINA_FALSE;
+}
+
static Eina_Bool
_e_comp_screen_cb_activate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
e_comp_screen = E_NEW(E_Comp_Screen, 1);
if (!e_comp_screen) return NULL;
- if (comp->hwc)
+ if (_e_comp_screen_can_hwc(comp))
{
/* tdm display init */
e_comp_screen->tdisplay = tdm_display_init(&error);
}
static Eina_Bool
-_e_comp_screen_drm_outputs_init(E_Comp_Screen *e_comp_screen)
+_e_comp_screen_init_drm_outputs(E_Comp_Screen *e_comp_screen)
{
Ecore_Drm_Device *dev;
Ecore_Drm_Output *output;
e_comp_screen->e_screens = screens;
}
-static void
-_e_comp_screen_drm_engine_deinit(void)
-{
- if (!e_comp) return;
- if (!e_comp->e_comp_screen) return;
-
- _e_comp_screen_deinit_outputs(e_comp->e_comp_screen);
- _e_comp_screen_del(e_comp->e_comp_screen);
- e_comp->e_comp_screen = NULL;
-}
-
-static Eina_Bool
-_e_comp_screen_drm_engine_init(void)
-{
- E_Comp_Screen *e_comp_screen = NULL;
- int w = 0, h = 0, scr_w = 1, scr_h = 1;
- int screen_rotation;
- char buf[1024];
-
- INF("ecore evase engine init with DRM. Not HWC.");
-
- /* set gl available if we have ecore_evas support */
- if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_DRM))
- e_comp_gl_set(EINA_TRUE);
-
- INF("GL available:%d config engine:%d screen size:%dx%d",
- e_comp_gl_get(), e_comp_config_get()->engine, scr_w, scr_h);
-
- if ((e_comp_gl_get()) &&
- (e_comp_config_get()->engine == E_COMP_ENGINE_GL))
- {
- e_main_ts("\tEE_GL_DRM New");
- e_comp->ee = ecore_evas_gl_drm_new(NULL, 0, 0, 0, scr_w, scr_h);
- snprintf(buf, sizeof(buf), "\tEE_GL_DRM New Done %p %dx%d", e_comp->ee, scr_w, scr_h);
- e_main_ts(buf);
-
- if (!e_comp->ee)
- e_comp_gl_set(EINA_FALSE);
- else
- {
- Evas_GL *evasgl = NULL;
- Evas_GL_API *glapi = NULL;
-
- e_main_ts("\tEvas_GL New");
- evasgl = evas_gl_new(ecore_evas_get(e_comp->ee));
- if (evasgl)
- {
- glapi = evas_gl_api_get(evasgl);
- if (!((glapi) && (glapi->evasglBindWaylandDisplay)))
- {
- e_comp_gl_set(EINA_FALSE);
- ecore_evas_free(e_comp->ee);
- e_comp->ee = NULL;
- e_main_ts("\tEvas_GL New Failed 1");
- }
- else
- {
- e_main_ts("\tEvas_GL New Done");
- }
- }
- else
- {
- e_comp_gl_set(EINA_FALSE);
- ecore_evas_free(e_comp->ee);
- e_comp->ee = NULL;
- e_main_ts("\tEvas_GL New Failed 2");
- }
- evas_gl_free(evasgl);
- }
- }
-
- /* fallback to framebuffer drm (non-accel) */
- if (!e_comp->ee)
- {
- e_main_ts("\tEE_DRM New");
- e_comp->ee = ecore_evas_drm_new(NULL, 0, 0, 0, scr_w, scr_h);
- snprintf(buf, sizeof(buf), "\tEE_DRM New Done %p %dx%d", e_comp->ee, scr_w, scr_h);
- e_main_ts(buf);
- }
-
- if (!e_comp->ee)
- {
- fprintf(stderr, "Could not create ecore_evas_drm canvas");
- return EINA_FALSE;
- }
-
- ecore_evas_data_set(e_comp->ee, "comp", e_comp);
-
- /* get the current screen geometry */
- ecore_evas_screen_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
-
- /* resize the canvas */
- if (!((scr_w == w) && (scr_h == h)))
- {
- snprintf(buf, sizeof(buf), "\tEE Resize %dx%d -> %dx%d", scr_w, scr_h, w, h);
- e_main_ts(buf);
-
- ecore_evas_resize(e_comp->ee, w, h);
-
- e_main_ts("\tEE Resize Done");
- }
-
- ecore_evas_callback_resize_set(e_comp->ee, _e_comp_screen_cb_ee_resize);
-
- screen_rotation = (e_config->screen_rotation_pre + e_config->screen_rotation_setting) % 360;
-
- INF("E_COMP_SCREEN: screen_rotation_pre %d and screen_rotation_setting %d",
- e_config->screen_rotation_pre, e_config->screen_rotation_setting);
-
- if (screen_rotation)
- {
- /* SHOULD called with resize option after ecore_evas_resize */
- ecore_evas_rotation_with_resize_set(e_comp->ee, screen_rotation);
- ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
-
- snprintf(buf, sizeof(buf), "\tEE Rotate and Resize %d, %dx%d", screen_rotation, w, h);
- e_main_ts(buf);
- }
-
- /* e_comp_screen new */
- e_comp_screen = _e_comp_screen_new(e_comp);
- EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
-
- e_comp->e_comp_screen = e_comp_screen;
- e_comp_screen->rotation = screen_rotation;
-
- e_main_ts("\tE_Outputs Init");
- if (!_e_comp_screen_drm_outputs_init(e_comp_screen))
- {
- e_error_message_show(_("Enlightenment cannot initialize outputs!\n"));
- _e_comp_screen_drm_engine_deinit();
- return EINA_FALSE;
- }
-
- // take current e_output config and apply it to the driver
- _e_comp_screen_config_maxsize(e_comp_screen);
- printf("OUTPUT: eval config...\n");
- _e_comp_screen_config_eval(e_comp_screen);
- printf("OUTPUT: really apply config...\n");
- _e_comp_screen_apply(e_comp_screen);
- printf("OUTPUT: done config...\n");
-
- if (!E_EVENT_SCREEN_CHANGE) E_EVENT_SCREEN_CHANGE = ecore_event_type_new();
-
- ecore_event_add(E_EVENT_SCREEN_CHANGE, NULL, NULL, NULL);
-
- e_comp_screen_e_screens_setup(e_comp_screen, -1, -1);
- e_main_ts("\tE_Outputs Init Done");
-
- E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_OUTPUT, _e_comp_screen_cb_output_drm, e_comp);
-
- return EINA_TRUE;
-}
-
-static void
-_e_comp_screen_engine_deinit(void)
-{
- if (!e_comp) return;
- if (!e_comp->e_comp_screen) return;
-
- _e_comp_screen_deinit_outputs(e_comp->e_comp_screen);
- _e_comp_screen_del(e_comp->e_comp_screen);
- e_comp->e_comp_screen = NULL;
-}
-
-static Eina_Bool
-_e_comp_screen_engine_init(void)
-{
- E_Comp_Screen *e_comp_screen = NULL;
- int w = 0, h = 0, scr_w = 1, scr_h = 1;
- int screen_rotation;
- char buf[1024];
-
- INF("ecore evase engine init with TDM. HWC.");
-
- /* set env for use tbm_surface_queue*/
- setenv("USE_EVAS_SOFTWARE_TBM_ENGINE", "1", 1);
-
- /* set gl available if we have ecore_evas support */
- if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_DRM))
- e_comp_gl_set(EINA_TRUE);
-
- INF("GL available:%d config engine:%d screen size:%dx%d",
- e_comp_gl_get(), e_comp_config_get()->engine, scr_w, scr_h);
-
- if ((e_comp_gl_get()) &&
- (e_comp_config_get()->engine == E_COMP_ENGINE_GL))
- {
- e_main_ts("\tEE_GL_DRM New");
- e_comp->ee = ecore_evas_gl_drm_new(NULL, 0, 0, 0, scr_w, scr_h);
- snprintf(buf, sizeof(buf), "\tEE_GL_DRM New Done %p %dx%d", e_comp->ee, scr_w, scr_h);
- e_main_ts(buf);
-
- if (!e_comp->ee)
- e_comp_gl_set(EINA_FALSE);
- else
- {
- Evas_GL *evasgl = NULL;
- Evas_GL_API *glapi = NULL;
-
- e_main_ts("\tEvas_GL New");
- evasgl = evas_gl_new(ecore_evas_get(e_comp->ee));
- if (evasgl)
- {
- glapi = evas_gl_api_get(evasgl);
- if (!((glapi) && (glapi->evasglBindWaylandDisplay)))
- {
- e_comp_gl_set(EINA_FALSE);
- ecore_evas_free(e_comp->ee);
- e_comp->ee = NULL;
- e_main_ts("\tEvas_GL New Failed 1");
- }
- else
- {
- e_main_ts("\tEvas_GL New Done");
- }
- }
- else
- {
- e_comp_gl_set(EINA_FALSE);
- ecore_evas_free(e_comp->ee);
- e_comp->ee = NULL;
- e_main_ts("\tEvas_GL New Failed 2");
- }
- evas_gl_free(evasgl);
- }
- }
-
- /* fallback to framebuffer drm (non-accel) */
- if (!e_comp->ee)
- {
- e_main_ts("\tEE_DRM New");
- e_comp->ee = ecore_evas_drm_new(NULL, 0, 0, 0, scr_w, scr_h);
- snprintf(buf, sizeof(buf), "\tEE_DRM New Done %p %dx%d", e_comp->ee, scr_w, scr_h);
- e_main_ts(buf);
- }
-
- if (!e_comp->ee)
- {
- fprintf(stderr, "Could not create ecore_evas_drm canvas");
- return EINA_FALSE;
- }
-
- ecore_evas_data_set(e_comp->ee, "comp", e_comp);
-
- /* get the current screen geometry */
- ecore_evas_screen_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
-
- /* resize the canvas */
- if (!((scr_w == w) && (scr_h == h)))
- {
- snprintf(buf, sizeof(buf), "\tEE Resize %dx%d -> %dx%d", scr_w, scr_h, w, h);
- e_main_ts(buf);
-
- ecore_evas_resize(e_comp->ee, w, h);
-
- e_main_ts("\tEE Resize Done");
- }
-
- ecore_evas_callback_resize_set(e_comp->ee, _e_comp_screen_cb_ee_resize);
-
- screen_rotation = (e_config->screen_rotation_pre + e_config->screen_rotation_setting) % 360;
-
- INF("E_COMP_SCREEN: screen_rotation_pre %d and screen_rotation_setting %d",
- e_config->screen_rotation_pre, e_config->screen_rotation_setting);
-
- if (screen_rotation)
- {
- /* SHOULD called with resize option after ecore_evas_resize */
- ecore_evas_rotation_with_resize_set(e_comp->ee, screen_rotation);
- ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
-
- snprintf(buf, sizeof(buf), "\tEE Rotate and Resize %d, %dx%d", screen_rotation, w, h);
- e_main_ts(buf);
- }
-
- /* e_comp_screen new */
- e_comp_screen = _e_comp_screen_new(e_comp);
- EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
-
- e_comp->e_comp_screen = e_comp_screen;
- e_comp_screen->rotation = screen_rotation;
-
- e_main_ts("\tE_Outputs Init");
- if (!_e_comp_screen_init_outputs(e_comp_screen))
- {
- e_error_message_show(_("Enlightenment cannot initialize outputs!\n"));
- _e_comp_screen_engine_deinit();
- return EINA_FALSE;
- }
-
- if (!E_EVENT_SCREEN_CHANGE) E_EVENT_SCREEN_CHANGE = ecore_event_type_new();
-
- ecore_event_add(E_EVENT_SCREEN_CHANGE, NULL, NULL, NULL);
-
- e_comp_screen_e_screens_setup(e_comp_screen, -1, -1);
- e_main_ts("\tE_Outputs Init Done");
-
- /* TODO: need the output changed handler with TDM */
- //E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_OUTPUT, _e_comp_screen_cb_output_drm, comp);
-
- /* update the screen, outputs and planes at the idle enterer of the ecore_loop */
- ecore_idle_enterer_add(_e_comp_screen_commit_idle_cb, e_comp);
-
- return EINA_TRUE;
-}
-
EINTERN void
e_comp_screen_e_screens_setup(E_Comp_Screen *e_comp_screen, int rw, int rh)
{
e_comp_screen_init()
{
E_Comp *comp;
- int w, h;
+ E_Comp_Screen *e_comp_screen = NULL;
+
+ int w = 0, h = 0, scr_w = 1, scr_h = 1;
struct xkb_context *ctx = NULL;
struct xkb_keymap *map = NULL;
+ char buf[1024];
+ int screen_rotation;
TRACE_DS_BEGIN(E_COMP_SCREEN:INIT);
if (!(comp = e_comp))
EINA_SAFETY_ON_NULL_RETURN_VAL(comp, EINA_FALSE);
}
- if (comp->hwc)
+ /* set env for use tbm_surface_queue*/
+ setenv("USE_EVAS_SOFTWARE_TBM_ENGINE", "1", 1);
+
+ /* set gl available if we have ecore_evas support */
+ if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_DRM))
+ e_comp_gl_set(EINA_TRUE);
+
+ INF("GL available:%d config engine:%d screen size:%dx%d",
+ e_comp_gl_get(), e_comp_config_get()->engine, scr_w, scr_h);
+
+ if ((e_comp_gl_get()) &&
+ (e_comp_config_get()->engine == E_COMP_ENGINE_GL))
{
- if (!_e_comp_screen_engine_init())
+ e_main_ts("\tEE_GL_DRM New");
+ comp->ee = ecore_evas_gl_drm_new(NULL, 0, 0, 0, scr_w, scr_h);
+ snprintf(buf, sizeof(buf), "\tEE_GL_DRM New Done %p %dx%d", comp->ee, scr_w, scr_h);
+ e_main_ts(buf);
+
+ if (!comp->ee)
+ e_comp_gl_set(EINA_FALSE);
+ else
{
- ERR("Could not initialize the ecore_evas engine.");
- goto failed_comp_screen;
+ Evas_GL *evasgl = NULL;
+ Evas_GL_API *glapi = NULL;
+
+ e_main_ts("\tEvas_GL New");
+ evasgl = evas_gl_new(ecore_evas_get(comp->ee));
+ if (evasgl)
+ {
+ glapi = evas_gl_api_get(evasgl);
+ if (!((glapi) && (glapi->evasglBindWaylandDisplay)))
+ {
+ e_comp_gl_set(EINA_FALSE);
+ ecore_evas_free(comp->ee);
+ comp->ee = NULL;
+ e_main_ts("\tEvas_GL New Failed 1");
+ }
+ else
+ {
+ e_main_ts("\tEvas_GL New Done");
+ }
+ }
+ else
+ {
+ e_comp_gl_set(EINA_FALSE);
+ ecore_evas_free(comp->ee);
+ comp->ee = NULL;
+ e_main_ts("\tEvas_GL New Failed 2");
+ }
+ evas_gl_free(evasgl);
+ }
+ }
+
+ /* fallback to framebuffer drm (non-accel) */
+ if (!comp->ee)
+ {
+ e_main_ts("\tEE_DRM New");
+ comp->ee = ecore_evas_drm_new(NULL, 0, 0, 0, scr_w, scr_h);
+ snprintf(buf, sizeof(buf), "\tEE_DRM New Done %p %dx%d", comp->ee, scr_w, scr_h);
+ e_main_ts(buf);
+ }
+
+ if (!comp->ee)
+ {
+ fprintf(stderr, "Could not create ecore_evas_drm canvas");
+ TRACE_DS_END();
+ return EINA_FALSE;
+ }
+
+ ecore_evas_data_set(e_comp->ee, "comp", e_comp);
+
+ /* get the current screen geometry */
+ ecore_evas_screen_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
+
+ /* resize the canvas */
+ if (!((scr_w == w) && (scr_h == h)))
+ {
+ snprintf(buf, sizeof(buf), "\tEE Resize %dx%d -> %dx%d", scr_w, scr_h, w, h);
+ e_main_ts(buf);
+
+ ecore_evas_resize(comp->ee, w, h);
+
+ e_main_ts("\tEE Resize Done");
+ }
+
+ ecore_evas_callback_resize_set(e_comp->ee, _e_comp_screen_cb_ee_resize);
+
+ screen_rotation = (e_config->screen_rotation_pre + e_config->screen_rotation_setting) % 360;
+
+ INF("E_COMP_SCREEN: screen_rotation_pre %d and screen_rotation_setting %d",
+ e_config->screen_rotation_pre, e_config->screen_rotation_setting);
+
+ if (screen_rotation)
+ {
+ /* SHOULD called with resize option after ecore_evas_resize */
+ ecore_evas_rotation_with_resize_set(comp->ee, screen_rotation);
+ ecore_evas_geometry_get(comp->ee, NULL, NULL, &w, &h);
+
+ snprintf(buf, sizeof(buf), "\tEE Rotate and Resize %d, %dx%d", screen_rotation, w, h);
+ e_main_ts(buf);
+ }
+
+ /* e_comp_screen new */
+ e_comp_screen = _e_comp_screen_new(e_comp);
+ if (!e_comp_screen)
+ {
+ TRACE_DS_END();
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
+ }
+ e_comp->e_comp_screen = e_comp_screen;
+ e_comp_screen->rotation = screen_rotation;
+
+ e_main_ts("\tE_Outputs Init");
+ if (_e_comp_screen_can_hwc(e_comp))
+ {
+ if (!_e_comp_screen_init_outputs(e_comp_screen))
+ {
+ e_error_message_show(_("Enlightenment cannot initialize outputs!\n"));
+ _e_comp_screen_del(e_comp_screen);
+ e_comp->e_comp_screen = NULL;
+ TRACE_DS_END();
+ return EINA_FALSE;
}
}
else
{
- if (!_e_comp_screen_drm_engine_init())
+ if (!_e_comp_screen_init_drm_outputs(e_comp_screen))
{
- ERR("Could not initialize the drm ecore_evas engine.");
- goto failed_comp_screen;
+ e_error_message_show(_("Enlightenment cannot initialize outputs!\n"));
+ _e_comp_screen_del(e_comp_screen);
+ e_comp->e_comp_screen = NULL;
+ TRACE_DS_END();
+ return EINA_FALSE;
}
+
+ // take current e_output config and apply it to the driver
+ _e_comp_screen_config_maxsize(e_comp_screen);
+ printf("OUTPUT: eval config...\n");
+ _e_comp_screen_config_eval(e_comp_screen);
+ printf("OUTPUT: really apply config...\n");
+ _e_comp_screen_apply(e_comp_screen);
+ printf("OUTPUT: done config...\n");
}
+ if (!E_EVENT_SCREEN_CHANGE) E_EVENT_SCREEN_CHANGE = ecore_event_type_new();
+
+ ecore_event_add(E_EVENT_SCREEN_CHANGE, NULL, NULL, NULL);
+
+ e_comp_screen_e_screens_setup(e_comp_screen, -1, -1);
+ e_main_ts("\tE_Outputs Init Done");
+
e_main_ts("\tE_Comp_Wl Init");
if (!e_comp_wl_init())
{
- goto failed_comp_screen;
+ TRACE_DS_END();
+ return EINA_FALSE;
}
e_main_ts("\tE_Comp_Wl Init Done");
- /* get the current screen geometry */
- ecore_evas_screen_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
-
/* canvas */
e_main_ts("\tE_Comp_Canvas Init");
if (!e_comp_canvas_init(w, h))
{
e_error_message_show(_("Enlightenment cannot initialize outputs!\n"));
- goto failed_comp_screen;
+ _e_comp_screen_deinit_outputs(e_comp->e_comp_screen);
+ _e_comp_screen_del(e_comp_screen);
+ e_comp->e_comp_screen = NULL;
+ TRACE_DS_END();
+ return EINA_FALSE;
}
e_main_ts("\tE_Comp_Canvas Init Done");
{
e_pointer_hide(comp->pointer);
- if (comp->e_comp_screen->rotation)
+ if (e_comp_screen->rotation)
{
const Eina_List *l;
Ecore_Drm_Device *dev;
EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev)
- ecore_drm_device_pointer_rotation_set(dev, comp->e_comp_screen->rotation);
+ ecore_drm_device_pointer_rotation_set(dev, e_comp_screen->rotation);
}
}
e_main_ts("\tE_Pointer New Done");
NULL, _tz_screen_rotation_cb_bind))
{
ERR("Could not add tizen_screen_rotation to wayland globals");
- goto failed_comp_screen;
+ return EINA_FALSE;
}
tzsr_client_hook_del = e_client_hook_add(E_CLIENT_HOOK_DEL, _tz_screen_rotation_cb_client_del, NULL);
+ /* if gl_drm evas engine is used, we do not look at the drm_output */
+ if (!_e_comp_screen_can_hwc(e_comp))
+ E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_OUTPUT, _e_comp_screen_cb_output_drm, comp);
+
E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_ACTIVATE, _e_comp_screen_cb_activate, comp);
E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_INPUT_DEVICE_ADD, _e_comp_screen_cb_input_device_add, comp);
E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_INPUT_DEVICE_DEL, _e_comp_screen_cb_input_device_del, comp);
- TRACE_DS_END();
-
- return EINA_TRUE;
-
-failed_comp_screen:
-
- if (comp->hwc)
- _e_comp_screen_engine_deinit();
- else
- _e_comp_screen_drm_engine_deinit();
+#ifdef HAVE_HWC
+ ecore_idle_enterer_add(_e_comp_screen_commit_idle_cb, comp);
+#endif
TRACE_DS_END();
- return EINA_FALSE;
+ return EINA_TRUE;
}
E_API void