e_server: move the init/deinit of e_explicit_sync
[platform/upstream/enlightenment.git] / src / bin / e_comp_screen.c
index 78ec7ca..71b22d1 100644 (file)
@@ -1,7 +1,35 @@
-#include "e.h"
-#include "Eeze.h"
+#include "e_client_intern.h"
+#include "e_utils_intern.h"
+#include "e_scale_intern.h"
+#include "e_comp_canvas_intern.h"
+#include "e_comp_screen_intern.h"
+#include "e_comp_wl_input_intern.h"
+#include "e_comp_wl_intern.h"
+#include "e_explicit_sync_intern.h"
+#include "e_comp_wl_tizen_hwc_intern.h"
+#include "e_comp_intern.h"
+#include "e_input_intern.h"
+#include "e_input_device_intern.h"
+#include "e_error_intern.h"
+#include "e_pointer_intern.h"
+#include "e_output_intern.h"
+#include "e_hwc_intern.h"
+#include "e_hwc_window_intern.h"
+#include "e_hwc_windows_intern.h"
+#include "e_egl_sync_intern.h"
+#include "e_config_intern.h"
+#include "e_dbus_conn_intern.h"
+#include "e_main_intern.h"
+#include "e_hwc_planes_intern.h"
+#include "e_linux_dmabuf_intern.h"
+#include "e_comp_input_intern.h"
+#include "e_screen_rotation_intern.h"
+#include "e_server_intern.h"
+
 #include <tizen-extension-server-protocol.h>
-#include <device/booting-internal.h>
+#include <device/board-internal.h>
+#include <tbm_drm_helper.h>
+#include <gbm.h>
 
 #define PATH "/org/enlightenment/wm"
 #define IFACE "org.enlightenment.wm.screen_rotation"
@@ -12,9 +40,7 @@ static Eldbus_Connection_Type edbus_conn_type = ELDBUS_CONNECTION_TYPE_SYSTEM;
 static Eldbus_Service_Interface *e_comp_screen_iface;
 
 static Eina_List *event_handlers = NULL;
-
-static Eina_Bool dont_set_e_input_keymap = EINA_FALSE;
-static Eina_Bool dont_use_xkb_cache = EINA_FALSE;
+static Eina_List *output_hooks = NULL;
 
 EINTERN int E_EVENT_SCREEN_CHANGE = 0;
 
@@ -23,131 +49,6 @@ enum
    E_COMP_SCREEN_SIGNAL_ROTATION_CHANGED = 0
 };
 
