e_output: 1st impletation, E_Plane is a child object of E_Output 01/65801/7
authorJuyeon Lee <juyeonne.lee@samsung.com>
Tue, 12 Apr 2016 13:49:26 +0000 (22:49 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Mon, 25 Apr 2016 05:03:04 +0000 (22:03 -0700)
Change-Id: Ic2d8442ae244b500165aeba4020a2c9149741780

src/bin/e_comp.c
src/bin/e_comp.h
src/bin/e_comp_cfdata.c
src/bin/e_comp_cfdata.h
src/bin/e_comp_hwc.c
src/bin/e_comp_hwc.h
src/bin/e_includes.h
src/bin/e_plane.c
src/bin/e_plane.h
src/bin/e_zone.c
src/bin/e_zone.h

index 0df5ebc6b59dca6f3aa5341f51e081cbd53bf2af..e372961636f29452645c451834d939f9f93a119b 100644 (file)
@@ -48,7 +48,7 @@ static int _e_comp_hooks_walking = 0;
 
 static Eina_Inlist *_e_comp_hooks[] =
 {
-   [E_COMP_HOOK_BEFORE_RENDER] = NULL,
+   [E_COMP_HOOK_ASSIGN_PLANE] = NULL,
 };
 
 E_API int E_EVENT_COMPOSITOR_RESIZE = -1;
@@ -333,6 +333,7 @@ _e_comp_cb_nocomp_end(void)
    ecore_event_add(E_EVENT_COMPOSITOR_ENABLE, NULL, NULL, NULL);
 }
 
+#ifndef MULTI_PLANE_HWC
 static Eina_Bool
 _e_comp_cb_nocomp_begin_timeout(void *data EINA_UNUSED)
 {
@@ -345,7 +346,7 @@ _e_comp_cb_nocomp_begin_timeout(void *data EINA_UNUSED)
      }
    return EINA_FALSE;
 }
-
+#endif
 E_API void
 e_comp_nocomp_end(const char *location)
 {
@@ -354,6 +355,234 @@ e_comp_nocomp_end(const char *location)
    INF("HWC : NOCOMP_END at %s\n", location);
    _e_comp_cb_nocomp_end();
 }
