From: Changyeon Lee Date: Mon, 24 Apr 2023 07:58:13 +0000 (+0900) Subject: e_comp_object: make the frame object transparent when it is unredirected X-Git-Tag: accepted/tizen/7.0/unified/20230502.051241~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff7ba00c5de9619544ba9cd7967547d3ac09db5f;p=platform%2Fupstream%2Fenlightenment.git e_comp_object: make the frame object transparent when it is unredirected glTexImage2D is called in next render if the frame object is redirected because it does not have native buffer and it is visible. we makes the frame object transparent and evas does not render the frame object.(glTexImage2D is not called) this patch optimizes gpu memory usage. Change-Id: I44a229c4d3e972c4eccf3bfb0b56d73fb6f04e0d --- diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index 32ebad686e..b40f56d990 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -177,6 +177,15 @@ typedef struct _E_Comp_Object Eina_Bool pending_resize_set; int pending_resize_w, pending_resize_h; } render_update_lock; + + struct + { + Eina_Bool set; + int user_r; + int user_g; + int user_b; + int user_a; + } transparent; } E_Comp_Object; typedef struct _E_Input_Rect_Data @@ -2782,6 +2791,23 @@ _e_comp_intercept_focus(void *data, Evas_Object *obj, Eina_Bool focus) evas_object_focus_set(obj, focus); } +static void +_e_comp_intercept_color_set(void *data, Evas_Object *obj, int r, int g, int b, int a) +{ + E_Comp_Object *cw = data; + + if (cw->transparent.set) + { + cw->transparent.user_r = r; + cw->transparent.user_g = g; + cw->transparent.user_b = b; + cw->transparent.user_a = a; + } + else + { + evas_object_color_set(obj, r, g, b, a); + } +} //////////////////////////////////////////////////// static void @@ -3205,6 +3231,7 @@ _e_comp_smart_add(Evas_Object *obj) evas_object_intercept_show_callback_add(obj, _e_comp_intercept_show, cw); evas_object_intercept_hide_callback_add(obj, _e_comp_intercept_hide, cw); evas_object_intercept_focus_set_callback_add(obj, _e_comp_intercept_focus, cw); + evas_object_intercept_color_set_callback_add(obj, _e_comp_intercept_color_set, cw); evas_object_smart_callback_add(obj, "shading", _e_comp_smart_cb_shading, cw); evas_object_smart_callback_add(obj, "shaded", _e_comp_smart_cb_shaded, cw); @@ -4746,6 +4773,56 @@ _e_comp_object_clear(E_Comp_Object *cw) e_comp_object_render_update_del(cw->smart_obj); } +static Eina_Bool +_e_comp_object_transparent_set(Evas_Object *obj, Eina_Bool set) +{ + int r, g, b, a; + + API_ENTRY EINA_FALSE; + + if (cw->transparent.set == set) + return EINA_TRUE; + + if (set) + { + evas_object_color_get(obj, &r, &g, &b, &a); + evas_object_color_set(obj, 0, 0, 0, 0); + + cw->transparent.user_r = r; + cw->transparent.user_g = g; + cw->transparent.user_b = b; + cw->transparent.user_a = a; + + ELOGF("COMP", "Transparent enabled user_color(%d,%d,%d,%d)", + cw->ec, + cw->transparent.user_r, + cw->transparent.user_g, + cw->transparent.user_b, + cw->transparent.user_a); + + cw->transparent.set = EINA_TRUE; + } + else + { + cw->transparent.set = EINA_FALSE; + + evas_object_color_set(obj, + cw->transparent.user_r, + cw->transparent.user_g, + cw->transparent.user_b, + cw->transparent.user_a); + + ELOGF("COMP", "Transparent disabled user_color(%d,%d,%d,%d)", + cw->ec, + cw->transparent.user_r, + cw->transparent.user_g, + cw->transparent.user_b, + cw->transparent.user_a); + } + + return EINA_TRUE; +} + /* helper function to simplify toggling of redirection for display servers which support it */ E_API void e_comp_object_redirected_set(Evas_Object *obj, Eina_Bool set) @@ -4765,11 +4842,14 @@ e_comp_object_redirected_set(Evas_Object *obj, Eina_Bool set) e_comp_object_render_update_add(obj); else e_comp_object_damage(obj, 0, 0, cw->w, cw->h); + + _e_comp_object_transparent_set(obj, EINA_FALSE); evas_object_smart_callback_call(obj, "redirected", NULL); } else { _e_comp_object_clear(cw); + _e_comp_object_transparent_set(obj, EINA_TRUE); evas_object_smart_callback_call(obj, "unredirected", NULL); } } diff --git a/src/bin/e_hwc_windows.c b/src/bin/e_hwc_windows.c index 5c0fdf0a4d..d124f75d88 100644 --- a/src/bin/e_hwc_windows.c +++ b/src/bin/e_hwc_windows.c @@ -1162,7 +1162,8 @@ _e_hwc_windows_visible_windows_list_get(E_Hwc *hwc) e_client_geometry_get(ec, &x, &y, &w, &h); - if ((!effect_client) && (!e_comp_object_color_visible_get(ec->frame))) + if ((!effect_client) && + (e_comp_object_redirected_get(ec->frame) && !e_comp_object_color_visible_get(ec->frame))) { e_hwc_window_state_set(hwc_window, E_HWC_WINDOW_STATE_NONE, EINA_TRUE);