-typedef struct _E_Comp_Screen_Tzsr
-{
-   struct wl_resource *resource; /* tizen_screen_rotation */
-   E_Client           *ec;
-} E_Comp_Screen_Tzsr;
-
-static Eina_List *tzsr_list;
-static E_Client_Hook *tzsr_client_hook_del;
-
-static E_Comp_Screen_Tzsr*
-_tz_surface_rotation_find(E_Client *ec)
-{
-   E_Comp_Screen_Tzsr *tzsr;
-   Eina_List *l;
-
-   EINA_LIST_FOREACH(tzsr_list, l, tzsr)
-     {
-        if (tzsr->ec == ec)
-          return tzsr;
-     }
-
-   return NULL;
-}
-
-static void
-_tz_surface_rotation_free(E_Comp_Screen_Tzsr *tzsr)
-{
-   ELOGF("TRANSFORM", "|tzsr(%p) freed", tzsr->ec, tzsr);
-   tzsr_list = eina_list_remove(tzsr_list, tzsr);
-   free(tzsr);
-}
-
-static void
-_tz_screen_rotation_cb_client_del(void *data, E_Client *ec)
-{
-   E_Comp_Screen_Tzsr *tzsr = _tz_surface_rotation_find(ec);
-   if (!tzsr) return;
-   _tz_surface_rotation_free(tzsr);
-}
-
-static void
-_tz_screen_rotation_get_ignore_output_transform(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface)
-{
-   E_Comp_Screen_Tzsr *tzsr;
-   E_Client *ec;
-   E_Hwc_Policy hwc_policy;
-   E_Output *output;
-   E_Zone *zone;
-   Eina_Bool ignore = EINA_TRUE;
-
-   ec = wl_resource_get_user_data(surface);
-   EINA_SAFETY_ON_NULL_RETURN(ec);
-
-   tzsr = _tz_surface_rotation_find(ec);
-   if (tzsr) return;
-
-   tzsr = E_NEW(E_Comp_Screen_Tzsr, 1);
-   if (!tzsr)
-     {
-        wl_client_post_no_memory(client);
-        return;
-     }
-
-   tzsr->resource = resource;
-   tzsr->ec = ec;
-
-   tzsr_list = eina_list_append(tzsr_list, tzsr);
-
-   zone = ec->zone;
-   if (zone)
-     {
-        output = e_output_find(zone->output_id);
-        if (output)
-          {
-             hwc_policy = e_hwc_policy_get(output->hwc);
-             if (hwc_policy == E_HWC_POLICY_WINDOWS)
-               ignore = EINA_FALSE;
-          }
-     }
-
-   ELOGF("TRANSFORM", "|tzsr(%p) client_ignore(%d) ignore(%d)",
-         ec, tzsr, e_config->screen_rotation_client_ignore, ignore);
-
-   e_comp_screen_rotation_ignore_output_transform_send(ec, ignore);
-}
-
-static void
-_tz_screen_rotation_iface_cb_destroy(struct wl_client *client, struct wl_resource *resource)
-{
-   wl_resource_destroy(resource);
-}
-
-static const struct tizen_screen_rotation_interface _tz_screen_rotation_interface =
-{
-   _tz_screen_rotation_get_ignore_output_transform,
-   _tz_screen_rotation_iface_cb_destroy,
-};
-
-static void _tz_screen_rotation_cb_destroy(struct wl_resource *resource)
-{
-   E_Comp_Screen_Tzsr *tzsr;
-   Eina_List *l, *ll;
-
-   EINA_LIST_FOREACH_SAFE(tzsr_list, l, ll, tzsr)
-     {
-        if (tzsr->resource == resource)
-          _tz_surface_rotation_free(tzsr);
-     }
-}
-
-static void
-_tz_screen_rotation_cb_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
-{
-   struct wl_resource *res;
-
-   if (!(res = wl_resource_create(client, &tizen_screen_rotation_interface, version, id)))
-     {
-        ERR("Could not create tizen_screen_rotation resource: %m");
-        wl_client_post_no_memory(client);
-        return;
-     }
-
-   wl_resource_set_implementation(res, &_tz_screen_rotation_interface, NULL, _tz_screen_rotation_cb_destroy);
-}
-
 static Eldbus_Message *
 _e_comp_screen_dbus_get_cb(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
 {
@@ -291,11 +192,6 @@ _e_comp_screen_cb_input_device_add(void *data, int type, void *event)
           }
         comp->wl_comp_data->ptr.num_devices++;
      }
-   else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD)
-     {
-        comp->wl_comp_data->kbd.num_devices++;
-        e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
-     }
    else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
      {
         e_comp_wl_input_touch_enabled_set(EINA_TRUE);
@@ -360,14 +256,6 @@ _e_comp_screen_cb_input_device_del(void *data, int type, void *event)
              _e_comp_screen_pointer_renew();
           }
      }
-   else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD)
-     {
-        comp->wl_comp_data->kbd.num_devices--;
-        if (comp->wl_comp_data->kbd.num_devices == 0)
-          {
-             e_comp_wl_input_keyboard_enabled_set(EINA_FALSE);
-          }
-     }
    else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
      {
         comp->wl_comp_data->touch.num_devices--;
@@ -383,6 +271,48 @@ end:
 }
 
 static Eina_Bool