+#ifdef MULTI_PLANE_HWC
+static Eina_Bool
+_e_comp_selcomp_check(void)
+{
+   Eina_List *l, *ll;
+   E_Zone *zone;
+   E_Client *ec;
+   int ret = 0;
+
+   // instead of zones, canvas list will be the condition of each output check
+   // TODO: e_comp->canvases
+   EINA_LIST_FOREACH_SAFE(e_comp->zones, l, ll, zone)
+     {
+        int ly_total = 0, ly_cnt = 0;
+        E_Hwc_Mode mode = E_HWC_MODE_INVALID;
+
+        if (zone->output) ly_total = zone->output->plane_count;
+
+        E_CLIENT_REVERSE_FOREACH(ec)
+          {
+             E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
+
+             // check clients to skip composite
+             if (ec->ignored || ec->input_only || (!evas_object_visible_get(ec->frame)) || (ec->zone != zone))
+               continue;
+
+             if (!E_INTERSECTS(0, 0, e_comp->w, e_comp->h,
+                               ec->client.x, ec->client.y, ec->client.w, ec->client.h))
+               {// check quick panel
+                  continue;
+               }
+
+             if (evas_object_data_get(ec->frame, "comp_skip"))
+               continue;
+
+             // check clients not able to use hwc
+             if ((!cdata->buffer_ref.buffer) ||
+                 (cdata->buffer_ref.buffer->type != E_COMP_WL_BUFFER_TYPE_NATIVE) ||
+                 (cdata->width_from_buffer != cdata->width_from_viewport) ||
+                 (cdata->height_from_buffer != cdata->height_from_viewport))
+               {
+                  if (ly_cnt) mode = E_HWC_MODE_HWC_COMPOSITE;
+                  else mode = E_HWC_MODE_COMPOSITE;
+                  break;
+               }
+
+             ly_cnt++;
+          }
+        if (mode == E_HWC_MODE_INVALID)
+          {
+             if (ly_cnt == 1 ) mode = E_HWC_MODE_NO_COMPOSITE;
+             else if (ly_cnt <= ly_total && ly_cnt > 1) mode = E_HWC_MODE_HWC_NO_COMPOSITE;
+             else if (ly_cnt > ly_total) mode = E_HWC_MODE_HWC_COMPOSITE;
+          }
+
+        if((mode != E_HWC_MODE_COMPOSITE) && (mode != E_HWC_MODE_INVALID)) ret++;
+     }
+
+   return (ret > 0);
+}
+
+static Eina_Bool
+_e_comp_selcomp_assign_planes(void)
+{
+   Eina_List *l, *ll;
+   E_Zone *zone;
+
+   if (!e_comp->hwc) return EINA_FALSE;
+
+   // TODO: e_comp->canvases
+   EINA_LIST_FOREACH_SAFE(e_comp->zones, l, ll, zone)
+     {
+        E_Client *ec;
+        E_Output *eout;
+        int mode = E_HWC_MODE_INVALID;
+        int num_of_ly = 0, ly_cnt = 0;
+        Eina_List *clist = NULL;
+
+        if (!zone && !zone->output) continue;
+
+        eout = zone->output;
+        printf("reassign all clients from zone %p\n", zone);
+        num_of_ly = eout->plane_count;
+
+        E_CLIENT_REVERSE_FOREACH(ec)
+          {
+             E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
+
+             if (ec->zone != zone) continue;
+
+             // check clients to skip composite
+             if (ec->ignored || ec->input_only || (!evas_object_visible_get(ec->frame)))
+               continue;
+
+             if (!E_INTERSECTS(0, 0, e_comp->w, e_comp->h,
+                               ec->client.x, ec->client.y, ec->client.w, ec->client.h))
+               {// check quick panel
+                  continue;
+               }
+
+             if (evas_object_data_get(ec->frame, "comp_skip"))
+               continue;
+
+             // check clients not able to use hwc
+             if ((!cdata->buffer_ref.buffer) ||
+                 (cdata->buffer_ref.buffer->type != E_COMP_WL_BUFFER_TYPE_NATIVE) ||
+                 (cdata->width_from_buffer != cdata->width_from_viewport) ||
+                 (cdata->height_from_buffer != cdata->height_from_viewport))
+               {
+                  if (ly_cnt) mode = E_HWC_MODE_HWC_COMPOSITE;
+                  else mode = E_HWC_MODE_COMPOSITE;
+                  break;
+               }
+
+             ly_cnt++;
+             clist = eina_list_append(clist, ec);
+          }
+        if (mode == E_HWC_MODE_INVALID)
+          {
+             if (ly_cnt == 1) mode = E_HWC_MODE_NO_COMPOSITE;
+             else if (ly_cnt <= num_of_ly && ly_cnt > 1) mode = E_HWC_MODE_HWC_NO_COMPOSITE;
+             else if (ly_cnt > num_of_ly) mode = E_HWC_MODE_HWC_COMPOSITE;
+          }
+
+#ifdef HAVE_HWC
+        // comepare clist with current and assign it to planes refer to core policy : FIXME
+        // ......
+        e_output_planes_clear(eout);
+        e_output_planes_set(eout, mode, clist);
+#endif
+       eina_list_free(clist);
+       clist = NULL;
+     }
+
+   return EINA_TRUE;
+}
+
+static void
+_e_comp_cb_selcomp_begin(void)
+{
+   Eina_List *l;
+   E_Zone *zone;
+   Eina_Bool mode_set = EINA_FALSE;
+
+   if (!e_comp->hwc) return;
+   E_FREE_FUNC(e_comp->selcomp_delay_timer, ecore_timer_del);
+
+   if (!_e_comp_selcomp_check()) return;
+   e_comp->selcomp_want = 1;
+
+#ifdef HAVE_HWC
+   // check core policy of plane assignment
+   _e_comp_selcomp_assign_planes();
+
+   // check extra policy
+   _e_comp_hook_call(E_COMP_HOOK_ASSIGN_PLANE, NULL);
+
+   EINA_LIST_FOREACH(e_comp->zones, l, zone)
+     {
+        if(zone->output) mode_set |= e_output_update(zone->output);
+     }
+#endif
+   if (!mode_set) return;
+
+   if (e_comp->calc_fps) e_comp->frametimes[0] = 0;
+
+   e_comp->selcomp = 1;
+   INF("JOB2...");
+
+   e_comp_render_queue();
+   e_comp_shape_queue_block(1);
+   ecore_event_add(E_EVENT_COMPOSITOR_DISABLE, NULL, NULL, NULL);
+}
+
+static Eina_Bool
+_e_comp_cb_selcomp_begin_timeout(void *data EINA_UNUSED)
+{
+   e_comp->selcomp_delay_timer = NULL;
+
+   if (e_comp->selcomp_override == 0)
+     {
+        _e_comp_cb_selcomp_begin();
+     }
+   return EINA_FALSE;
+}
+
+E_API void
+e_comp_selcomp_end(const char *location)
+{
+   Eina_Bool mode_set = EINA_FALSE;
+   E_Client *ec;
+   E_Zone *zone;
+   Eina_List *l, *ll;
+
+   if (!e_comp->hwc) return;
+   if (!e_comp->selcomp) return;
+
+   e_comp->selcomp_want = 0;
+   E_FREE_FUNC(e_comp->selcomp_delay_timer, ecore_timer_del);
+
+#ifdef HAVE_HWC
+   // e_comp->canvases will be replace e_comp->zones
+   EINA_LIST_FOREACH_SAFE(e_comp->zones, l, ll, zone)
+     {
+        if (zone->output)
+          {
+             e_output_planes_clear(zone->output);
+             mode_set |= e_output_update(zone->output);
+          }
+     }
+#endif
+   if (!mode_set) return;
+
+   INF("HWC : selective comp _END at %s\n", location);
+   INF("COMP RESUME!");
+
+   E_CLIENT_FOREACH(ec)
+     {
+        if (ec->visible && (!ec->input_only))
+          e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
+
+     }
+   e_comp->selcomp = 0;
+   e_comp_render_queue();
+   e_comp_shape_queue_block(0);
+   ecore_event_add(E_EVENT_COMPOSITOR_ENABLE, NULL, NULL, NULL);
+}
+#endif
 
 static void
 _e_comp_client_update(E_Client *ec)
