Evas sw_generic/x11: Fix calls to native_bind_cb/unbind_cb 32/52232/2
authorJoogab Yun <joogab.yun@samsung.com>
Fri, 20 Nov 2015 05:42:16 +0000 (14:42 +0900)
committerjoogab yun <joogab.yun@samsung.com>
Wed, 25 Nov 2015 06:14:11 +0000 (22:14 -0800)
Summary:
In Evas-SW-Generic/X11, native_unbind_cb is not called sometimes, although
native_bind_cb was called.
Some native surface's cases, both native_bind_cb and native_unbind_cb should
be called for mapping and unmapping, eg. with tbm_surface.

@fix

Test Plan:
Evas Native Surface with pixmap sample.
Evas Native Surface with tbm(this sample can work in Tize Device)
elementary_test

Reviewers: raster, jpeg, cedric, spacegrapher

Subscribers: JoogabYun, scholb.kim, dkdk

Differential Revision: https://phab.enlightenment.org/D3317

From 84cb06784e6491277f3303276b1339c0207fca64 Mon Sep 17 00:00:00 2001
From: Wonsik Jung <sidein@samsung.com>

Change-Id: Ibb0d729ab085f0722649f7dfeaf134f2eac5326e

src/modules/evas/engines/software_generic/evas_engine.c
src/modules/evas/engines/software_x11/evas_engine.c
src/modules/evas/engines/software_x11/evas_xcb_image.c
src/modules/evas/engines/software_x11/evas_xlib_image.c

index e51d49b..f01b753 100644 (file)
@@ -1921,6 +1921,7 @@ eng_image_draw(void *data EINA_UNUSED, void *context, void *surface, void *image
 
    if (do_async)
      {
+        Eina_Bool ret;
         if (!evas_common_rgba_image_scalecache_prepare(image, surface, context, smooth,
                                                        src_x, src_y, src_w, src_h,
                                                        dst_x, dst_y, dst_w, dst_h))
@@ -1933,15 +1934,23 @@ eng_image_draw(void *data EINA_UNUSED, void *context, void *surface, void *image
                   else
 #endif
                     evas_cache_image_load_data(&im->cache_entry);
-                  if (!im->cache_entry.flags.loaded) return EINA_FALSE;
+                  if (!im->cache_entry.flags.loaded)
+                    {
+                       if (im->native.func.unbind)
+                         im->native.func.unbind(data, image);
+                       return EINA_FALSE;
+                    }
                }
           }
-        return evas_common_rgba_image_scalecache_do_cbs(image, surface,
+        ret = evas_common_rgba_image_scalecache_do_cbs(image, surface,
                                                         context, smooth,
                                                         src_x, src_y, src_w, src_h,
                                                         dst_x, dst_y, dst_w, dst_h,
                                                         _image_thr_cb_sample,
                                                         _image_thr_cb_smooth);
+        if (im->native.func.unbind)
+           im->native.func.unbind(data, image);
+        return ret;
      }
 #ifdef BUILD_PIPE_RENDER
    else if ((cpunum > 1))
index 5a5d1cf..bd8bb1d 100644 (file)
@@ -641,6 +641,7 @@ _native_evasgl_free(void *data EINA_UNUSED, void *image)
    im->native.data        = NULL;
    im->native.func.data   = NULL;
    im->native.func.bind   = NULL;
+   im->native.func.unbind = NULL;
    im->native.func.free   = NULL;
    //im->image.data         = NULL;
    free(n);
@@ -740,6 +741,7 @@ eng_image_native_set(void *data EINA_UNUSED, void *image, void *native)
              im->native.func.free = _native_evasgl_free;
              im->native.func.data = NULL;
              im->native.func.bind = NULL;
+             im->native.func.unbind = NULL;
           }
      }
 
index d15dbe3..597a8c6 100644 (file)
@@ -68,6 +68,7 @@ _native_cb_free(void *data EINA_UNUSED, void *image)
    im->native.data = NULL;
    im->native.func.data = NULL;
    im->native.func.bind = NULL;
+   im->native.func.unbind = NULL;
    im->native.func.free = NULL;
    im->image.data = NULL;
 
@@ -116,6 +117,7 @@ evas_xcb_image_native_set(void *data, void *image, void *native)
         im->native.data = n;
         im->native.func.data = NULL;
         im->native.func.bind = _native_cb_bind;
+        im->native.func.unbind = NULL;
         im->native.func.free = _native_cb_free;
 
         _evas_xcb_image_update(data, image, 0, 0, w, h);
index 615d11a..9472977 100644 (file)
@@ -60,6 +60,7 @@ _native_free_cb(void *data EINA_UNUSED, void *image)
    im->native.data        = NULL;
    im->native.func.data   = NULL;
    im->native.func.bind   = NULL;
+   im->native.func.unbind = NULL;
    im->native.func.free   = NULL;
    im->image.data         = NULL;
    free(n);