+_e_comp_screen_size_update(E_Comp_Screen *e_comp_screen)
+{
+   E_Output *output;
+   int sum_w = 0, max_h = 0, output_w, output_h;
+   Eina_List *l;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
+
+   /* we place external output to the right of primary output */
+   EINA_LIST_FOREACH(e_comp_screen->outputs, l, output)
+     {
+        if (!e_output_connected(output)) continue;
+
+        e_output_size_get(output, &output_w, &output_h);
+        sum_w += output_w;
+
+        if (max_h < output_h)
+          max_h = output_h;
+     }
+
+   e_comp_screen->w = sum_w;
+   e_comp_screen->h = max_h;
+
+   if (e_comp->ee)
+     {
+        /* rotation should be reset because tbm_surface_queue or gbm_surface of
+         * ecore_evas is created without rotation
+         * and rotation of ecore_evas is reset after it is resized
+         */
+        if (e_comp_screen->rotation)
+          ecore_evas_rotation_with_resize_set(e_comp->ee, 0);
+
+        ecore_evas_resize(e_comp->ee, e_comp_screen->w, e_comp_screen->h);
+
+        if (e_comp_screen->rotation)
+          ecore_evas_rotation_with_resize_set(e_comp->ee, e_comp_screen->rotation);
+     }
+
+   return EINA_TRUE;
+}
+
+static Eina_Bool
 _e_comp_screen_cb_event(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
 {
    E_Comp_Screen *e_comp_screen;
@@ -422,6 +352,7 @@ _e_comp_screen_new(E_Comp *comp)
      }
    e_main_ts_end("\tTDM Display Init Done");
 
+   e_comp_screen->gdevice_fd = -1;
    e_comp_screen->fd = -1;
    tdm_display_get_fd(e_comp_screen->tdisplay, &fd);
    if (fd < 0)
@@ -502,6 +433,9 @@ _e_comp_screen_del(E_Comp_Screen *e_comp_screen)
              e_comp_screen->available_pp_formats = eina_list_remove(e_comp_screen->available_pp_formats, l);
           }
      }
+
+   if (e_comp_screen->gdevice) gbm_device_destroy(e_comp_screen->gdevice);
+   if (e_comp_screen->gdevice_fd >= 0) close(e_comp_screen->gdevice_fd);
    if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr);
    if (e_comp_screen->fd >= 0) close(e_comp_screen->fd);
    if (e_comp_screen->hdlr) ecore_main_fd_handler_del(e_comp_screen->hdlr);
@@ -586,7 +520,6 @@ _e_comp_screen_output_destroy_cb(tdm_output *toutput, void *user_data)
              e_output_del(output);
           }
      }
-
 }
 
 static void
@@ -647,6 +580,8 @@ _e_comp_screen_deinit_outputs(E_Comp_Screen *e_comp_screen)
 
    tdm_display_remove_output_create_handler(e_comp_screen->tdisplay, _e_comp_screen_output_create_cb, e_comp_screen);
 
+   e_hwc_ecore_evas_deinit();
+
    // free up e_outputs
    EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, l, ll, output)
      {
@@ -654,7 +589,6 @@ _e_comp_screen_deinit_outputs(E_Comp_Screen *e_comp_screen)
         e_output_del(output);
      }
 
-   e_explicit_sync_deinit();
    e_egl_sync_deinit();
    e_hwc_deinit();
    e_hwc_windows_deinit();
@@ -665,18 +599,26 @@ _e_comp_screen_deinit_outputs(E_Comp_Screen *e_comp_screen)
 static Eina_Bool
 _e_comp_screen_fake_output_set(E_Comp_Screen *e_comp_screen)
 {
-   E_Output *output = NULL;
+   E_Output *primary_output = NULL;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
 
-   output = e_output_find_by_index(0);
+   primary_output = e_comp_screen_primary_output_get(e_comp_screen);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE);
 
-   if (!e_output_hwc_setup(output))
+   if (!e_output_hwc_setup(primary_output))
      {
         ERR("fail to e_output_hwc_setup.");
         return EINA_FALSE;
      }
 
+   if (!e_output_fake_config_set(primary_output, 2, 1))
+     {
+        e_error_message_show(_("Fail to set the fake output config!\n"));
+        e_hwc_ecore_evas_deinit();
+        return EINA_FALSE;
+     }
+
    return EINA_TRUE;
 }
 
