set the tbm_surface to the tbm_bo 41/54441/1
authorSooChan Lim <sc1.lim@samsung.com>
Tue, 15 Dec 2015 08:14:07 +0000 (17:14 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 15 Dec 2015 08:14:07 +0000 (17:14 +0900)
Change-Id: Ida0ef33e9d5d87e9b59a21bbaa06bd2a750d4cb6

src/tbm_bufmgr.c
src/tbm_bufmgr_int.h
src/tbm_surface_internal.c

index f10020f..01af1f6 100755 (executable)
@@ -1775,3 +1775,15 @@ tbm_bufmgr_debug_trace (tbm_bufmgr bufmgr, int onoff)
        TBM_LOG("Not implemented yet.\n");
 }
 
+/* internal function */
+int
+_tbm_bo_set_surface (tbm_bo bo, tbm_surface_h surface)
+{
+    TBM_RETURN_VAL_IF_FAIL (_tbm_bo_is_valid(bo), 0);
+
+       bo->surface = surface;
+
+       return 1;
+}
+
+
index 72da4c4..5d46572 100755 (executable)
@@ -145,6 +145,9 @@ struct _tbm_bo
     struct list_head item_link; /* link of bo */
 
     tbm_bo_handle default_handle; /*default handle */
+
+       tbm_surface_h surface; /* tbm_surface */
+
 };
 
 /**
@@ -203,6 +206,8 @@ struct _tbm_surface {
 int tbm_bufmgr_get_drm_fd_x11(void);
 int tbm_bufmgr_get_drm_fd_wayland(void);
 
+int _tbm_bo_set_surface (tbm_bo bo, tbm_surface_h surface);
+
 /* functions for mutex */
 int          tbm_surface_internal_get_info (tbm_surface_h surface, int opt, tbm_surface_info_s *info, int map);
 void         tbm_surface_internal_unmap (tbm_surface_h surface);
index 052321f..71bf485 100755 (executable)
@@ -230,6 +230,8 @@ _tbm_surface_internal_destroy (tbm_surface_h surface)
 
     for (i = 0; i < surface->num_bos; i++)
     {
+               surface->bos[i]->surface = NULL;
+
         tbm_bo_unref (surface->bos[i]);
         surface->bos[i] = NULL;
     }
@@ -530,6 +532,8 @@ tbm_surface_internal_create_with_flags (int width, int height, int format, int f
             _tbm_surface_mutex_unlock();
             return NULL;
         }
+               _tbm_bo_set_surface(surf->bos[i], surf);
+
     }
 
     LIST_ADD (&surf->item_link, &mgr->surf_list);
@@ -620,6 +624,7 @@ tbm_surface_internal_create_with_bos (tbm_surface_info_s *info, tbm_bo *bos, int
             goto bail1;
 
         surf->bos[i] = tbm_bo_ref(bos[i]);
+               _tbm_bo_set_surface(bos[i], surf);
     }
 
     LIST_ADD (&surf->item_link, &mgr->surf_list);