zoom code ...
authorJunkyeong Kim <jk0430.kim@samsung.com>
Tue, 30 May 2017 07:55:49 +0000 (16:55 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 26 Jun 2017 08:29:52 +0000 (17:29 +0900)
e_comp: make hwc_multi_plane enable and disable

use e_comp's hwc_use_multi_plane flag instead of conf->hwc_use_multi_plane.
make two function for this flag setting.(e_comp_hwc_get_multi_plane_usable, e_comp_hwc_use_multi_plane)

Change-Id: If5eb0cbbc3f8e12dda85b6f30a33d01dceae694a
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
Signed-off-by: SooChan Lim <sc1.lim@samsung.com>
e_plane: support accessibility zoom

use tdm pp for zoom.
make another surface queue for pp dst.
convert original surface to created surface by pp and set converted surface to tdm layer.
default enable: see configure.ac

Change-Id: I95f3f4839aa208c6ed587e4e6d6a9fa89a04c55f
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
e_output: support accessibility zoom

if multi plane enabled, set using only primary layer.
make primary_layer set pp convert by 'e_plane_zoom_set'

Change-Id: Iad0bce98aa7fa4f3a26aee02dcf915181ce938de
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
e_desk: support accessibility zoom by pp

if e_config->use_desk_smart_obj is not set, use tdm pp for accessibility zoom.
if smart_obj is set, do not use tdm pp for zoom.

Change-Id: Id17c227aec0c05e1866bf544b55ee64c51e5ef9e
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
refactoring

Change-Id: I8ba0104753367715e81cf8a09e8e3fd5c90d8600

zoom patch

Change-Id: Iab861e8f13f796930c1fcd7fbe2cb0e66f62d7f4
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
zoom patch: support zoom set and unset showing

Change-Id: I2c9994ac2353a366b4cfd6b8dc3ec11da3a3f7dc
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
zoom: fix lock up

Change-Id: I7b54df08694c451ac949f2e239862cae255d5fcf
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
configure.ac
src/bin/e_desk.c
src/bin/e_output.c
src/bin/e_output.h
src/bin/e_plane.c
src/bin/e_plane.h

index 1de73f1a5934377653d5fac1542fc6bdb740f5f6..7771ce5ef5e74a8f45c5ed0f38d886fb68527beb 100755 (executable)
@@ -429,6 +429,10 @@ if test "x${have_wayland}" = "xyes"; then
   else
     have_hwc=no
   fi
+
+  if test "x$have_hwc" = "xyes";then
+    AC_DEFINE_UNQUOTED([HAVE_ZOOM_PP], [1], [enable pp_zoom support])
+  fi
 fi
 
 # does this compiler support -fopenmp, does it have the include file
index 1ec3db57a6b237191262d5d59c23e16434096213..a896b9fbb03448a9ba41f52b7d4da52d961afca8 100644 (file)
@@ -821,42 +821,60 @@ e_desk_zoom_set(E_Desk *desk, double zoomx, double zoomy, int cx, int cy)
 {
    E_Client *ec;
    Eina_List *l;
-
-   if (!e_config->use_desk_smart_obj)
-     {
-        DBG("Do nothing, Desk Smart Object is disabled");
-        return;
-     }
+#ifdef HAVE_ZOOM_PP
+   E_Zone *zone = NULL;
+   E_Output *eout = NULL;
+#endif
 
    E_OBJECT_CHECK(desk);
    E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
 
-   E_DESK_SMART_DATA_GET_OR_RETURN(desk->smart_obj, sd);
-
-   if ((sd->zoom.ratio_x != zoomx) || (sd->zoom.ratio_y != zoomy) ||
-       (sd->zoom.center_x != cx) || (sd->zoom.center_y != cy))
+   if (e_config->use_desk_smart_obj)
      {
-        sd->zoom.ratio_x = zoomx;
-        sd->zoom.ratio_y = zoomy;
-        sd->zoom.center_x = cx;
-        sd->zoom.center_y = cy;
+        E_DESK_SMART_DATA_GET_OR_RETURN(desk->smart_obj, sd);
 
-        _e_desk_object_zoom(desk->smart_obj, zoomx, zoomy, cx, cy);
-        EINA_LIST_FOREACH(sd->clients, l, ec)
-           _e_desk_client_zoom(ec, zoomx, zoomy, cx, cy);
-     }
+        if ((sd->zoom.ratio_x != zoomx) || (sd->zoom.ratio_y != zoomy) ||
+            (sd->zoom.center_x != cx) || (sd->zoom.center_y != cy))
+          {
+             sd->zoom.ratio_x = zoomx;
+             sd->zoom.ratio_y = zoomy;
+             sd->zoom.center_x = cx;
+             sd->zoom.center_y = cy;
+
+             _e_desk_object_zoom(desk->smart_obj, zoomx, zoomy, cx, cy);
+             EINA_LIST_FOREACH(sd->clients, l, ec)
+               _e_desk_client_zoom(ec, zoomx, zoomy, cx, cy);
+          }
 
-   if (!sd->zoom.enabled)
-     {
-        sd->zoom.enabled = EINA_TRUE;
+        if (!sd->zoom.enabled)
+          {
+             sd->zoom.enabled = EINA_TRUE;
 
-        evas_object_map_enable_set(desk->smart_obj, EINA_TRUE);
-        EINA_LIST_FOREACH(sd->clients, l, ec)
-           evas_object_map_enable_set(ec->frame, EINA_TRUE);
+             evas_object_map_enable_set(desk->smart_obj, EINA_TRUE);
+             EINA_LIST_FOREACH(sd->clients, l, ec)
+               evas_object_map_enable_set(ec->frame, EINA_TRUE);
 
-        /* FIXME TEMP disable hwc */
-        _e_desk_util_comp_hwc_disable_set(EINA_TRUE);
+             /* FIXME TEMP disable hwc */
+             _e_desk_util_comp_hwc_disable_set(EINA_TRUE);
+          }
+     }
+#ifdef HAVE_ZOOM_PP
+   else
+     {
+        /* use PP */
+        zone = desk->zone;
+        eout = e_output_find(zone->output_id);
+        if (!eout)
+          {
+             ERR("e_desk_zoom_set: fail get eout");
+             return;
+          }
+        if (!e_output_zoom_set(eout, zoomx, zoomy, cx, cy))
+          ERR("e_desk_zoom_set: fail zoom set");
+        else
+          DBG("e_desk_zoom_set: zoomx:%f, zoomy:%f, x:%d, y:%d", zoomx, zoomy, cx, cy);
      }
+#endif
 }
 
 E_API void
@@ -864,37 +882,56 @@ e_desk_zoom_unset(E_Desk *desk)
 {
    E_Client *ec;
    Eina_List *l;
-
-   if (!e_config->use_desk_smart_obj)
-     {
-        DBG("Do nothing, Desk Smart Object is disabled");
-        return;
-     }
+#ifdef HAVE_ZOOM_PP
+   E_Zone *zone = NULL;
+   E_Output *eout = NULL;
+#endif
 
    E_OBJECT_CHECK(desk);
    E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
 
-   E_DESK_SMART_DATA_GET_OR_RETURN(desk->smart_obj, sd);
+   if (e_config->use_desk_smart_obj)
+     {
+        E_DESK_SMART_DATA_GET_OR_RETURN(desk->smart_obj, sd);
 
-   if (!sd->zoom.enabled)
-     return;
+        if (!sd->zoom.enabled)
+          return;
 
-   sd->zoom.ratio_x = 1.0;
-   sd->zoom.ratio_y = 1.0;
-   sd->zoom.enabled = EINA_FALSE;
+        sd->zoom.ratio_x = 1.0;
+        sd->zoom.ratio_y = 1.0;
+        sd->zoom.center_x = 0;
+        sd->zoom.center_y = 0;
+        sd->zoom.enabled = EINA_FALSE;
 
-   evas_object_map_enable_set(desk->smart_obj, EINA_FALSE);
-   EINA_LIST_FOREACH(sd->clients, l, ec)
-     {
-        /* NOTE Is it really necessary?
-         * Why isn't it enough to just call evas_object_map_enable_set(false)? */
-        _e_desk_client_zoom(ec, sd->zoom.ratio_x, sd->zoom.ratio_y,
-                            sd->zoom.center_x, sd->zoom.center_y);
-        evas_object_map_enable_set(ec->frame, EINA_FALSE);
+        evas_object_map_enable_set(desk->smart_obj, EINA_FALSE);
+        EINA_LIST_FOREACH(sd->clients, l, ec)
+          {
+             /* NOTE Is it really necessary?
+              * Why isn't it enough to just call evas_object_map_enable_set(false)? */
+             _e_desk_client_zoom(ec, sd->zoom.ratio_x, sd->zoom.ratio_y,
+                                 sd->zoom.center_x, sd->zoom.center_y);
+             evas_object_map_enable_set(ec->frame, EINA_FALSE);
+          }
+
+        /* FIXME TEMP enable hwc */
+        _e_desk_util_comp_hwc_disable_set(EINA_FALSE);
      }
+#ifdef HAVE_ZOOM_PP
+   else
+     {
+        /* use PP */
+        zone = desk->zone;
+        eout = e_output_find(zone->output_id);
+        if (!eout)
+          {
+             ERR("e_desk_zoom_set: fail get eout");
+             return;
+          }
 
-   /* FIXME TEMP enable hwc */
-   _e_desk_util_comp_hwc_disable_set(EINA_FALSE);
+        e_output_zoom_unset(eout);
+        DBG("e_desk_zoom_unset");
+     }
+#endif
 }
 
 E_API void
index 10dde855d2602547a8095147424aff93ef4b451d..f2c279b4145547c61d37828ce890d19e4ba6f55c 100644 (file)
@@ -669,48 +669,78 @@ e_output_commit(E_Output *output)
    if (fb_commit && (output->dpms == E_OUTPUT_DPMS_OFF))
      e_plane_unfetch(fb_target);
 
-   /* set planes */
-   EINA_LIST_FOREACH(output->planes, l, plane)
+   if (output->zoom_set)
      {
-        /* skip the fb_target fetch because we do this previously */
-        if (e_plane_is_fb_target(plane)) continue;
+        /* commit only primary */
+        if (!fb_commit)
+          {
+             ERR("fb_commit is failed.");
+             return EINA_FALSE;
+          }
 
-        /* if the plane is the candidate to unset,
-           set the plane to be unset_try */
-        if (e_plane_is_unset_candidate(plane))
-          e_plane_unset_try_set(plane, EINA_TRUE);
+        /* do not execute the tdm functions */
+        e_plane_activation_set(plane, EINA_FALSE);
 
-        /* if the plane is trying to unset,
-           1. if fetching the fb is not available, continue.
-           2. if fetching the fb is available, verify the unset commit check.  */
-        if (e_plane_is_unset_try(plane))
+        if (!e_plane_fetch(plane))
           {
-            if (!fb_commit) continue;
-            if (!e_plane_unset_commit_check(plane)) continue;
+//            ERR("fail to fetch the plane.");
+            return EINA_FALSE;
           }
 
-        /* fetch the surface to the plane */
-        if (!e_plane_fetch(plane)) continue;
-
-        if (output->dpms == E_OUTPUT_DPMS_OFF)
-          e_plane_unfetch(plane);
+        if (!e_plane_commit(plane))
+          ERR("fail to e_plane_commit");
 
-        if (e_plane_is_unset_try(plane))
-          e_plane_unset_try_set(plane, EINA_FALSE);
+        if (!e_plane_zoom_commit(plane))
+          ERR("fail to e_plane_zoom_commit");
      }
+   else
+     {
+        /* set planes */
+        EINA_LIST_FOREACH(output->planes, l, plane)
+          {
+             /* skip the fb_target fetch because we do this previously */
+             if (e_plane_is_fb_target(plane)) continue;
 
-   if (output->dpms == E_OUTPUT_DPMS_OFF) return EINA_TRUE;
+             /* execute the tdm functions */
+             e_plane_activation_set(plane, EINA_TRUE);
 
-   EINA_LIST_FOREACH(output->planes, l, plane)
-     {
-        if (e_plane_is_unset_try(plane)) continue;
+             /* if the plane is the candidate to unset,
+                set the plane to be unset_try */
+             if (e_plane_is_unset_candidate(plane))
+               e_plane_unset_try_set(plane, EINA_TRUE);
 
-        if (!e_plane_commit(plane))
-          ERR("fail to e_plane_commit");
+             /* if the plane is trying to unset,
+                1. if fetching the fb is not available, continue.
+                2. if fetching the fb is available, verify the unset commit check.  */
+             if (e_plane_is_unset_try(plane))
+               {
+                 if (!fb_commit) continue;
+                 if (!e_plane_unset_commit_check(plane)) continue;
+               }
 
-        // TODO: to be fixed. check fps of fb_target currently.
-        if (fb_commit) _e_output_update_fps();
-     }
+             /* fetch the surface to the plane */
+             if (!e_plane_fetch(plane)) continue;
+
+             if (output->dpms == E_OUTPUT_DPMS_OFF)
+               e_plane_unfetch(plane);
+
+             if (e_plane_is_unset_try(plane))
+               e_plane_unset_try_set(plane, EINA_FALSE);
+          }
+
+        if (output->dpms == E_OUTPUT_DPMS_OFF) return EINA_TRUE;
+
+        EINA_LIST_FOREACH(output->planes, l, plane)
+          {
+             if (e_plane_is_unset_try(plane)) continue;
+
+             if (!e_plane_commit(plane))
+               ERR("fail to e_plane_commit");
+
+             // TODO: to be fixed. check fps of fb_target currently.
+             if (fb_commit) _e_output_update_fps();
+          }
+    }
 
    return EINA_TRUE;
 }
@@ -873,3 +903,166 @@ e_output_plane_get_by_zpos(E_Output *output, int zpos)
 
    return NULL;
 }