@@ -691,6 +633,8 @@ _e_comp_screen_init_outputs(E_Comp_Screen *e_comp_screen)
    Eina_Bool scale_updated = EINA_FALSE;
    Eina_Bool connection_check = EINA_FALSE;
    tdm_error err = TDM_ERROR_NONE;
+   char bootmode[32];
+   int ret;
 
    /* init e_output */
    if (!e_output_init())
@@ -775,7 +719,12 @@ _e_comp_screen_init_outputs(E_Comp_Screen *e_comp_screen)
         e_main_ts_end("\tE_Output Mode Apply Done");
 
         e_main_ts_begin("\tE_Output Set DPMS ON");
-        if (device_get_reboot_mode() != SILENT_BOOT)
+        ret = device_board_get_boot_mode(bootmode, sizeof(bootmode));
+        if (!ret && !e_util_strcmp(bootmode, "silent"))
+          {
+             INF("silent reboot. do not set dpms");
+          }
+        else
           {
              if (!e_output_dpms_set(output, E_OUTPUT_DPMS_ON))
                {
@@ -784,8 +733,7 @@ _e_comp_screen_init_outputs(E_Comp_Screen *e_comp_screen)
                   goto fail;
                }
           }
-        else
-          INF("silent reboot. do not set dpms");
+
         e_main_ts_end("\tE_Output Set DPMS ON Done");
 
         e_main_ts_begin("\tE_Output Hwc Setup");
@@ -812,13 +760,23 @@ _e_comp_screen_init_outputs(E_Comp_Screen *e_comp_screen)
      }
 
    //TODO: if there is no output connected, make the fake output which is connected.
-
    if (!connection_check)
      {
         if (!_e_comp_screen_fake_output_set(e_comp_screen))
           goto fail;
      }
 
+   _e_comp_screen_size_update(e_comp_screen);
+
+   e_main_ts_begin("\tE_Hwc Ecore_Evas Init");
+   if (!e_hwc_ecore_evas_init())
+     {
+        e_main_ts_end("\ttE_Hwc Ecore_Evas Init Failed");
+        ERR("fail to e_hwc_ecore_evas_init");
+        goto fail;
+     }
+   e_main_ts_end("\tE_Hwc Ecore_Evas Init Done");
+
    if (tdm_display_add_output_create_handler(tdisplay, _e_comp_screen_output_create_cb, e_comp_screen)) goto fail;
 
    return EINA_TRUE;
@@ -828,58 +786,6 @@ fail:
    return EINA_FALSE;
 }
 
