From fde8d8cea3f2f7f8c622eeae4a7ed63f8c88988e Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Wed, 18 Mar 2020 21:16:28 +0900 Subject: [PATCH] e_config: add config use_buffer_flush_timeout/buffer_flush_timer_interval if use_buffer_flush_timeout and buffer_flush_timer_interval are set, buffer_flush is not performed immediately. e20 wait the timer interval after e_pixmap_buffer_clear is called. Change-Id: I679f1d111121fbb1b1d371a23972bf722039bf56 --- src/bin/e_config.c | 3 + src/bin/e_config.h | 2 + src/bin/e_pixmap.c | 139 +++++++++++++++++++++++++++------------------ 3 files changed, 90 insertions(+), 54 deletions(-) diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 9bd435bde4..302f355d33 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -274,6 +274,8 @@ _e_config_edd_init(Eina_Bool old) E_CONFIG_VAL(D, T, comp_canvas_bg.opmode, INT); E_CONFIG_VAL(D, T, delayed_load_idle_count, INT); E_CONFIG_VAL(D, T, use_buffer_flush, UCHAR); + E_CONFIG_VAL(D, T, use_buffer_flush_timeout, UCHAR); + E_CONFIG_VAL(D, T, buffer_flush_timer_interval, DOUBLE); E_CONFIG_VAL(D, T, use_desk_smart_obj, UCHAR); E_CONFIG_LIST(D, T, sock_accesses, _e_config_socket_access_edd); E_CONFIG_LIST(D, T, aux_hint_supported, _e_config_aux_hint_supported_edd); @@ -518,6 +520,7 @@ e_config_load(void) E_CONFIG_LIMIT(e_config->comp_canvas_bg.opmode, 0, 11); E_CONFIG_LIMIT(e_config->delayed_load_idle_count, 0, 100); E_CONFIG_LIMIT(e_config->use_buffer_flush, 0, 1); + E_CONFIG_LIMIT(e_config->use_buffer_flush_timeout, 0, 1); E_CONFIG_LIMIT(e_config->use_desk_smart_obj, 0, 1); E_CONFIG_LIMIT(e_config->use_module_srv.qp, 0, 1); E_CONFIG_LIMIT(e_config->launchscreen_timeout, 7.0, 100.0); diff --git a/src/bin/e_config.h b/src/bin/e_config.h index e93fc09b15..2e64fcedf2 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -174,6 +174,8 @@ struct _E_Config int delayed_load_idle_count; Eina_Bool use_buffer_flush; // 0: none, 1: let a client flush buffer when it is changed into iconic state to save memory + Eina_Bool use_buffer_flush_timeout; // 0: none 1: use buffer_flush timer + double buffer_flush_timer_interval; // time value the interval of buffer flush after iconify or commit in second (default : 0) Eina_Bool use_desk_smart_obj; // 0: none, 1: make e_desk as a smart object Eina_List *sock_accesses; // list of socket(wayland-0, tbm-drm-auto, tbm-socket) to grant permission without systemd Eina_List *aux_hint_supported; // pre-defined aux hint list for a client launched ahead of delayed e-module loading diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c index fc8847e5e9..8c3478f951 100644 --- a/src/bin/e_pixmap.c +++ b/src/bin/e_pixmap.c @@ -40,6 +40,8 @@ struct _E_Pixmap uuid_t uuid; struct wl_resource *shm_flusher; + Ecore_Timer *buffer_flush_timer; + Eina_Bool buffer_flush_only_free; E_Comp_Wl_Client_Data *cdata; Eina_Bool own_cdata : 1; @@ -146,6 +148,9 @@ _e_pixmap_free(E_Pixmap *cp) if (cp->buffer) wl_list_remove(&cp->buffer_destroy_listener.link); + if (cp->buffer_flush_timer) + ecore_timer_del(cp->buffer_flush_timer); + free(cp); } @@ -1025,75 +1030,52 @@ e_pixmap_shutdown(void) { } -/* By this calling, client will destroy their buffer by this feature - * implementation. the implementation for shared memory is in evas_shm engine. - */ -E_API void -e_pixmap_buffer_clear(E_Pixmap *cp, Eina_Bool only_free) +static void +_e_pixmap_buffer_clear(E_Pixmap *cp, Eina_Bool only_free) { E_Comp_Wl_Client_Data *cdata; struct wl_resource *cb; Eina_List *l, *ll; - EINA_SAFETY_ON_NULL_RETURN(cp); - - /* disabled this feature */ - if (!(cp->client && cp->client->exp_iconify.buffer_flush)) - return; + if (!cp->client) return; + if (!e_policy_visibility_client_is_iconic(cp->client)) return; DBG("PIXMAP: Buffer Flush(%s) '%s'(%p) only_free:%d", cp->shm_flusher ? "SHM" : "NATIVE", cp->client->icccm.name?:"", cp->client, only_free); - if (cp->shm_flusher) + if (only_free) { - if (only_free == EINA_TRUE) - { - if (TIZEN_SURFACE_SHM_FLUSHER_FREE_FLUSH_SINCE_VERSION <= wl_resource_get_version(cp->shm_flusher)) - { - tizen_surface_shm_flusher_send_free_flush(cp->shm_flusher); - } - else - { - /*free_flush was supported from version 2*/ - return; - } - } - else - { - tizen_surface_shm_flusher_send_flush(cp->shm_flusher); - } - } - else if (cp->buffer) - { - if (only_free) + if (!cp->shm_flusher) return; + + /*free_flush was supported from version 2*/ + if (wl_resource_get_version(cp->shm_flusher) < TIZEN_SURFACE_SHM_FLUSHER_FREE_FLUSH_SINCE_VERSION) return; - switch (cp->buffer->type) - { - case E_COMP_WL_BUFFER_TYPE_TBM: - case E_COMP_WL_BUFFER_TYPE_NATIVE: - { - struct wayland_tbm_client_queue *cqueue; - - cqueue = - wayland_tbm_server_client_queue_get(e_comp_wl->tbm.server, - cp->client->comp_data->wl_surface); - if (!cqueue) - return; - - wayland_tbm_server_client_queue_flush(cqueue); - } - break; - default: - /* Do nothing */ - break; - } + tizen_surface_shm_flusher_send_free_flush(cp->shm_flusher); } else - return; - - if (only_free == EINA_FALSE) { + if (cp->shm_flusher) + tizen_surface_shm_flusher_send_flush(cp->shm_flusher); + else + { + if ((cp->buffer) && (cp->client->comp_data)) + { + if ((cp->buffer->type == E_COMP_WL_BUFFER_TYPE_TBM) || + (cp->buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE)) + { + struct wayland_tbm_client_queue *cqueue; + + cqueue = wayland_tbm_server_client_queue_get(e_comp_wl->tbm.server, + cp->client->comp_data->wl_surface); + if (!cqueue) return; + + wayland_tbm_server_client_queue_flush(cqueue); + } + } + } + + /* release the helded buffer by e_client */ if (cp->client->comp_data) { /* release the helded buffer by e_client */ @@ -1114,7 +1096,56 @@ e_pixmap_buffer_clear(E_Pixmap *cp, Eina_Bool only_free) wl_resource_destroy(cb); } } +} + +static Eina_Bool +_e_pixmap_cb_buffer_flush_timer(void *data) +{ + E_Pixmap *cp = (E_Pixmap *)data; + if (!cp) return ECORE_CALLBACK_CANCEL; + + cp->buffer_flush_timer = NULL; + _e_pixmap_buffer_clear(cp, cp->buffer_flush_only_free); + + return ECORE_CALLBACK_CANCEL; +} + +/* By this calling, client will destroy their buffer by this feature + * implementation. the implementation for shared memory is in evas_shm engine. + */ +E_API void +e_pixmap_buffer_clear(E_Pixmap *cp, Eina_Bool only_free) +{ + EINA_SAFETY_ON_NULL_RETURN(cp); + + /* disabled this feature */ + if (!cp->client) return; + if (!cp->client->exp_iconify.buffer_flush) return; + + if (only_free) + { + if (!cp->shm_flusher) return; + + /*free_flush was supported from version 2*/ + if (wl_resource_get_version(cp->shm_flusher) < TIZEN_SURFACE_SHM_FLUSHER_FREE_FLUSH_SINCE_VERSION) + return; + } + + if ((e_config->use_buffer_flush_timeout) && (e_config->buffer_flush_timer_interval > 0)) + { + if (cp->buffer_flush_timer) + { + ecore_timer_del(cp->buffer_flush_timer); + cp->buffer_flush_timer = NULL; + } + cp->buffer_flush_only_free = only_free; + cp->buffer_flush_timer = ecore_timer_add(e_config->buffer_flush_timer_interval, + _e_pixmap_cb_buffer_flush_timer, + cp); + } + else + _e_pixmap_buffer_clear(cp, only_free); } EINTERN void * -- 2.34.1