+
+#ifdef HAVE_ZOOM_PP
+#ifdef HAVE_TOUCH_TRANSFORM
+static Eina_Bool
+_e_output_zoom_touch_set(E_Plane *plane, Eina_Bool set)
+{
+   Ecore_Drm_Device *dev = NULL;
+   Eina_Bool ret = EINA_FALSE;
+   const Eina_List *l;
+   Ecore_Drm_Output *primary_output = NULL;
+   int w, h;
+
+   EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev)
+     {
+        primary_output = ecore_drm_output_primary_get(dev);
+        if (primary_output != NULL)
+          break;
+     }
+
+   if (!primary_output)
+     {
+        ERR("fail get primary_output");
+        return EINA_FALSE;
+     }
+
+   if (set)
+     ret = ecore_drm_device_touch_transformation_set(dev,
+                                                     plane->zoom_rect.x, plane->zoom_rect.y,
+                                                     plane->zoom_rect.w, plane->zoom_rect.h);
+   else
+     {
+        e_output_size_get(plane->output, &w, &h);
+        ret = ecore_drm_device_touch_transformation_set(dev, 0, 0, e_comp->w, e_comp->h);
+     }
+
+   if (ret != EINA_TRUE)
+     ERR("fail ecore_drm_device_touch_transformation_set");
+
+   return ret;
+}
+#endif //HAVE_TOUCH_TRANSFORM
+
+static void
+_e_output_zoom_scaled_rect_get(int out_w, int out_h, double zoomx, double zoomy, int cx, int cy, Eina_Rectangle *rect)
+{
+   double x, y;
+   double dx, dy;
+
+   rect->w = (int)((double)out_w / zoomx);
+   rect->h = (int)((double)out_h / zoomy);
+
+   x = 0 - cx;
+   y = 0 - cy;
+
+   x = (((double)x) * zoomx);
+   y = (((double)y) * zoomy);
+
+   x = x + cx;
+   y = y + cy;
+
+   if (x == 0)
+     dx = 0;
+   else
+     dx = 0 - x;
+
+   if (y == 0)
+     dy = 0;
+   else
+     dy = 0 - y;
+
+   rect->x = (int)(dx / zoomx);
+   rect->y = (int)(dy / zoomy);
+}
+
+EINTERN Eina_Bool
+e_output_zoom_set(E_Output *eout, double zoomx, double zoomy, int cx, int cy)
+{
+   E_Zone *zone = NULL;
+   E_Plane *ep = NULL;
+   Eina_List *l;
+   Eina_Rectangle rect = {0, };
+   int w, h;
+
+   if (!e_comp_screen_pp_support())
+     {
+        WRN("Comp Screen does not support the Zoom.");
+        return EINA_FALSE;
+     }
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eout, EINA_FALSE);
+
+   e_output_size_get(eout, &w, &h);
+
+   EINA_SAFETY_ON_FALSE_RETURN_VAL((cx >= 0 || cy >= 0), EINA_FALSE);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL((cx < w || cy < h), EINA_FALSE);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL((zoomx > 0 || zoomy > 0), EINA_FALSE);
+
+   ep = e_output_fb_target_get(eout);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ep, EINA_FALSE);
+
+#ifdef ENABLE_HWC_MULTI
+   e_comp_hwc_multi_plane_set(EINA_FALSE);
+#endif
+
+   DBG("set zoom (zoomx:%f,zoomy:%f) (w:%d,h:%d)", zoomx, zoomy, cx, cy);
+
+   /* get the scaled rect */
+   _e_output_zoom_scaled_rect_get(w, h, zoomx, zoomy, cx, cy, &rect);
+   DBG("zoom_rect (x:%d,y:%d) (w:%d,h:%d)", rect.x, rect.y, rect.w, rect.h);
+
+   if (!e_plane_zoom_set(ep, &rect))
+     {
+        ERR("e_plane_zoom_set failed.");
+#ifdef ENABLE_HWC_MULTI
+        e_comp_hwc_multi_plane_set(EINA_TRUE);
+#endif
+        return EINA_FALSE;
+     }
+
+#ifdef HAVE_TOUCH_TRANSFORM
+   //test position
+   if (!_e_output_zoom_touch_set(plane, EINA_TRUE))
+     ERR("fail _e_output_zoom_touch_set");
+#endif
+
+   if (!eout->zoom_set) eout->zoom_set = EINA_TRUE;
+   DBG("zoom set output:%s", eout->id);
+
+   return EINA_TRUE;
+}
+
+EINTERN void
+e_output_zoom_unset(E_Output *eout)
+{
+   E_Zone *zone = NULL;
+   E_Plane *ep = NULL;
+   Eina_List *l;
+   Eina_Bool ret = EINA_FALSE;
+
+   EINA_SAFETY_ON_NULL_RETURN(eout);
+
+   if (!eout->zoom_set) return;
+
+   ep = e_output_fb_target_get(eout);
+   EINA_SAFETY_ON_NULL_RETURN(ep);
+
+#ifdef HAVE_TOUCH_TRANSFORM
+   //test position
+   if (!_e_output_zoom_touch_set(plane, EINA_FALSE))
+     ERR("fail _e_output_zoom_touch_set");
+#endif
+
+   e_plane_zoom_unset(ep);
+
+   eout->zoom_set = EINA_FALSE;
+
+#ifdef ENABLE_HWC_MULTI
+   e_comp_hwc_multi_plane_set(EINA_TRUE);
+#endif
+
+   DBG("e_output_zoom_unset: output:%s", eout->id);
+}
+#endif
index a59b70eb823c40f3fe7721e179d4c699442212ae..9b288ca9731c8430ae4e8fe96c2a2059f89be2b8 100644 (file)
@@ -65,6 +65,9 @@ struct _E_Output
        int max_w, max_h;
        int preferred_align;
    } cursor_available;
