From: Changyeon Lee Date: Wed, 22 Jan 2020 08:24:59 +0000 (+0900) Subject: e_hwc_windows: don't create backup buffer if buffer_flush is done X-Git-Tag: submit/tizen/20200206.060445~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd481acce78a410d747d3b880267e5890d992dcf;p=platform%2Fupstream%2Fenlightenment.git e_hwc_windows: don't create backup buffer if buffer_flush is done if client is iconic and buffer_flush is done, backup buffer isn't needed. because client isn't shown untill new buffer is attached Change-Id: I92e5a4847dff462310eddddad3ebdb209fc05b75 --- diff --git a/src/bin/e_hwc_window.c b/src/bin/e_hwc_window.c index 1bd7ab8725..0de3039959 100644 --- a/src/bin/e_hwc_window.c +++ b/src/bin/e_hwc_window.c @@ -1960,28 +1960,35 @@ e_hwc_window_constraints_update(E_Hwc_Window *hwc_window) return EINA_TRUE; } -static void +static Eina_Bool _e_hwc_window_client_recover(E_Hwc_Window *hwc_window) { E_Comp_Wl_Buffer *recover_buffer = NULL;; tbm_surface_h tsurface =NULL; E_Client *ec = NULL; - if (hwc_window->is_deleted) return; + if (hwc_window->is_deleted) return EINA_FALSE; ec = hwc_window->ec; - if (!ec) return; + if (!ec) return EINA_FALSE; - if (e_object_is_del(E_OBJECT(ec))) return; + if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; recover_buffer = _e_hwc_window_comp_wl_buffer_get(hwc_window); + + if ((!recover_buffer) && + (!evas_object_visible_get(ec->frame)) && + (ec->exp_iconify.buffer_flush) && + (e_policy_visibility_client_is_iconic(ec))) + return EINA_FALSE; + if (!recover_buffer) { tsurface = e_hwc_window_displaying_surface_get(hwc_window); - if (!tsurface) return; + if (!tsurface) return EINA_FALSE; recover_buffer = e_comp_wl_tbm_buffer_get(tsurface); - EINA_SAFETY_ON_NULL_RETURN(recover_buffer); + EINA_SAFETY_ON_NULL_RETURN_VAL(recover_buffer, EINA_FALSE); } EHWTRACE("Recover ts:%p -- {%s}", @@ -1992,12 +1999,15 @@ _e_hwc_window_client_recover(E_Hwc_Window *hwc_window) e_comp_wl_surface_attach(ec, recover_buffer); e_hwc_window_buffer_fetch(hwc_window); + + return EINA_TRUE; } static Eina_Bool _e_hwc_window_rendered_window_set(E_Hwc_Window *hwc_window, Eina_Bool set) { E_Client *ec = NULL; + Eina_Bool ret; EINA_SAFETY_ON_NULL_RETURN_VAL(hwc_window, EINA_FALSE); @@ -2012,14 +2022,17 @@ _e_hwc_window_rendered_window_set(E_Hwc_Window *hwc_window, Eina_Bool set) if (set) { - _e_hwc_window_client_recover(hwc_window); + ret = _e_hwc_window_client_recover(hwc_window); if (hwc_window->ec->redirected) { - e_pixmap_image_refresh(ec->pixmap); - e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h); - e_comp_object_dirty(ec->frame); - e_comp_object_render(ec->frame); + if (ret) + { + e_pixmap_image_refresh(ec->pixmap); + e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h); + e_comp_object_dirty(ec->frame); + e_comp_object_render(ec->frame); + } e_comp_object_redirected_set(ec->frame, EINA_TRUE); diff --git a/src/bin/e_hwc_window_queue.c b/src/bin/e_hwc_window_queue.c index b9261a3eff..c60ec2fd88 100644 --- a/src/bin/e_hwc_window_queue.c +++ b/src/bin/e_hwc_window_queue.c @@ -779,7 +779,7 @@ fail: return EINA_FALSE; } -static Eina_Bool +static tbm_surface_h _e_hwc_window_queue_backup_buffer_set(E_Hwc_Window *hwc_window, Eina_Bool attach) { E_Comp_Wl_Buffer *comp_buffer = NULL, *backup_buffer = NULL; @@ -787,11 +787,11 @@ _e_hwc_window_queue_backup_buffer_set(E_Hwc_Window *hwc_window, Eina_Bool attach uint32_t flags = 0; E_Client *ec = hwc_window->ec; - if (!ec) return EINA_FALSE; + if (!ec) return NULL; comp_buffer = _comp_wl_buffer_get(hwc_window->ec); - if (!comp_buffer) return EINA_FALSE; - if (!comp_buffer->tbm_surface) return EINA_FALSE; + if (!comp_buffer) return NULL; + if (!comp_buffer->tbm_surface) return NULL; tsurface = comp_buffer->tbm_surface; @@ -799,15 +799,15 @@ _e_hwc_window_queue_backup_buffer_set(E_Hwc_Window *hwc_window, Eina_Bool attach { flags = _comp_wl_buffer_flags_get(comp_buffer); if (flags != E_HWC_WINDOW_QUEUE_BUFFER_FLAGS) - return EINA_FALSE; + return NULL; } else { if (tsurface != hwc_window->display.buffer.tsurface) - return EINA_FALSE; + return NULL; if (!hwc_window->display.buffer.from_queue) - return EINA_FALSE; + return NULL; } EHWQINF("Backup buffer get ehw:%p origin:%p", @@ -815,7 +815,7 @@ _e_hwc_window_queue_backup_buffer_set(E_Hwc_Window *hwc_window, Eina_Bool attach comp_buffer->tbm_surface); backup_buffer = _comp_wl_backup_buffer_get(tsurface); - EINA_SAFETY_ON_NULL_RETURN_VAL(backup_buffer, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(backup_buffer, NULL); if (comp_buffer) backup_buffer->transform = comp_buffer->transform; @@ -836,7 +836,7 @@ _e_hwc_window_queue_backup_buffer_set(E_Hwc_Window *hwc_window, Eina_Bool attach e_pixmap_refresh(ec->pixmap); } - return EINA_TRUE; + return tsurface; } static Eina_Bool @@ -933,32 +933,47 @@ _e_hwc_window_queue_prepare_unset(E_Hwc_Window_Queue *queue) { struct wayland_tbm_client_queue *cqueue = NULL; E_Hwc_Window *hwc_window = queue->user; + tbm_surface_h tsurface; + E_Hwc_Window_Queue_Buffer *queue_buffer; - if (hwc_window && hwc_window->ec) - { - cqueue = _user_cqueue_get(hwc_window->ec); - if (cqueue) - wayland_tbm_server_client_queue_set_wait_usable_cb(cqueue, NULL, NULL); - - if (_e_hwc_window_queue_backup_buffer_set(hwc_window, EINA_TRUE)) - { - if(hwc_window->render_target) - { - e_pixmap_image_refresh(hwc_window->ec->pixmap); - e_comp_object_damage(hwc_window->ec->frame, 0, 0, - hwc_window->ec->w, hwc_window->ec->h); - e_comp_object_dirty(hwc_window->ec->frame); - e_comp_object_render(hwc_window->ec->frame); - } - } - } + /* queue retrieve the buffers from the hwc_window */ + _e_hwc_window_queue_buffers_retrieve(queue, queue->user); tbm_surface_queue_remove_dequeuable_cb(queue->tqueue, _e_hwc_window_queue_cb_dequeueable, (void *)queue); - /* queue retrieve the buffers from the hwc_window */ - _e_hwc_window_queue_buffers_retrieve(queue, queue->user); + if (!hwc_window || !hwc_window->ec) return; + + cqueue = _user_cqueue_get(hwc_window->ec); + if (cqueue) + wayland_tbm_server_client_queue_set_wait_usable_cb(cqueue, NULL, NULL); + + if ((!_comp_wl_buffer_get(hwc_window->ec)) && + (!evas_object_visible_get(hwc_window->ec->frame)) && + (hwc_window->ec->exp_iconify.buffer_flush) && + (e_policy_visibility_client_is_iconic(hwc_window->ec))) + return; + + tsurface = _e_hwc_window_queue_backup_buffer_set(hwc_window, EINA_TRUE); + if (tsurface) + { + if(hwc_window->render_target) + { + e_pixmap_image_refresh(hwc_window->ec->pixmap); + e_comp_object_damage(hwc_window->ec->frame, 0, 0, + hwc_window->ec->w, hwc_window->ec->h); + e_comp_object_dirty(hwc_window->ec->frame); + e_comp_object_render(hwc_window->ec->frame); + } + + queue_buffer = e_hwc_window_queue_buffer_find(queue, tsurface); + if (queue_buffer) + { + if (!queue_buffer->acquired && queue_buffer->dequeued) + e_hwc_window_queue_buffer_release(queue, queue_buffer); + } + } } static void @@ -1056,15 +1071,45 @@ static void _e_hwc_window_queue_cb_buffer_change(void *data, E_Client *ec) { E_Hwc_Window *hwc_window = NULL; + E_Comp_Wl_Buffer *comp_buffer; + E_Hwc_Window_Queue_Buffer *queue_buffer; + uint32_t flags = 0; + tbm_surface_h tsurface; EINA_SAFETY_ON_NULL_RETURN(ec); hwc_window = ec->hwc_window; if (!hwc_window) return; if ((hwc_window->queue) && (e_hwc_window_device_state_available_get(hwc_window))) + { + if (hwc_window->queue->state == E_HWC_WINDOW_QUEUE_STATE_SET) + return; + + comp_buffer = _comp_wl_buffer_get(ec); + if (!comp_buffer) return; + if (!comp_buffer->resource) return; + if (!comp_buffer->tbm_surface) return; + + flags = _comp_wl_buffer_flags_get(comp_buffer); + if (flags != E_HWC_WINDOW_QUEUE_BUFFER_FLAGS) return; + + if (e_hwc_window_queue_buffer_find(hwc_window->queue, comp_buffer->tbm_surface)) + return; + } + + if ((ec->exp_iconify.buffer_flush) && (e_policy_visibility_client_is_iconic(ec))) return; - _e_hwc_window_queue_backup_buffer_set(hwc_window, EINA_FALSE); + tsurface = _e_hwc_window_queue_backup_buffer_set(hwc_window, EINA_FALSE); + if (tsurface && hwc_window->queue) + { + queue_buffer = e_hwc_window_queue_buffer_find(hwc_window->queue, tsurface); + if (queue_buffer) + { + if (!queue_buffer->acquired && queue_buffer->dequeued) + e_hwc_window_queue_buffer_release(hwc_window->queue, queue_buffer); + } + } } void diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c index b5679cfe61..fc8847e5e9 100644 --- a/src/bin/e_pixmap.c +++ b/src/bin/e_pixmap.c @@ -1060,9 +1060,6 @@ e_pixmap_buffer_clear(E_Pixmap *cp, Eina_Bool only_free) } else { - if (e_comp_is_on_overlay(cp->client)) - e_comp_hwc_client_end(cp->client, __FUNCTION__); - tizen_surface_shm_flusher_send_flush(cp->shm_flusher); } }