e_comp_object: ref/unref tbm_surface when call native_surface_set 79/201079/2 accepted/tizen/5.0/unified/20190313.094926 submit/tizen_5.0/20190312.074507
authorChangyeon Lee <cyeon.lee@samsung.com>
Fri, 8 Mar 2019 04:53:48 +0000 (13:53 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Tue, 12 Mar 2019 07:24:29 +0000 (16:24 +0900)
Change-Id: I15e55b383cc9cdd9058de181db73c58d9e142d59

src/bin/e_comp_object.c

index 52b9c977af0b6415271061676e85b03bb256b398..8e825f31055697691cfee70a37cc36feaf64943d 100644 (file)
@@ -156,6 +156,8 @@ typedef struct _E_Comp_Object
         Eina_Bool           mask_set;
         int                 mask_x, mask_y, mask_w, mask_h;
      } dim;
+
+   tbm_surface_h        tbm_surface;
 } E_Comp_Object;
 
 typedef struct _E_Input_Rect_Data
@@ -2959,6 +2961,12 @@ _e_comp_smart_del(Evas_Object *obj)
         cw->buffer_destroy_listener.notify = NULL;
      }
 
+   if (cw->tbm_surface)
+     {
+        tbm_surface_internal_unref(cw->tbm_surface);
+        cw->tbm_surface = NULL;
+     }
+
    e_comp_object_render_update_del(cw->smart_obj);
    E_FREE_FUNC(cw->updates, eina_tiler_free);
    E_FREE_FUNC(cw->pending_updates, eina_tiler_free);
@@ -4358,10 +4366,24 @@ _e_comp_object_native_surface_set(E_Comp_Object *cw, Evas_Native_Surface *ns, Ei
         cw->buffer_destroy_listener.notify = NULL;
      }
 
-   if ((ns) && (ns->type == EVAS_NATIVE_SURFACE_WL) && (ns->data.wl.legacy_buffer))
+   if (cw->tbm_surface)
+     {
+        tbm_surface_internal_unref(cw->tbm_surface);
+        cw->tbm_surface = NULL;
+     }
+
+   if (ns)
      {
-        cw->buffer_destroy_listener.notify = _e_comp_object_cb_buffer_destroy;
-        wl_resource_add_destroy_listener((struct wl_resource *)ns->data.wl.legacy_buffer, &cw->buffer_destroy_listener);
+        if ((ns->type == EVAS_NATIVE_SURFACE_WL) && (ns->data.wl.legacy_buffer))
+          {
+             cw->buffer_destroy_listener.notify = _e_comp_object_cb_buffer_destroy;
+             wl_resource_add_destroy_listener((struct wl_resource *)ns->data.wl.legacy_buffer, &cw->buffer_destroy_listener);
+          }
+        else if ((ns->type == EVAS_NATIVE_SURFACE_TBM) && (ns->data.tbm.buffer))
+          {
+             tbm_surface_internal_ref(ns->data.tbm.buffer);
+             cw->tbm_surface = ns->data.tbm.buffer;
+          }
      }
 
    evas_object_image_native_surface_set(cw->obj, ns);