+#ifdef HAVE_ZOOM_PP
+   Eina_Bool            zoom_set;
+#endif
 };
 
 EINTERN Eina_Bool         e_output_init(void);
@@ -90,5 +93,10 @@ E_API Eina_Bool           e_output_is_fb_full_compositing(E_Output *output);
 E_API E_Plane           * e_output_fb_target_get(E_Output *output);
 E_API E_Plane           * e_output_plane_get_by_zpos(E_Output *output, int zpos);
 
+#ifdef HAVE_ZOOM_PP
+EINTERN Eina_Bool         e_output_zoom_set(E_Output *eout, double zoomx, double zoomy, int cx, int cy);
+EINTERN void              e_output_zoom_unset(E_Output *eout);
+#endif
+
 #endif
 #endif
index 53c8bb562af2226598b4afefb97b87cc54b65a49..2ef7bbec4e807a1009026e3ac6112428ef212500 100644 (file)
@@ -98,11 +98,14 @@ _e_plane_surface_unset(E_Plane *plane)
 
    CLEAR(plane->info);
 
-   error = tdm_layer_unset_buffer(tlayer);
-   if (error != TDM_ERROR_NONE)
+   if (plane->activation)
      {
-        ERR("fail to tdm_layer_unset_buffer");
-        return EINA_FALSE;
+        error = tdm_layer_unset_buffer(tlayer);
+        if (error != TDM_ERROR_NONE)
+          {
+              ERR("fail to tdm_layer_unset_buffer");
+              return EINA_FALSE;
+          }
      }
 
    return EINA_TRUE;
@@ -136,18 +139,12 @@ _e_plane_ev(E_Plane *ep, int type)
    ep->need_ev = EINA_FALSE;
 }
 
-static Eina_Bool
-_e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
+static unsigned int
+_e_plane_aligned_width_get(tbm_surface_h tsurface)
 {
+   unsigned int aligned_width = 0;
    tbm_surface_info_s surf_info;
-   tdm_error error;
-   tdm_layer *tlayer = plane->tlayer;
-   E_Output *output = plane->output;
-   E_Client *ec = plane->ec;
-   int aligned_width;
-   int dst_pos_x, dst_pos_y;
 
-   /* set layer when the layer infomation is different from the previous one */
    tbm_surface_get_info(tsurface, &surf_info);
 
    switch (surf_info.format)
@@ -170,9 +167,28 @@ _e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
         break;
       default:
         ERR("not supported format: %x", surf_info.format);
-        return EINA_FALSE;
      }
 