@@ -446,11 +675,30 @@ nocomp:
    // query if selective HWC plane can be used
    if (!e_comp_gl_get() && !e_comp->hwc)
      {
-        TRACE_DS_END();
-        return ECORE_CALLBACK_RENEW;
+        goto end;
      }
 #ifdef MULTI_PLANE_HWC
-   _e_comp_hook_call(E_COMP_HOOK_BEFORE_RENDER, e_comp);
+   if(_e_comp_selcomp_check())
+     {
+        // switch mode
+        if (conf->selcomp_use_timer)
+          {
+             if (!e_comp->selcomp_delay_timer)
+               {
+                  e_comp->selcomp_delay_timer = ecore_timer_add(conf->selcomp_begin_timeout,
+                                                                _e_comp_cb_selcomp_begin_timeout,
+                                                                NULL);
+               }
+          }
+        else
+          {
+             _e_comp_cb_selcomp_begin();
+          }
+     }
+   else
+     {
+        if (e_comp->selcomp) e_comp_selcomp_end(__FUNCTION__);
+     }
 #else
    ec = _e_comp_fullscreen_check();
    if (ec)
@@ -482,11 +730,14 @@ nocomp:
           }
      }
    else
-      {
+     {
         if (e_comp->nocomp && e_comp->nocomp_ec)
-           e_comp_nocomp_end("_e_comp_cb_update : ec is not fullscreen");
-      }
+          e_comp_nocomp_end("_e_comp_cb_update : ec is not fullscreen");
+     }
 #endif
+
+end:
+
    TRACE_DS_END();
 
    return ECORE_CALLBACK_RENEW;
