e_comp: use e_comp_hwc_mode_nocomp for single hwc plane
authorJuyeon Lee <juyeonne.lee@samsung.com>
Wed, 8 Jun 2016 11:41:47 +0000 (20:41 +0900)
committerJuyeon Lee <juyeonne.lee@samsung.com>
Fri, 10 Jun 2016 02:14:04 +0000 (11:14 +0900)
Using e_comp_hwc_mode_nocomp(ec or null); for comp <-> nocomp transition
Using e_comp_hwc_display_client(ec) than..
 ec is shown on screen thru tdm_output_commit

Change-Id: I3a5d48c3a7eb8616e89794a0479c19ee905faeda

src/bin/e_comp.c
src/bin/e_comp.h
src/bin/e_comp_hwc.c
src/bin/e_comp_object.c
src/bin/e_comp_object.h
src/bin/e_comp_wl.c

index bd3fea6b9f7ab89437d4ab2ead461c7c6b9778df..08739d653a12ba25c83f8aa4c767012c6c4d5ddf 100644 (file)
@@ -402,6 +402,8 @@ _hwc_set(E_Output * eout)
                     {
                        e_client_redirected_set(ep->prepare_ec, 0);
                        ep->ec = ep->prepare_ec;
+                       // FIXME: will remove out once tdm_output_commit thru e_output,e_plane
+                       e_comp_hwc_mode_nocomp(ep->ec);
                     }
                }
              continue;
@@ -409,7 +411,6 @@ _hwc_set(E_Output * eout)
         if (e_plane_is_cursor(ep)) continue;
         if (ep->zpos > ep_prime->zpos)
           {
-             ep_prime = ep;
              if (ep->prepare_ec)
                {
                   e_client_redirected_set(ep->prepare_ec, 0);
@@ -509,6 +510,8 @@ _e_comp_hwc_cancel(E_Output * eout)
         if (ep->ec) e_client_redirected_set(ep->ec, 1);
         ep->prepare_ec = NULL;
         ep->ec = NULL;
+        // FIXME: will remove out once tdm_output_commit thru e_output,e_plane
+        e_comp_hwc_mode_nocomp(NULL);
      }
 
    return EINA_TRUE;
@@ -738,7 +741,7 @@ _e_comp_hwc_cb_begin_timeout(void *data EINA_UNUSED)
    return EINA_FALSE;
 }
 
-void
+E_API void
 _e_comp_hwc_end(const char *location)
 {
    Eina_Bool mode_set = EINA_FALSE;
@@ -1339,6 +1342,55 @@ _e_comp_screensaver_off(void *data EINA_UNUSED, int type EINA_UNUSED, void *even
    return ECORE_CALLBACK_PASS_ON;
 }
 
+
+static Eina_Bool
+_e_comp_cb_idle(void)
+{
+   Eina_List *l, *ll;
+   E_Zone *zone;
+   E_Client *ec;
+
+   if (!e_comp->hwc) goto end;
+   if (!_e_comp_hwc_is_on()) goto end;
+   //if (evas_changed_get(ecore_evas_get(e_comp->ee))) return ECORE_CALLBACK_RENEW;
+
+   EINA_LIST_FOREACH_SAFE(e_comp->zones, l, ll, zone)
+     {
+        E_Output *eout = NULL;
+        E_Plane *ep = NULL, *ep_prime = NULL;
+        const Eina_List *ep_l = NULL, *p_l, *p_ll;
+
+        if (!zone || !zone->output_id) continue;
+
+        eout = e_output_find(zone->output_id);
+        ep_l = e_output_planes_get(eout);
+        EINA_LIST_FOREACH_SAFE(ep_l, p_l, p_ll, ep)
+          {
+             E_Comp_Wl_Buffer *buffer;
+             if (!ep_prime)
+               {
+                  if (e_plane_is_primary(ep))
+                    {
+                       // FIXME: will remove out once tdm_output_commit thru e_output,e_plane
+                       ec = ep->ec;
+                       if (!ec)
+                         {
+                            if (!e_comp_object_hwc_update_exists(ec->frame)) goto end;
+                            e_comp_object_hwc_update_set(ec->frame, 0);
+                            buffer = e_pixmap_resource_get(ec->pixmap);
+                            if (buffer) e_comp_hwc_display_client(ec);
+                         }
+                        goto end;
+                    }
+                  continue;
+               }
+          }
+     }
+
+end:
+   return ECORE_CALLBACK_RENEW;
+}
+
 //////////////////////////////////////////////////////////////////////////
 
 EINTERN Eina_Bool
@@ -1421,6 +1473,10 @@ e_comp_init(void)
    E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_SIGNAL_USER, _e_comp_signal_user,     NULL);
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_COMP_OBJECT_ADD, _e_comp_object_add,      NULL);
 
+#ifdef ENABLE_HWC_MULTI
+   ecore_idle_enterer_add(_e_comp_cb_idle, NULL);
+#endif
+
    return EINA_TRUE;
 }
 
