#include <errno.h>
#include <pthread.h>
#include "tbm_bufmgr.h"
-#include "tbm_bufmgr_glock.h"
+#include "tbm_bufmgr_tgl.h"
#include "tbm_bufmgr_backend.h"
#include "tbm_bufmgr_int.h"
#include "list.h"
#define DEBUG
#ifdef DEBUG
static int bDebug = 0;
-#define DBG(...) if(bDebug&0x1) fprintf(stderr, __VA_ARGS__)
-#define DBG_LOCK(...) if(bDebug&0x2) fprintf(stderr, __VA_ARGS__)
+#define DBG(...) if(bDebug&0x1) TBM_LOG (__VA_ARGS__)
+#define DBG_LOCK(...) if(bDebug&0x2) TBM_LOG (__VA_ARGS__)
#else
#define DBG(...)
#define DBG_LOCK(...)
/* check condition */
#define TBM_RETURN_IF_FAIL(cond) {\
if (!(cond)) {\
- fprintf (stderr, "[%s] : '%s' failed.\n", __FUNCTION__, #cond);\
+ TBM_LOG ("[%s] : '%s' failed.\n", __FUNCTION__, #cond);\
return;\
}\
}
#define TBM_RETURN_VAL_IF_FAIL(cond, val) {\
if (!(cond)) {\
- fprintf (stderr, "[%s] : '%s' failed.\n", __FUNCTION__, #cond);\
+ TBM_LOG ("[%s] : '%s' failed.\n", __FUNCTION__, #cond);\
return val;\
}\
}
bo->item_link.next && \
bo->item_link.next->prev == &bo->item_link)
-#define CTRL_BACKEND_VALID(flags) ((flags&TBM_CACHE_CTRL_BACKEND) && \
- (flags&TBM_LOCK_CTRL_BACKEND))
+#define TBM_ALL_CTRL_BACKEND_VALID(flags) \
+ ((flags&TBM_CACHE_CTRL_BACKEND) &&\
+ (flags&TBM_LOCK_CTRL_BACKEND))
+#define TBM_CACHE_CTRL_BACKEND_VALID(flags) \
+ (flags&TBM_CACHE_CTRL_BACKEND)
+#define TBM_LOCK_CTRL_BACKEND_VALID(flags) \
+ (flags&TBM_LOCK_CTRL_BACKEND)
#define PREFIX_LIB "libtbm_"
#define SUFFIX_LIB ".so"
#define MODULE_VERSION_NUMERIC(maj, min, patch) \
((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF))
-#define GET_MODULE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF)
-#define GET_MODULE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF)
-#define GET_MODULE_PATCHLEVEL(vers) ((vers) & 0xFFFF)
+#define GET_MODULE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF)
+#define GET_MODULE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF)
+#define GET_MODULE_PATCHLEVEL(vers) ((vers) & 0xFFFF)
enum {
LOCK_TRY_ONCE,
err = ioctl (fd, TGL_IOC_INIT_LOCK, &attr);
if (err)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ( "[libtbm:%d] "
"error(%s) %s:%d key:%d\n",
getpid(), strerror(errno), __FUNCTION__, __LINE__, key);
return 0;
err = ioctl (fd, TGL_IOC_DESTROY_LOCK, key);
if (err)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ( "[libtbm:%d] "
"error(%s) %s:%d key:%d\n",
getpid(), strerror(errno), __FUNCTION__, __LINE__, key);
return 0;
err = ioctl (fd, TGL_IOC_LOCK_LOCK, key);
if (err)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"error(%s) %s:%d key:%d\n",
getpid(), strerror(errno), __FUNCTION__, __LINE__, key);
return 0;
err = ioctl (fd, TGL_IOC_UNLOCK_LOCK, key);
if (err)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"error(%s) %s:%d key:%d\n",
getpid(), strerror(errno), __FUNCTION__, __LINE__, key);
return 0;
err = ioctl (fd, TGL_IOC_SET_DATA, &arg);
if (err)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"error(%s) %s:%d key:%d\n",
getpid(), strerror(errno), __FUNCTION__, __LINE__, key);
return 0;
err = ioctl (fd, TGL_IOC_GET_DATA, &arg);
if (err)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"error(%s) %s:%d key:%d\n",
getpid(), strerror(errno), __FUNCTION__, __LINE__, key);
return 0;
}
static int
-_bo_lock (tbm_bo bo)
+_bo_lock (tbm_bo bo, int device, int opt)
{
tbm_bufmgr bufmgr = bo->bufmgr;
int ret = 0;
- if (bufmgr->backend->flags&TBM_LOCK_CTRL_BACKEND &&
- bufmgr->backend->bo_lock)
+ if (TBM_LOCK_CTRL_BACKEND_VALID(bufmgr->backend->flags))
{
- /* use backend lock */
- ret = bufmgr->backend->bo_lock (bo);
+ if (bufmgr->backend->bo_lock2)
+ {
+ /* use bo_lock2 backend lock */
+ ret = bufmgr->backend->bo_lock2 (bo, device, opt);
+ }
+ else if (bufmgr->backend->bo_lock)
+ {
+ /* use bo_lock backend lock */
+ ret = bufmgr->backend->bo_lock (bo);
+ }
+ else
+ TBM_LOG ("[libtbm:%d] "
+ "error %s:%d no backend lock functions\n",
+ getpid(), __FUNCTION__, __LINE__);
}
else
{
{
tbm_bufmgr bufmgr = bo->bufmgr;
- if (bufmgr->backend->flags&TBM_LOCK_CTRL_BACKEND &&
- bufmgr->backend->bo_unlock)
+ if (TBM_LOCK_CTRL_BACKEND_VALID(bufmgr->backend->flags))
{
- /* use backend unlock */
- bufmgr->backend->bo_unlock (bo);
+ if (bufmgr->backend->bo_unlock)
+ {
+ /* use backend unlock */
+ bufmgr->backend->bo_unlock (bo);
+ }
+ else
+ TBM_LOG ("[libtbm:%d] "
+ "error %s:%d no backend unlock functions\n",
+ getpid(), __FUNCTION__, __LINE__);
}
else
{
}
static int
-_tbm_bo_lock (tbm_bo bo)
+_tbm_bo_init_state (tbm_bo bo, int opt)
{
- tbm_bufmgr bufmgr = NULL;
- int old;
- int ret = 0;
+ tbm_bufmgr bufmgr = bo->bufmgr;
+ tbm_bo_cache_state cache_state;
- if (!bo)
- return 0;
+ RETURN_VAL_CHECK_FLAG (TBM_ALL_CTRL_BACKEND_VALID(bufmgr->backend->flags), 1);
- bufmgr = bo->bufmgr;
+ cache_state.val = 0;
+ switch (opt)
+ {
+ case CACHE_OP_CREATE: /*Create*/
+ if (bo->tgl_key == INITIAL_KEY)
+ bo->tgl_key = bufmgr->backend->bo_get_global_key (bo);
- RETURN_VAL_CHECK_FLAG (CTRL_BACKEND_VALID(bufmgr->backend->flags), 1);
+ _tgl_init (bufmgr->lock_fd, bo->tgl_key);
- if (bo->lock_cnt < 0)
- {
- fprintf (stderr, "[libtbm:%d] "
- "error %s:%d bo:%p(%d) LOCK_CNT=%d\n",
- getpid(), __FUNCTION__, __LINE__, bo, bo->tgl_key, bo->lock_cnt);
- }
+ cache_state.data.isCacheable = BO_IS_CACHEABLE(bo);
+ cache_state.data.isDirtied = DEVICE_NONE;
+ cache_state.data.isCached = 0;
+ cache_state.data.cntFlush = 0;
- old = bo->lock_cnt;
- switch (bufmgr->lock_type)
- {
- case LOCK_TRY_ALWAYS: /* LOCK_TRY_ALWAYS */
- pthread_mutex_unlock (&bufmgr->lock);
- ret = _bo_lock (bo);
- pthread_mutex_lock (&bufmgr->lock);
- if(ret)
- bo->lock_cnt++;
- break;
- case LOCK_TRY_NEVER: /* LOCK_TRY_NEVER */
- return 1;
- break;
- default:
- if (bo->lock_cnt == 0)
- {
- pthread_mutex_unlock (&bufmgr->lock);
- ret = _bo_lock (bo);
- pthread_mutex_lock (&bufmgr->lock);
- if (ret)
- bo->lock_cnt++;
- }
+ _tgl_set_data (bufmgr->lock_fd, bo->tgl_key, cache_state.val);
+ break;
+ case CACHE_OP_IMPORT: /*Import*/
+ if (bo->tgl_key == INITIAL_KEY)
+ bo->tgl_key = bufmgr->backend->bo_get_global_key (bo);
- break;
+ _tgl_init (bufmgr->lock_fd, bo->tgl_key);
+ break;
+ default:
+ break;
}
- DBG_LOCK ("[libtbm:%d] >> LOCK bo:%p(%d, %d->%d)\n", getpid(),
- bo, bo->tgl_key, old, bo->lock_cnt);
-
return 1;
}
static void
-_tbm_bo_unlock (tbm_bo bo)
+_tbm_bo_destroy_state (tbm_bo bo)
{
- tbm_bufmgr bufmgr = NULL;
-
- int old;
-
- if (!bo)
- return;
-
- bufmgr = bo->bufmgr;
-
- RETURN_CHECK_FLAG (CTRL_BACKEND_VALID(bufmgr->backend->flags));
+ tbm_bufmgr bufmgr = bo->bufmgr;
- old = bo->lock_cnt;
- if (bo->lock_cnt > 0)
- {
- bo->lock_cnt--;
- if (bo->lock_cnt == 0)
- _bo_unlock (bo);
- }
- else if (bo->lock_cnt < 0)
- {
- bo->lock_cnt = 0;
- }
+ RETURN_CHECK_FLAG (TBM_ALL_CTRL_BACKEND_VALID(bufmgr->backend->flags));
- DBG_LOCK ("[libtbm:%d] << unlock bo:%p(%d, %d->%d)\n", getpid(),
- bo, bo->tgl_key, old, bo->lock_cnt);
+ _tgl_destroy (bufmgr->lock_fd, bo->tgl_key);
}
-
static int
_tbm_bo_set_state (tbm_bo bo, int device, int opt)
{
unsigned short cntFlush = 0;
unsigned int is_locked;
- RETURN_VAL_CHECK_FLAG (CTRL_BACKEND_VALID(bufmgr->backend->flags), 1);
+ RETURN_VAL_CHECK_FLAG (TBM_CACHE_CTRL_BACKEND_VALID(bufmgr->backend->flags), 1);
/* get cache state of a bo */
bo->cache_state.val = _tgl_get_data (bufmgr->lock_fd, bo->tgl_key, &is_locked);
tbm_bufmgr bufmgr = bo->bufmgr;
unsigned short cntFlush = 0;
- RETURN_CHECK_FLAG (CTRL_BACKEND_VALID(bufmgr->backend->flags));
+ RETURN_CHECK_FLAG (TBM_CACHE_CTRL_BACKEND_VALID(bufmgr->backend->flags));
/* get global cache flush count */
cntFlush = (unsigned short)_tgl_get_data (bufmgr->lock_fd, GLOBAL_KEY, NULL);
_tgl_set_data(bufmgr->lock_fd, bo->tgl_key, bo->cache_state.val);
}
+
static int
-_tbm_bo_init_state (tbm_bo bo, int opt)
+_tbm_bo_lock (tbm_bo bo, int device, int opt)
{
- tbm_bufmgr bufmgr = bo->bufmgr;
- tbm_bo_cache_state cache_state;
-
- RETURN_VAL_CHECK_FLAG (CTRL_BACKEND_VALID(bufmgr->backend->flags), 1);
+ tbm_bufmgr bufmgr = NULL;
+ int old;
+ int ret = 0;
- cache_state.val = 0;
- switch (opt)
- {
- case CACHE_OP_CREATE: /*Create*/
- if (bo->tgl_key == INITIAL_KEY)
- bo->tgl_key = bufmgr->backend->bo_get_global_key (bo);
+ if (!bo)
+ return 0;
- _tgl_init (bufmgr->lock_fd, bo->tgl_key);
+ bufmgr = bo->bufmgr;
- cache_state.data.isCacheable = BO_IS_CACHEABLE(bo);
- cache_state.data.isDirtied = DEVICE_NONE;
- cache_state.data.isCached = 0;
- cache_state.data.cntFlush = 0;
+ /* do not try to lock the bo */
+ if (bufmgr->lock_type == LOCK_TRY_NEVER)
+ return 1;
- _tgl_set_data (bufmgr->lock_fd, bo->tgl_key, cache_state.val);
- break;
- case CACHE_OP_IMPORT: /*Import*/
- if (bo->tgl_key == INITIAL_KEY)
- bo->tgl_key = bufmgr->backend->bo_get_global_key (bo);
+ if (bo->lock_cnt < 0)
+ {
+ TBM_LOG ("[libtbm:%d] "
+ "error %s:%d bo:%p(%d) LOCK_CNT=%d\n",
+ getpid(), __FUNCTION__, __LINE__, bo, bo->tgl_key, bo->lock_cnt);
+ }
- _tgl_init (bufmgr->lock_fd, bo->tgl_key);
- break;
- default:
- break;
+ old = bo->lock_cnt;
+ if (bufmgr->lock_type == LOCK_TRY_ONCE)
+ {
+ if (bo->lock_cnt == 0)
+ {
+ pthread_mutex_unlock (&bufmgr->lock);
+ ret = _bo_lock (bo, device, opt);
+ pthread_mutex_lock (&bufmgr->lock);
+ if (ret)
+ bo->lock_cnt++;
+ }
+ }
+ else if (bufmgr->lock_type == LOCK_TRY_ALWAYS)
+ {
+ pthread_mutex_unlock (&bufmgr->lock);
+ ret = _bo_lock (bo, device, opt);
+ pthread_mutex_lock (&bufmgr->lock);
+ if(ret)
+ bo->lock_cnt++;
}
+ else
+ TBM_LOG ("[libtbm:%d] "
+ "error %s:%d bo:%p lock_type is wrong.\n",
+ getpid(), __FUNCTION__, __LINE__, bo);
+
+ DBG_LOCK ("[libtbm:%d] >> LOCK bo:%p(%d, %d->%d)\n", getpid(),
+ bo, bo->tgl_key, old, bo->lock_cnt);
return 1;
}
static void
-_tbm_bo_destroy_state (tbm_bo bo)
+_tbm_bo_unlock (tbm_bo bo)
{
- tbm_bufmgr bufmgr = bo->bufmgr;
+ tbm_bufmgr bufmgr = NULL;
- RETURN_CHECK_FLAG (CTRL_BACKEND_VALID(bufmgr->backend->flags));
+ int old;
- _tgl_destroy (bufmgr->lock_fd, bo->tgl_key);
+ if (!bo)
+ return;
+
+ bufmgr = bo->bufmgr;
+
+ /* do not try to unlock the bo */
+ if (bufmgr->lock_type == LOCK_TRY_NEVER)
+ return;
+
+ old = bo->lock_cnt;
+ if (bufmgr->lock_type == LOCK_TRY_ONCE)
+ {
+ if (bo->lock_cnt > 0)
+ {
+ bo->lock_cnt--;
+ if (bo->lock_cnt == 0)
+ _bo_unlock (bo);
+ }
+ }
+ else if (bufmgr->lock_type == LOCK_TRY_ALWAYS)
+ {
+ if (bo->lock_cnt > 0)
+ {
+ bo->lock_cnt--;
+ _bo_unlock (bo);
+ }
+ }
+ else
+ TBM_LOG ("[libtbm:%d] "
+ "error %s:%d bo:%p lock_type is wrong.\n",
+ getpid(), __FUNCTION__, __LINE__, bo);
+
+ if (bo->lock_cnt < 0)
+ bo->lock_cnt = 0;
+
+ DBG_LOCK ("[libtbm:%d] << unlock bo:%p(%d, %d->%d)\n", getpid(),
+ bo, bo->tgl_key, old, bo->lock_cnt);
}
+
static void
_tbm_bo_ref (tbm_bo bo)
{
if (bo->lock_cnt > 0)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"error %s:%d lock_cnt:%d\n",
getpid(), __FUNCTION__, __LINE__, bo->lock_cnt);
_bo_unlock (bo);
static int
_tbm_bufmgr_init_state (tbm_bufmgr bufmgr)
{
- RETURN_VAL_CHECK_FLAG (CTRL_BACKEND_VALID(bufmgr->backend->flags), 1);
+ RETURN_VAL_CHECK_FLAG (TBM_ALL_CTRL_BACKEND_VALID(bufmgr->backend->flags), 1);
- bufmgr->lock_fd = open(tgl_devfile, O_RDWR);
+ bufmgr->lock_fd = open (tgl_devfile, O_RDWR);
if(bufmgr->lock_fd < 0)
{
- fprintf (stderr, "[libtbm:%d] "
- "error: Fail to open global_lock:%s\n",
- getpid(), tgl_devfile);
- return 0;
+ bufmgr->lock_fd = open (tgl_devfile1, O_RDWR);
+ if(bufmgr->lock_fd < 0)
+ {
+
+ TBM_LOG ("[libtbm:%d] "
+ "error: Fail to open global_lock:%s\n",
+ getpid(), tgl_devfile);
+ return 0;
+ }
}
if (!_tgl_init(bufmgr->lock_fd, GLOBAL_KEY))
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"error: Fail to initialize the tgl\n",
getpid());
return 0;
static void
_tbm_bufmgr_destroy_state (tbm_bufmgr bufmgr)
{
- RETURN_CHECK_FLAG (CTRL_BACKEND_VALID(bufmgr->backend->flags));
+ RETURN_CHECK_FLAG (TBM_ALL_CTRL_BACKEND_VALID(bufmgr->backend->flags));
close (bufmgr->lock_fd);
}
abimaj = GET_ABI_MAJOR (data->abiversion);
abimin = GET_ABI_MINOR (data->abiversion);
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"TBM module %s: vendor=\"%s\" ABI=%d,%d\n",
getpid(), data->modname ? data->modname : "UNKNOWN!",
data->vendor ? data->vendor : "UNKNOWN!", abimaj, abimin);
if (abimaj != vermaj)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"TBM module ABI major ver(%d) doesn't match the TBM's ver(%d)\n",
getpid(), abimaj, vermaj);
return 0;
}
else if (abimin > vermin)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"TBM module ABI minor ver(%d) is newer than the TBM's ver(%d)\n",
getpid(), abimin, vermin);
return 0;
module_data = dlopen (path, RTLD_LAZY);
if (!module_data)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"failed to load module: %s(%s)\n",
getpid(), dlerror(), file);
return 0;
}
else
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"Error: module does not supply version information.\n",
getpid());
{
if(!init (bufmgr, fd))
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"Fail to init module(%s)\n",
getpid(), file);
dlclose (module_data);
}
else
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"Error: module does not supply init symbol.\n", getpid());
dlclose (module_data);
return 0;
}
else
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"Error: module does not have data object.\n", getpid());
dlclose (module_data);
return 0;
bufmgr->module_data = module_data;
- fprintf (stderr,"[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"Success to load module(%s)\n", getpid(), file);
return 1;
{
n = scandir (BUFMGR_MODULE_DIR, &namelist, 0, alphasort);
if (n < 0)
- fprintf (stderr,"[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"no files : %s\n", getpid(), BUFMGR_MODULE_DIR);
else
{
if(env)
{
bDebug = atoi(env);
- fprintf(stderr, "GEM_DEBUG=%s\n", env);
+ TBM_LOG ("GEM_DEBUG=%s\n", env);
}
else
bDebug = 0;
if(bufmgr->fd == fd)
{
bufmgr->ref_count++;
- fprintf (stderr, "[libtbm:%d] bufmgr ref: fd=%d, ref_count:%d\n",
+ TBM_LOG ("[libtbm:%d] bufmgr ref: fd=%d, ref_count:%d\n",
getpid(), fd, bufmgr->ref_count);
return bufmgr;
}
}
bufmgr = NULL;
}
- fprintf(stderr, "[libtbm:%d] bufmgr init: fd=%d\n", getpid(), fd);
+ TBM_LOG ("[libtbm:%d] bufmgr init: fd=%d\n", getpid(), fd);
/* allocate bufmgr */
bufmgr = calloc (1, sizeof(struct _tbm_bufmgr));
/* load bufmgr priv from env */
if (!_tbm_load_module(bufmgr, fd))
{
- fprintf (stderr,"[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"error : Fail to load bufmgr backend\n",
getpid());
free (bufmgr);
bufmgr->ref_count = 1;
bufmgr->fd = fd;
- fprintf(stderr, "[libtbm:%d] create tizen bufmgr: ref_count:%d\n",
+ TBM_LOG ("[libtbm:%d] create tizen bufmgr: ref_count:%d\n",
getpid(), bufmgr->ref_count);
if (pthread_mutex_init (&bufmgr->lock, NULL) != 0)
/* intialize the tizen global status */
if (!_tbm_bufmgr_init_state (bufmgr))
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"error: Fail to init state\n",
getpid());
bufmgr->backend->bufmgr_deinit (bufmgr);
bufmgr->ref_count--;
if (bufmgr->ref_count > 0)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"tizen bufmgr destroy: bufmgr:%p, ref_cnt:%d\n",
getpid(), bufmgr, bufmgr->ref_count);
return;
{
LIST_FOR_EACH_ENTRY_SAFE (bo, tmp, &bufmgr->bo_list, item_link)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"Un-freed bo(%p, ref:%d) \n",
getpid(), bo, bo->ref_cnt);
bo->ref_cnt = 1;
pthread_mutex_destroy (&bufmgr->lock);
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"tizen bufmgr destroy: bufmgr:%p, ref_cnt:%d\n",
getpid(), bufmgr, bufmgr->ref_count);
pthread_mutex_lock (&bufmgr->lock);
- _tbm_bo_lock (bo);
bo_handle = bufmgr->backend->bo_map (bo, device, opt);
- /* increase the ref_count */
-// _tbm_bo_ref (bo);
+ _tbm_bo_lock (bo, device, opt);
if (bufmgr->use_map_cache == 1 && bo->map_cnt == 0)
_tbm_bo_set_state (bo, device, opt);
pthread_mutex_lock (&bufmgr->lock);
+ _tbm_bo_unlock (bo);
+
ret = bufmgr->backend->bo_unmap (bo);
/* decrease the map_count */
if (bo->map_cnt == 0)
_tbm_bo_save_state (bo);
- _tbm_bo_unlock (bo);
-
- /* decrease the ref_count */
-// _tbm_bo_unref (bo);
-
pthread_mutex_unlock (&bufmgr->lock);
return ret;
data = _user_data_lookup (&bo->user_data_list, key);
if (data)
{
- fprintf (stderr, "[libtbm:%d] "
+ TBM_LOG ("[libtbm:%d] "
"waring: %s:%d user data already exist. key:%ld\n",
getpid(), __FUNCTION__, __LINE__, key);
return 0;