From 759a65ffa9edf214f96ca086c395f05f558f4d7a Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 15 Dec 2015 17:14:07 +0900 Subject: [PATCH] set the tbm_surface to the tbm_bo Change-Id: Ida0ef33e9d5d87e9b59a21bbaa06bd2a750d4cb6 --- src/tbm_bufmgr.c | 12 ++++++++++++ src/tbm_bufmgr_int.h | 5 +++++ src/tbm_surface_internal.c | 5 +++++ 3 files changed, 22 insertions(+) diff --git a/src/tbm_bufmgr.c b/src/tbm_bufmgr.c index f10020f..01af1f6 100755 --- a/src/tbm_bufmgr.c +++ b/src/tbm_bufmgr.c @@ -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; +} + + diff --git a/src/tbm_bufmgr_int.h b/src/tbm_bufmgr_int.h index 72da4c4..5d46572 100755 --- a/src/tbm_bufmgr_int.h +++ b/src/tbm_bufmgr_int.h @@ -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); diff --git a/src/tbm_surface_internal.c b/src/tbm_surface_internal.c index 052321f..71bf485 100755 --- a/src/tbm_surface_internal.c +++ b/src/tbm_surface_internal.c @@ -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); -- 2.7.4