create a bg rectangle only if 24 depth and topmost 51/62351/2
authorBoram Park <boram1288.park@samsung.com>
Tue, 15 Mar 2016 12:48:14 +0000 (21:48 +0900)
committerBoram Park <boram1288.park@samsung.com>
Tue, 15 Mar 2016 13:13:44 +0000 (22:13 +0900)
Change-Id: I9b6d2c3d1f70b105a0893451847ecca0aabd32db

src/bin/e_comp_wl.c

index 116aa27cd2f0acbafac481197110223068f31420..edd9e6fd05b89d5561166796ae9b750bb65fc264 100644 (file)
@@ -31,6 +31,7 @@ E_API int E_EVENT_WAYLAND_GLOBAL_ADD = -1;
 static void _e_comp_wl_subsurface_parent_commit(E_Client *ec, Eina_Bool parent_synchronized);
 static void _e_comp_wl_subsurface_restack(E_Client *ec);
 static void _e_comp_wl_subsurface_restack_bg_rectangle(E_Client *ec);
+static void _e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec);
 
 /* local variables */
 typedef struct _E_Comp_Wl_Transform_Context
@@ -577,6 +578,26 @@ _e_comp_wl_topmost_parent_get(E_Client *ec)
    return ec;
 }
 
+static Eina_Bool
+_e_comp_wl_video_client_has(E_Client *ec)
+{
+   E_Client *subc;
+   Eina_List *l;
+
+   if (ec->comp_data->video_client)
+     return EINA_TRUE;
+
+   EINA_LIST_FOREACH(ec->comp_data->sub.below_list_pending, l, subc)
+     if (_e_comp_wl_video_client_has(subc))
+        return EINA_TRUE;
+
+   EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc)
+     if (_e_comp_wl_video_client_has(subc))
+        return EINA_TRUE;
+
+   return EINA_FALSE;
+}
+
 static void
 _e_comp_wl_extern_parent_commit(E_Client *ec)
 {
@@ -2413,6 +2434,8 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
         eina_tiler_clear(state->input);
      }
 
+   _e_comp_wl_subsurface_check_below_bg_rectangle(ec);
+
    if (!state->buffer_viewport.changed &&
        (buffer && buffer->type == E_COMP_WL_BUFFER_TYPE_VIDEO) &&
        e_comp->wl_comp_data->available_hw_accel.underlay)
@@ -3113,12 +3136,17 @@ _e_comp_wl_subsurface_bg_evas_cb_resize(void *data, Evas *evas EINA_UNUSED, Evas
 }
 
 static void
-_e_comp_wl_subsurface_create_below_bg_rectangle(E_Client *ec)
+_e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec)
 {
+   Eina_Bool has_video_client;
    short layer;
 
    if (ec->comp_data->sub.below_obj) return;
+   if (ec->comp_data->sub.data) return;
+   if (!ec->comp_data->sub.below_list && !ec->comp_data->sub.below_list_pending) return;
+   if (ec->argb) return;
 
+   /* create a bg rectangle if topmost window is 24 depth window */
    ec->comp_data->sub.below_obj = evas_object_rectangle_add(e_comp->evas);
    EINA_SAFETY_ON_NULL_RETURN(ec->comp_data->sub.below_obj);
 
@@ -3133,6 +3161,13 @@ _e_comp_wl_subsurface_create_below_bg_rectangle(E_Client *ec)
    evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESIZE,
                                   _e_comp_wl_subsurface_bg_evas_cb_resize, ec);
 
+   has_video_client = _e_comp_wl_video_client_has(ec);
+   ELOGF("COMP", "         |bg_rectangle|video_client:%d", NULL, ec, has_video_client);
+
+   /* set alpha only if SW path */
+   if (!has_video_client)
+     e_comp_object_alpha_set(ec->frame, EINA_TRUE);
+
    _e_comp_wl_subsurface_restack(ec);
    _e_comp_wl_subsurface_restack_bg_rectangle(ec);
 }
@@ -3444,6 +3479,8 @@ e_comp_wl_subsurface_create(E_Client *ec, E_Client *epc, uint32_t id, struct wl_
    ec->no_shape_cut = EINA_TRUE;
    ec->border_size = 0;
 
+   ELOGF("COMP", "         |subsurface_parent:%p", NULL, ec, epc);
+
    if (epc)
      {
         if (epc->frame)
@@ -4650,19 +4687,6 @@ e_comp_wl_surface_commit(E_Client *ec)
         _e_comp_wl_subsurface_restack_bg_rectangle(topmost);
      }
 
-   if (ec->comp_data->sub.below_list || ec->comp_data->sub.below_list_pending)
-     {
-        //temporarily only check if below_obj is null.
-        if (!ec->comp_data->sub.below_obj)
-//        if (!ec->argb && !ec->comp_data->video_client && !ec->comp_data->sub.below_obj)
-          {
-            e_comp_object_alpha_set(ec->frame, EINA_TRUE);
-
-            if (e_pixmap_resource_get(ec->pixmap))
-              _e_comp_wl_subsurface_create_below_bg_rectangle(ec);
-          }
-     }
-
    if (!e_pixmap_usable_get(ec->pixmap))
      {
         if (ec->comp_data->mapped)