index 5b642024fd690214f4bd1a50e745695c9be3d32e..5b03f39d4c7607b6e37d732c4c6f2c1ebf6b3ac1 100644 (file)
@@ -236,6 +236,7 @@ E_API void e_comp_post_update_purge(E_Client *ec);
 E_API E_Comp_Hook *e_comp_hook_add(E_Comp_Hook_Point hookpoint, E_Comp_Hook_Cb func, const void *data);
 E_API void e_comp_hook_del(E_Comp_Hook *ph);
 EINTERN Eina_Bool e_comp_is_on_overlay(E_Client *ec);
+E_API void _e_comp_hwc_end(const char *location);
 
 #endif
 #endif
index 90b8f17e8f5d35dfd52fb3dee57b141ab451b349..7de55b5b36222c3f66c04b2deeef099f799ff492 100644 (file)
@@ -1585,7 +1585,13 @@ e_comp_hwc_display_client(E_Client *ec)
                   if (cdata->sub.below_list || cdata->sub.below_list_pending)
                     {
                        if (!e_comp_wl_video_client_has(ec))
-                         e_comp_nocomp_end(__FUNCTION__);
+                         {
+#ifdef ENABLE_HWC_MULTI
+                            _e_comp_hwc_end(__FUNCTION__);
+#else 
+                            e_comp_nocomp_end(__FUNCTION__);
+#endif
+                         }
                     }
                }
              else
index 6a28da805a49a3449f71c939bc8f28cb19c150f5..3478d624efc535f3b1e51ce9b94b49398b3069fd 100644 (file)
@@ -114,7 +114,7 @@ typedef struct _E_Comp_Object
    Eina_Bool            native : 1;  // native
 
    Eina_Bool            nocomp : 1;  // nocomp applied
-   Eina_Bool            nocomp_need_update : 1;  // nocomp in effect, but this window updated while in nocomp mode
+   Eina_Bool            hwc_need_update : 1;  // this window updated while on e_plane to use hwc
    Eina_Bool            real_hid : 1;  // last hide was a real window unmap
 
    Eina_Bool            effect_set : 1; //effect_obj has a valid group
@@ -3302,9 +3302,17 @@ e_comp_object_damage(Evas_Object *obj, int x, int y, int w, int h)
    evas_object_smart_callback_call(obj, "damage", &rect);
    if (e_comp->nocomp)
      {
-        cw->nocomp_need_update = EINA_TRUE;
+        cw->hwc_need_update = EINA_TRUE;
         return;
      }
+
+   // FIXME: will remove out once tdm_output_commit thru e_output,e_plane
+   if (e_comp_is_on_overlay(cw->ec))
+     {
+        e_comp_object_hwc_update_set(obj, 1);
+        //return;
+     }
+
    /* ignore overdraw */
    if (cw->updates_full)
      {
@@ -3366,6 +3374,20 @@ e_comp_object_damage_exists(Evas_Object *obj)
    return cw->updates_exist;
 }
 
+E_API Eina_Bool
+e_comp_object_hwc_update_exists(Evas_Object *obj)
+{
+   API_ENTRY EINA_FALSE;
+   return cw->hwc_need_update;
+}
+
+E_API void
+e_comp_object_hwc_update_set(Evas_Object *obj, Eina_Bool set)
+{
+   API_ENTRY EINA_FALSE;
+   cw->hwc_need_update = set;
+}
+
 E_API void
 e_comp_object_render_update_add(Evas_Object *obj)
 {
index 2b0ba69d7d9475cbb3f762cf38afda800f0c435d..925fa92217ba014feebc0cc34fad107df2062e66 100644 (file)
@@ -131,6 +131,9 @@ E_API void e_comp_object_layer_update(Evas_Object *obj, Evas_Object *above, Evas
 
 E_API Eina_Bool e_comp_object_content_set(Evas_Object* obj, Evas_Object *content, E_Comp_Object_Content_Type type);
 E_API Eina_Bool e_comp_object_content_unset(Evas_Object* obj);
+E_API Eina_Bool e_comp_object_hwc_update_exists(Evas_Object *obj);
+E_API void      e_comp_object_hwc_update_set(Evas_Object *obj, Eina_Bool set);
+
 #endif
 #endif
 
index 0e5bcd7ba7109f62eb0c7a4c76a47b690e305e14..46e00e845abd02211c3bce2aadf8df59184f45f1 100644 (file)
@@ -2443,6 +2443,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
    _e_comp_wl_subsurface_check_below_bg_rectangle(ec);
 
 #ifdef HAVE_HWC
+#ifndef MULTI_PLANE_HWC
    /* HWC: if the compositor fall into the nocomposite mode,
           the compositor display e_client on the hw layer directly */
    if (e_comp->hwc && buffer)
@@ -2451,6 +2452,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
      }
    if (e_comp->hwc)
      e_comp_hwc_client_commit(ec);
+#endif // end of MULTI_PLANE_HWC
 #endif
 
    if ((buffer && buffer->type == E_COMP_WL_BUFFER_TYPE_VIDEO) &&