@@ -815,6 +1066,8 @@ _e_comp_free(E_Comp *c)
    if (c->screen_job) ecore_job_del(c->screen_job);
    if (c->nocomp_delay_timer) ecore_timer_del(c->nocomp_delay_timer);
    if (c->nocomp_override_timer) ecore_timer_del(c->nocomp_override_timer);
+   if (c->selcomp_delay_timer) ecore_timer_del(c->selcomp_delay_timer);
+   if (c->selcomp_override_timer) ecore_timer_del(c->selcomp_override_timer);
    ecore_job_del(c->shape_job);
 
    free(c);
index e2d807acf49c7b68e703892a1a76b6fb28fe27d7..a86da537f19ed639636da1e480e6007d3dbf4241 100644 (file)
@@ -90,7 +90,7 @@ typedef struct _E_Comp_Hook E_Comp_Hook;
 
 typedef enum _E_Comp_Hook_Point
 {
-   E_COMP_HOOK_BEFORE_RENDER,
+   E_COMP_HOOK_ASSIGN_PLANE,
    E_COMP_HOOK_LAST
 } E_Comp_Hook_Point;
 
@@ -165,12 +165,15 @@ struct _E_Comp
    Ecore_Job      *screen_job;
    Ecore_Timer    *nocomp_delay_timer;
    Ecore_Timer    *nocomp_override_timer;
+   Ecore_Timer    *selcomp_delay_timer;
+   Ecore_Timer    *selcomp_override_timer;
    int             animating;
    double          frametimes[122];
    int             frameskip;
    double          fps;
 
    int             nocomp_override; //number of times nocomp override has been requested
+   int             selcomp_override; //number of times selcomp override has been requested
    Ecore_Window block_win;
    int             block_count; //number of times block window has been requested
 
@@ -189,6 +192,8 @@ struct _E_Comp
    Eina_Bool       grabbed : 1;
    Eina_Bool       nocomp : 1;
    Eina_Bool       nocomp_want : 1;
+   Eina_Bool       selcomp : 1;
+   Eina_Bool       selcomp_want : 1;
    Eina_Bool       saver : 1;
    Eina_Bool       shape_queue_blocked : 1;
    Eina_Bool       calc_fps : 1;
index e533a856ae4f85e08b40a274ca96c7a1371a92bd..a2c077f3fbea685a47c542d8593c5c987f1adec0 100644 (file)
@@ -52,6 +52,8 @@ e_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd)
    E_CONFIG_VAL(D, T, nocomp_fs, UCHAR);
    E_CONFIG_VAL(D, T, nocomp_use_timer, UCHAR);
    E_CONFIG_VAL(D, T, nocomp_begin_timeout, DOUBLE);
+   E_CONFIG_VAL(D, T, selcomp_use_timer, UCHAR);
+   E_CONFIG_VAL(D, T, selcomp_begin_timeout, DOUBLE);
    E_CONFIG_VAL(D, T, hwc, UCHAR);
    E_CONFIG_VAL(D, T, nofade, UCHAR);
    E_CONFIG_VAL(D, T, smooth_windows, UCHAR);
@@ -109,6 +111,8 @@ e_comp_cfdata_config_new(void)
    cfg->nocomp_fs = 1;
    cfg->nocomp_use_timer = 1;
    cfg->nocomp_begin_timeout = 2.0;
+   cfg->selcomp_use_timer = 1;
+   cfg->selcomp_begin_timeout = 2.0;
    cfg->hwc = 0;
    cfg->nofade = 0;
    cfg->smooth_windows = 0; // 1 if gl, 0 if not
index a158a9de435a3bf178f7ef9367547c3f554f00e3..a6a7d6abbbf988e4207319576d749bbd3ad4d1ab 100644 (file)
@@ -29,6 +29,8 @@ struct _E_Comp_Config
    unsigned char nocomp_fs;
    unsigned char nocomp_use_timer;
    double        nocomp_begin_timeout;
