From: Joogab Yun Date: Wed, 7 Dec 2016 10:53:17 +0000 (+0900) Subject: [ecore_evas_wayland_shm] wayland_tbm_client_init / deinit X-Git-Tag: accepted/tizen/common/20170102.152350~105 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=813c089407d9af117ff9870e3d75700e6c636f96;p=platform%2Fupstream%2Fefl.git [ecore_evas_wayland_shm] wayland_tbm_client_init / deinit Change-Id: I91cabd1d6334fb230e1d3af443d3fbccd082a075 --- diff --git a/configure.ac b/configure.ac index 584da9e..647a56b 100755 --- a/configure.ac +++ b/configure.ac @@ -3023,7 +3023,7 @@ EFL_INTERNAL_DEPEND_PKG([ECORE_WAYLAND], [eo]) EFL_INTERNAL_DEPEND_PKG([ECORE_WAYLAND], [eina]) EFL_DEPEND_PKG([ECORE_WAYLAND], [WAYLAND], - [wayland-client >= 1.3.0 wayland-cursor >= 1.3.0 xkbcommon >= 0.3.0 xdg-shell-client text-client tizen-extension-client]) + [wayland-client >= 1.3.0 wayland-cursor >= 1.3.0 xkbcommon >= 0.3.0 xdg-shell-client text-client tizen-extension-client wayland-tbm-client]) EFL_EVAL_PKGS([ECORE_WAYLAND]) diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index e631409..1db1661 100755 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -2091,3 +2091,9 @@ _ecore_evas_wl_interface_new(void) return iface; } + +int +_ecore_evas_common_init_count_get(void) +{ + return _ecore_evas_wl_init_count; +} diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h old mode 100644 new mode 100755 index 6fedd00..13107c3 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h @@ -109,6 +109,8 @@ void _ecore_evas_wl_common_wm_rot_available_rotations_set(Ecore_Evas *ee, const void _ecore_evas_wl_common_wm_rot_manual_rotation_done_set(Ecore_Evas *ee, Eina_Bool set); void _ecore_evas_wl_common_wm_rot_manual_rotation_done(Ecore_Evas *ee); +int _ecore_evas_common_init_count_get(void); + #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM void _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location); void _ecore_evas_wayland_shm_resize_edge_set(Ecore_Evas *ee, int edge); diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c old mode 100644 new mode 100755 index 5231b17..9ee3e15 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c @@ -1,4 +1,5 @@ #include "ecore_evas_wayland_private.h" +#include #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM # include @@ -31,6 +32,7 @@ #endif /* ! _WIN32 */ /* local function prototypes */ +static void _ecore_evas_wl_free(Ecore_Evas *ee); static void _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h); static void _ecore_evas_wl_show(Ecore_Evas *ee); static void _ecore_evas_wl_hide(Ecore_Evas *ee); @@ -40,7 +42,7 @@ static void _ecore_evas_wl_rotation_set(Ecore_Evas *ee, int rotation, int resize static Ecore_Evas_Engine_Func _ecore_wl_engine_func = { - _ecore_evas_wl_common_free, + _ecore_evas_wl_free, _ecore_evas_wl_common_callback_resize_set, _ecore_evas_wl_common_callback_move_set, NULL, @@ -125,6 +127,7 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent, Ecore_Evas_Engine_Wl_Data *wdata; Ecore_Evas_Interface_Wayland *iface; Ecore_Evas *ee; + int _ecore_evas_wl_init_count = -1; int method = 0; int fx = 0, fy = 0, fw = 0, fh = 0; @@ -162,7 +165,7 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent, ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); - _ecore_evas_wl_common_init(); + _ecore_evas_wl_init_count = _ecore_evas_wl_common_init(); ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func; ee->engine.data = wdata; @@ -252,6 +255,10 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent, { einfo->info.wl_disp = ecore_wl_display_get(); einfo->info.wl_shm = ecore_wl_shm_get(); + + if (_ecore_evas_wl_init_count == 1) + einfo->info.tbm_client = wayland_tbm_client_init(einfo->info.wl_disp); + einfo->info.destination_alpha = EINA_TRUE; einfo->info.rotation = ee->rotation; einfo->info.wl_surface = ecore_wl_window_surface_create(wdata->win); @@ -316,6 +323,24 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent, } static void +_ecore_evas_wl_free(Ecore_Evas *ee) +{ + Evas_Engine_Info_Wayland_Shm *einfo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + + einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); + if (einfo && einfo->info.tbm_client) + { + if (_ecore_evas_common_init_count_get() == 1) + wayland_tbm_client_deinit(einfo->info.tbm_client); + } + _ecore_evas_wl_common_free(ee); +} + +static void _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) { LOGFN(__FILE__, __LINE__, __FUNCTION__); diff --git a/src/modules/evas/engines/wayland_shm/Evas_Engine_Wayland_Shm.h b/src/modules/evas/engines/wayland_shm/Evas_Engine_Wayland_Shm.h index ef4605a..9651a64 100755 --- a/src/modules/evas/engines/wayland_shm/Evas_Engine_Wayland_Shm.h +++ b/src/modules/evas/engines/wayland_shm/Evas_Engine_Wayland_Shm.h @@ -15,6 +15,7 @@ struct _Evas_Engine_Info_Wayland_Shm /* the wayland shm object used to create new shm pool */ struct wl_shm *wl_shm; struct wl_surface *wl_surface; + struct wayland_tbm_client *tbm_client; unsigned int rotation, depth; Eina_Bool destination_alpha : 1; diff --git a/src/modules/evas/engines/wayland_shm/evas_tbmbuf.c b/src/modules/evas/engines/wayland_shm/evas_tbmbuf.c index 5e15a0a..4f3df5c 100755 --- a/src/modules/evas/engines/wayland_shm/evas_tbmbuf.c +++ b/src/modules/evas/engines/wayland_shm/evas_tbmbuf.c @@ -528,9 +528,6 @@ _evas_tbmbuf_surface_destroy(Surface *s) sym_tbm_surface_queue_destroy(surf->tbm_queue); } - if (surf->tbm_client) - sym_wayland_tbm_client_deinit(surf->tbm_client); - surf->tbm_queue = NULL; surf->tbm_client = NULL; free(surf); @@ -564,7 +561,7 @@ _evas_tbmbuf_surface_create(Surface *s, int w, int h, int num_buff EINA_UNUSED) surf->compositor_version = 3; /* create tbm_client */ - surf->tbm_client = sym_wayland_tbm_client_init(surf->wl_display); + surf->tbm_client = s->info->info.tbm_client; if (surf->tbm_client == NULL) { ERR("No wayland_tbm global"); goto err;