From: Joogab Yun Date: Wed, 9 Nov 2016 10:17:15 +0000 (+0900) Subject: [evas_sw] add tbm_surface_internal_ref/unref X-Git-Tag: accepted/tizen/common/20170102.152350~223 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c687cab7168c68d256d006fc0e80eff5c392bb9;p=platform%2Fupstream%2Fefl.git [evas_sw] add tbm_surface_internal_ref/unref Change-Id: Ib0b1948bd512656d01132e0e37b06ea8931913f3 --- diff --git a/src/modules/evas/engines/software_generic/evas_native_tbm.c b/src/modules/evas/engines/software_generic/evas_native_tbm.c index a0049b8..54d94de 100644 --- a/src/modules/evas/engines/software_generic/evas_native_tbm.c +++ b/src/modules/evas/engines/software_generic/evas_native_tbm.c @@ -67,6 +67,8 @@ typedef struct _tbm_surface_info /* returns 0 on success */ static int (*sym_tbm_surface_map) (tbm_surface_h surface, int opt, tbm_surface_info_s *info) = NULL; static int (*sym_tbm_surface_unmap) (tbm_surface_h surface) = NULL; +static void (*sym_tbm_surface_internal_unref) (tbm_surface_h surface) = NULL; +static void (*sym_tbm_surface_internal_ref) (tbm_surface_h surface) = NULL; static Eina_Bool tbm_init(void) @@ -102,6 +104,8 @@ tbm_init(void) fail = 0; SYM(tbm_lib, tbm_surface_map); SYM(tbm_lib, tbm_surface_unmap); + SYM(tbm_lib, tbm_surface_internal_unref); + SYM(tbm_lib, tbm_surface_internal_ref); if (fail) { dlclose(tbm_lib); @@ -261,16 +265,27 @@ _native_free_cb(void *data EINA_UNUSED, void *image) { RGBA_Image *im; Native *n; + tbm_surface_h tbm_surf; if (!(im = image)) return; if (!(n = im->native.data)) return; + + if (n->ns.type == EVAS_NATIVE_SURFACE_TBM) + tbm_surf = n->ns.data.tbm.buffer; + else if (n->ns.type == EVAS_NATIVE_SURFACE_WL) + tbm_surf = n->ns_data.wl_surface.tbm_surface; + else + tbm_surf = NULL; + + if (tbm_surf) + sym_tbm_surface_internal_unref(tbm_surf); + im->native.data = NULL; im->native.func.bind = NULL; im->native.func.unbind = NULL; im->native.func.free = NULL; im->native.func.data = NULL; im->image.data = NULL; - free(n); tbm_shutdown(); @@ -378,6 +393,8 @@ evas_native_tbm_surface_image_set(void *data, void *image, void *native) im->native.func.unbind = _native_unbind_cb; im->native.func.free = _native_free_cb; + sym_tbm_surface_internal_ref(tbm_surf); + if (sym_tbm_surface_unmap(tbm_surf)) { ERR("Fail to tbm_surface_unmap()");