+   unsigned char selcomp_use_timer;
+   double        selcomp_begin_timeout;
    unsigned char hwc;
    unsigned char smooth_windows;
    unsigned char nofade;
index cf293347ad7b01a79a3e44087404f39c52518c37..a78b372c707fa055918a0de72f064c47606d6d60 100755 (executable)
@@ -29,14 +29,6 @@ typedef struct _E_Comp_Hwc_Layer E_Comp_Hwc_Layer;
 typedef struct _E_Comp_Hwc_Renderer E_Comp_Hwc_Renderer;
 typedef struct _E_Comp_Hwc_Commit_Data E_Comp_Hwc_Commit_Data;
 
-typedef enum _E_Hwc_Mode
-{
-   E_HWC_MODE_COMPOSITE = 1,        /* display only canvas */
-   E_HWC_MODE_NO_COMPOSITE = 2,      /* display only one surface */
-   E_HWC_MODE_HWC_COMPOSITE = 3,    /* display one or more surfaces and a canvas */
-   E_HWC_MODE_HWC_NO_COMPOSITE = 4, /* display multi surfaces */
-} E_Hwc_Mode;
-
 struct _E_Comp_Hwc_Commit_Data {
    E_Comp_Hwc_Layer *hwc_layer;
    tbm_surface_h tsurface;
@@ -108,6 +100,24 @@ static E_Comp_Hwc *g_hwc = NULL;
 static Eina_Bool _e_comp_hwc_output_commit(E_Comp_Hwc_Output *hwc_output, E_Comp_Hwc_Layer *hwc_layer, tbm_surface_h tsurface, Eina_Bool is_canvas);
 
 
+///////////////////////////////////////////
+
+/* local subsystem functions */
+static void
+_e_output_free(E_Output *output)
+{
+   E_Plane *ep;
+   /* Delete the object event callbacks */
+
+   /* remove planes */
+   EINA_LIST_FREE(output->planes, ep)
+     {
+        if (!e_object_is_del(E_OBJECT(ep)))
+           e_object_free(E_OBJECT(ep));
+     }
+   free(output);
+}
+
 static void
 _e_comp_hwc_update_client_fps()
 {
@@ -1432,13 +1442,15 @@ EINTERN Eina_Bool
 e_comp_hwc_plane_init(E_Zone *zone)
 {
    E_Comp_Hwc_Output *hwc_output = NULL;
-   E_Comp_Hwc_Layer *hwc_layer;
    Ecore_Drm_Device *dev;
    Ecore_Drm_Output *drm_output;
    E_Randr2_Screen *s;
    const Eina_List *l, *ll;
-   tdm_layer_capability capa;
+   E_Output * eout = NULL;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
 
+   // TODO: canvas, zone shall match with one output
    EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev)
      {
         EINA_LIST_FOREACH(e_randr2->screens, ll, s)
@@ -1460,21 +1472,116 @@ e_comp_hwc_plane_init(E_Zone *zone)
      }
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(hwc_output, EINA_FALSE);
+   eout = e_output_new(zone);
 
-   EINA_LIST_FOREACH_SAFE(hwc_output->hwc_layers, l, ll, hwc_layer)
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eout, EINA_FALSE);
+   zone->output = eout;
+
+   for (int i = 0; i < hwc_output->num_layers; i++)
      {
-        E_Plane *ep;
-        if (!hwc_layer) continue;
+        e_plane_new(eout);
+     }
+
+   return EINA_TRUE;
+}
+
+E_API E_Output *
+e_output_new(E_Zone *zone)
+{
+   E_Output *output;
+
+   if (!zone) return NULL;
+
+   output = E_OBJECT_ALLOC(E_Output, E_OUTPUT_TYPE, _e_output_free);
+   if (!output) return NULL;
 
-        ep = e_plane_new(zone);
+   output->zone = zone;
+   output->geom.x = zone->x;
+   output->geom.y = zone->y;
+   output->geom.w = zone->w;
+   output->geom.h = zone->h;
+   output->plane_count = 0;
 
-        tdm_layer_get_capabilities(hwc_layer->tlayer, &capa);
+   return output;
+}
+
+E_API Eina_Bool
+e_output_planes_clear(E_Output * output)
+{
+   Eina_List *l, *ll;
+   E_Plane *ep;
 
-        if (capa & (TDM_LAYER_CAPABILITY_PRIMARY))
+   EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(output->planes, EINA_FALSE);
+
+   EINA_LIST_FOREACH_SAFE(output->planes, l, ll, ep)
+     {
+        ep->ec = NULL;
+     }
+   return EINA_TRUE;
+}
+
+E_API Eina_Bool
+e_output_planes_set(E_Output * output, E_Hwc_Mode mode, Eina_List* clist)
+{
+   Eina_List *l_p, *l_ec;
+   Eina_List *l, *ll;
+   E_Plane *ep;
+   int num_c;
+
+   num_c = eina_list_count(clist);
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(output->planes, EINA_FALSE);
+   if ((num_c > output->plane_count) ||
+       (num_c < 1))
+     return EINA_FALSE;
+
+   l_p = output->planes;
+   l_ec = clist;
+   if ((mode == E_HWC_MODE_COMPOSITE) ||
+       (mode == E_HWC_MODE_HWC_COMPOSITE))
+     {
+        ep = eina_list_data_get(l_p);
+        if (ep) ep->ec = NULL; // 1st plane is assigned for e_comp->evas
+        l_p = eina_list_next(l_p);
+     }
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(l_p, EINA_FALSE);
+   EINA_LIST_FOREACH_SAFE(l_p, l, ll, ep)
+     {
+        E_Client *ec = NULL;
+
+        if (!l_ec) break;
+        ec = eina_list_data_get(l_ec);
+
+        if(ec)
           {
-             zone->primary_plane = ep;
+             ep->ec = ec;
           }
+        l_ec = eina_list_next(l_ec);
      }
 
    return EINA_TRUE;
 }