-E_API void
-_e_comp_screen_keymap_set(struct xkb_context **ctx, struct xkb_keymap **map)
-{
-   char *keymap_path = NULL;
-   struct xkb_context *context;
-   struct xkb_keymap *keymap;
-   struct xkb_rule_names names = {0,};
-   const char* default_rules, *default_model, *default_layout, *default_variant, *default_options;
-
-   TRACE_INPUT_BEGIN(_e_comp_screen_keymap_set);
-
-   context = xkb_context_new(0);
-   EINA_SAFETY_ON_NULL_RETURN(context);
-
-   /* assemble xkb_rule_names so we can fetch keymap */
-   memset(&names, 0, sizeof(names));
-
-   default_rules = e_comp_wl_input_keymap_default_rules_get();
-   default_model = e_comp_wl_input_keymap_default_model_get();
-   default_layout = e_comp_wl_input_keymap_default_layout_get();
-   default_variant = e_comp_wl_input_keymap_default_variant_get();
-   default_options = e_comp_wl_input_keymap_default_options_get();
-
-   names.rules = strdup(default_rules);
-   names.model = strdup(default_model);
-   names.layout = strdup(default_layout);
-   if (default_variant) names.variant = strdup(default_variant);
-   if (default_options) names.options = strdup(default_options);
-
-   keymap = e_comp_wl_input_keymap_compile(context, names, &keymap_path);
-   eina_stringshare_del(keymap_path);
-   EINA_SAFETY_ON_NULL_GOTO(keymap, cleanup);
-
-   *ctx = context;
-   *map = keymap;
-
-   if (dont_set_e_input_keymap == EINA_FALSE)
-     {
-        e_input_device_keyboard_cached_context_set(*ctx);
-        e_input_device_keyboard_cached_keymap_set(*map);
-     }
-
-cleanup:
-   free((char *)names.rules);
-   free((char *)names.model);
-   free((char *)names.layout);
-   if (names.variant) free((char *)names.variant);
-   if (names.options) free((char *)names.options);
-
-   TRACE_INPUT_END();
-}
-
 static void
 _e_comp_screen_e_screen_free(E_Screen *scr)
 {
@@ -977,43 +883,59 @@ _e_comp_screen_cb_dbus_init_done(void *data, int type, void *event)
 EINTERN void
 e_comp_screen_e_screens_setup(E_Comp_Screen *e_comp_screen, int rw, int rh)
 {
-   // setup only the primary output.
    E_Screen *screen;
    E_Output *output;
    Eina_List *e_screens = NULL;
-   int i = 0;
+   Eina_List *l;
+   int i = 0, right_x = 0;
 
    output = e_comp_screen_primary_output_get(e_comp_screen);
    /* No pirmary output means that there is no output at the system */
    if (!output) goto out;
 
-   screen = E_NEW(E_Screen, 1);
-   if (!screen) return;
+   EINA_LIST_FOREACH(e_comp_screen->outputs, l, output)
+     {
+        screen = E_NEW(E_Screen, 1);
+        if (!screen) return;
 
-   screen->escreen = screen->screen = i;
-   screen->x = output->config.geom.x;
-   screen->y = output->config.geom.y;
+        screen->escreen = screen->screen = i;
 
-   if (output->config.rotation % 180)
-     {
-        screen->w = output->config.geom.h;
-        screen->h = output->config.geom.w;
-     }
-   else
-     {
-        screen->w = output->config.geom.w;
-        screen->h = output->config.geom.h;
-     }
+        if (output->config.rotation % 180)
+          {
+             screen->w = output->config.geom.h;
+             screen->h = output->config.geom.w;
+          }
+        else
+          {
+             screen->w = output->config.geom.w;
+             screen->h = output->config.geom.h;
+          }
 
-   if (output->id) screen->id = strdup(output->id);
+        if (e_output_connected(output))
+          {
+             output->config.geom.x = right_x;
+             right_x += output->config.geom.w;
+          }
+        else
+          {
+             output->config.geom.x = 0;
+          }
 
-   e_screens = eina_list_append(e_screens, screen);
-   ELOGF("COMP_SCREEN","E INIT: SCREEN: [%i][%i], %ix%i+%i+%i",
-         NULL, i, i, screen->w, screen->h, screen->x, screen->y);
-   i++;
+        screen->x = output->config.geom.x;
+        screen->y = output->config.geom.y;
+
+        if (output->id) screen->id = strdup(output->id);
+
+        e_screens = eina_list_append(e_screens, screen);
+        ELOGF("COMP_SCREEN","E INIT: SCREEN: [%i][%i], %ix%i+%i+%i",
+              NULL, i, i, screen->w, screen->h, screen->x, screen->y);
+        i++;
+     }
 
    ELOGF("COMP_SCREEN","e_comp_screen_e_screens_setup............... %i %p\n", NULL, i, e_comp_screen->e_screens);
 
+   ecore_event_add(E_EVENT_SCREEN_CHANGE, NULL, NULL, NULL);
+
    _e_comp_screen_e_screens_set(e_comp_screen, e_screens);
 
    return;
@@ -1048,28 +970,27 @@ e_comp_screen_e_screens_get(E_Comp_Screen *e_comp_screen)
    return e_comp_screen->e_screens;
 }
 
+static void
+_e_comp_screen_cb_output_connect_status_change(void *data, E_Output *output)
+{
+   _e_comp_screen_size_update(e_comp->e_comp_screen);
+}
+
+static void
+_e_comp_screen_cb_output_mode_change(void *data, E_Output *output)
+{
+   _e_comp_screen_size_update(e_comp->e_comp_screen);
+}
+
 EINTERN Eina_Bool
 e_comp_screen_init()
 {
    E_Comp *comp;
    int w, h, ptr_x = 0, ptr_y = 0;
-   struct xkb_context *ctx = NULL;
-   struct xkb_keymap *map = NULL;
 
    if (!(comp = e_comp))
      EINA_SAFETY_ON_NULL_RETURN_VAL(comp, EINA_FALSE);
 
-   /* keymap */
-   dont_set_e_input_keymap = getenv("NO_E_INPUT_KEYMAP_CACHE") ? EINA_TRUE : EINA_FALSE;
-   dont_use_xkb_cache = getenv("NO_KEYMAP_CACHE") ? EINA_TRUE : EINA_FALSE;
-
-   if (e_config->xkb.use_cache && !dont_use_xkb_cache)
-     {
-        e_main_ts_begin("\tDRM Keymap Init");
-        _e_comp_screen_keymap_set(&ctx, &map);
-        e_main_ts_end("\tDRM Keymap Init Done");
-     }
-
    e_main_ts_begin("\tE_Comp_Screen_Engine Init");
    if (!_e_comp_screen_engine_init())
      {
@@ -1088,13 +1009,13 @@ e_comp_screen_init()
      }
    e_main_ts_end("\tE_Input Init Done");
 
-   e_main_ts_begin("\tE_Comp_Wl Init");
-   if (!e_comp_wl_init())
+   e_main_ts_begin("\tE_Server Init");
+   if (!e_server_init())
      {
-        e_main_ts_begin("\tE_Comp_Wl Init Failed");
+        e_main_ts_end("\tE_Server Init Failed");
         goto failed_comp_screen;
      }
-   e_main_ts_end("\tE_Comp_Wl Init Done");
+   e_main_ts_end("\tE_Server Init Done");
 
    /* get the current screen geometry */
    ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
@@ -1114,10 +1035,9 @@ e_comp_screen_init()
      ELOGF("E_EGL_SYNC", "Enabled the E_Egl_Sync", NULL);
    e_main_ts_end("\tE_Egl_Sync Init Done");
 
-   e_main_ts_begin("\tE_Explicit_Sync Init");
-   if (e_explicit_sync_init())
-     ELOGF("EX-SYNC", "Enabled the E_Explicit_Sync", NULL);
-   e_main_ts_end("\tE_Explicit_Sync Init Done");
+   e_main_ts_begin("\tE_Linux_Dmabuf Init");
+   e_linux_dmabuf_init(e_comp_wl->wl.disp);
+   e_main_ts_end("\tE_Linux_Dmabuf Init Done");
 
    /* pointer */
    e_input_device_pointer_xy_get(NULL, &ptr_x, &ptr_y);
@@ -1143,20 +1063,17 @@ e_comp_screen_init()
 
    /* FIXME: This is just for testing at the moment....
     * happens to jive with what drm does */
-   e_main_ts_begin("\tE_Comp_WL Keymap Init");
-   e_comp_wl_input_keymap_set(e_comp_wl_input_keymap_default_rules_get(),
-                              e_comp_wl_input_keymap_default_model_get(),
-                              e_comp_wl_input_keymap_default_layout_get(),
-                              e_comp_wl_input_keymap_default_variant_get(),
-                              e_comp_wl_input_keymap_default_options_get(),
-                              ctx, map);
-   e_main_ts_end("\tE_Comp_WL Keymap Init Done");
-
-   /* try to add tizen_video to wayland globals */
-   if (!wl_global_create(e_comp_wl->wl.disp, &tizen_screen_rotation_interface, 1,
-                         NULL, _tz_screen_rotation_cb_bind))
-     {
-        ERR("Could not add tizen_screen_rotation to wayland globals");
+
+   if (!e_input_thread_mode_get())
+     {
+        e_main_ts_begin("\tE_Comp_WL Keymap Init");
+        e_comp_wl_input_keymap_init();
+        e_main_ts_begin("\tE_Comp_WL Keymap Init Done");
+     }
+
+   if (!e_screen_rotation_init())
+     {
+        e_main_ts_end("\e_screen_rotation_init Init Failed");
         goto failed_comp_screen;
      }
 
@@ -1176,10 +1093,11 @@ e_comp_screen_init()
      }
    e_main_ts_end("\tDBUS Init Done");
 
-   tzsr_client_hook_del = e_client_hook_add(E_CLIENT_HOOK_DEL, _tz_screen_rotation_cb_client_del, NULL);
-
    E_LIST_HANDLER_APPEND(event_handlers, ECORE_EVENT_DEVICE_ADD, _e_comp_screen_cb_input_device_add, comp);
-   E_LIST_HANDLER_APPEND(event_handlers, ECORE_EVENT_DEVICE_DEL, _e_comp_screen_cb_input_device_del, comp);
+   E_LIST_HANDLER_PREPEND(event_handlers, ECORE_EVENT_DEVICE_DEL, _e_comp_screen_cb_input_device_del, comp);
+
+   E_OUTPUT_HOOK_APPEND(output_hooks, E_OUTPUT_HOOK_CONNECT_STATUS_CHANGE, _e_comp_screen_cb_output_connect_status_change, comp);
+   E_OUTPUT_HOOK_APPEND(output_hooks, E_OUTPUT_HOOK_MODE_CHANGE, _e_comp_screen_cb_output_mode_change, comp);
 
    _e_comp_screen_input_rotation_set(e_comp->e_comp_screen->rotation);
 
@@ -1187,6 +1105,7 @@ e_comp_screen_init()
 
 failed_comp_screen:
 
+   e_screen_rotation_shutdown();
    e_comp_wl_tizen_hwc_shutdown();
    e_input_shutdown();
    _e_comp_screen_engine_deinit();
@@ -1200,6 +1119,7 @@ e_comp_screen_shutdown()
    if (!e_comp) return;
    if (!e_comp->e_comp_screen) return;
 
+   e_screen_rotation_shutdown();
    e_comp_wl_tizen_hwc_shutdown();
 
    if (e_comp_screen_iface)
@@ -1218,11 +1138,8 @@ e_comp_screen_shutdown()
 
    _e_comp_screen_deinit_outputs(e_comp->e_comp_screen);
 
-   e_client_hook_del(tzsr_client_hook_del);
-   tzsr_client_hook_del = NULL;
+   E_FREE_LIST(output_hooks, e_output_hook_del);
 
-   dont_set_e_input_keymap = EINA_FALSE;
-   dont_use_xkb_cache = EINA_FALSE;
    E_FREE_LIST(event_handlers, ecore_event_handler_del);
 
    /* delete e_comp_sreen */
@@ -1357,36 +1274,24 @@ e_comp_screen_rotation_setting_set(E_Comp_Screen *e_comp_screen, int rotation)
 E_API void
 e_comp_screen_rotation_ignore_output_transform_send(E_Client *ec, Eina_Bool ignore)
 {
-   E_Comp_Screen_Tzsr *tzsr = _tz_surface_rotation_find(ec);
-
-   if (!tzsr) return;
-
    /* if client have to considers the output transform */
    if (!ignore)
      {
         /* exception */
         if (e_config->screen_rotation_client_ignore)
           {
-             ELOGF("TRANSFORM", "|tzsr(%p) ignore_output_transform: client_ignore", ec, tzsr);
+             ELOGF("TRANSFORM", "|ignore_output_transform: client_ignore", ec);
              return;
           }
 
         if (e_policy_client_is_quickpanel(ec))
            {
-              ELOGF("TRANSFORM", "|tzsr(%p) ignore_output_transform: quickpanel", ec, tzsr);
+              ELOGF("TRANSFORM", "|ignore_output_transform: quickpanel", ec);
               return;
            }
      }
 
-   ELOGF("TRANSFORM", "|tzsr(%p) ignore_output_transform(%d)", ec, tzsr, ignore);
-
-   tizen_screen_rotation_send_ignore_output_transform(tzsr->resource, ec->comp_data->surface, ignore);
-}
-
-EINTERN Eina_Bool
-e_comp_screen_rotation_ignore_output_transform_watch(E_Client *ec)
-{
-   return (_tz_surface_rotation_find(ec)) ? EINA_TRUE : EINA_FALSE;
+   e_screen_rotation_ignore_output_transform_send(ec, ignore);
 }
 
 EINTERN E_Output *
@@ -1653,6 +1558,63 @@ e_comp_screen_available_video_formats_get(const tbm_format **formats, int *count
    return EINA_TRUE;
 }
 
+EINTERN void *
+e_comp_screen_gbm_device_get(E_Comp_Screen *e_comp_screen)
+{
+   int fd;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL);
+
+   if (e_comp_screen->gdevice) return e_comp_screen->gdevice;
+
+   fd = tbm_drm_helper_get_master_fd();
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(fd >= 0, NULL);
+
+   e_comp_screen->gdevice = gbm_create_device(fd);
+   if (!e_comp_screen->gdevice)
+     {
+        ERR("fail to create gbm device");
+        close(fd);
+        return NULL;
+     }
+
+   e_comp_screen->gdevice_fd = fd;
+
+   return e_comp_screen->gdevice;
+}
+
+EINTERN Eina_Bool
+e_comp_screen_size_get(E_Comp_Screen *e_comp_screen, int *w, int *h)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
+
+   if (w) *w = e_comp_screen->w;
+   if (h) *h = e_comp_screen->h;
+
+   return EINA_TRUE;
+}
+static char *
+_e_comp_screen_dpms_to_string(E_OUTPUT_DPMS dpms)
+{
+   switch (dpms)
+     {
+        case E_OUTPUT_DPMS_ON:
+          return "DPMS_ON";
+          break;
+        case E_OUTPUT_DPMS_STANDBY:
+          return "DPMS_STANDBY";
+          break;
+        case E_OUTPUT_DPMS_SUSPEND:
+          return "DPMS_SUSPEND";
+          break;
+        case E_OUTPUT_DPMS_OFF:
+          return "DPMS_OFF";
+          break;
+        default:
+          return "Unknown";
+     }
+}
+
 EINTERN void
 e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter)
 {
@@ -1662,7 +1624,6 @@ e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter)
    E_Hwc *hwc = NULL;
    Eina_List *l;
    char info_str[1024];
