e_pixmap/e_comp_object: ref shm data pool for evas image data set 61/79861/1 accepted/tizen/common/20160713.145051 accepted/tizen/ivi/20160713.094452 accepted/tizen/mobile/20160713.094517 accepted/tizen/tv/20160713.094433 accepted/tizen/wearable/20160713.094505 submit/tizen/20160713.083957
authorMinJeong Kim <minjjj.kim@samsung.com>
Wed, 13 Jul 2016 08:32:54 +0000 (17:32 +0900)
committerMinJeong Kim <minjjj.kim@samsung.com>
Wed, 13 Jul 2016 08:34:35 +0000 (17:34 +0900)
ref shm data pool for evas image data set instead of pixmap refresh.

Change-Id: Ic99ecc87d052e932b94863f9c5e51df261dea398
Signed-off-by: MinJeong Kim <minjjj.kim@samsung.com>
src/bin/e_comp_object.c
src/bin/e_pixmap.c
src/bin/e_pixmap.h

index 8af73dc..b7efb11 100644 (file)
@@ -3762,6 +3762,9 @@ e_comp_object_render(Evas_Object *obj)
         pix = e_pixmap_image_data_get(cw->ec->pixmap);
      }
 
+   if ((pix) && ((!cw->blanked) || (cw->obj_mirror)))
+     e_pixmap_image_data_ref(cw->ec->pixmap);
+
    /* set pixel data */
    evas_object_image_data_set(cw->obj, cw->blanked ? NULL : pix);
    _e_comp_object_alpha_set(cw);
index 1952368..9be0833 100644 (file)
@@ -35,6 +35,7 @@ struct _E_Pixmap
    E_Comp_Wl_Buffer_Ref buffer_ref;
    struct wl_listener buffer_destroy_listener;
    void *data;
+   struct wl_shm_buffer *shm_buffer;
    struct wl_shm_pool *data_pool;
    Eina_Rectangle opaque;
    uuid_t uuid;
@@ -100,6 +101,7 @@ _e_pixmap_cb_buffer_destroy(struct wl_listener *listener, void *data EINA_UNUSED
 
    cp = container_of(listener, E_Pixmap, buffer_destroy_listener);
    cp->data = NULL;
+   cp->shm_buffer = NULL;
    cp->buffer_destroy_listener.notify = NULL;
 }
 
@@ -673,6 +675,7 @@ e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache)
      }
    e_comp_wl_buffer_reference(&cp->buffer_ref, NULL);
    cp->data = NULL;
+   cp->shm_buffer = NULL;
 }
 
 E_API Eina_Bool
@@ -734,9 +737,7 @@ e_pixmap_image_refresh(E_Pixmap *cp)
           }
 
         cp->data = wl_shm_buffer_get_data(shm_buffer);
-
-        if (cp->data_pool) wl_shm_pool_unref(cp->data_pool);
-        cp->data_pool = wl_shm_buffer_ref_pool(shm_buffer);
+        cp->shm_buffer = shm_buffer;
      }
    else if (buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE)
      {
@@ -772,6 +773,7 @@ e_pixmap_image_refresh(E_Pixmap *cp)
         cp->h = buffer->h;
         cp->image_argb = EINA_FALSE; /* TODO: format */
         cp->data = NULL;
+        cp->shm_buffer = NULL;
 
         /* TODO: Current buffer management process doesn't ensure
          * to render all committed buffer, it means there are buffers
@@ -803,6 +805,7 @@ e_pixmap_image_refresh(E_Pixmap *cp)
               break;
           }
         cp->data = NULL;
+        cp->shm_buffer = NULL;
      }
    else
      {
@@ -837,6 +840,26 @@ e_pixmap_image_is_argb(const E_Pixmap *cp)
    return EINA_FALSE;
 }
 
+E_API void
+e_pixmap_image_data_ref(E_Pixmap *cp)
+{
+   EINA_SAFETY_ON_NULL_RETURN(cp);
+
+   switch (cp->type)
+     {
+      case E_PIXMAP_TYPE_WL:
+         if (cp->shm_buffer)
+           {
+              if (cp->data_pool) wl_shm_pool_unref(cp->data_pool);
+              cp->data_pool = wl_shm_buffer_ref_pool(cp->shm_buffer);
+           }
+         break;
+      default:
+         break;
+     }
+   return;
+}
+
 E_API void *
 e_pixmap_image_data_get(E_Pixmap *cp)
 {
index cd519e8..194686a 100644 (file)
@@ -71,6 +71,7 @@ E_API Eina_Bool e_pixmap_image_refresh(E_Pixmap *cp);
 E_API Eina_Bool e_pixmap_image_exists(const E_Pixmap *cp);
 E_API Eina_Bool e_pixmap_image_is_argb(const E_Pixmap *cp);
 E_API void *e_pixmap_image_data_get(E_Pixmap *cp);
+E_API void e_pixmap_image_data_ref(E_Pixmap *cp);
 E_API Eina_Bool e_pixmap_image_data_argb_convert(E_Pixmap *cp, void *pix, void *ipix, Eina_Rectangle *r, int stride);
 
 E_API void e_pixmap_image_opaque_set(E_Pixmap *cp, int x, int y, int w, int h);