+
+E_API Eina_Bool
+e_output_update(E_Output * output)
+{
+
+   Eina_List *l, *ll;
+   E_Plane *ep;
+   E_Client *ec;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(output->planes, EINA_FALSE);
+
+   EINA_LIST_FOREACH_SAFE(output->planes, l, ll, ep)
+     {
+        ec = ep->ec;
+        if (ec) INF("HWC:\t|---\t %s 0x%08x\n", ec->icccm.title, (unsigned int)ec->frame);
+     }
+
+   // TODO: hwc mode change
+   return EINA_FALSE; // SHALL BE EINA_TRUE after hwc multi plane implementation
+}
+
index c22546ca3f809b208e8731c59dd71e56319bd7da..d8b3ffeecaa6d9755a6ead8bb12228c3e17da135 100644 (file)
@@ -1,8 +1,33 @@
 #ifdef E_TYPEDEFS
+
+typedef struct _E_Output                     E_Output;
+
 #else
 # ifndef E_COMP_HWC_H
 #  define E_COMP_HWC_H
 
+#define E_OUTPUT_TYPE (int)0xE0b11002
+
+typedef enum _E_Hwc_Mode
+{
+   E_HWC_MODE_COMPOSITE = 1,        /* display only canvas */
+   E_HWC_MODE_NO_COMPOSITE = 2,      /* display only one surface */
+   E_HWC_MODE_HWC_COMPOSITE = 3,    /* display one or more surfaces and a canvas */
+   E_HWC_MODE_HWC_NO_COMPOSITE = 4, /* display multi surfaces */
+   E_HWC_MODE_INVALID
+} E_Hwc_Mode;
+
+struct _E_Output
+{
+   E_Object             e_obj_inherit;
+
+   Eina_Rectangle       geom;
+   Eina_List           *planes;
+   int                  plane_count;
+
+   E_Zone              *zone;
+};
+
 EINTERN Eina_Bool e_comp_hwc_init(void);
 EINTERN void      e_comp_hwc_shutdown(void);
 EINTERN Eina_Bool e_comp_hwc_mode_nocomp(E_Client *ec);