-   int idx = 0;
 
    e_comp_screen = e_comp->e_comp_screen;
 
@@ -1677,13 +1638,11 @@ e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter)
      }
 
    eldbus_message_iter_basic_append(line_array, 's',
-   "==========================================================================================="
-   "=============================================================");
+   "===========================================================================================");
    eldbus_message_iter_basic_append(line_array, 's',
-   " idx   maker   model   name   type   status   dpms   subpixel   align_w   min   max   phy(mm)");
+   " idx      id           status       dpms     (   x  ,   y  ) ( w    x    h ) ");
    eldbus_message_iter_basic_append(line_array, 's',
-   "==========================================================================================="
-   "=============================================================");
+   "===========================================================================================");
 
    EINA_LIST_FOREACH(e_comp_screen->outputs, l, output)
      {
@@ -1692,14 +1651,26 @@ e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter)
         if (!output->hwc) continue;
         if (e_hwc_policy_get(hwc) == E_HWC_POLICY_NONE) continue;
 
-        // TODO: need to implement more to show the specific information
-        snprintf(info_str, sizeof(info_str), "%d, %s", ++idx, "NOT IMPLEMENTED YET~!!! TODO::::");
+        snprintf(info_str, sizeof(info_str), "%2d %12s %15s %10s   (%5d , %5d) (%5d x %5d)",
+                 output->index, output->id,
+                 output->info.connected ? "connected" : "disconnected",
+                 _e_comp_screen_dpms_to_string(output->dpms),
+                 output->config.geom.x, output->config.geom.y,
+                 output->config.geom.w, output->config.geom.h);
+
         eldbus_message_iter_basic_append(line_array, 's', info_str);
      }
 
    eldbus_message_iter_basic_append(line_array, 's',
-   "==========================================================================================="
-   "=============================================================");
+   "===========================================================================================");
 
    eldbus_message_iter_container_close(iter, line_array);
 }
+
+E_API Eina_List *
+e_comp_screen_outputs_get(E_Comp_Screen *e_comp_screen)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL);
+
+   return e_comp_screen->outputs;
+}