Divide into engine init and drm engine init 48/131848/3
authorSooChan Lim <sc1.lim@samsung.com>
Wed, 31 May 2017 01:05:17 +0000 (10:05 +0900)
committerJuyeon Lee <juyeonne.lee@samsung.com>
Thu, 1 Jun 2017 02:25:52 +0000 (02:25 +0000)
According to the HWC configuration, screen configuration
is set up by tdm or drm.
When hwc is on, screen initialization is done
at enlightenment with tdm.
When hwc is off, screen initiailzation is done
at drm or ecore_drm engine.

Change-Id: I560eff4810d7099025e96d5e0caa94a6c5431099
Signed-off-by: SooChan Lim <sc1.lim@samsung.com>
src/bin/e_comp.c
src/bin/e_comp_screen.c

index 257cf353409b72cce851d3f02cb4e33620dabf73..ec07631662b887ad9ba8a575f3987cd6b93eb95a 100644 (file)
@@ -1506,6 +1506,9 @@ e_comp_init(void)
    e_comp_new();
 
    e_main_ts("\tE_Comp_Screen Init");
+   /* initialize the hwc with the configuration vaule */
+   e_comp->hwc = conf->hwc;
+
    if (!e_comp_screen_init())
      {
         ERR("Fail to init e_comp_screen");
index 6b14b0248a737fad8f9bc6119d476c5f70b88010..a646609c8f04cc5e368709008a69f6f112c48e59 100644 (file)
@@ -114,20 +114,6 @@ _layer_cap_to_str(tdm_layer_capability caps, tdm_layer_capability cap)
    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)
 {
@@ -350,7 +336,7 @@ _e_comp_screen_new(E_Comp *comp)
    e_comp_screen = E_NEW(E_Comp_Screen, 1);
    if (!e_comp_screen) return NULL;
 
-   if (_e_comp_screen_can_hwc(comp))
+   if (comp->hwc)
      {
         /* tdm display init */
         e_comp_screen->tdisplay = tdm_display_init(&error);
@@ -398,7 +384,7 @@ _e_comp_screen_deinit_outputs(E_Comp_Screen *e_comp_screen)
 }
 
 static Eina_Bool
-_e_comp_screen_init_drm_outputs(E_Comp_Screen *e_comp_screen)
+_e_comp_screen_drm_outputs_init(E_Comp_Screen *e_comp_screen)
 {
    Ecore_Drm_Device *dev;
    Ecore_Drm_Output *output;
@@ -766,6 +752,313 @@ _e_comp_screen_e_screens_set(E_Comp_Screen *e_comp_screen, Eina_List *screens)
    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)
 {
@@ -910,13 +1203,9 @@ E_API Eina_Bool
 e_comp_screen_init()
 {
    E_Comp *comp;
-   E_Comp_Screen *e_comp_screen = NULL;
-
-   int w = 0, h = 0, scr_w = 1, scr_h = 1;
+   int w, h;
    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))
@@ -925,175 +1214,39 @@ e_comp_screen_init()
         EINA_SAFETY_ON_NULL_RETURN_VAL(comp, EINA_FALSE);
      }
 
-   /* 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 (comp->hwc)
      {
-        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
+        if (!_e_comp_screen_engine_init())
           {
-             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;
+             ERR("Could not initialize the ecore_evas engine.");
+             goto failed_comp_screen;
           }
      }
    else
      {
-        if (!_e_comp_screen_init_drm_outputs(e_comp_screen))
+        if (!_e_comp_screen_drm_engine_init())
           {
-             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;
+             ERR("Could not initialize the drm ecore_evas engine.");
+             goto failed_comp_screen;
           }
-
-        // 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())
      {
-        TRACE_DS_END();
-        return EINA_FALSE;
+        goto failed_comp_screen;
      }
    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"));
-        _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;
+        goto failed_comp_screen;
      }
    e_main_ts("\tE_Comp_Canvas Init Done");
 
@@ -1111,12 +1264,12 @@ e_comp_screen_init()
      {
         e_pointer_hide(comp->pointer);
 
-        if (e_comp_screen->rotation)
+        if (comp->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, e_comp_screen->rotation);
+               ecore_drm_device_pointer_rotation_set(dev, comp->e_comp_screen->rotation);
           }
      }
    e_main_ts("\tE_Pointer New Done");
@@ -1156,26 +1309,29 @@ e_comp_screen_init()
                          NULL, _tz_screen_rotation_cb_bind))
      {
         ERR("Could not add tizen_screen_rotation to wayland globals");
-        return EINA_FALSE;
+        goto failed_comp_screen;
      }
 
    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);
 
-#ifdef HAVE_HWC
-   ecore_idle_enterer_add(_e_comp_screen_commit_idle_cb, comp);
-#endif
-
    TRACE_DS_END();
 
    return EINA_TRUE;
+
+failed_comp_screen:
+
+   if (comp->hwc)
+     _e_comp_screen_engine_deinit();
+   else
+     _e_comp_screen_drm_engine_deinit();
+
+   TRACE_DS_END();
+
+   return EINA_FALSE;
 }
 
 E_API void