@@ -10,5 +35,10 @@ EINTERN void      e_comp_hwc_display_client(E_Client *ec);
 EINTERN void      e_comp_hwc_trace_debug(Eina_Bool onoff);
 EINTERN Eina_Bool e_comp_hwc_plane_init(E_Zone *zone);
 
+E_API E_Output * e_output_new(E_Zone *zone);
+E_API Eina_Bool e_output_planes_clear(E_Output * output);
+E_API Eina_Bool e_output_planes_set(E_Output * output, E_Hwc_Mode mode, Eina_List* clist);
+E_API Eina_Bool e_output_update(E_Output * output);
+
 # endif
 #endif
index 1934d3ff673cbadd808316cce73093eae3fe7caa..e464e7ba8bf983a796ea51c2513e1d93c30c1c93 100644 (file)
@@ -61,4 +61,7 @@
 #ifdef HAVE_WAYLAND_TBM
 # include "e_comp_wl_tbm.h"
 #endif
+#ifdef HAVE_HWC
+# include "e_comp_hwc.h"
+#endif
 #endif
index ab07c256af9a9aba05383d5880f6ff4e163d3403..3ca35b8611c50c592701ccf63ef7c423f05ec567 100644 (file)
@@ -1,7 +1,8 @@
 #include "e.h"
 
-/* E_Plane is a child object of E_Zone. There is one zone per screen
- * in a xinerama setup. Each zone has one or more planes.
+/* E_Plane is a child object of E_Output. There is one Output per screen
+ * E_plane represents hw overlay and a surface is assigned to disable composition
+ * Each Output always has dedicated canvas and a zone
  */
 
 E_API int E_EVENT_PLANE_ADD = 0;
@@ -15,10 +16,8 @@ _e_plane_free(E_Plane *plane)
 {
    //printf("@@@@@@@@@@ e_plane_free: %i %i | %i %i %ix%i = %p\n", zone->num, zone->id, zone->x, zone->y, zone->w, zone->h, zone);
 
-   /* Delete the object event callbacks */
-
-   /* remove clients list */
-   eina_list_free(plane->clist);
+   if (!plane) return;
+   if (plane->output) plane->output->plane_count--;
 
    /* remove handlers */
    E_FREE_LIST(plane->handlers, ecore_event_handler_del);
@@ -31,14 +30,9 @@ _e_plane_free(E_Plane *plane)
 static void
 _e_plane_reconfigure_clients(E_Plane *plane, int dx, int dy, int dw, int dh)
 {
-   E_Client *ec;
-
-   Eina_List *l, *ll;
-   EINA_LIST_FOREACH_SAFE(plane->clist, l, ll, ec)
-     {
-        if (!ec) break;
-        /* TODO: config ec refer to resolution */
-     }
+   EINA_SAFETY_ON_NULL_RETURN(plane->ec);
+
+   /* TODO: config ec refer to resolution */
 }
 
 ///////////////////////////////////////////
@@ -59,48 +53,37 @@ e_plane_shutdown(void)
 }
 
 E_API E_Plane *
-e_plane_new(E_Zone *zone)
+e_plane_new(E_Output *output)
 {
    E_Plane *plane;
 
    char name[40];
 
-   if (!zone) return NULL;
+   if (!output) return NULL;
 
    plane = E_OBJECT_ALLOC(E_Plane, E_PLANE_TYPE, _e_plane_free);
    if (!plane) return NULL;
 
-   snprintf(name, sizeof(name), "Plane %d", zone->num);
+   snprintf(name, sizeof(name), "Plane %d", output->zone->num);
    plane->name = eina_stringshare_add(name);
 
    plane->type = E_PLANE_TYPE_INVALID;
-   plane->zone = zone;
+   plane->output = output;
 
-   /* config default resolution with zone size*/
-   plane->resolution.x = zone->x;
-   plane->resolution.y = zone->y;
-   plane->resolution.w = zone->w;
-   plane->resolution.h = zone->h;
+   /* config default resolution with output size*/
+   plane->resolution.x = output->geom.x;
+   plane->resolution.y = output->geom.y;
+   plane->resolution.w = output->geom.w;
+   plane->resolution.h = output->geom.h;
 
-   zone->planes = eina_list_append(zone->planes, plane);
+   output->planes = eina_list_append(output->planes, plane);
+   output->plane_count++;
 
-   printf("@@@@@@@@@@ e_plane_new: %s | %i %i %ix%i = %p\n", zone->randr2_id, plane->resolution.x , plane->resolution.y, plane->resolution.w, plane->resolution.h, zone);
+   printf("@@@@@@@@@@ e_plane_new: %s | %i %i %ix%i = %p\n", output->zone->randr2_id, plane->resolution.x , plane->resolution.y, plane->resolution.w, plane->resolution.h, output);
 
    return plane;
 }
 