+   return aligned_width;
+}
+
+static Eina_Bool
+_e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
+{
+   tbm_surface_info_s surf_info;
+   tdm_error error;
+   tdm_layer *tlayer = plane->tlayer;
+   E_Output *output = plane->output;
+   E_Client *ec = plane->ec;
+   unsigned int aligned_width;
+   int dst_x, dst_y, dst_w, dst_h;
+
+   /* set layer when the layer infomation is different from the previous one */
+   tbm_surface_get_info(tsurface, &surf_info);
+
+   aligned_width = _e_plane_aligned_width_get(tsurface);
+   if (aligned_width == 0) return EINA_FALSE;
+
    if (ec)
      {
         if (plane->role == E_PLANE_ROLE_CURSOR)
@@ -184,13 +200,13 @@ _e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
                   return EINA_FALSE;
                }
 
-             dst_pos_x = pointer->x - pointer->hot.x;
-             dst_pos_y = pointer->y - pointer->hot.y;
+             dst_x = pointer->x - pointer->hot.x;
+             dst_y = pointer->y - pointer->hot.y;
           }
         else
           {
-             dst_pos_x = ec->x;
-             dst_pos_y = ec->y;
+             dst_x = ec->x;
+             dst_y = ec->y;
           }
 
         /* if output is transformed, the position of a buffer on screen should be also
@@ -202,68 +218,46 @@ _e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
              e_pixmap_size_get(ec->pixmap, &bw, &bh);
              e_comp_wl_rect_convert(ec->zone->w, ec->zone->h,
                                     output->config.rotation / 90, 1,
-                                    dst_pos_x, dst_pos_y, bw, bh,
-                                    &dst_pos_x, &dst_pos_y, NULL, NULL);
-          }
-
-        if (plane->info.src_config.size.h != aligned_width ||
-            plane->info.src_config.size.v != surf_info.height ||
-            plane->info.src_config.pos.x != 0 ||
-            plane->info.src_config.pos.y != 0 ||
-            plane->info.src_config.pos.w != surf_info.width ||
-            plane->info.src_config.pos.h != surf_info.height ||
-            plane->info.dst_pos.x != dst_pos_x ||
-            plane->info.dst_pos.y != dst_pos_y ||
-            plane->info.dst_pos.w != surf_info.width ||
-            plane->info.dst_pos.h != surf_info.height ||
-            plane->info.transform != TDM_TRANSFORM_NORMAL)
-          {
-             plane->info.src_config.size.h = aligned_width;
-             plane->info.src_config.size.v = surf_info.height;
-             plane->info.src_config.pos.x = 0;
-             plane->info.src_config.pos.y = 0;
-             plane->info.src_config.pos.w = surf_info.width;
-             plane->info.src_config.pos.h = surf_info.height;
-             plane->info.dst_pos.x = dst_pos_x;
-             plane->info.dst_pos.y = dst_pos_y;
-             plane->info.dst_pos.w = surf_info.width;
-             plane->info.dst_pos.h = surf_info.height;
-             plane->info.transform = TDM_TRANSFORM_NORMAL;
-
-             error = tdm_layer_set_info(tlayer, &plane->info);
-             if (error != TDM_ERROR_NONE)
-               {
-                  ERR("fail to tdm_layer_set_info");
-                  return EINA_FALSE;
-               }
+                                    dst_x, dst_y, bw, bh,
+                                    &dst_x, &dst_y, NULL, NULL);
           }
+        dst_w = surf_info.width;
+        dst_h = surf_info.height;
      }
    else
      {
-        if (plane->info.src_config.size.h != aligned_width ||
-            plane->info.src_config.size.v != surf_info.height ||
-            plane->info.src_config.pos.x != 0 ||
-            plane->info.src_config.pos.y != 0 ||
-            plane->info.src_config.pos.w != surf_info.width ||
-            plane->info.src_config.pos.h != surf_info.height ||
-            plane->info.dst_pos.x != output->config.geom.x ||
-            plane->info.dst_pos.y != output->config.geom.y ||
-            plane->info.dst_pos.w != output->config.geom.w ||
-            plane->info.dst_pos.h != output->config.geom.h ||
-            plane->info.transform != TDM_TRANSFORM_NORMAL)
-          {
-             plane->info.src_config.size.h = aligned_width;
-             plane->info.src_config.size.v = surf_info.height;
-             plane->info.src_config.pos.x = 0;
-             plane->info.src_config.pos.y = 0;
-             plane->info.src_config.pos.w = surf_info.width;
-             plane->info.src_config.pos.h = surf_info.height;
-             plane->info.dst_pos.x = output->config.geom.x;
-             plane->info.dst_pos.y = output->config.geom.y;
-             plane->info.dst_pos.w = output->config.geom.w;
-             plane->info.dst_pos.h = output->config.geom.h;
-             plane->info.transform = TDM_TRANSFORM_NORMAL;
+        dst_x = output->config.geom.x;
+        dst_y = output->config.geom.y;
+        dst_w = output->config.geom.w;
+        dst_h = output->config.geom.h;
+     }
 
+   if (plane->info.src_config.size.h != aligned_width ||
+       plane->info.src_config.size.v != surf_info.height ||
+       plane->info.src_config.pos.x != 0 ||
+       plane->info.src_config.pos.y != 0 ||
+       plane->info.src_config.pos.w != surf_info.width ||
+       plane->info.src_config.pos.h != surf_info.height ||
+       plane->info.dst_pos.x != dst_x ||
+       plane->info.dst_pos.y != dst_y ||
+       plane->info.dst_pos.w != dst_w ||
+       plane->info.dst_pos.h != dst_h ||
+       plane->info.transform != TDM_TRANSFORM_NORMAL)
+     {
+        plane->info.src_config.size.h = aligned_width;
+        plane->info.src_config.size.v = surf_info.height;
+        plane->info.src_config.pos.x = 0;
+        plane->info.src_config.pos.y = 0;
+        plane->info.src_config.pos.w = surf_info.width;
+        plane->info.src_config.pos.h = surf_info.height;
+        plane->info.dst_pos.x = dst_x;
+        plane->info.dst_pos.y = dst_y;
+        plane->info.dst_pos.w = dst_w;
+        plane->info.dst_pos.h = dst_h;
+        plane->info.transform = TDM_TRANSFORM_NORMAL;
+
+        if (plane->activation)
+          {
              error = tdm_layer_set_info(tlayer, &plane->info);
              if (error != TDM_ERROR_NONE)
                {
@@ -284,11 +278,14 @@ _e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
               plane->info.dst_pos.w, plane->info.dst_pos.h);
      }
 
-   error = tdm_layer_set_buffer(tlayer, tsurface);
-   if (error != TDM_ERROR_NONE)
+   if (plane->activation)
      {
-        ERR("fail to tdm_layer_set_buffer");
-        return EINA_FALSE;
+        error = tdm_layer_set_buffer(tlayer, tsurface);
+        if (error != TDM_ERROR_NONE)
+          {
+             ERR("fail to tdm_layer_set_buffer");
+             return EINA_FALSE;
+          }
      }
 
    _e_plane_ev(plane, E_EVENT_PLANE_WIN_CHANGE);
@@ -639,6 +636,7 @@ e_plane_new(E_Output *output, int index)
    tdm_layer_get_zpos(tlayer, &zpos);
    plane->zpos = zpos;
    plane->output = output;
+   plane->activation = EINA_TRUE;
 
    tdm_err = tdm_layer_get_buffer_flags(plane->tlayer, &buffer_flags);
    if (tdm_err == TDM_ERROR_NONE)
@@ -908,6 +906,23 @@ _e_plane_commit_hanler(tdm_layer *layer, unsigned int sequence,
    e_plane_commit_data_release(data);
 }
 
+static void
+_e_plane_zoom_destroy(E_Plane *plane)
+{
+   if (plane->zoom_tqueue)
+     {
+        tbm_surface_queue_destroy(plane->zoom_tqueue);
+        plane->zoom_tqueue = NULL;
+     }
+   if (plane->tpp)
+     {
+        tdm_pp_destroy(plane->tpp);
+        plane->tpp = NULL;
+     }
+
+   ERR("_e_plane_zoom_destroy done");
+}
+
 EINTERN Eina_Bool
 e_plane_commit(E_Plane *plane)
 {
@@ -916,6 +931,15 @@ e_plane_commit(E_Plane *plane)
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(plane, EINA_FALSE);
 
+   if (plane->is_primary)
+     {
+        if (plane->zoom_tsurface)
+          {
+             if (!tbm_surface_queue_can_dequeue(plane->zoom_tqueue, 0))
+               return EINA_TRUE;
+          }
+     }
+
    data = e_plane_commit_data_aquire(plane);
 
    if (!data) return EINA_TRUE;
@@ -927,24 +951,46 @@ e_plane_commit(E_Plane *plane)
            NULL, NULL, plane, plane->zpos, data->tsurface, plane->renderer ? plane->renderer->tqueue : NULL,
            data->buffer_ref.buffer ? data->buffer_ref.buffer->resource : NULL, data);
 
-   error = tdm_layer_commit(plane->tlayer, _e_plane_commit_hanler, data);
-   if (error != TDM_ERROR_NONE)
+   if (plane->activation)
      {
-        ERR("fail to tdm_layer_commit plane:%p, zpos:%d", plane, plane->zpos);
-        e_plane_commit_data_release(data);
-        return EINA_FALSE;
-     }
+        error = tdm_layer_commit(plane->tlayer, _e_plane_commit_hanler, data);
+        if (error != TDM_ERROR_NONE)
+          {
+             ERR("fail to tdm_layer_commit plane:%p, zpos:%d", plane, plane->zpos);
+             e_plane_commit_data_release(data);
+             return EINA_FALSE;
+          }
 
-   error = tdm_output_wait_vblank(plane->output->toutput, 1, 0, _e_plane_vblank_handler, (void *)plane);
-   if (error != TDM_ERROR_NONE)
-     {
-        ERR("fail to tdm_output_wait_vblank plane:%p, zpos:%d", plane, plane->zpos);
-        return EINA_FALSE;
-     }
+        error = tdm_output_wait_vblank(plane->output->toutput, 1, 0, _e_plane_vblank_handler, (void *)plane);
+        if (error != TDM_ERROR_NONE)
+          {
+             ERR("fail to tdm_output_wait_vblank plane:%p, zpos:%d", plane, plane->zpos);
+             return EINA_FALSE;
+          }
 
-    /* send frame event enlightenment dosen't send frame evnet in nocomp */
-    if (plane->ec)
-      e_pixmap_image_clear(plane->ec->pixmap, 1);
+        /* send frame event enlightenment dosen't send frame evnet in nocomp */
+        if (plane->ec)
+           e_pixmap_image_clear(plane->ec->pixmap, 1);
+
+        if (plane->zoom_unset)
+          {
+             if (plane->is_primary)
+               {
+                  if (plane->zoom_tsurface)
+                    {
+                       tbm_surface_queue_release(plane->zoom_tqueue, plane->zoom_tsurface);
+                       tbm_surface_internal_unref(plane->zoom_tsurface);
+
+                       plane->zoom_tsurface = NULL;
+                    }
+                  if (eina_list_count(plane->pending_commit_zoom_data_list) == 0)
+                    {
+                       _e_plane_zoom_destroy(plane);
+                       plane->zoom_unset = EINA_FALSE;
+                    }
+               }
+          }
+     }
 
    plane->wait_commit = EINA_TRUE;
 