-E_API void
-e_plane_name_set(E_Zone *zone,
-                 const char *name)
-{
-   E_OBJECT_CHECK(zone);
-   E_OBJECT_TYPE_CHECK(zone, E_PLANE_TYPE);
-
-   if (zone->name) eina_stringshare_del(zone->name);
-   zone->name = eina_stringshare_add(name);
-}
-
-
 E_API Eina_Bool
 e_plane_resolution_set(E_Plane *plane,
                        int x,
index 191d70e58c117802cf092d5f2768e9979d02befc..3098a2971de040add98bfc7a11a27bd5560aad1a 100644 (file)
@@ -27,9 +27,10 @@ struct _E_Plane
 
    const char  *name;
    E_Plane_Type_State type;
-   E_Zone              *zone;
-   Eina_List   *clist;
+   E_Client     *ec;
    Eina_List   *handlers;
+
+   E_Output     *output;
 };
 
 extern E_API int E_EVENT_PLANE_ADD;
@@ -37,8 +38,7 @@ extern E_API int E_EVENT_PLANE_DEL;
 
 EINTERN int    e_plane_init(void);
 EINTERN int    e_plane_shutdown(void);
-E_API E_Plane   * e_plane_new(E_Zone *zone);
-E_API void       e_plane_name_set(E_Zone *zone, const char *name);
+E_API E_Plane   * e_plane_new(E_Output *zone);
 E_API Eina_Bool  e_plane_resolution_set(E_Plane *plane, int x, int y, int w, int h);
 E_API void       e_plane_type_set(E_Plane *plane, E_Plane_Type_State type);
 E_API E_Plane_Type_State e_plane_type_get(E_Plane *plane);
index 15aeef36b3ecc385228f88a5df7d16afcc0524c7..bb3d6cc6f49fb5b821b340c096bce6c57129a2cf 100644 (file)
@@ -1162,7 +1162,6 @@ static void
 _e_zone_free(E_Zone *zone)
 {
    int x, y;
-   E_Plane *ep;
    //printf("@@@@@@@@@@ e_zone_free: %i %i | %i %i %ix%i = %p\n", zone->num, zone->id, zone->x, zone->y, zone->w, zone->h, zone);
    /* Delete the edge windows if they exist */
    E_FREE_FUNC(zone->edge.top, evas_object_del);
@@ -1191,13 +1190,6 @@ _e_zone_free(E_Zone *zone)
    /* remove handlers */
    E_FREE_LIST(zone->handlers, ecore_event_handler_del);
 
-   /* remove planes */
-   EINA_LIST_FREE(zone->planes, ep)
-     {
-        if (!e_object_is_del(E_OBJECT(ep)))
-           e_object_free(E_OBJECT(ep));
-     }
-
    if (zone->name) eina_stringshare_del(zone->name);
    e_comp->zones = eina_list_remove(e_comp->zones, zone);
    evas_object_del(zone->bg_event_object);
index 7007653d665bde4622e9cc4e28f1cd84426289b7..4c23dde8a8bfcc25bac0007e709c07a1272574cf 100644 (file)
@@ -111,7 +111,7 @@ struct _E_Zone
    E_Zone_Display_State display_state;
    char *randr2_id; // same id we get from randr2 so look it up there
 
-   Eina_List   *planes;
+   E_Output    *output;
    E_Plane     *primary_plane;
 };