@@ -1492,3 +1538,604 @@ e_plane_show_state(E_Plane *plane)
    if (plane->renderer)
      e_plane_renderer_show_state(plane->renderer);
 }
+
+EINTERN void
+e_plane_activation_set(E_Plane *plane, Eina_Bool set)
+{
+   EINA_SAFETY_ON_NULL_RETURN(plane);
+
+   if (plane->activation == set) return;
+
+   plane->activation = set;
+
+   ELOGF("E_PLANE", "Plane(%p) activation set to be %s",
+         NULL, NULL, plane, set?"True":"False");
+}
+
+static Eina_Bool
+_e_plane_tdm_info_changed_check(E_Plane *plane, unsigned int size_w, unsigned int size_h,
+                              unsigned int src_x, unsigned int src_y, unsigned int src_w, unsigned int src_h,
+                              unsigned int dst_x, unsigned int dst_y, unsigned int dst_w, unsigned int dst_h,
+                              tdm_transform transform)
+{
+   if (plane->info.src_config.size.h != size_w ||
+       plane->info.src_config.size.v != size_h ||
+       plane->info.src_config.pos.x != src_x ||
+       plane->info.src_config.pos.y != src_y ||
+       plane->info.src_config.pos.w != src_w ||
+       plane->info.src_config.pos.h != src_h ||
+       plane->info.dst_pos.x != dst_x ||
+       plane->info.dst_pos.y != dst_y ||
+       plane->info.dst_pos.w != dst_w ||
+       plane->info.dst_pos.h != dst_h ||
+       plane->info.transform != transform)
+     return EINA_TRUE;
+
+   return EINA_FALSE;
+}
+
+static void
+_e_plane_tdm_info_set(E_Plane *plane, unsigned int size_w, unsigned int size_h,
+                          unsigned int src_x, unsigned int src_y, unsigned int src_w, unsigned int src_h,
+                          unsigned int dst_x, unsigned int dst_y, unsigned int dst_w, unsigned int dst_h,
+                          tdm_transform transform)
+{
+   plane->info.src_config.size.h = size_w;
+   plane->info.src_config.size.v = size_h;
+   plane->info.src_config.pos.x = src_x;
+   plane->info.src_config.pos.y = src_y;
+   plane->info.src_config.pos.w = src_w;
+   plane->info.src_config.pos.h = src_h;
+   plane->info.dst_pos.x = dst_x;
+   plane->info.dst_pos.y = dst_y;
+   plane->info.dst_pos.w = dst_w;
+   plane->info.dst_pos.h = dst_h;
+   plane->info.transform = transform;
+}
+
+static void
+_e_plane_zoom_commit_data_release(E_Plane_Pp_Data *data)
+{
+   E_Plane *plane = NULL;
+   tbm_surface_h zoom_tsurface = NULL;
+
+   EINA_SAFETY_ON_NULL_RETURN(data);
+
+   plane = data->plane;
+   zoom_tsurface = data->zoom_tsurface;
+
+   if (plane->zoom_tsurface)
+     {
+        tbm_surface_queue_release(plane->zoom_tqueue, plane->zoom_tsurface);
+
+        tbm_surface_internal_unref(plane->zoom_tsurface);
+     }
+   plane->zoom_tsurface = zoom_tsurface;
+//   plane->zoom_commit = EINA_FALSE;
+#if 0
+   if (plane->zoom_need_unset)
+     {
+        plane->zoom_set = EINA_FALSE;
+        plane->zoom_set_prepare = EINA_FALSE;
+        plane->zoom_need_unset = EINA_FALSE;
+     }
+#endif
+   plane->pending_commit_zoom_data_list = eina_list_remove(plane->pending_commit_zoom_data_list, data);
+
+   free(data);
+}
+
+static void
+_e_plane_zoom_commit_handler(tdm_layer *layer, unsigned int sequence,
+                                  unsigned int tv_sec, unsigned int tv_usec,
+                                  void *user_data)
+{
+   E_Plane_Pp_Data *data = (E_Plane_Pp_Data *)user_data;
+
+   EINA_SAFETY_ON_NULL_RETURN(data);
+
+   TRACE_DS_ASYNC_END((unsigned int)layer, [PLANE:COMMIT~HANDLER]);
+
+   _e_plane_zoom_commit_data_release(data);
+}
+
+static void
+_e_plane_zoom_pp_cb(tdm_pp *pp, tbm_surface_h tsurface_src, tbm_surface_h tsurface_dst, void *user_data)
+{
+   E_Plane_Pp_Data *pp_data = NULL;
+   E_Plane_Commit_Data *data = NULL;
+   E_Plane *plane = NULL;
+   tbm_surface_info_s surf_info;
+   tbm_surface_h zoom_tsurface;
+   tbm_error_e tbm_err;
+   tdm_error tdm_err;
+   tdm_layer *tlayer = NULL;
+   E_Output *output = NULL;
+   unsigned int aligned_width;
+
+   pp_data = (E_Plane_Pp_Data *)user_data;
+   if (!pp_data)
+     {
+        ERR("_e_plane_zoom_pp_cb: fail no pp_data");
+        return;
+     }
+
+   data = pp_data->data;
+   if (!data)
+     ERR("_e_plane_zoom_pp_cb: fail no data");
+
+   plane = pp_data->plane;
+   if (!plane)
+     {
+        ERR("_e_plane_zoom_pp_cb: fail no plane");
+        return;
+     }
+
+   if (data)
+     {
+        if (data->ec)
+          e_pixmap_image_clear(data->ec->pixmap, 1);
+        e_plane_commit_data_release(data);
+        pp_data->data = NULL;
+     }
+
+   plane->pending_commit = EINA_FALSE;
+   if (plane->zoom_unset)
+     {
+        tbm_surface_queue_release(plane->zoom_tqueue, tsurface_dst);
+        tbm_surface_internal_unref(tsurface_dst);
+
+        plane->pending_commit_zoom_data_list = eina_list_remove(plane->pending_commit_zoom_data_list, pp_data);
+
+        free(pp_data);
+
+        return;
+     }
+   
+#if 0
+   plane->zoom_converting = EINA_FALSE;
+   if (plane->zoom_show_current)
+     plane->zoom_show_current = EINA_FALSE;
+#endif
+   tlayer = plane->tlayer;
+   output = plane->output;
+
+   /* set layer when the layer infomation is different from the previous one */
+   tbm_surface_get_info(tsurface_dst, &surf_info);
+
+   aligned_width = _e_plane_aligned_width_get(tsurface_dst);
+   if (aligned_width == 0)
+     {
+        ERR("_e_plane_zoom_pp_cb: aligned_width 0");
+        _e_plane_zoom_commit_data_release(pp_data);
+        return;
+     }
+
+   if (_e_plane_tdm_info_changed_check(plane, aligned_width, surf_info.height, 0, 0, surf_info.width, surf_info.height,
+                                       output->config.geom.x, output->config.geom.y, output->config.geom.w, output->config.geom.h,
+                                       TDM_TRANSFORM_NORMAL))
+     {
+        _e_plane_tdm_info_set(plane, aligned_width, surf_info.height, 0, 0, surf_info.width, surf_info.height,
+                              output->config.geom.x, output->config.geom.y, output->config.geom.w, output->config.geom.h,
+                              TDM_TRANSFORM_NORMAL);
+
+        tdm_err = tdm_layer_set_info(tlayer, &plane->info);
+        if (tdm_err != TDM_ERROR_NONE)
+          {
+             ERR("_e_plane_zoom_pp_cb: fail tdm_layer_set_info");
+             _e_plane_zoom_commit_data_release(pp_data);
+             return;
+          }
+     }
+
+   if (plane_trace_debug)
+     {
+        ELOGF("E_PLANE", "Set     Plane(%p)     tsurface(%p) (%dx%d,[%d,%d,%d,%d]=>[%d,%d,%d,%d])",
+              NULL, NULL, plane, tsurface_dst,
+              plane->info.src_config.size.h, plane->info.src_config.size.h,
+              plane->info.src_config.pos.x, plane->info.src_config.pos.y,
+              plane->info.src_config.pos.w, plane->info.src_config.pos.h,
+              plane->info.dst_pos.x, plane->info.dst_pos.y,
+              plane->info.dst_pos.w, plane->info.dst_pos.h);
+     }
+
+   tbm_err = tbm_surface_queue_enqueue(plane->zoom_tqueue, tsurface_dst);
+   if (tbm_err != TBM_ERROR_NONE)
+     {
+        ERR("_e_plane_zoom_pp_cb : fail tbm_surface_queue_enqueue");
+        _e_plane_zoom_commit_data_release(pp_data);
+        return;
+     }
+
+   tbm_err = tbm_surface_queue_acquire(plane->zoom_tqueue, &zoom_tsurface);
+   if (tbm_err != TBM_ERROR_NONE)
+     {
+        ERR("_e_plane_zoom_pp_cb : fail tbm_surface_queue_acquire");
+        _e_plane_zoom_commit_data_release(pp_data);
+        return;
+     }
+
+   tdm_err = tdm_layer_set_buffer(tlayer, zoom_tsurface);
+   if (tdm_err != TDM_ERROR_NONE)
+     {
+        ERR("fail to tdm_layer_set_buffer");
+        _e_plane_zoom_commit_data_release(pp_data);
+        return;
+     }
+
+   pp_data->zoom_tsurface = zoom_tsurface;
+   pp_data->plane = plane;
+
+//   _e_plane_ev(plane, E_EVENT_PLANE_WIN_CHANGE);
+
+#ifdef HAVE_TOUCH_TRANSFORM
+   //coreect position
+//   if (!_e_plane_zoom_set_touch(plane))
+//     ERR("_e_plane_zoom_pp_cb: fail _e_plane_zoom_set_touch");
+#endif
+
+   tdm_err = tdm_layer_commit(tlayer, _e_plane_zoom_commit_handler, pp_data);
+   if (tdm_err != TDM_ERROR_NONE)
+     {
+        ERR("_e_plane_zoom_pp_cb: fail to tdm_layer_commit plane:%p, zpos:%d", plane, plane->zpos);
+        _e_plane_zoom_commit_data_release(pp_data);
+        return;
+     }
+#if 0
+   tdm_err = tdm_output_wait_vblank(output->toutput, 1, 0, _e_plane_zoom_vblank_handler, (void *)plane);
+   if (tdm_err != TDM_ERROR_NONE)
+     {
+        ERR("_e_plane_zoom_pp_cb: fail to tdm_output_wait_vblank plane:%p, zpos:%d", plane, plane->zpos);
+        return;
+     }
+#endif
+   return;
+}
+
+static Eina_Bool
+_e_plane_zoom_set_pp_info(E_Plane *plane)
+{
+   tdm_info_pp pp_info;
+   tdm_error ret = TDM_ERROR_NONE;
+   unsigned int aligned_width = 0;
+   tbm_surface_info_s surf_info;
+   tbm_surface_h tsurface = plane->tsurface;
+   int dst_w, dst_h;
+
+   tbm_surface_get_info(tsurface, &surf_info);
+
+   aligned_width = _e_plane_aligned_width_get(tsurface);
+   if (aligned_width == 0) return EINA_FALSE;
+
+   e_output_size_get(plane->output, &dst_w, &dst_h);
+
+   pp_info.src_config.size.h = aligned_width;
+   pp_info.src_config.size.v = surf_info.height;
+   pp_info.src_config.pos.x = plane->zoom_rect_temp.x;
+   pp_info.src_config.pos.y = plane->zoom_rect_temp.y;
+   pp_info.src_config.pos.w = plane->zoom_rect_temp.w;
+   pp_info.src_config.pos.h = plane->zoom_rect_temp.h;
+   pp_info.src_config.format = TBM_FORMAT_ARGB8888;
+
+   pp_info.dst_config.size.h = aligned_width;
+   pp_info.dst_config.size.v = surf_info.height;
+   pp_info.dst_config.pos.x = 0;
+   pp_info.dst_config.pos.y = 0;
+   pp_info.dst_config.pos.w = dst_w;
+   pp_info.dst_config.pos.h = dst_h;
+   pp_info.dst_config.format = TBM_FORMAT_ARGB8888;
+
+   pp_info.transform = TDM_TRANSFORM_NORMAL;
+   pp_info.sync = 0;
+   pp_info.flags = 0;
+
+   ret = tdm_pp_set_info(plane->tpp, &pp_info);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(ret == TDM_ERROR_NONE, EINA_FALSE);
+
+   plane->zoom_rect.x = plane->zoom_rect_temp.x;
+   plane->zoom_rect.y = plane->zoom_rect_temp.y;
+   plane->zoom_rect.w = plane->zoom_rect_temp.w;
+   plane->zoom_rect.h = plane->zoom_rect_temp.h;
+
+   DBG("_e_plane_zoom_set_pp_info success(src x:%d,y:%d,w:%d,h:%d)",
+       plane->zoom_rect.x, plane->zoom_rect.y, plane->zoom_rect.w, plane->zoom_rect.h);
+
+   return EINA_TRUE;
+}
+
+static Eina_Bool
+_e_plane_zoom_find_data(E_Plane *plane, E_Plane_Commit_Data *data)
+{
+   Eina_List *l = NULL;
+   E_Plane_Pp_Data *pp_data = NULL;
+
+   EINA_LIST_FOREACH(plane->pending_commit_zoom_data_list, l, pp_data)
+     {
+        if (!pp_data) continue;
+        if (!pp_data->data) continue;
+        if (pp_data->data == data) return EINA_TRUE;
+     }
+
+   return EINA_FALSE;
+}
+
+EINTERN Eina_Bool
+e_plane_zoom_commit(E_Plane *plane)
+{
+   tbm_surface_h tsurface = plane->tsurface;
+   tbm_surface_info_s surf_info;
+   E_Plane_Commit_Data *data = NULL;
+   E_Plane_Pp_Data *pp_data = NULL;
+   int count = 0;
+   tbm_error_e tbm_err = TBM_ERROR_NONE;
+   tbm_surface_h zoom_tsurface = NULL;
+   tdm_error tdm_err = TDM_ERROR_NONE;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(plane, EINA_FALSE);
+
+   count = eina_list_count(plane->pending_commit_data_list);
+   if (count == 0) return EINA_TRUE;
+
+   data = eina_list_nth(plane->pending_commit_data_list, count - 1);
+   if (!data)
+     {
+        ERR("e_plane_zoom_commit: fail E_Plane_Commit_Data get");
+        return EINA_FALSE;
+     }
+   if (_e_plane_zoom_find_data(plane, data)) return EINA_TRUE;
+
+   tbm_err = tbm_surface_queue_dequeue(plane->zoom_tqueue, &zoom_tsurface);
+   if (tbm_err != TBM_ERROR_NONE)
+     {
+        ERR("e_plane_zoom_commit: fail tbm_surface_queue_dequeue");
+        return EINA_FALSE;
+     }
+   tbm_surface_internal_ref(zoom_tsurface);
+
+   pp_data = E_NEW(E_Plane_Pp_Data, 1);
+   pp_data->zoom_tsurface = zoom_tsurface;
+   pp_data->data = data;
+   pp_data->plane = plane;
+
+   plane->pending_commit_zoom_data_list = eina_list_append(plane->pending_commit_zoom_data_list, pp_data);
+
+   if (plane->zoom_rect.x != plane->zoom_rect_temp.x || plane->zoom_rect.y != plane->zoom_rect_temp.y ||
+       plane->zoom_rect.w != plane->zoom_rect_temp.w || plane->zoom_rect.h != plane->zoom_rect_temp.h)
+     {
+        if (!_e_plane_zoom_set_pp_info(plane))
+          {
+             ERR("e_plane_zoom_commit: fail _e_plane_zoom_set_pp_info");
+             goto pp_fail;
+          }
+     }
+
+   tdm_err = tdm_pp_set_done_handler(plane->tpp, _e_plane_zoom_pp_cb, pp_data);
+   EINA_SAFETY_ON_FALSE_GOTO(tdm_err == TDM_ERROR_NONE, pp_fail);
+
+   tdm_err = tdm_pp_attach(plane->tpp, tsurface, zoom_tsurface);
+   EINA_SAFETY_ON_FALSE_GOTO(tdm_err == TDM_ERROR_NONE, pp_fail);
+
+   tdm_err = tdm_pp_commit(plane->tpp);
+   EINA_SAFETY_ON_FALSE_GOTO(tdm_err == TDM_ERROR_NONE, pp_fail);
+
+   return EINA_TRUE;
+
+pp_fail:
+   plane->pending_commit_zoom_data_list = eina_list_remove(plane->pending_commit_zoom_data_list, pp_data);
+
+   if (data)
+     e_plane_commit_data_release(data);
+
+   if (pp_data)
+     free(pp_data);
+
+   return EINA_FALSE;
+}
+
+static void
+_e_plane_zoom_set_show(E_Plane *plane)
+{
+   E_Plane_Pp_Data *pp_data = NULL;
+   tbm_surface_h zoom_tsurface = NULL;
+   tbm_error_e tbm_err = TBM_ERROR_NONE;
+   tdm_error tdm_err = TDM_ERROR_NONE;
+
+   if (!plane->tsurface)
+     return;
+
+   if (eina_list_count(plane->pending_commit_zoom_data_list) != 0)
+     return;
+
+   if (plane->pending_commit)
+     return;
+
+   plane->pending_commit = EINA_TRUE;
+
+   tbm_err = tbm_surface_queue_dequeue(plane->zoom_tqueue, &zoom_tsurface);
+   if (tbm_err != TBM_ERROR_NONE)
+     {
+        plane->pending_commit = EINA_FALSE;
+        ERR("_e_plane_zoom_set_show: fail tbm_surface_queue_dequeue");
+        return;
+     }
+   tbm_surface_internal_ref(zoom_tsurface);
+
+   pp_data = E_NEW(E_Plane_Pp_Data, 1);
+   pp_data->zoom_tsurface = zoom_tsurface;
+   pp_data->data = NULL;
+   pp_data->plane = plane;
+
+   plane->pending_commit_zoom_data_list = eina_list_append(plane->pending_commit_zoom_data_list, pp_data);
+
+   if (plane->zoom_rect.x != plane->zoom_rect_temp.x || plane->zoom_rect.y != plane->zoom_rect_temp.y ||
+       plane->zoom_rect.w != plane->zoom_rect_temp.w || plane->zoom_rect.h != plane->zoom_rect_temp.h)
+     {
+        if (!_e_plane_zoom_set_pp_info(plane))
+          {
+             ERR("e_plane_zoom_commit: fail _e_plane_zoom_set_pp_info");
+             goto pp_fail;
+          }
+     }
+
+   tdm_err = tdm_pp_set_done_handler(plane->tpp, _e_plane_zoom_pp_cb, pp_data);
+   EINA_SAFETY_ON_FALSE_GOTO(tdm_err == TDM_ERROR_NONE, pp_fail);
+
+   tdm_err = tdm_pp_attach(plane->tpp, plane->tsurface, zoom_tsurface);
+   EINA_SAFETY_ON_FALSE_GOTO(tdm_err == TDM_ERROR_NONE, pp_fail);
+
+   tdm_err = tdm_pp_commit(plane->tpp);
+   EINA_SAFETY_ON_FALSE_GOTO(tdm_err == TDM_ERROR_NONE, pp_fail);
+
+   DBG("_e_plane_zoom_set_show: done pp_data:%p", pp_data);
+
+   return;
+
+pp_fail:
+   plane->pending_commit = EINA_FALSE;
+   plane->pending_commit_zoom_data_list = eina_list_remove(plane->pending_commit_zoom_data_list, pp_data);
+   tbm_surface_queue_release(plane->zoom_tqueue, zoom_tsurface);
+   tbm_surface_internal_unref(zoom_tsurface);
+   free(pp_data);
+   ERR("_e_plane_zoom_set_show: fail");
+}
+
+static void
+_e_plane_zoom_unset_show(E_Plane *plane)
+{
+   E_Plane_Pp_Data *pp_data = NULL;
+   tbm_surface_info_s src_info, dst_info;
+   tbm_surface_h zoom_tsurface = NULL;
+   tbm_surface_h dst_tsurface = NULL;
+   tbm_error_e tbm_err = TBM_ERROR_NONE;
+   tdm_error tdm_err = TDM_ERROR_NONE;
+   tdm_layer *tlayer = NULL;
+
+   if (!plane->tsurface)
+     return;
+
+   if (eina_list_count(plane->pending_commit_zoom_data_list) != 0)
+     return;
+
+   if (plane->pending_commit)
+     return;
+
+   tbm_err = tbm_surface_queue_dequeue(plane->zoom_tqueue, &zoom_tsurface);
+   if (tbm_err != TBM_ERROR_NONE)
+     {
+        ERR("_e_plane_zoom_unset_show: fail tbm_surface_queue_dequeue");
+        return;
+     }
+   tbm_surface_internal_ref(zoom_tsurface);
+
+   pp_data = E_NEW(E_Plane_Pp_Data, 1);
+   pp_data->zoom_tsurface = zoom_tsurface;
+   pp_data->data = NULL;
+   pp_data->plane = plane;
+
+   plane->pending_commit_zoom_data_list = eina_list_append(plane->pending_commit_zoom_data_list, pp_data);
+
+   tbm_err = tbm_surface_map(plane->tsurface, TBM_SURF_OPTION_READ, &src_info);
+   if (tbm_err != TBM_SURFACE_ERROR_NONE)
+     {
+        ERR("_e_plane_zoom_unset_show: fail to map the src_tsurface.");
+        goto map_fail;
+     }
+
+   tbm_err = tbm_surface_map(zoom_tsurface, TBM_SURF_OPTION_WRITE, &dst_info);
+   if (tbm_err != TBM_SURFACE_ERROR_NONE)
+     {
+        tbm_surface_unmap(plane->tsurface);
+        ERR("_e_plane_zoom_unset_show: fail to map the dst_tsurface.");
+        goto map_fail;
+     }
+   memcpy(dst_info.planes[0].ptr, src_info.planes[0].ptr, src_info.planes[0].size);
+
+   tbm_surface_unmap(zoom_tsurface);
+   tbm_surface_unmap(plane->tsurface);
+
+   _e_plane_zoom_pp_cb(plane->tpp, plane->tsurface, zoom_tsurface, pp_data);
+
+   DBG("_e_plane_zoom_unset_show: done pp_data:%p", pp_data);
+
+   return;
+
+map_fail:
+   plane->pending_commit_zoom_data_list = eina_list_remove(plane->pending_commit_zoom_data_list, pp_data);
+   tbm_surface_queue_release(plane->zoom_tqueue, zoom_tsurface);
+   tbm_surface_internal_unref(zoom_tsurface);
+   free(pp_data);
+   ERR("_e_plane_zoom_unset_show: fail");
+}
+
+EINTERN Eina_Bool
+e_plane_zoom_set(E_Plane *plane, Eina_Rectangle *rect)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(plane, EINA_FALSE);
+
+   E_Comp_Screen *e_comp_screen = NULL;
+   tdm_error ret = TDM_ERROR_NONE;
+   int w, h;
+
+   if (plane->zoom_unset)
+     plane->zoom_unset = EINA_FALSE;
+
+   e_comp_screen = e_comp->e_comp_screen;
+   e_output_size_get(plane->output, &w, &h);
+
+   if (!plane->tpp)
+     {
+        plane->tpp = tdm_display_create_pp(e_comp_screen->tdisplay, &ret);
+        if (ret != TDM_ERROR_NONE)
+          {
+             ERR("fail tdm pp create");
+             goto fail;
+          }
+     }
+
+   if (!plane->zoom_tqueue)
+     {
+        plane->zoom_tqueue = tbm_surface_queue_create(3, w, h, TBM_FORMAT_ARGB8888, plane->buffer_flags | TBM_BO_SCANOUT);
+        if (!plane->zoom_tqueue)
+          {
+             ERR("fail tbm_surface_queue_create");
+             goto fail;
+          }
+     }
+
+   if ((plane->zoom_rect_temp.x == rect->x) && (plane->zoom_rect_temp.y == rect->y) &&
+       (plane->zoom_rect_temp.w == rect->w) && (plane->zoom_rect_temp.h == rect->h))
+     return EINA_TRUE;
+
+   plane->zoom_rect_temp.x = rect->x;
+   plane->zoom_rect_temp.y = rect->y;
+   plane->zoom_rect_temp.w = rect->w;
+   plane->zoom_rect_temp.h = rect->h;
+
+   _e_plane_zoom_set_show(plane);
+
+   return EINA_TRUE;
+
+fail:
+   if (plane->tpp)
+     {
+        tdm_pp_destroy(plane->tpp);
+        plane->tpp = NULL;
+     }
+
+   return EINA_FALSE;
+}
+
+EINTERN void
+e_plane_zoom_unset(E_Plane *plane)
+{
+   EINA_SAFETY_ON_NULL_RETURN(plane);
+
+   plane->zoom_rect.x = plane->zoom_rect_temp.x = 0;
+   plane->zoom_rect.y = plane->zoom_rect_temp.y = 0;
+   plane->zoom_rect.w = plane->zoom_rect_temp.w = 0;
+   plane->zoom_rect.h = plane->zoom_rect_temp.h = 0;
+
+   _e_plane_zoom_unset_show(plane);
+
+   plane->zoom_unset = EINA_TRUE;
+}
index 45de426f99c05b30fee258d3b55b07c358fb7018..94a1afd46a4226cdf518977e5bff0017ffa941bd 100644 (file)
@@ -25,6 +25,7 @@ typedef enum _E_Plane_Color
 
 typedef struct _E_Plane                      E_Plane;
 typedef struct _E_Plane_Commit_Data          E_Plane_Commit_Data;
+typedef struct _E_Plane_Pp_Data              E_Plane_Pp_Data;
 typedef struct _E_Event_Plane_Win_Change     E_Event_Plane_Win_Change;
 #else
 #ifndef E_PLANE_H
@@ -69,6 +70,8 @@ struct _E_Plane
    Eina_Bool             unset_commit;
    int                   unset_counter;
 
+   Eina_Bool             activation;
+
    /* true if plane's ec is set or unset.
     * false when E_Event_Plane_Win_Change has been generated.
     */
@@ -84,6 +87,15 @@ struct _E_Plane
       E_Plane_Renderer     *renderer;
       E_Client             *ec;
    } display_info;
+
+   /* for zoom */
+   tdm_pp               *tpp;
+   Eina_List            *pending_commit_zoom_data_list;
+   tbm_surface_queue_h   zoom_tqueue;
+   tbm_surface_h         zoom_tsurface;
+   Eina_Rectangle        zoom_rect;
+   Eina_Rectangle        zoom_rect_temp;
+   Eina_Bool             zoom_unset;
 };
 
 struct _E_Plane_Commit_Data {
@@ -94,6 +106,12 @@ struct _E_Plane_Commit_Data {
    E_Comp_Wl_Buffer_Ref  buffer_ref;
 };
 
+struct _E_Plane_Pp_Data {
+   E_Plane_Commit_Data *data;
+   E_Plane       *plane;
+   tbm_surface_h  zoom_tsurface;
+};
+
 struct _E_Event_Plane_Win_Change
 {
    E_Plane *ep;
@@ -121,6 +139,10 @@ EINTERN Eina_Bool            e_plane_is_unset_candidate(E_Plane *plane);
 EINTERN Eina_Bool            e_plane_is_unset_try(E_Plane *plane);
 EINTERN void                 e_plane_unset_try_set(E_Plane *plane, Eina_Bool set);
 EINTERN Eina_Bool            e_plane_unset_commit_check(E_Plane *plane);
+EINTERN void                 e_plane_activation_set(E_Plane *plane, Eina_Bool set);
+EINTERN Eina_Bool            e_plane_zoom_commit(E_Plane *plane);
+EINTERN Eina_Bool            e_plane_zoom_set(E_Plane *plane, Eina_Rectangle *rect);
+EINTERN void                 e_plane_zoom_unset(E_Plane *plane);
 
 E_API Eina_Bool              e_plane_type_set(E_Plane *plane, E_Plane_Type type);
 E_API E_Plane_Type           e_plane_type_get(E_Plane *plane);
@@ -136,5 +158,6 @@ E_API Eina_Bool              e_plane_is_cursor(E_Plane *plane);
 E_API E_Plane_Color          e_plane_color_val_get(E_Plane *plane);
 E_API Eina_Bool              e_plane_is_fb_target(E_Plane *plane);
 
+
 #endif
 #endif