%{_includedir}/tbm_drm_helper.h
%{_includedir}/tbm_sync.h
%{_includedir}/tbm_bo.h
+%{_includedir}/tbm_log.h
%{_libdir}/libtbm.so
%{_libdir}/pkgconfig/libtbm.pc
tbm_bo.c \
tbm_drm_helper_server.c \
tbm_drm_helper_client.c \
- tbm_sync.c
+ tbm_sync.c \
+ tbm_log.c
nodist_libtbm_la_SOURCES = \
wayland-tbm-drm-auth-server-protocol.h \
tbm_surface_internal.h \
tbm_surface_queue.h \
tbm_drm_helper.h \
- tbm_sync.h
+ tbm_sync.h \
+ tbm_log.h
CLEANFILES = $(BUILT_SOURCES)
/* check condition */
#define TBM_BO_RETURN_IF_FAIL(cond) {\
if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.\n", #cond);\
_tbm_bo_mutex_unlock();\
return;\
} \
#define TBM_BO_RETURN_VAL_IF_FAIL(cond, val) {\
if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.\n", #cond);\
_tbm_bo_mutex_unlock();\
return val;\
} \
return true;
if (pthread_mutex_init(&tbm_bo_lock, NULL)) {
- TBM_LOG_E("fail: Cannot pthread_mutex_init for tbm_bo_lock.\n");
+ TBM_ERR("fail: Cannot pthread_mutex_init for tbm_bo_lock.\n");
return false;
}
_tbm_bo_mutex_lock(void)
{
if (!_tbm_bo_mutex_init()) {
- TBM_LOG_E("fail: _tbm_bo_mutex_init()\n");
+ TBM_ERR("fail: _tbm_bo_mutex_init()\n");
return;
}
if ((bufmgr->bo_cnt >= 500) && ((bufmgr->bo_cnt % 20) == 0) &&
(bufmgr->bo_cnt > last_chk_bo_cnt)) {
- TBM_DEBUG("============TBM BO CNT DEBUG: bo_cnt=%d\n", bufmgr->bo_cnt);
+ TBM_DBG("============TBM BO CNT DEBUG: bo_cnt=%d\n", bufmgr->bo_cnt);
tbm_bufmgr_debug_show(bufmgr);
last_chk_bo_cnt = bufmgr->bo_cnt;
}
user_data = calloc(1, sizeof(tbm_user_data));
if (!user_data) {
/* LCOV_EXCL_START */
- TBM_LOG_E("fail to allocate an user_date\n");
+ TBM_ERR("fail to allocate an user_date\n");
return NULL;
/* LCOV_EXCL_STOP */
}
return 1;
if (bo->lock_cnt < 0) {
- TBM_LOG_E("error bo:%p LOCK_CNT=%d\n",
+ TBM_ERR("error bo:%p LOCK_CNT=%d\n",
bo, bo->lock_cnt);
return 0;
}
bo->lock_cnt++;
break;
default:
- TBM_LOG_E("error bo:%p bo_lock_type[%d] is wrong.\n",
+ TBM_ERR("error bo:%p bo_lock_type[%d] is wrong.\n",
bo, bo->bufmgr->bo_lock_type);
ret = 0;
break;
}
- TBM_DBG_LOCK(">> LOCK bo:%p(%d->%d)\n", bo, old, bo->lock_cnt);
+ TBM_DBG(">> LOCK bo:%p(%d->%d)\n", bo, old, bo->lock_cnt);
return ret;
}
}
break;
default:
- TBM_LOG_E("error bo:%p bo_lock_type[%d] is wrong.\n",
+ TBM_ERR("error bo:%p bo_lock_type[%d] is wrong.\n",
bo, bo->bufmgr->bo_lock_type);
break;
}
if (bo->lock_cnt < 0)
bo->lock_cnt = 0;
- TBM_DBG_LOCK(">> UNLOCK bo:%p(%d->%d)\n", bo, old, bo->lock_cnt);
+ TBM_DBG(">> UNLOCK bo:%p(%d->%d)\n", bo, old, bo->lock_cnt);
}
static int
tbm_bo old_data = NULL;
if (bo == NULL) {
- TBM_LOG_E("error: bo is NULL.\n");
+ TBM_ERR("error: bo is NULL.\n");
return 0;
}
bufmgr = tbm_bufmgr_get();
if (bufmgr == NULL) {
- TBM_LOG_E("error: bufmgr is NULL.\n");
+ TBM_ERR("error: bufmgr is NULL.\n");
return 0;
}
if (LIST_IS_EMPTY(&bufmgr->bo_list)) {
- TBM_LOG_E("error: bo->bo->bufmgr->bo_list is EMPTY.\n");
+ TBM_ERR("error: bo->bo->bufmgr->bo_list is EMPTY.\n");
return 0;
}
return 1;
}
- TBM_LOG_E("error: No valid bo(%p).\n", bo);
+ TBM_ERR("error: No valid bo(%p).\n", bo);
return 0;
}
bo = calloc(1, sizeof(struct _tbm_bo));
if (!bo) {
/* LCOV_EXCL_START */
- TBM_LOG_E("error: fail to create of tbm_bo size(%d) flag(%s)\n",
+ TBM_ERR("error: fail to create of tbm_bo size(%d) flag(%s)\n",
size, _tbm_flag_to_str(flags));
_tbm_set_last_result(TBM_BO_ERROR_HEAP_ALLOC_FAILED);
_tbm_bo_mutex_unlock();
bo_priv = bo->bufmgr->backend->bo_alloc(bo, size, flags);
if (!bo_priv) {
/* LCOV_EXCL_START */
- TBM_LOG_E("error: fail to create of tbm_bo size(%d) flag(%s)\n",
+ TBM_ERR("error: fail to create of tbm_bo size(%d) flag(%s)\n",
size, _tbm_flag_to_str(flags));
_tbm_set_last_result(TBM_BO_ERROR_BO_ALLOC_FAILED);
free(bo);
bo->flags = flags;
bo->priv = bo_priv;
- TBM_TRACE("bo(%p) size(%d) refcnt(%d), flag(%s)\n", bo, size, bo->ref_cnt,
+ TBM_TRACE_BO("bo(%p) size(%d) refcnt(%d), flag(%s)\n", bo, size, bo->ref_cnt,
_tbm_flag_to_str(bo->flags));
LIST_INITHEAD(&bo->user_data_list);
bo->ref_cnt++;
- TBM_TRACE("bo(%p) ref_cnt(%d)\n", bo, bo->ref_cnt);
+ TBM_TRACE_BO("bo(%p) ref_cnt(%d)\n", bo, bo->ref_cnt);
_tbm_bo_mutex_unlock();
TBM_BO_RETURN_IF_FAIL(_tbm_bo_is_valid(bo));
- TBM_TRACE("bo(%p) ref_cnt(%d)\n", bo, bo->ref_cnt - 1);
+ TBM_TRACE_BO("bo(%p) ref_cnt(%d)\n", bo, bo->ref_cnt - 1);
if (bo->ref_cnt <= 0) {
_tbm_bo_mutex_unlock();
if (!_tbm_bo_lock(bo, device, opt)) {
_tbm_set_last_result(TBM_BO_ERROR_LOCK_FAILED);
- TBM_LOG_E("error: fail to lock bo:%p)\n", bo);
+ TBM_ERR("error: fail to lock bo:%p)\n", bo);
_tbm_bo_mutex_unlock();
return (tbm_bo_handle) NULL;
}
if (bo_handle.ptr == NULL) {
/* LCOV_EXCL_START */
_tbm_set_last_result(TBM_BO_ERROR_MAP_FAILED);
- TBM_LOG_E("error: fail to map bo:%p\n", bo);
+ TBM_ERR("error: fail to map bo:%p\n", bo);
_tbm_bo_unlock(bo);
_tbm_bo_mutex_unlock();
return (tbm_bo_handle) NULL;
/* increase the map_count */
bo->map_cnt++;
- TBM_TRACE("bo(%p) map_cnt(%d)\n", bo, bo->map_cnt);
+ TBM_TRACE_BO("bo(%p) map_cnt(%d)\n", bo, bo->map_cnt);
_tbm_bo_mutex_unlock();
ret = bo->bufmgr->backend->bo_unmap(bo);
if (!ret) {
/* LCOV_EXCL_START */
- TBM_LOG_E("error: bo(%p) map_cnt(%d)\n", bo, bo->map_cnt);
+ TBM_ERR("error: bo(%p) map_cnt(%d)\n", bo, bo->map_cnt);
_tbm_set_last_result(TBM_BO_ERROR_UNMAP_FAILED);
_tbm_bo_mutex_unlock();
return ret;
/* decrease the map_count */
bo->map_cnt--;
- TBM_TRACE("bo(%p) map_cnt(%d)\n", bo, bo->map_cnt);
+ TBM_TRACE_BO("bo(%p) map_cnt(%d)\n", bo, bo->map_cnt);
_tbm_bo_unlock(bo);
if (bo_handle.ptr == NULL) {
/* LCOV_EXCL_START */
_tbm_set_last_result(TBM_BO_ERROR_GET_HANDLE_FAILED);
- TBM_LOG_E("error: bo(%p) bo_handle(%p)\n", bo, bo_handle.ptr);
+ TBM_ERR("error: bo(%p) bo_handle(%p)\n", bo, bo_handle.ptr);
_tbm_bo_mutex_unlock();
return (tbm_bo_handle) NULL;
/* LCOV_EXCL_STOP */
}
- TBM_TRACE("bo(%p) bo_handle(%p)\n", bo, bo_handle.ptr);
+ TBM_TRACE_BO("bo(%p) bo_handle(%p)\n", bo, bo_handle.ptr);
_tbm_bo_mutex_unlock();
if (!ret) {
/* LCOV_EXCL_START */
_tbm_set_last_result(TBM_BO_ERROR_EXPORT_FAILED);
- TBM_LOG_E("error: bo(%p) tbm_key(%d)\n", bo, ret);
+ TBM_ERR("error: bo(%p) tbm_key(%d)\n", bo, ret);
_tbm_bo_mutex_unlock();
return ret;
/* LCOV_EXCL_STOP */
}
- TBM_TRACE("bo(%p) tbm_key(%u)\n", bo, ret);
+ TBM_TRACE_BO("bo(%p) tbm_key(%u)\n", bo, ret);
_tbm_bo_mutex_unlock();
if (ret < 0) {
/* LCOV_EXCL_START */
_tbm_set_last_result(TBM_BO_ERROR_EXPORT_FD_FAILED);
- TBM_LOG_E("error: bo(%p) tbm_fd(%d)\n", bo, ret);
+ TBM_ERR("error: bo(%p) tbm_fd(%d)\n", bo, ret);
_tbm_bo_mutex_unlock();
return ret;
/* LCOV_EXCL_STOP */
}
- TBM_TRACE("bo(%p) tbm_fd(%d)\n", bo, ret);
+ TBM_TRACE_BO("bo(%p) tbm_fd(%d)\n", bo, ret);
_tbm_bo_mutex_unlock();
bo = calloc(1, sizeof(struct _tbm_bo));
if (!bo) {
/* LCOV_EXCL_START */
- TBM_LOG_E("error: fail to import of tbm_bo by key(%d)\n", key);
+ TBM_ERR("error: fail to import of tbm_bo by key(%d)\n", key);
_tbm_bo_mutex_unlock();
return NULL;
/* LCOV_EXCL_STOP */
bo_priv = bo->bufmgr->backend->bo_import(bo, key);
if (!bo_priv) {
/* LCOV_EXCL_START */
- TBM_LOG_E("error: fail to import of tbm_bo by key(%d)\n", key);
+ TBM_ERR("error: fail to import of tbm_bo by key(%d)\n", key);
_tbm_set_last_result(TBM_BO_ERROR_IMPORT_FAILED);
free(bo);
_tbm_bo_mutex_unlock();
if (!LIST_IS_EMPTY(&bo->bufmgr->bo_list)) {
LIST_FOR_EACH_ENTRY(bo2, &bo->bufmgr->bo_list, item_link) {
if (bo2->priv == bo_priv) {
- TBM_TRACE("find bo(%p) ref(%d) key(%d) flag(%s) in list\n",
+ TBM_TRACE_BO("find bo(%p) ref(%d) key(%d) flag(%s) in list\n",
bo2, bo2->ref_cnt, key,
_tbm_flag_to_str(bo2->flags));
bo2->ref_cnt++;
else
bo->flags = TBM_BO_DEFAULT;
- TBM_TRACE("import new bo(%p) ref(%d) key(%d) flag(%s) in list\n",
+ TBM_TRACE_BO("import new bo(%p) ref(%d) key(%d) flag(%s) in list\n",
bo, bo->ref_cnt, key, _tbm_flag_to_str(bo->flags));
LIST_INITHEAD(&bo->user_data_list);
bo = calloc(1, sizeof(struct _tbm_bo));
if (!bo) {
/* LCOV_EXCL_START */
- TBM_LOG_E("error: fail to import tbm_bo by tbm_fd(%d)\n", fd);
+ TBM_ERR("error: fail to import tbm_bo by tbm_fd(%d)\n", fd);
_tbm_bo_mutex_unlock();
return NULL;
/* LCOV_EXCL_STOP */
bo_priv = bo->bufmgr->backend->bo_import_fd(bo, fd);
if (!bo_priv) {
/* LCOV_EXCL_START */
- TBM_LOG_E("error: fail to import tbm_bo by tbm_fd(%d)\n", fd);
+ TBM_ERR("error: fail to import tbm_bo by tbm_fd(%d)\n", fd);
_tbm_set_last_result(TBM_BO_ERROR_IMPORT_FD_FAILED);
free(bo);
_tbm_bo_mutex_unlock();
LIST_FOR_EACH_ENTRY(bo2, &bo->bufmgr->bo_list, item_link) {
if (bo2->priv == bo_priv) {
- TBM_TRACE("find bo(%p) ref(%d) fd(%d) flag(%s) in list\n",
+ TBM_TRACE_BO("find bo(%p) ref(%d) fd(%d) flag(%s) in list\n",
bo2, bo2->ref_cnt, fd,
_tbm_flag_to_str(bo2->flags));
bo2->ref_cnt++;
else
bo->flags = TBM_BO_DEFAULT;
- TBM_TRACE("import bo(%p) ref(%d) fd(%d) flag(%s)\n",
+ TBM_TRACE_BO("import bo(%p) ref(%d) fd(%d) flag(%s)\n",
bo, bo->ref_cnt, fd, _tbm_flag_to_str(bo->flags));
LIST_INITHEAD(&bo->user_data_list);
size = bo->bufmgr->backend->bo_size(bo);
- TBM_TRACE("bo(%p) size(%d)\n", bo, size);
+ TBM_TRACE_BO("bo(%p) size(%d)\n", bo, size);
_tbm_bo_mutex_unlock();
TBM_BO_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
if (bo->bufmgr->bo_lock_type == TBM_BUFMGR_BO_LOCK_TYPE_NEVER) {
- TBM_LOG_E("bo(%p) lock_cnt(%d)\n", bo, bo->lock_cnt);
+ TBM_ERR("bo(%p) lock_cnt(%d)\n", bo, bo->lock_cnt);
_tbm_bo_mutex_unlock();
return 0;
}
if (bo->lock_cnt > 0) {
- TBM_TRACE("error: bo(%p) lock_cnt(%d)\n", bo, bo->lock_cnt);
+ TBM_TRACE_BO("error: bo(%p) lock_cnt(%d)\n", bo, bo->lock_cnt);
_tbm_bo_mutex_unlock();
return 1;
}
- TBM_TRACE("bo(%p) lock_cnt(%d)\n", bo, bo->lock_cnt);
+ TBM_TRACE_BO("bo(%p) lock_cnt(%d)\n", bo, bo->lock_cnt);
_tbm_bo_mutex_unlock();
return 0;
TBM_BO_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo1), 0);
TBM_BO_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo2), 0);
- TBM_TRACE("before: bo1(%p) bo2(%p)\n", bo1, bo2);
+ TBM_TRACE_BO("before: bo1(%p) bo2(%p)\n", bo1, bo2);
if (bo1->bufmgr->backend->bo_size(bo1) != bo2->bufmgr->backend->bo_size(bo2)) {
_tbm_set_last_result(TBM_BO_ERROR_SWAP_FAILED);
- TBM_LOG_E("error: bo1(%p) bo2(%p)\n", bo1, bo2);
+ TBM_ERR("error: bo1(%p) bo2(%p)\n", bo1, bo2);
_tbm_bo_mutex_unlock();
return 0;
}
- TBM_TRACE("after: bo1(%p) bo2(%p)\n", bo1, bo2);
+ TBM_TRACE_BO("after: bo1(%p) bo2(%p)\n", bo1, bo2);
temp = bo1->priv;
bo1->priv = bo2->priv;
/* check if the data according to the key exist if so, return false. */
data = user_data_lookup(&bo->user_data_list, key);
if (data) {
- TBM_TRACE("warning: user data already exist key(%ld)\n", key);
+ TBM_TRACE_BO("warning: user data already exist key(%ld)\n", key);
_tbm_bo_mutex_unlock();
return 0;
}
data = user_data_create(key, data_free_func);
if (!data) {
- TBM_LOG_E("error: bo(%p) key(%lu)\n", bo, key);
+ TBM_ERR("error: bo(%p) key(%lu)\n", bo, key);
_tbm_bo_mutex_unlock();
return 0;
}
- TBM_TRACE("bo(%p) key(%lu) data(%p)\n", bo, key, data->data);
+ TBM_TRACE_BO("bo(%p) key(%lu) data(%p)\n", bo, key, data->data);
LIST_ADD(&data->item_link, &bo->user_data_list);
TBM_BO_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
if (LIST_IS_EMPTY(&bo->user_data_list)) {
- TBM_TRACE("error: bo(%p) key(%lu)\n", bo, key);
+ TBM_TRACE_BO("error: bo(%p) key(%lu)\n", bo, key);
_tbm_bo_mutex_unlock();
return 0;
}
old_data = user_data_lookup(&bo->user_data_list, key);
if (!old_data) {
- TBM_TRACE("error: bo(%p) key(%lu)\n", bo, key);
+ TBM_TRACE_BO("error: bo(%p) key(%lu)\n", bo, key);
_tbm_bo_mutex_unlock();
return 0;
}
- TBM_TRACE("bo(%p) key(%lu) data(%p)\n", bo, key, old_data->data);
+ TBM_TRACE_BO("bo(%p) key(%lu) data(%p)\n", bo, key, old_data->data);
user_data_delete(old_data);
TBM_BO_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
if (LIST_IS_EMPTY(&bo->user_data_list)) {
- TBM_TRACE("error: bo(%p) key(%lu)\n", bo, key);
+ TBM_TRACE_BO("error: bo(%p) key(%lu)\n", bo, key);
_tbm_bo_mutex_unlock();
return 0;
}
old_data = user_data_lookup(&bo->user_data_list, key);
if (!old_data) {
- TBM_TRACE("error: bo(%p) key(%lu)\n", bo, key);
+ TBM_TRACE_BO("error: bo(%p) key(%lu)\n", bo, key);
_tbm_bo_mutex_unlock();
return 0;
}
old_data->free_func(old_data->data);
old_data->data = data;
- TBM_TRACE("bo(%p) key(%lu) data(%p)\n", bo, key, old_data->data);
+ TBM_TRACE_BO("bo(%p) key(%lu) data(%p)\n", bo, key, old_data->data);
_tbm_bo_mutex_unlock();
TBM_BO_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
if (!data || LIST_IS_EMPTY(&bo->user_data_list)) {
- TBM_TRACE("error: bo(%p) key(%lu)\n", bo, key);
+ TBM_TRACE_BO("error: bo(%p) key(%lu)\n", bo, key);
_tbm_bo_mutex_unlock();
return 0;
}
old_data = user_data_lookup(&bo->user_data_list, key);
if (!old_data) {
- TBM_TRACE("error: bo(%p) key(%lu)\n", bo, key);
+ TBM_TRACE_BO("error: bo(%p) key(%lu)\n", bo, key);
*data = NULL;
_tbm_bo_mutex_unlock();
return 0;
*data = old_data->data;
- TBM_TRACE("bo(%p) key(%lu) data(%p)\n", bo, key, old_data->data);
+ TBM_TRACE_BO("bo(%p) key(%lu) data(%p)\n", bo, key, old_data->data);
_tbm_bo_mutex_unlock();
flags = bo->flags;
- TBM_TRACE("bo(%p)\n", bo);
+ TBM_TRACE_BO("bo(%p)\n", bo);
_tbm_bo_mutex_unlock();
}
while (bo->lock_cnt > 0) {
- TBM_LOG_E("error lock_cnt:%d\n", bo->lock_cnt);
+ TBM_ERR("error lock_cnt:%d\n", bo->lock_cnt);
_bo_unlock(bo);
bo->lock_cnt--;
}
#include <sys/resource.h>
-#ifdef DEBUG
-int bDebug;
-#endif
-
-#ifdef TRACE
-int bTrace;
-#endif
+int trace_mask = 0;
#ifdef HAVE_DLOG
int bDlog;
/* check condition */
#define TBM_BUFMGR_RETURN_IF_FAIL(cond) {\
if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.\n", #cond);\
_tbm_bufmgr_mutex_unlock();\
return;\
} \
#define TBM_BUFMGR_RETURN_VAL_IF_FAIL(cond, val) {\
if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.\n", #cond);\
_tbm_bufmgr_mutex_unlock();\
return val;\
} \
return true;
if (pthread_mutex_init(&tbm_bufmgr_lock, NULL)) {
- TBM_LOG_E("fail: Cannot pthread_mutex_init for tbm_bufmgr_lock.\n");
+ TBM_ERR("fail: Cannot pthread_mutex_init for tbm_bufmgr_lock.\n");
return false;
}
_tbm_bufmgr_mutex_lock(void)
{
if (!_tbm_bufmgr_mutex_init()) {
- TBM_LOG_E("fail: _tbm_bufmgr_mutex_init()\n");
+ TBM_ERR("fail: _tbm_bufmgr_mutex_init()\n");
return;
}
fp = fopen(fn_cmdline, "r");
if (fp == 0) {
- TBM_LOG_E("cannot file open %s\n", fn_cmdline);
+ TBM_ERR("cannot file open %s\n", fn_cmdline);
return;
}
if (!fgets(cmdline, 255, fp)) {
- TBM_LOG_E("fail to get appname for pid(%ld)\n", pid);
+ TBM_ERR("fail to get appname for pid(%ld)\n", pid);
fclose(fp);
return;
}
vermaj, vermin);
if (abimaj != vermaj) {
- TBM_LOG_E("TBM module ABI major ver(%d) doesn't match the TBM's ver(%d)\n",
+ TBM_ERR("TBM module ABI major ver(%d) doesn't match the TBM's ver(%d)\n",
abimaj, vermaj);
return 0;
} else if (abimin > vermin) {
- TBM_LOG_E("TBM module ABI minor ver(%d) is newer than the TBM's ver(%d)\n",
+ TBM_ERR("TBM module ABI minor ver(%d) is newer than the TBM's ver(%d)\n",
abimin, vermin);
return 0;
}
module_data = dlopen(path, RTLD_LAZY);
if (!module_data) {
- TBM_LOG_E("failed to load module: %s(%s)\n", dlerror(), file);
+ TBM_ERR("failed to load module: %s(%s)\n", dlerror(), file);
return 0;
}
initdata = dlsym(module_data, "tbmModuleData");
if (!initdata) {
- TBM_LOG_E("Error: module does not have data object.\n");
+ TBM_ERR("Error: module does not have data object.\n");
goto err;
}
vers = initdata->vers;
if (!vers) {
- TBM_LOG_E("Error: module does not supply version information.\n");
+ TBM_ERR("Error: module does not supply version information.\n");
goto err;
}
init = initdata->init;
if (!init) {
- TBM_LOG_E("Error: module does not supply init symbol.\n");
+ TBM_ERR("Error: module does not supply init symbol.\n");
goto err;
}
if (!_check_version(vers)) {
- TBM_LOG_E("Fail to check version.\n");
+ TBM_ERR("Fail to check version.\n");
goto err;
}
if (!init(bufmgr, fd)) {
- TBM_LOG_E("Fail to init module(%s)\n", file);
+ TBM_ERR("Fail to init module(%s)\n", file);
goto err;
}
if (!bufmgr->backend || !bufmgr->backend->priv) {
- TBM_LOG_E("Error: module(%s) wrong operation. Check backend or backend's priv.\n", file);
+ TBM_ERR("Error: module(%s) wrong operation. Check backend or backend's priv.\n", file);
goto err;
}
/* load bufmgr priv from configured path */
n = scandir(BUFMGR_MODULE_DIR, &namelist, 0, alphasort);
if (n < 0) {
- TBM_LOG_E("no files : %s\n", BUFMGR_MODULE_DIR);
+ TBM_ERR("no files : %s\n", BUFMGR_MODULE_DIR);
return 0;
}
env = getenv("TBM_DLOG");
if (env) {
bDlog = atoi(env);
- TBM_LOG_D("TBM_DLOG=%s\n", env);
+ TBM_DBG("TBM_DLOG=%s\n", env);
} else
bDlog = 1;
#endif
-#ifdef DEBUG
- env = getenv("TBM_DEBUG");
- if (env) {
- bDebug = atoi(env);
- TBM_LOG_D("TBM_DEBUG=%s\n", env);
- } else
- bDebug = 0;
-#endif
-
#ifdef TRACE
env = getenv("TBM_TRACE");
if (env) {
- bTrace = atoi(env);
- TBM_LOG_D("TBM_TRACE=%s\n", env);
+ trace_mask = atoi(env);
+ TBM_DBG("TBM_TRACE=%s\n", env);
} else
- bTrace = 0;
+ trace_mask = 0;
#endif
pthread_mutex_lock(&gLock);
if (fd >= 0) {
- TBM_LOG_W("!!!!!WARNING:: The tbm_bufmgr_init DOSE NOT use argument fd ANYMORE.\n");
- TBM_LOG_W("!!!!!WARNING:: IT WILL BE CHANGED like tbm_bufmgr_init(int fd) --> tbm_bufmgr_init(void).\n");
+ TBM_WRN("!!!!!WARNING:: The tbm_bufmgr_init DOSE NOT use argument fd ANYMORE.\n");
+ TBM_WRN("!!!!!WARNING:: IT WILL BE CHANGED like tbm_bufmgr_init(int fd) --> tbm_bufmgr_init(void).\n");
}
/* initialize buffer manager */
if (gBufMgr) {
gBufMgr->ref_count++;
- TBM_TRACE("reuse tbm_bufmgr(%p) ref_count(%d) fd(%d)\n", gBufMgr, gBufMgr->ref_count, gBufMgr->fd);
+ TBM_INFO("reuse tbm_bufmgr(%p) ref_count(%d) fd(%d)\n", gBufMgr, gBufMgr->ref_count, gBufMgr->fd);
pthread_mutex_unlock(&gLock);
return gBufMgr;
}
/* allocate bufmgr */
gBufMgr = calloc(1, sizeof(struct _tbm_bufmgr));
if (!gBufMgr) {
- TBM_TRACE("error: fail to alloc bufmgr fd(%d)\n", fd);
+ TBM_ERR("error: fail to alloc bufmgr fd(%d)\n", fd);
pthread_mutex_unlock(&gLock);
return NULL;
}
/* set the display_server flag before loading the backend module */
if (server) {
- TBM_LOG_I("The tbm_bufmgr(%p) is used by display server. Need to bind the native_display.\n", gBufMgr);
+ TBM_INFO("The tbm_bufmgr(%p) is used by display server. Need to bind the native_display.\n", gBufMgr);
gBufMgr->display_server = 1;
}
/* load bufmgr priv from env */
if (!_tbm_load_module(gBufMgr, gBufMgr->fd)) {
- TBM_LOG_E("error : Fail to load bufmgr backend\n");
+ TBM_ERR("error : Fail to load bufmgr backend\n");
free(gBufMgr);
gBufMgr = NULL;
pthread_mutex_unlock(&gLock);
}
/* LCOV_EXCL_STOP */
- /* log for tbm backend_flag */
- TBM_DBG("backend flag:%x:", gBufMgr->backend->flags);
- TBM_DBG("\n");
-
gBufMgr->ref_count = 1;
- TBM_DBG("create tizen bufmgr:%p ref_count:%d\n",
+ TBM_INFO("create tizen bufmgr:%p ref_count:%d\n",
gBufMgr, gBufMgr->ref_count);
/* setup the bo_lock_type */
TBM_DBG("BUFMGR_LOCK_TYPE=%s\n", env ? env : "default:once");
- TBM_TRACE("create tbm_bufmgr(%p) ref_count(%d) fd(%d)\n", gBufMgr, gBufMgr->ref_count, fd);
-
/* intialize bo_list */
LIST_INITHEAD(&gBufMgr->bo_list);
#ifdef TBM_BUFMGR_INIT_TIME
/* get the end tv */
gettimeofday(&end_tv, NULL);
- TBM_LOG_I("tbm_bufmgr_init time: %ld ms", ((end_tv.tv_sec * 1000 + end_tv.tv_usec / 1000) - (start_tv.tv_sec * 1000 + start_tv.tv_usec / 1000)));
+ TBM_INFO("tbm_bufmgr_init time: %ld ms", ((end_tv.tv_sec * 1000 + end_tv.tv_usec / 1000) - (start_tv.tv_sec * 1000 + start_tv.tv_usec / 1000)));
#endif
pthread_mutex_unlock(&gLock);
pthread_mutex_lock(&gLock);
if (!gBufMgr) {
- TBM_LOG_E("gBufmgr already destroy: bufmgr:%p\n", bufmgr);
+ TBM_ERR("gBufmgr already destroy: bufmgr:%p\n", bufmgr);
pthread_mutex_unlock(&gLock);
_tbm_bufmgr_mutex_unlock();
return;
bufmgr->ref_count--;
if (bufmgr->ref_count > 0) {
- TBM_TRACE("reduce a ref_count(%d) of tbm_bufmgr(%p)\n", bufmgr->ref_count, bufmgr);
+ TBM_INFO("reduce a ref_count(%d) of tbm_bufmgr(%p)\n", bufmgr->ref_count, bufmgr);
pthread_mutex_unlock(&gLock);
_tbm_bufmgr_mutex_unlock();
return;
tbm_bo bo = NULL, tmp;
LIST_FOR_EACH_ENTRY_SAFE(bo, tmp, &bufmgr->bo_list, item_link) {
- TBM_LOG_E("Un-freed bo(%p, ref:%d)\n", bo, bo->ref_cnt);
+ TBM_ERR("Un-freed bo(%p, ref:%d)\n", bo, bo->ref_cnt);
_tbm_bo_free(bo);
}
LIST_DELINIT(&bufmgr->bo_list);
tbm_surface_h surf = NULL, tmp;
LIST_FOR_EACH_ENTRY_SAFE(surf, tmp, &bufmgr->surf_list, item_link) {
- TBM_LOG_E("Un-freed surf(%p, ref:%d)\n", surf, surf->refcnt);
+ TBM_ERR("Un-freed surf(%p, ref:%d)\n", surf, surf->refcnt);
tbm_surface_destroy(surf);
}
LIST_DELINIT(&bufmgr->surf_list);
tbm_backend_free(bufmgr->backend);
bufmgr->backend = NULL;
- TBM_TRACE("destroy tbm_bufmgr(%p)\n", bufmgr);
+ TBM_INFO("destroy tbm_bufmgr(%p)\n", bufmgr);
dlclose(bufmgr->module_data);
TBM_BUFMGR_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), TBM_BUFMGR_CAPABILITY_NONE);
TBM_BUFMGR_RETURN_VAL_IF_FAIL(bufmgr == gBufMgr, TBM_BUFMGR_CAPABILITY_NONE);
- TBM_TRACE("tbm_bufmgr(%p) capability(%u)\n", bufmgr, bufmgr->capabilities);
-
capabilities = bufmgr->capabilities;
_tbm_bufmgr_mutex_unlock();
pthread_mutex_lock(&gLock);
if (!TBM_BUFMGR_IS_VALID(bufmgr) || (bufmgr != gBufMgr)) {
- TBM_LOG_E("invalid bufmgr\n");
+ TBM_ERR("invalid bufmgr\n");
pthread_mutex_unlock(&gLock);
return NULL;
}
str = malloc(len);
if (!str) {
- TBM_LOG_E("Fail to allocate the string.\n");
+ TBM_ERR("Fail to allocate the string.\n");
pthread_mutex_unlock(&gLock);
return NULL;
}
char * str;
str = tbm_bufmgr_debug_tbm_info_get(bufmgr);
if (str) {
- TBM_DEBUG(" %s", str);
+ TBM_DBG(" %s", str);
free(str);
}
}
pthread_mutex_lock(&gLock);
if (onoff == 0) {
- TBM_LOG_D("count=%d onoff=%d\n", count, onoff);
+ TBM_DBG("count=%d onoff=%d\n", count, onoff);
b_dump_queue = 0;
tbm_surface_internal_dump_end();
} else {
int w, h;
if (path == NULL) {
- TBM_LOG_E("path is null");
+ TBM_ERR("path is null");
pthread_mutex_unlock(&gLock);
return 0;
}
- TBM_LOG_D("path=%s count=%d onoff=%d\n", path, count, onoff);
+ TBM_DBG("path=%s count=%d onoff=%d\n", path, count, onoff);
if (_tbm_util_get_max_surface_size(&w, &h) == 0) {
- TBM_LOG_E("Fail to get tbm_surface size.\n");
+ TBM_ERR("Fail to get tbm_surface size.\n");
pthread_mutex_unlock(&gLock);
return 0;
}
tbm_surface_h surface = NULL;
TBM_RETURN_VAL_IF_FAIL(path != NULL, 0);
- TBM_LOG_D("path=%s\n", path);
+ TBM_DBG("path=%s\n", path);
pthread_mutex_lock(&gLock);
count = _tbm_util_get_max_surface_size(&w, &h);
if (count == 0) {
- TBM_LOG_E("No tbm_surface.\n");
+ TBM_ERR("No tbm_surface.\n");
pthread_mutex_unlock(&gLock);
return 1;
}
TBM_BUFMGR_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(gBufMgr), 0);
if (!bufmgr->backend->bufmgr_bind_native_display) {
- TBM_TRACE("skip: tbm_bufmgr(%p) native_display(%p)\n",
+ TBM_WRN("skip: tbm_bufmgr(%p) native_display(%p)\n",
bufmgr, native_display);
_tbm_bufmgr_mutex_unlock();
return 1;
ret = bufmgr->backend->bufmgr_bind_native_display(bufmgr, native_display);
if (!ret) {
- TBM_LOG_E("error: tbm_bufmgr(%p) native_display(%p)\n",
+ TBM_ERR("error: tbm_bufmgr(%p) native_display(%p)\n",
bufmgr, native_display);
_tbm_bufmgr_mutex_unlock();
return 0;
}
- TBM_TRACE("tbm_bufmgr(%p) native_display(%p)\n", bufmgr, native_display);
+ TBM_INFO("tbm_bufmgr(%p) native_display(%p)\n", bufmgr, native_display);
_tbm_bufmgr_mutex_unlock();
gBufMgr->bo_lock_type = bo_lock_type;
- TBM_LOG_I("The bo_lock_type of the bo is %d\n", bo_lock_type);
+ TBM_INFO("The bo_lock_type of the bo is %d\n", bo_lock_type);
return 1;
}
bufmgr_backend = calloc(1, sizeof(struct _tbm_bufmgr_backend));
if (!bufmgr_backend) {
- TBM_LOG_E("error: fail to allocate the bufmgr_backend\n");
+ TBM_ERR("error: fail to allocate the bufmgr_backend\n");
return NULL;
}
int tbm_backend_init(tbm_bufmgr bufmgr, tbm_bufmgr_backend backend)
{
if (!bufmgr) {
- TBM_LOG_E("error: fail to init tbm backend... bufmgr is null\n");
+ TBM_ERR("error: fail to init tbm backend... bufmgr is null\n");
return 0;
}
if (!backend) {
- TBM_LOG_E("error: fail to init tbm backend... backend is null\n");
+ TBM_ERR("error: fail to init tbm backend... backend is null\n");
return 0;
}
const char *value;
if (gBufMgr == NULL) {
- TBM_LOG_E("error: no gBufMgr.\n");
+ TBM_ERR("error: no gBufMgr.\n");
return 0;
}
#include <dirent.h>
#include <string.h>
#include <errno.h>
+#include <assert.h>
#include <pthread.h>
#include <tbm_bufmgr.h>
#include <tbm_bo.h>
#include <tbm_surface_internal.h>
#include <tbm_bufmgr_backend.h>
#include <tbm_surface_queue.h>
+#include <tbm_log.h>
+#include <dlog.h>
-#define DEBUG
-#ifdef DEBUG
-extern int bDebug;
extern tbm_bufmgr gBufMgr;
-
-#define TBM_DBG(...) { if (bDebug&0x1) TBM_LOG_D(__VA_ARGS__); }
-#define TBM_DBG_LOCK(...) { if (bDebug&0x2) TBM_LOG_D(__VA_ARGS__); }
-#else
-#define TBM_DBG(...)
-#define TBM_DBG_LOCK(...)
-#endif /* DEBUG */
-
-#define TRACE
-#ifdef TRACE
-extern int bTrace;
-#endif /* TRACE */
-
extern int b_dump_queue;
-
-#ifdef HAVE_DLOG
-#include <dlog.h>
-
-extern int bDlog;
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "TBM"
-
-#define TBM_LOG_D(fmt, ...) {\
- if (bDlog) {\
- LOGD("[TBM:D] " fmt, ##__VA_ARGS__);\
- } \
- else {\
- fprintf(stderr, "[TBM:D(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__);\
- } \
-}
-
-#define TBM_LOG_I(fmt, ...) {\
- if (bDlog) {\
- LOGI("[TBM:I] " fmt, ##__VA_ARGS__);\
- } \
- else {\
- fprintf(stderr, "[TBM:I(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__);\
- } \
-}
-
-#define TBM_LOG_W(fmt, ...) {\
- if (bDlog) {\
- LOGW("[TBM:W] " fmt, ##__VA_ARGS__);\
- } \
- else {\
- fprintf(stderr, "[TBM:W(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__);\
- } \
-}
-
-#define TBM_LOG_E(fmt, ...) {\
- if (bDlog) {\
- LOGE("[TBM:E] " fmt, ##__VA_ARGS__);\
- } \
- else {\
- fprintf(stderr, "[TBM:E(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__);\
- } \
-}
-
-#define TBM_DEBUG(fmt, ...) {\
- if (bDlog) {\
- LOGE("[TBM_DEBUG] " fmt, ##__VA_ARGS__);\
- } \
- else {\
- fprintf(stderr, "[TBM:DEBUG(%d)] " fmt, getpid(), ##__VA_ARGS__);\
- } \
-}
-
-#ifdef TRACE
-#define TBM_TRACE(fmt, ...) {\
- if (bDlog) {\
- if (bTrace&0x1) LOGE("[TBM:TRACE] " fmt, ##__VA_ARGS__);\
- } \
- else {\
- if (bTrace&0x1) fprintf(stderr, "[TBM:TRACE(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__);\
- } \
-}
-#else
-#define TBM_TRACE(fmt, ...)
-#endif /* TRACE */
-
-#else
-#define TBM_LOG_D(fmt, ...) fprintf(stderr, "[TBM:D(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__)
-#define TBM_LOG_I(fmt, ...) fprintf(stderr, "[TBM:I(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__)
-#define TBM_LOG_W(fmt, ...) fprintf(stderr, "[TBM:W(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__)
-#define TBM_LOG_E(fmt, ...) fprintf(stderr, "[TBM:E(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__)
-#define TBM_DEBUG(fmt, ...) fprintf(stderr, "[TBM:DEBUG(%d)] " fmt, getpid(), ##__VA_ARGS__)
-#ifdef TRACE
-#define TBM_TRACE(fmt, ...) { if (bTrace&0x1) fprintf(stderr, "[TBM:TRACE(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__); }
-#else
-#define TBM_TRACE(fmt, ...)
-#endif /* TRACE */
-#endif /* HAVE_DLOG */
+extern int trace_mask;
/* check condition */
#define TBM_RETURN_IF_FAIL(cond) {\
if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.\n", #cond);\
return;\
} \
}
#define TBM_RETURN_VAL_IF_FAIL(cond, val) {\
if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.\n", #cond);\
return val;\
} \
}
#define TBM_GOTO_VAL_IF_FAIL(cond, val) {\
if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.\n", #cond);\
goto val;\
} \
}
} \
}
+#define TBM_TRACE_BO(fmt, args...) \
+ do { \
+ if (trace_mask&TBM_BUFGMR_DEBUG_TRACE_BO) { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_INFO, "[%5d.%06d][%d][%s %d](TRACE)"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } \
+ } while (0)
+
+#define TBM_TRACE_SURFACE_INTERNAL(fmt, args...) \
+ do { \
+ if (trace_mask&TBM_BUFGMR_DEBUG_TRACE_SURFACE_INTERNAL) { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_INFO, "[%5d.%06d][%d][%s %d](TRACE)"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } \
+ } while (0)
+
+#define TBM_TRACE_SURFACE(fmt, args...) \
+ do { \
+ if (trace_mask&TBM_BUFGMR_DEBUG_TRACE_SURFACE) { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_INFO, "[%5d.%06d][%d][%s %d](TRACE)"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } \
+ } while (0)
+
+#define TBM_TRACE_SURFACE_QUEUE(fmt, args...) \
+ do { \
+ if (trace_mask&TBM_BUFGMR_DEBUG_TRACE_SURFACE_QUEUE) { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_INFO, "[%5d.%06d][%d][%s %d](TRACE)"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } \
+ } while (0)
+
+#define TBM_TRACE(fmt, args...) \
+ do { \
+ if (trace_mask&0x1) { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_INFO, "[%5d.%06d][%d][%s %d](TRACE)"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } \
+ } while (0)
+
+
/* check validation */
#define TBM_BUFMGR_IS_VALID(mgr) (mgr && mgr == gBufMgr)
#define TBM_BO_IS_VALID(bo) (bo && \
display = wl_display_connect("tbm-drm-auth");
if (!display) {
- TBM_LOG_E("Failed to connect display\n");
+ TBM_ERR("Failed to connect display\n");
free(tbm_drm_client);
return 0;
wl_registry = wl_display_get_registry(display);
if (!wl_registry) {
- TBM_LOG_E("Failed to get registry\n");
+ TBM_ERR("Failed to get registry\n");
wl_display_disconnect(display);
free(tbm_drm_client);
wl_registry_add_listener(wl_registry, ®istry_listener, tbm_drm_client);
if (wl_display_roundtrip(display) < 0) { //For Gloabl registry
- TBM_LOG_E("Failed to wl_display_roundtrip for global registry\n");
+ TBM_ERR("Failed to wl_display_roundtrip for global registry\n");
wl_registry_destroy(wl_registry);
wl_display_disconnect(display);
free(tbm_drm_client);
}
if (!tbm_drm_client->wl_tbm_drm_auth) {
- TBM_LOG_E("Failed to get wl_tbm_drm_auth interface\n");
+ TBM_ERR("Failed to get wl_tbm_drm_auth interface\n");
wl_registry_destroy(wl_registry);
wl_display_disconnect(display);
free(tbm_drm_client);
wl_tbm_drm_auth_get_authentication_info(tbm_drm_client->wl_tbm_drm_auth);
if (wl_display_roundtrip(display) < 0) {
- TBM_LOG_E("Failed to wl_display_roundtrip get auth info\n");
+ TBM_ERR("Failed to wl_display_roundtrip get auth info\n");
wl_tbm_drm_auth_set_user_data(tbm_drm_client->wl_tbm_drm_auth, NULL);
wl_tbm_drm_auth_destroy(tbm_drm_client->wl_tbm_drm_auth);
wl_registry_destroy(wl_registry);
}
if (tbm_drm_client->auth_fd < 0) {
- TBM_LOG_E("Failed to get auth info\n");
+ TBM_ERR("Failed to get auth info\n");
wl_tbm_drm_auth_set_user_data(tbm_drm_client->wl_tbm_drm_auth, NULL);
wl_tbm_drm_auth_destroy(tbm_drm_client->wl_tbm_drm_auth);
wl_registry_destroy(wl_registry);
return;
if (fd < 0 || fd > fd_max) {
- TBM_LOG_E("%d out of fd range\n", fd);
+ TBM_ERR("%d out of fd range\n", fd);
return;
}
if (tbm_drm_fd != -1)
- TBM_LOG_W("already has TBM_DRM_FD: %d\n", tbm_drm_fd);
+ TBM_WRN("already has TBM_DRM_FD: %d\n", tbm_drm_fd);
tbm_drm_fd = fd;
- TBM_LOG_I("TBM_DRM_FD: %d\n", tbm_drm_fd);
+ TBM_INFO("TBM_DRM_FD: %d\n", tbm_drm_fd);
}
void
tbm_drm_helper_unset_fd(void)
{
tbm_drm_fd = -1;
- TBM_LOG_I("TBM_DRM_FD: %d\n", tbm_drm_fd);
+ TBM_INFO("TBM_DRM_FD: %d\n", tbm_drm_fd);
}
int
int new_fd, flags;
if (tbm_drm_fd == -1) {
- TBM_LOG_E("no drm fd");
+ TBM_ERR("no drm fd");
return -1;
}
- TBM_LOG_I("TBM_DRM_FD: %d\n", tbm_drm_fd);
+ TBM_INFO("TBM_DRM_FD: %d\n", tbm_drm_fd);
flags = fcntl(tbm_drm_fd, F_GETFD);
if (flags == -1) {
- TBM_LOG_E("fcntl failed: %m");
+ TBM_ERR("fcntl failed: %m");
return -1;
}
new_fd = dup(tbm_drm_fd);
if (new_fd < 0) {
- TBM_LOG_E("dup failed: %m");
+ TBM_ERR("dup failed: %m");
return -1;
}
if (fcntl(new_fd, F_SETFD, flags|FD_CLOEXEC) == -1) {
- TBM_LOG_E("failed to set fd\n");
+ TBM_ERR("failed to set fd\n");
close(new_fd);
return -1;
}
- TBM_LOG_I("Return TBM_FD: %d\n", new_fd);
+ TBM_INFO("Return TBM_FD: %d\n", new_fd);
return new_fd;
}
fd = open(tbm_drm_auth_srv->device_name, O_RDWR);
if (fd != -1) {
if (fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC) == -1) {
- TBM_LOG_E("failed to set fd\n");
+ TBM_ERR("failed to set fd\n");
goto fini;
}
}
}
if (fd < 0) {
- TBM_LOG_E("failed to open drm : device_name, %s\n", tbm_drm_auth_srv->device_name);
+ TBM_ERR("failed to open drm : device_name, %s\n", tbm_drm_auth_srv->device_name);
wl_resource_post_error(resource, WL_TBM_DRM_AUTH_ERROR_AUTHENTICATE_FAIL,
"authenicate failed::open_drm");
if (drmGetMagic(fd, &magic) < 0) {
if (errno != EACCES) {
- TBM_LOG_E("failed to get magic\n");
+ TBM_ERR("failed to get magic\n");
wl_resource_post_error(resource, WL_TBM_DRM_AUTH_ERROR_AUTHENTICATE_FAIL,
"authenicate failed::get_magic");
}
if (drmAuthMagic(tbm_drm_auth_srv->fd, magic) < 0) {
- TBM_LOG_E("failed to authenticate magic\n");
+ TBM_ERR("failed to authenticate magic\n");
wl_resource_post_error(resource, WL_TBM_DRM_AUTH_ERROR_AUTHENTICATE_FAIL,
"authenicate failed::auth_magic");
buf = calloc(1, buf_len * sizeof(char));
if (!buf) {
- TBM_LOG_E("creating buffer failed\n");
+ TBM_ERR("creating buffer failed\n");
goto failed;
}
grp = calloc(1, sizeof(struct group));
if (!grp) {
- TBM_LOG_E("creating group failed\n");
+ TBM_ERR("creating group failed\n");
goto failed;
}
ret = getgrnam_r(name, grp, buf, buf_len, &grp_res);
if (ret < 0) {
- TBM_LOG_E("getgrnam_r failed errno:%d(%m)\n", ret);
+ TBM_ERR("getgrnam_r failed errno:%d(%m)\n", ret);
goto failed;
}
if (grp_res == NULL) {
- TBM_LOG_E("finding name:%s group failed\n", name);
+ TBM_ERR("finding name:%s group failed\n", name);
goto failed;
}
dir = getenv("XDG_RUNTIME_DIR");
if (!dir) {
- TBM_LOG_W("getting XDG_RUNTIME_DIR failed\n");
+ TBM_WRN("getting XDG_RUNTIME_DIR failed\n");
return;
}
ret = chmod(socket_path, 509);
if (ret < 0) {
- TBM_LOG_W("changing modes of socket file failed:%s (%m)\n", socket_path);
+ TBM_WRN("changing modes of socket file failed:%s (%m)\n", socket_path);
return;
}
ret = _tbm_getgrnam_r("root");
if (ret < 0) {
- TBM_LOG_W("getting uid failed\n");
+ TBM_WRN("getting uid failed\n");
return;
}
uid = ret;
ret = _tbm_getgrnam_r("display");
if (ret < 0) {
- TBM_LOG_W("getting gid failed\n");
+ TBM_WRN("getting gid failed\n");
return;
}
gid = ret;
ret = chown(socket_path, uid, gid);
if (ret < 0) {
- TBM_LOG_W("changing owner of socket file failed:%s (%m)\n", socket_path);
+ TBM_WRN("changing owner of socket file failed:%s (%m)\n", socket_path);
return;
}
}
tbm_drm_auth_srv->flags = flags;
if (wl_display_add_socket(tbm_drm_auth_srv->display, "tbm-drm-auth")) {
- TBM_LOG_E("[TBM_DRM] fail to add socket\n");
+ TBM_ERR("[TBM_DRM] fail to add socket\n");
if (tbm_drm_auth_srv->device_name)
free(tbm_drm_auth_srv->device_name);
const long int sl = strtol(value, &end, 10);
if (end == value) {
- TBM_LOG_E("%s: not a decimal number\n", value);
+ TBM_ERR("%s: not a decimal number\n", value);
return -1;
} else if (*end != '\0') {
- TBM_LOG_E("%s: extra characters at end of input: %s\n", value, end);
+ TBM_ERR("%s: extra characters at end of input: %s\n", value, end);
return -1;
} else if ((sl == LONG_MIN || sl == LONG_MAX) && errno == ERANGE) {
- TBM_LOG_E("%s out of range of type long\n", value);
+ TBM_ERR("%s out of range of type long\n", value);
return -1;
} else if (sl >= INT_MAX) {
- TBM_LOG_E("%ld greater than INT_MAX\n", sl);
+ TBM_ERR("%ld greater than INT_MAX\n", sl);
return -1;
} else if (sl <= INT_MIN) {
- TBM_LOG_E("%ld less than INT_MIN\n", sl);
+ TBM_ERR("%ld less than INT_MIN\n", sl);
return -1;
} else {
int fd_max = tbm_bufmgr_get_fd_limit();
fd = (int)sl;
if (fd < 0 || fd > fd_max) {
- TBM_LOG_E("%d out of fd range\n", fd);
+ TBM_ERR("%d out of fd range\n", fd);
return -1;
}
}
fd = tbm_drm_master_fd;
if (fd == -1) {
- TBM_LOG_I("no presetted TBM DRM MASTER FD");
+ TBM_INFO("no presetted TBM DRM MASTER FD");
return -1;
}
- TBM_LOG_I("TBM DRM MASTER FD: %d\n", fd);
+ TBM_INFO("TBM DRM MASTER FD: %d\n", fd);
flags = fcntl(fd, F_GETFD);
if (flags == -1) {
- TBM_LOG_E("fcntl failed: %m");
+ TBM_ERR("fcntl failed: %m");
return -1;
}
new_fd = dup(fd);
if (new_fd < 0) {
- TBM_LOG_E("dup failed: %m");
+ TBM_ERR("dup failed: %m");
return -1;
}
if (fcntl(new_fd, F_SETFD, flags|FD_CLOEXEC) == -1) {
- TBM_LOG_E("failed to set fd\n");
+ TBM_ERR("failed to set fd\n");
close(new_fd);
return -1;
}
- TBM_LOG_I("Return MASTER_FD: %d\n", new_fd);
+ TBM_INFO("Return MASTER_FD: %d\n", new_fd);
return new_fd;
}
return;
if (fd < 0 || fd > fd_max) {
- TBM_LOG_E("%d out of fd range\n", fd);
+ TBM_ERR("%d out of fd range\n", fd);
return;
}
if (tbm_drm_master_fd != -1)
- TBM_LOG_W("already has TBM DRM MASTER FD: %d\n", tbm_drm_master_fd);
+ TBM_WRN("already has TBM DRM MASTER FD: %d\n", tbm_drm_master_fd);
tbm_drm_master_fd = fd;
- TBM_LOG_I("TBM DRM MASTER FD: %d\n", tbm_drm_master_fd);
+ TBM_INFO("TBM DRM MASTER FD: %d\n", tbm_drm_master_fd);
}
void
tbm_drm_helper_unset_tbm_master_fd(void)
{
tbm_drm_master_fd = -1;
- TBM_LOG_I("TBM DRM MASTER FD: %d\n", tbm_drm_master_fd);
+ TBM_INFO("TBM DRM MASTER FD: %d\n", tbm_drm_master_fd);
}
/* LCOV_EXCL_STOP */
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2018 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tbm_bufmgr_int.h"
+#include "tbm_log.h"
+
+#define TBM_PATH_LEN 1024
+
+#define COLOR_RED "\x1b[31m" /* for error */
+#define COLOR_YELLOW "\x1b[33m" /* for warning */
+#define COLOR_GREEN "\x1b[32m" /* for info */
+#define COLOR_RESET "\x1b[0m"
+
+#undef LOG_TAG
+#define LOG_TAG "TBM"
+
+static unsigned int dlog_enable = 1;
+static unsigned int color_enable = 1;
+
+static unsigned int assert_level = TBM_LOG_LEVEL_NONE;
+
+static unsigned int log_lock_init;
+static pthread_mutex_t log_lock;
+
+unsigned int tbm_log_debug_level = TBM_LOG_LEVEL_INFO;
+
+static int stdout_fd = -1;
+
+void
+tbm_log_enable_color(unsigned int enable)
+{
+ color_enable = enable;
+}
+
+void
+tbm_log_enable_dlog(unsigned int enable)
+{
+ const char *str = getenv("TBM_DLOG");
+ if (str)
+ enable = (str[0] == '1') ? 1 : 0;
+ dlog_enable = enable;
+}
+
+void
+tbm_log_enable_debug(unsigned int enable)
+{
+ if (enable)
+ tbm_log_debug_level = TBM_LOG_LEVEL_DBG;
+ else
+ tbm_log_debug_level = TBM_LOG_LEVEL_INFO;
+}
+
+void
+tbm_log_set_debug_level(int level)
+{
+ tbm_log_debug_level = level;
+}
+
+void
+tbm_log_set_assert_level(int level)
+{
+ assert_level = level;
+}
+
+void
+tbm_log_set_path(const char *path)
+{
+ if (!path) {
+ if (stdout_fd != -1) {
+ fflush(stdout);
+ close(STDOUT_FILENO);
+ dup2(stdout_fd, STDOUT_FILENO);
+ close(stdout_fd);
+ stdout_fd = -1;
+ }
+ } else {
+ char fd_name[TBM_PATH_LEN];
+ int log_fd = -1;
+ FILE *log_fl;
+
+ snprintf(fd_name, TBM_PATH_LEN, "%s", path);
+
+ log_fl = fopen(fd_name, "a");
+ if (!log_fl) {
+ TBM_ERR("failed: open file(%s)\n", fd_name);
+ return;
+ }
+
+ if (stdout_fd == -1) {
+ fflush(stdout);
+ stdout_fd = dup(STDOUT_FILENO);
+ if (stdout_fd < 0) {
+ TBM_ERR("dup failed: %m\n");
+ fclose(log_fl);
+ return;
+ }
+ }
+
+ setvbuf(log_fl, NULL, _IOLBF, 512);
+ log_fd = fileno(log_fl);
+
+ close(STDOUT_FILENO);
+ dup2(log_fd, STDOUT_FILENO);
+ fclose(log_fl);
+ }
+}
+
+static void
+_tbm_log_vprint_stdout(int level, const char *fmt, va_list arg)
+{
+ char *lvl_str[] = {"TBM_NON", "TBM_ERR", "TBM_WRN", "TBM_INF", "TBM_DBG"};
+ char *color[] = {COLOR_RESET, COLOR_RED, COLOR_YELLOW, COLOR_GREEN, COLOR_RESET};
+
+ if (!log_lock_init) {
+ log_lock_init = 1;
+ pthread_mutex_init(&log_lock, NULL);
+ }
+
+ if (level > tbm_log_debug_level)
+ return;
+
+ pthread_mutex_lock(&log_lock);
+
+ if (color_enable)
+ printf("%s", color[level]);
+ printf("[%s]", lvl_str[level]);
+ if (color_enable)
+ printf(COLOR_RESET);
+ vprintf(fmt, arg);
+ printf("\n");
+ pthread_mutex_unlock(&log_lock);
+}
+
+void
+tbm_log_print_stdout(int level, const char *fmt, ...)
+{
+ va_list arg;
+ va_start(arg, fmt);
+ _tbm_log_vprint_stdout(level, fmt, arg);
+ va_end(arg);
+}
+
+static void
+_tbm_log_dlog_print(int level, const char *fmt, va_list arg)
+{
+ log_priority dlog_prio;
+
+ switch (level) {
+ case TBM_LOG_LEVEL_ERR:
+ dlog_prio = DLOG_ERROR;
+ break;
+ case TBM_LOG_LEVEL_WRN:
+ dlog_prio = DLOG_WARN;
+ break;
+ case TBM_LOG_LEVEL_INFO:
+ dlog_prio = DLOG_INFO;
+ break;
+ case TBM_LOG_LEVEL_DBG:
+ dlog_prio = DLOG_DEBUG;
+ break;
+ default:
+ return;
+ }
+ __dlog_vprint(LOG_ID_SYSTEM, dlog_prio, LOG_TAG, fmt, arg);
+}
+
+void
+tbm_log_print(int level, const char *fmt, ...)
+{
+ va_list arg;
+
+ if (!log_lock_init) {
+ log_lock_init = 1;
+ pthread_mutex_init(&log_lock, NULL);
+ }
+
+ if (level > tbm_log_debug_level)
+ return;
+
+ if (dlog_enable) {
+ va_start(arg, fmt);
+ _tbm_log_dlog_print(level, fmt, arg);
+ va_end(arg);
+ } else {
+ va_start(arg, fmt);
+ _tbm_log_vprint_stdout(level, fmt, arg);
+ va_end(arg);
+ }
+
+ assert(level > assert_level);
+}
+
+void
+tbm_log_reset(void)
+{
+ pthread_mutex_trylock(&log_lock);
+ pthread_mutex_unlock(&log_lock);
+}
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2018 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _TBM_LOG_H_
+#define _TBM_LOG_H_
+
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <time.h>
+#include <dlog.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file tbm_log.h
+ * @brief The header file to print logs in frontend and backend modules
+ * @details
+ */
+
+enum {
+ TBM_LOG_LEVEL_NONE,
+ TBM_LOG_LEVEL_ERR,
+ TBM_LOG_LEVEL_WRN,
+ TBM_LOG_LEVEL_INFO,
+ TBM_LOG_LEVEL_DBG,
+};
+
+void tbm_log_enable_color(unsigned int enable);
+void tbm_log_enable_dlog(unsigned int enable);
+void tbm_log_enable_debug(unsigned int enable);
+void tbm_log_set_debug_level(int level);
+void tbm_log_set_assert_level(int level);
+void tbm_log_set_path(const char *path);
+void tbm_log_print(int level, const char *fmt, ...);
+void tbm_log_reset(void);
+
+#define TBM_DBG(fmt, args...) \
+ do { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_DBG, "[%5d.%06d][%d][%s %d]"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } while (0)
+#define TBM_INFO(fmt, args...) \
+ do { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_INFO, "[%5d.%06d][%d][%s %d]"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } while (0)
+#define TBM_WRN(fmt, args...) \
+ do { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_WRN, "[%5d.%06d][%d][%s %d]"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } while (0)
+#define TBM_ERR(fmt, args...) \
+ do { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_ERR, "[%5d.%06d][%d][%s %d]"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } while (0)
+
+#define TBM_NEVER_GET_HERE() TBM_WRN("** NEVER GET HERE **")
+#define TBM_DEPRECATED(str) \
+ do { \
+ if (str) \
+ TBM_WRN("** DEPRECATED: %s **", str); \
+ else \
+ TBM_WRN("** DEPRECATED **"); \
+ } while(0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TBM_LOG_H_ */
int
tbm_surface_query_formats(uint32_t **formats, uint32_t *num)
{
- TBM_TRACE("\n");
+ TBM_TRACE_SURFACE("\n");
if (!tbm_surface_internal_query_supported_formats(formats, num))
return TBM_SURFACE_ERROR_INVALID_OPERATION;
tbm_surface_h
tbm_surface_create(int width, int height, tbm_format format)
{
- TBM_TRACE("width(%d) height(%d)\n", width, height);
+ TBM_TRACE_SURFACE("width(%d) height(%d)\n", width, height);
if (!(width > 0) || !(height > 0)) {
#ifdef HAVE_CAPI_0_1_1
int
tbm_surface_destroy(tbm_surface_h surface)
{
- TBM_TRACE("tbm_surface(%p)\n", surface);
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
TBM_RETURN_VAL_IF_FAIL(surface, TBM_SURFACE_ERROR_INVALID_PARAMETER);
int
tbm_surface_map(tbm_surface_h surface, int opt, tbm_surface_info_s *info)
{
- TBM_TRACE("tbm_surface(%p)\n", surface);
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
TBM_RETURN_VAL_IF_FAIL(surface, TBM_SURFACE_ERROR_INVALID_PARAMETER);
TBM_RETURN_VAL_IF_FAIL(info != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
int
tbm_surface_unmap(tbm_surface_h surface)
{
- TBM_TRACE("tbm_surface(%p)\n", surface);
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
TBM_RETURN_VAL_IF_FAIL(surface, TBM_SURFACE_ERROR_INVALID_PARAMETER);
int
tbm_surface_get_info(tbm_surface_h surface, tbm_surface_info_s *info)
{
- TBM_TRACE("tbm_surface(%p)\n", surface);
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
TBM_RETURN_VAL_IF_FAIL(surface, TBM_SURFACE_ERROR_INVALID_PARAMETER);
TBM_RETURN_VAL_IF_FAIL(info != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
int
tbm_surface_get_width(tbm_surface_h surface)
{
- TBM_TRACE("tbm_surface(%p)\n", surface);
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
TBM_RETURN_VAL_IF_FAIL(surface, TBM_SURFACE_ERROR_INVALID_PARAMETER);
int
tbm_surface_get_height(tbm_surface_h surface)
{
- TBM_TRACE("tbm_surface(%p)\n", surface);
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
TBM_RETURN_VAL_IF_FAIL(surface, TBM_SURFACE_ERROR_INVALID_PARAMETER);
tbm_format
tbm_surface_get_format(tbm_surface_h surface)
{
- TBM_TRACE("tbm_surface(%p)\n", surface);
+ TBM_TRACE_SURFACE("tbm_surface(%p)\n", surface);
if (!surface) {
#ifdef HAVE_CAPI_0_1_1
/* check condition */
#define TBM_SURFACE_RETURN_IF_FAIL(cond) {\
if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.\n", #cond);\
_tbm_surface_mutex_unlock();\
return;\
} \
#define TBM_SURFACE_RETURN_VAL_IF_FAIL(cond, val) {\
if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.\n", #cond);\
_tbm_surface_mutex_unlock();\
return val;\
} \
return true;
if (pthread_mutex_init(&tbm_surface_lock, NULL)) {
- TBM_LOG_E("fail: pthread_mutex_init for tbm_surface_lock.\n");
+ TBM_ERR("fail: pthread_mutex_init for tbm_surface_lock.\n");
return false;
}
_tbm_surface_mutex_lock(void)
{
if (!_tbm_surface_mutex_init()) {
- TBM_LOG_E("fail: _tbm_surface_mutex_init.\n");
+ TBM_ERR("fail: _tbm_surface_mutex_init.\n");
return;
}
if (!LIST_IS_EMPTY(&g_surface_bufmgr->surf_list)) {
LIST_FOR_EACH_ENTRY(old_data, &g_surface_bufmgr->surf_list, item_link) {
if (old_data == surface) {
- TBM_TRACE("tbm_surface(%p)\n", surface);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p)\n", surface);
return 1;
}
}
}
- TBM_LOG_E("error: No valid tbm_surface(%p)\n", surface);
+ TBM_ERR("error: No valid tbm_surface(%p)\n", surface);
return 0;
}
surf->info.height, surf->info.format, plane_idx, size, offset, pitch, bo_idx);
if (!ret) {
/* LCOV_EXCL_START */
- TBM_LOG_E("Fail to surface_get_plane_data. surface(%p)\n", surface);
+ TBM_ERR("Fail to surface_get_plane_data. surface(%p)\n", surface);
return 0;
/* LCOV_EXCL_STOP */
}
ret = bufmgr->backend->surface_supported_format(formats, num);
if (!ret) {
/* LCOV_EXCL_START */
- TBM_LOG_E("Fail to surface_supported_format.\n");
+ TBM_ERR("Fail to surface_supported_format.\n");
goto fail;
/* LCOV_EXCL_START */
}
- TBM_TRACE("tbm_bufmgr(%p) format num(%u)\n", g_surface_bufmgr, *num);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_bufmgr(%p) format num(%u)\n", g_surface_bufmgr, *num);
if (bufmgr_initialized) {
LIST_DELINIT(&g_surface_bufmgr->surf_list);
}
_tbm_surface_mutex_unlock();
- TBM_LOG_E("error: tbm_bufmgr(%p)\n", g_surface_bufmgr);
+ TBM_ERR("error: tbm_bufmgr(%p)\n", g_surface_bufmgr);
return 0;
/* LCOV_EXCL_STOP */
break;
}
- TBM_TRACE("tbm_format(%s) num_planes(%d)\n", _tbm_surface_internal_format_to_str(format), num_planes);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_format(%s) num_planes(%d)\n", _tbm_surface_internal_format_to_str(format), num_planes);
return num_planes;
}
break;
}
- TBM_TRACE("tbm_format(%s) bpp(%d)\n", _tbm_surface_internal_format_to_str(format), bpp);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_format(%s) bpp(%d)\n", _tbm_surface_internal_format_to_str(format), bpp);
return bpp;
}
mgr = g_surface_bufmgr;
if (!TBM_BUFMGR_IS_VALID(mgr)) {
- TBM_LOG_E("The bufmgr is invalid\n");
+ TBM_ERR("The bufmgr is invalid\n");
goto check_valid_fail;
}
surf = calloc(1, sizeof(struct _tbm_surface));
if (!surf) {
/* LCOV_EXCL_START */
- TBM_LOG_E("fail to alloc surf\n");
+ TBM_ERR("fail to alloc surf\n");
goto alloc_surf_fail;
/* LCOV_EXCL_STOP */
}
for (i = 0; i < surf->info.num_planes; i++) {
if (!_tbm_surface_internal_query_plane_data(surf, i, &size,
&offset, &stride, &bo_idx)) {
- TBM_LOG_E("fail to query plane data\n");
+ TBM_ERR("fail to query plane data\n");
goto query_plane_data_fail;
}
bo = calloc(1, sizeof(struct _tbm_bo));
if (!bo) {
- TBM_LOG_E("fail to alloc bo struct\n");
+ TBM_ERR("fail to alloc bo struct\n");
goto alloc_bo_fail;
}
bo_priv = mgr->backend->surface_bo_alloc(bo, width, height, format, flags, i);
if (!bo_priv) {
- TBM_LOG_E("fail to alloc bo priv\n");
+ TBM_ERR("fail to alloc bo priv\n");
free(bo);
pthread_mutex_unlock(&surf->bufmgr->lock);
goto alloc_bo_fail;
} else {
surf->bos[i] = tbm_bo_alloc(mgr, bo_size, flags);
if (!surf->bos[i]) {
- TBM_LOG_E("fail to alloc bo idx:%d\n", i);
+ TBM_ERR("fail to alloc bo idx:%d\n", i);
goto alloc_bo_fail;
}
}
_tbm_bo_set_surface(surf->bos[i], surf);
}
- TBM_TRACE("width(%d) height(%d) format(%s) flags(%d) tbm_surface(%p)\n", width, height,
+ TBM_TRACE_SURFACE_INTERNAL("width(%d) height(%d) format(%s) flags(%d) tbm_surface(%p)\n", width, height,
_tbm_surface_internal_format_to_str(format), flags, surf);
LIST_INITHEAD(&surf->user_data_list);
}
_tbm_surface_mutex_unlock();
- TBM_LOG_E("error: width(%d) height(%d) format(%s) flags(%d)\n",
+ TBM_ERR("error: width(%d) height(%d) format(%s) flags(%d)\n",
width, height,
_tbm_surface_internal_format_to_str(format), flags);
/* LCOV_EXCL_STOP */
mgr = g_surface_bufmgr;
if (!TBM_BUFMGR_IS_VALID(mgr)) {
- TBM_LOG_E("fail to validate the Bufmgr.\n");
+ TBM_ERR("fail to validate the Bufmgr.\n");
goto check_valid_fail;
}
surf = calloc(1, sizeof(struct _tbm_surface));
if (!surf) {
/* LCOV_EXCL_START */
- TBM_LOG_E("fail to allocate struct _tbm_surface.\n");
+ TBM_ERR("fail to allocate struct _tbm_surface.\n");
goto alloc_surf_fail;
/* LCOV_EXCL_STOP */
}
surf->num_bos = num;
for (i = 0; i < num; i++) {
if (bos[i] == NULL) {
- TBM_LOG_E("bos[%d] is null.\n", i);
+ TBM_ERR("bos[%d] is null.\n", i);
goto check_bo_fail;
}
_tbm_bo_set_surface(bos[i], surf);
}
- TBM_TRACE("tbm_surface(%p) width(%u) height(%u) format(%s) bo_num(%d)\n", surf,
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) width(%u) height(%u) format(%s) bo_num(%d)\n", surf,
info->width, info->height, _tbm_surface_internal_format_to_str(info->format), num);
LIST_INITHEAD(&surf->user_data_list);
}
_tbm_surface_mutex_unlock();
- TBM_LOG_E("error: width(%u) height(%u) format(%s) bo_num(%d)\n",
+ TBM_ERR("error: width(%u) height(%u) format(%s) bo_num(%d)\n",
info->width, info->height,
_tbm_surface_internal_format_to_str(info->format), num);
/* LCOV_EXCL_STOP */
surface->refcnt--;
if (surface->refcnt > 0) {
- TBM_TRACE("reduce a refcnt(%d) of tbm_surface(%p)\n", surface->refcnt, surface);
+ TBM_TRACE_SURFACE_INTERNAL("reduce a refcnt(%d) of tbm_surface(%p)\n", surface->refcnt, surface);
_tbm_surface_mutex_unlock();
return;
}
- TBM_TRACE("destroy tbm_surface(%p) refcnt(%d)\n", surface, surface->refcnt);
+ TBM_TRACE_SURFACE_INTERNAL("destroy tbm_surface(%p) refcnt(%d)\n", surface, surface->refcnt);
if (surface->refcnt == 0)
_tbm_surface_internal_destroy(surface);
surface->refcnt++;
- TBM_TRACE("tbm_surface(%p) refcnt(%d)\n", surface, surface->refcnt);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) refcnt(%d)\n", surface, surface->refcnt);
_tbm_surface_mutex_unlock();
}
surface->refcnt--;
if (surface->refcnt > 0) {
- TBM_TRACE("reduce a refcnt(%d) of tbm_surface(%p)\n", surface->refcnt, surface);
+ TBM_TRACE_SURFACE_INTERNAL("reduce a refcnt(%d) of tbm_surface(%p)\n", surface->refcnt, surface);
_tbm_surface_mutex_unlock();
return;
}
- TBM_TRACE("destroy tbm_surface(%p) refcnt(%d)\n", surface, surface->refcnt);
+ TBM_TRACE_SURFACE_INTERNAL("destroy tbm_surface(%p) refcnt(%d)\n", surface, surface->refcnt);
if (surface->refcnt == 0)
_tbm_surface_internal_destroy(surface);
surf = (struct _tbm_surface *)surface;
num = surf->num_bos;
- TBM_TRACE("tbm_surface(%p) num_bos(%d)\n", surface, num);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) num_bos(%d)\n", surface, num);
_tbm_surface_mutex_unlock();
surf = (struct _tbm_surface *)surface;
bo = surf->bos[bo_idx];
- TBM_TRACE("tbm_surface(%p) bo_idx(%d) tbm_bo(%p)\n", surface, bo_idx, bo);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) bo_idx(%d) tbm_bo(%p)\n", surface, bo_idx, bo);
_tbm_surface_mutex_unlock();
surf = (struct _tbm_surface *)surface;
size = surf->info.size;
- TBM_TRACE("tbm_surface(%p) size(%u)\n", surface, size);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) size(%u)\n", surface, size);
_tbm_surface_mutex_unlock();
surf = (struct _tbm_surface *)surface;
if (plane_idx >= surf->info.num_planes) {
- TBM_TRACE("error: tbm_surface(%p) plane_idx(%d)\n", surface, plane_idx);
+ TBM_TRACE_SURFACE_INTERNAL("error: tbm_surface(%p) plane_idx(%d)\n", surface, plane_idx);
_tbm_surface_mutex_unlock();
return 0;
}
if (pitch)
*pitch = surf->info.planes[plane_idx].stride;
- TBM_TRACE("tbm_surface(%p) plane_idx(%d) size(%u) offset(%u) pitch(%u)\n", surface, plane_idx,
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) plane_idx(%d) size(%u) offset(%u) pitch(%u)\n", surface, plane_idx,
surf->info.planes[plane_idx].size, surf->info.planes[plane_idx].offset,
surf->info.planes[plane_idx].stride);
for (j = 0; j < i; j++)
tbm_bo_unmap(bos[j]);
- TBM_LOG_E("error: tbm_surface(%p) opt(%d) map(%d)\n", surface, opt, map);
+ TBM_ERR("error: tbm_surface(%p) opt(%d) map(%d)\n", surface, opt, map);
return 0;
}
}
for (i = 0; i < num_bos; i++) {
bo_handles[i] = tbm_bo_get_handle(bos[i], TBM_DEVICE_CPU);
if (bo_handles[i].ptr == NULL) {
- TBM_LOG_E("error: tbm_surface(%p) opt(%d) map(%d)\n", surface, opt, map);
+ TBM_ERR("error: tbm_surface(%p) opt(%d) map(%d)\n", surface, opt, map);
_tbm_surface_mutex_unlock();
return 0;
}
info->planes[i].ptr = bo_handles[planes_bo_idx[i]].ptr + info->planes[i].offset;
}
- TBM_TRACE("tbm_surface(%p) opt(%d) map(%d)\n", surface, opt, map);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) opt(%d) map(%d)\n", surface, opt, map);
_tbm_surface_mutex_unlock();
for (i = 0; i < surf->num_bos; i++)
tbm_bo_unmap(surf->bos[i]);
- TBM_TRACE("tbm_surface(%p)\n", surface);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p)\n", surface);
_tbm_surface_mutex_unlock();
}
surf = (struct _tbm_surface *)surface;
width = surf->info.width;
- TBM_TRACE("tbm_surface(%p) width(%u)\n", surface, width);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) width(%u)\n", surface, width);
_tbm_surface_mutex_unlock();
surf = (struct _tbm_surface *)surface;
height = surf->info.height;
- TBM_TRACE("tbm_surface(%p) height(%u)\n", surface, height);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) height(%u)\n", surface, height);
_tbm_surface_mutex_unlock();
surf = (struct _tbm_surface *)surface;
format = surf->info.format;
- TBM_TRACE("tbm_surface(%p) format(%s)\n", surface, _tbm_surface_internal_format_to_str(format));
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) format(%s)\n", surface, _tbm_surface_internal_format_to_str(format));
_tbm_surface_mutex_unlock();
surf = (struct _tbm_surface *)surface;
bo_idx = surf->planes_bo_idx[plane_idx];
- TBM_TRACE("tbm_surface(%p) plane_idx(%d) bo_idx(%d)\n", surface, plane_idx, bo_idx);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) plane_idx(%d) bo_idx(%d)\n", surface, plane_idx, bo_idx);
_tbm_surface_mutex_unlock();
/* check if the data according to the key exist if so, return false. */
data = user_data_lookup(&surface->user_data_list, key);
if (data) {
- TBM_TRACE("warning: user data already exist tbm_surface(%p) key(%lu)\n", surface, key);
+ TBM_TRACE_SURFACE_INTERNAL("warning: user data already exist tbm_surface(%p) key(%lu)\n", surface, key);
_tbm_surface_mutex_unlock();
return 0;
}
data = user_data_create(key, data_free_func);
if (!data) {
- TBM_TRACE("error: tbm_surface(%p) key(%lu)\n", surface, key);
+ TBM_TRACE_SURFACE_INTERNAL("error: tbm_surface(%p) key(%lu)\n", surface, key);
_tbm_surface_mutex_unlock();
return 0;
}
- TBM_TRACE("tbm_surface(%p) key(%lu) data(%p)\n", surface, key, data);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) key(%lu) data(%p)\n", surface, key, data);
LIST_ADD(&data->item_link, &surface->user_data_list);
old_data = user_data_lookup(&surface->user_data_list, key);
if (!old_data) {
- TBM_TRACE("error: tbm_surface(%p) key(%lu)\n", surface, key);
+ TBM_TRACE_SURFACE_INTERNAL("error: tbm_surface(%p) key(%lu)\n", surface, key);
_tbm_surface_mutex_unlock();
return 0;
}
old_data->data = data;
- TBM_TRACE("tbm_surface(%p) key(%lu) data(%p)\n", surface, key, old_data->data);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) key(%lu) data(%p)\n", surface, key, old_data->data);
_tbm_surface_mutex_unlock();
TBM_SURFACE_RETURN_VAL_IF_FAIL(_tbm_surface_internal_is_valid(surface), 0);
if (!data) {
- TBM_LOG_E("error: tbm_surface(%p) key(%lu)\n", surface, key);
+ TBM_ERR("error: tbm_surface(%p) key(%lu)\n", surface, key);
_tbm_surface_mutex_unlock();
return 0;
}
old_data = user_data_lookup(&surface->user_data_list, key);
if (!old_data) {
- TBM_TRACE("error: tbm_surface(%p) key(%lu)\n", surface, key);
+ TBM_TRACE_SURFACE_INTERNAL("error: tbm_surface(%p) key(%lu)\n", surface, key);
_tbm_surface_mutex_unlock();
return 0;
}
*data = old_data->data;
- TBM_TRACE("tbm_surface(%p) key(%lu) data(%p)\n", surface, key, old_data->data);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) key(%lu) data(%p)\n", surface, key, old_data->data);
_tbm_surface_mutex_unlock();
old_data = user_data_lookup(&surface->user_data_list, key);
if (!old_data) {
- TBM_TRACE("error: tbm_surface(%p) key(%lu)\n", surface, key);
+ TBM_TRACE_SURFACE_INTERNAL("error: tbm_surface(%p) key(%lu)\n", surface, key);
_tbm_surface_mutex_unlock();
return 0;
}
- TBM_TRACE("tbm_surface(%p) key(%lu) data(%p)\n", surface, key, old_data->data);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) key(%lu) data(%p)\n", surface, key, old_data->data);
user_data_delete(old_data);
if (old_data) {
if (!strcmp(old_data->key, key)) {
if (old_data->value && value && !strncmp(old_data->value, value, strlen(old_data->value))) {
- TBM_TRACE("tbm_surface(%p) Already exist key(%s) and value(%s)!\n", surface, key, value);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) Already exist key(%s) and value(%s)!\n", surface, key, value);
goto add_debug_key_list;
}
debug_data = _tbm_surface_internal_debug_data_create(key, value);
if (!debug_data) {
- TBM_LOG_E("error: tbm_surface(%p) key(%s) value(%s)\n", surface, key, value);
+ TBM_ERR("error: tbm_surface(%p) key(%s) value(%s)\n", surface, key, value);
_tbm_surface_mutex_unlock();
return 0;
}
- TBM_TRACE("tbm_surface(%p) key(%s) value(%s)\n", surface, key, value);
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) key(%s) value(%s)\n", surface, key, value);
LIST_ADD(&debug_data->item_link, &surface->debug_data_list);
unsigned int *blocks;
if (_tbm_surface_check_file_is_symbolic_link(file))
- TBM_LOG_E("%s is symbolic link\n", file);
+ TBM_ERR("%s is symbolic link\n", file);
fp = fopen(file, "w+");
TBM_RETURN_IF_FAIL(fp != NULL);
int depth = 8, y;
if (_tbm_surface_check_file_is_symbolic_link(file))
- TBM_LOG_E("%s is symbolic link\n", file);
+ TBM_ERR("%s is symbolic link\n", file);
fp = fopen(file, "wb");
TBM_RETURN_IF_FAIL(fp != NULL);
png_structp pPngStruct = png_create_write_struct(PNG_LIBPNG_VER_STRING,
NULL, NULL, NULL);
if (!pPngStruct) {
- TBM_LOG_E("fail to create a png write structure.\n");
+ TBM_ERR("fail to create a png write structure.\n");
fclose(fp);
return;
}
png_infop pPngInfo = png_create_info_struct(pPngStruct);
if (!pPngInfo) {
- TBM_LOG_E("fail to create a png info structure.\n");
+ TBM_ERR("fail to create a png info structure.\n");
png_destroy_write_struct(&pPngStruct, NULL);
fclose(fp);
return;
row_pointers = png_malloc(pPngStruct, height * sizeof(png_byte *));
if (!row_pointers) {
- TBM_LOG_E("fail to allocate the png row_pointers.\n");
+ TBM_ERR("fail to allocate the png row_pointers.\n");
png_destroy_write_struct(&pPngStruct, &pPngInfo);
fclose(fp);
return;
row = png_malloc(pPngStruct, sizeof(png_byte) * width * pixel_size);
if (!row) {
- TBM_LOG_E("fail to allocate the png row.\n");
+ TBM_ERR("fail to allocate the png row.\n");
for (x = 0; x < y; x++)
png_free(pPngStruct, row_pointers[x]);
png_free(pPngStruct, row_pointers);
/* check running */
if (g_dump_info) {
- TBM_LOG_W("waring already running the tbm_surface_internal_dump.\n");
+ TBM_WRN("waring already running the tbm_surface_internal_dump.\n");
return;
}
/* get buffer size */
tbm_surface = tbm_surface_create(w, h, TBM_FORMAT_ARGB8888);
if (tbm_surface == NULL) {
- TBM_LOG_E("tbm_surface_create fail\n");
+ TBM_ERR("tbm_surface_create fail\n");
free(g_dump_info);
g_dump_info = NULL;
return;
}
if (TBM_SURFACE_ERROR_NONE != tbm_surface_get_info(tbm_surface, &info)) {
- TBM_LOG_E("tbm_surface_get_info fail\n");
+ TBM_ERR("tbm_surface_get_info fail\n");
tbm_surface_destroy(tbm_surface);
free(g_dump_info);
g_dump_info = NULL;
bo = tbm_bo_alloc(g_surface_bufmgr, buffer_size, TBM_BO_DEFAULT);
if (bo == NULL) {
- TBM_LOG_E("fail to allocate the tbm_bo[%d]\n", i);
+ TBM_ERR("fail to allocate the tbm_bo[%d]\n", i);
free(buf_info);
goto fail;
}
scale_factor = 0.0;
- TBM_LOG_I("Dump Start.. path:%s, count:%d\n", g_dump_info->path, count);
+ TBM_INFO("Dump Start.. path:%s, count:%d\n", g_dump_info->path, count);
return;
}
}
- TBM_LOG_E("Dump Start fail.. path:%s\n", g_dump_info->path);
+ TBM_ERR("Dump Start fail.. path:%s\n", g_dump_info->path);
free(g_dump_info);
g_dump_info = NULL;
}
snprintf(file, sizeof(file), "%s/%s", g_dump_info->path, buf_info->name);
- TBM_LOG_I("Dump File.. %s generated.\n", file);
+ TBM_INFO("Dump File.. %s generated.\n", file);
if (buf_info->dirty) {
void *ptr1 = NULL, *ptr2 = NULL;
NULL, 0, NULL, 0);
break;
default:
- TBM_LOG_E("can't dump %c%c%c%c buffer", FOURCC_STR(buf_info->info.format));
+ TBM_ERR("can't dump %c%c%c%c buffer", FOURCC_STR(buf_info->info.format));
break;
}
} else if (buf_info->dirty_shm)
free(g_dump_info);
g_dump_info = NULL;
- TBM_LOG_I("Dump End..\n");
+ TBM_INFO("Dump End..\n");
}
static pixman_format_code_t
keys = calloc(KEYS_LEN + 1, sizeof(char));
if (!keys) {
- TBM_LOG_E("Failed to alloc memory");
+ TBM_ERR("Failed to alloc memory");
_tbm_surface_mutex_unlock();
return NULL;
}
const int bpp = 4;
if (info.format != TBM_FORMAT_ARGB8888 && info.format != TBM_FORMAT_XRGB8888) {
- TBM_LOG_W("Dump with scale skip. unsupported format(%s)\n",
+ TBM_WRN("Dump with scale skip. unsupported format(%s)\n",
_tbm_surface_internal_format_to_str(info.format));
tbm_surface_unmap(surface);
return;
buf_info->info.size = buf_info->info.width * buf_info->info.height * bpp;
if (buf_info->info.size > buf_info->size) {
- TBM_LOG_W("Dump with scale skip. surface over created buffer size(%u, %d)\n",
+ TBM_WRN("Dump with scale skip. surface over created buffer size(%u, %d)\n",
buf_info->info.size, buf_info->size);
tbm_surface_unmap(surface);
return;
}
} else {
if (info.size > buf_info->size) {
- TBM_LOG_W("Dump skip. surface over created buffer size(%u, %d)\n",
+ TBM_WRN("Dump skip. surface over created buffer size(%u, %d)\n",
info.size, buf_info->size);
tbm_surface_unmap(surface);
return;
keys = _tbm_surface_internal_get_keys(surface);
if (!keys) {
- TBM_LOG_E("fail to get keys");
+ TBM_ERR("fail to get keys");
tbm_surface_unmap(surface);
return;
}
/* dump */
bo_handle = tbm_bo_map(buf_info->bo, TBM_DEVICE_CPU, TBM_OPTION_WRITE);
if (!bo_handle.ptr) {
- TBM_LOG_E("fail to map bo");
+ TBM_ERR("fail to map bo");
_tbm_surface_internal_put_keys(keys);
tbm_surface_unmap(surface);
return;
buf_info->info.width,
buf_info->info.height);
if (ret != TBM_SURFACE_ERROR_NONE) {
- TBM_LOG_E("fail to scale buffer");
+ TBM_ERR("fail to scale buffer");
tbm_bo_unmap(buf_info->bo);
_tbm_surface_internal_put_keys(keys);
tbm_surface_unmap(surface);
memcpy(bo_handle.ptr, info.planes[0].ptr, info.planes[0].stride * info.height);
break;
default:
- TBM_LOG_E("can't copy %c%c%c%c buffer", FOURCC_STR(info.format));
+ TBM_ERR("can't copy %c%c%c%c buffer", FOURCC_STR(info.format));
tbm_bo_unmap(buf_info->bo);
_tbm_surface_internal_put_keys(keys);
tbm_surface_unmap(surface);
g_dump_info->link = next_link;
- TBM_LOG_I("Dump %s \n", buf_info->name);
+ TBM_INFO("Dump %s \n", buf_info->name);
}
void tbm_surface_internal_dump_shm_buffer(void *ptr, int w, int h, int stride,
size = stride * h;
if (size > buf_info->size) {
- TBM_LOG_W("Dump skip. shm buffer over created buffer size(%d, %d)\n",
+ TBM_WRN("Dump skip. shm buffer over created buffer size(%d, %d)\n",
size, buf_info->size);
return;
}
TBM_FORMAT_ARGB8888, stride,
w, h, dstride, dw, dh);
if (ret != TBM_SURFACE_ERROR_NONE) {
- TBM_LOG_E("fail to scale buffer");
+ TBM_ERR("fail to scale buffer");
tbm_bo_unmap(buf_info->bo);
return;
}
g_dump_info->link = next_link;
- TBM_LOG_I("Dump %s \n", buf_info->name);
+ TBM_INFO("Dump %s \n", buf_info->name);
}
int
postfix = dump_postfix[1];
if (strcmp(postfix, type)) {
- TBM_LOG_E("not support type(%s) %c%c%c%c buffer", type, FOURCC_STR(info.format));
+ TBM_ERR("not support type(%s) %c%c%c%c buffer", type, FOURCC_STR(info.format));
tbm_surface_unmap(surface);
return 0;
}
snprintf(file, sizeof(file), "%s/%s.%s", path , name, postfix);
if (!access(file, 0)) {
- TBM_LOG_E("can't capture buffer, exist file %s", file);
+ TBM_ERR("can't capture buffer, exist file %s", file);
tbm_surface_unmap(surface);
return 0;
}
NULL, 0, NULL, 0);
break;
default:
- TBM_LOG_E("can't dump %c%c%c%c buffer", FOURCC_STR(info.format));
+ TBM_ERR("can't dump %c%c%c%c buffer", FOURCC_STR(info.format));
tbm_surface_unmap(surface);
return 0;
}
tbm_surface_unmap(surface);
- TBM_TRACE("Capture %s \n", file);
+ TBM_TRACE_SURFACE_INTERNAL("Capture %s \n", file);
return 1;
}
char file[1024];
if (strcmp(dump_postfix[0], type)) {
- TBM_LOG_E("Not supported type:%s'", type);
+ TBM_ERR("Not supported type:%s'", type);
return 0;
}
snprintf(file, sizeof(file), "%s/%s.%s", path , name, dump_postfix[0]);
if (!access(file, 0)) {
- TBM_LOG_E("can't capture buffer, exist file %sTBM_FORMAT_XRGB8888", file);
+ TBM_ERR("can't capture buffer, exist file %sTBM_FORMAT_XRGB8888", file);
return 0;
}
_tbm_surface_internal_dump_file_png(file, ptr, w, h, 0);
- TBM_TRACE("Capture %s \n", file);
+ TBM_TRACE_SURFACE_INTERNAL("Capture %s \n", file);
return 1;
}
#define DIRTY_QUEUE 2
#define NODE_LIST 4
-#define TBM_QUEUE_DEBUG 0
-
-#ifdef TRACE
-#define TBM_QUEUE_TRACE(fmt, ...) { if (bTrace&0x1) fprintf(stderr, "[TBM:TRACE(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__); }
-#else
-#define TBM_QUEUE_TRACE(fmt, ...)
-#endif /* TRACE */
-
-#if TBM_QUEUE_DEBUG
-#define TBM_LOCK() TBM_LOG_D("[LOCK] %s:%d surface:%p\n", __func__, __LINE__, surface_queue)
-#define TBM_UNLOCK() TBM_LOG_D("[UNLOCK] %s:%d surface:%p\n", __func__, __LINE__, surface_queue)
-#else
-#define TBM_LOCK()
-#define TBM_UNLOCK()
-#endif
-
static tbm_bufmgr g_surf_queue_bufmgr;
static pthread_mutex_t tbm_surf_queue_lock;
void _tbm_surface_queue_mutex_unlock(void);
/* check condition */
#define TBM_SURF_QUEUE_RETURN_IF_FAIL(cond) {\
if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.\n", #cond);\
_tbm_surf_queue_mutex_unlock();\
return;\
} \
#define TBM_SURF_QUEUE_RETURN_VAL_IF_FAIL(cond, val) {\
if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
+ TBM_ERR("'%s' failed.\n", #cond);\
_tbm_surf_queue_mutex_unlock();\
return val;\
} \
return true;
if (pthread_mutex_init(&tbm_surf_queue_lock, NULL)) {
- TBM_LOG_E("fail: pthread_mutex_init\n");
+ TBM_ERR("fail: pthread_mutex_init\n");
return false;
}
_tbm_surf_queue_mutex_lock(void)
{
if (!_tbm_surf_queue_mutex_init()) {
- TBM_LOG_E("fail: _tbm_surf_queue_mutex_init\n");
+ TBM_ERR("fail: _tbm_surf_queue_mutex_init\n");
return;
}
tbm_surface_queue_h old_data = NULL;
if (surface_queue == NULL) {
- TBM_LOG_E("error: surface_queue is NULL.\n");
+ TBM_ERR("error: surface_queue is NULL.\n");
return 0;
}
if (g_surf_queue_bufmgr == NULL) {
- TBM_LOG_E("error: g_surf_queue_bufmgr is NULL.\n");
+ TBM_ERR("error: g_surf_queue_bufmgr is NULL.\n");
return 0;
}
if (LIST_IS_EMPTY(&g_surf_queue_bufmgr->surf_queue_list)) {
- TBM_LOG_E("error: surf_queue_list is empty\n");
+ TBM_ERR("error: surf_queue_list is empty\n");
return 0;
}
LIST_FOR_EACH_ENTRY(old_data, &g_surf_queue_bufmgr->surf_queue_list,
item_link) {
if (old_data == surface_queue) {
- TBM_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
return 1;
}
}
- TBM_LOG_E("error: Invalid tbm_surface_queue(%p)\n", surface_queue);
+ TBM_ERR("error: Invalid tbm_surface_queue(%p)\n", surface_queue);
return 0;
}
}
}
- TBM_LOG_E("fail to get the queue_node.\n");
+ TBM_ERR("fail to get the queue_node.\n");
return NULL;
}
}
}
- TBM_LOG_E("Cannot find notifiy\n");
+ TBM_ERR("Cannot find notifiy\n");
}
static void
}
}
- TBM_LOG_E("Cannot find notifiy\n");
+ TBM_ERR("Cannot find notifiy\n");
}
static void
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_notify_add(&surface_queue->destory_noti, destroy_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_notify_remove(&surface_queue->destory_noti, destroy_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_notify_add(&surface_queue->dequeuable_noti, dequeuable_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_notify_remove(&surface_queue->dequeuable_noti, dequeuable_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_notify_add(&surface_queue->dequeue_noti, dequeue_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_notify_remove(&surface_queue->dequeue_noti, dequeue_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_notify_add(&surface_queue->can_dequeue_noti, can_dequeue_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_notify_remove(&surface_queue->can_dequeue_noti, can_dequeue_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_notify_add(&surface_queue->acquirable_noti, acquirable_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_notify_remove(&surface_queue->acquirable_noti, acquirable_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_trace_add(&surface_queue->trace_noti, trace_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_trace_remove(&surface_queue->trace_noti, trace_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
surface_queue->alloc_cb = alloc_cb;
surface_queue->free_cb = free_cb;
TBM_SURF_QUEUE_RETURN_VAL_IF_FAIL(_tbm_surface_queue_is_valid(surface_queue), 0);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
width = surface_queue->width;
TBM_SURF_QUEUE_RETURN_VAL_IF_FAIL(_tbm_surface_queue_is_valid(surface_queue), 0);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
height = surface_queue->height;
TBM_SURF_QUEUE_RETURN_VAL_IF_FAIL(_tbm_surface_queue_is_valid(surface_queue), 0);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
format = surface_queue->format;
TBM_SURF_QUEUE_RETURN_VAL_IF_FAIL(_tbm_surface_queue_is_valid(surface_queue), 0);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
queue_size = surface_queue->queue_size;
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_notify_add(&surface_queue->reset_noti, reset_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
_notify_remove(&surface_queue->reset_noti, reset_cb, data);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, surface);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, surface);
node = _queue_get_node(surface_queue, 0, surface, &queue_type);
if (node == NULL || queue_type != NODE_LIST) {
- TBM_LOG_E("tbm_surface_queue_enqueue::Surface is existed in free_queue or dirty_queue node:%p, type:%d\n",
+ TBM_ERR("tbm_surface_queue_enqueue::Surface is existed in free_queue or dirty_queue node:%p, type:%d\n",
node, queue_type);
pthread_mutex_unlock(&surface_queue->lock);
_tbm_surface_queue_enqueue(surface_queue, node, 1);
if (!_queue_get_node(surface_queue, DIRTY_QUEUE, surface, NULL)) {
- TBM_LOG_E("enqueue surface(%p) but surface isn't present in the dirty_queue\n", surface);
+ TBM_ERR("enqueue surface(%p) but surface isn't present in the dirty_queue\n", surface);
pthread_mutex_unlock(&surface_queue->lock);
_tbm_surf_queue_mutex_unlock();
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, surface);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, surface);
node = _queue_get_node(surface_queue, 0, surface, &queue_type);
if (node == NULL || queue_type != NODE_LIST) {
- TBM_LOG_E("tbm_surface_queue_cancel_dequeue::Surface is existed in free_queue or dirty_queue node:%p, type:%d\n",
+ TBM_ERR("tbm_surface_queue_cancel_dequeue::Surface is existed in free_queue or dirty_queue node:%p, type:%d\n",
node, queue_type);
pthread_mutex_unlock(&surface_queue->lock);
}
if (node->delete_pending) {
- TBM_QUEUE_TRACE("delete pending tbm_surface_queue(%p) surface(%p)\n", surface_queue, node->surface);
+ TBM_TRACE_SURFACE_QUEUE("delete pending tbm_surface_queue(%p) surface(%p)\n", surface_queue, node->surface);
_queue_delete_node(surface_queue, node);
}
if (surface_queue->queue_size < surface_queue->num_attached) {
- TBM_QUEUE_TRACE("deatch tbm_surface_queue(%p) surface(%p)\n", surface_queue, node->surface);
+ TBM_TRACE_SURFACE_QUEUE("deatch tbm_surface_queue(%p) surface(%p)\n", surface_queue, node->surface);
if (surface_queue->impl && surface_queue->impl->need_detach)
surface_queue->impl->need_detach(surface_queue, node);
if (_queue_is_empty(&surface_queue->free_queue)) {
pthread_mutex_unlock(&surface_queue->lock);
- TBM_LOG_E("surface_queue->free_queue is empty.\n");
+ TBM_ERR("surface_queue->free_queue is empty.\n");
_tbm_surf_queue_mutex_unlock();
return TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE;
}
surface_queue->impl->need_attach(surface_queue);
if (!_tbm_surface_queue_is_valid(surface_queue)) {
- TBM_LOG_E("surface_queue:%p is invalid", surface_queue);
+ TBM_ERR("surface_queue:%p is invalid", surface_queue);
pthread_mutex_unlock(&surface_queue->lock);
_tbm_surf_queue_mutex_unlock();
return TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE;
node = _tbm_surface_queue_dequeue(surface_queue);
if (node == NULL || node->surface == NULL) {
- TBM_LOG_E("_queue_node_pop_front failed\n");
+ TBM_ERR("_queue_node_pop_front failed\n");
pthread_mutex_unlock(&surface_queue->lock);
_tbm_surf_queue_mutex_unlock();
node->type = QUEUE_NODE_TYPE_DEQUEUE;
*surface = node->surface;
- TBM_QUEUE_TRACE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, *surface);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, *surface);
pthread_mutex_unlock(&surface_queue->lock);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
if (_queue_is_empty(&surface_queue->free_queue)) {
if (surface_queue->impl && surface_queue->impl->need_attach)
surface_queue->impl->need_attach(surface_queue);
if (!_tbm_surface_queue_is_valid(surface_queue)) {
- TBM_LOG_E("surface_queue:%p is invalid", surface_queue);
+ TBM_ERR("surface_queue:%p is invalid", surface_queue);
pthread_mutex_unlock(&surface_queue->lock);
_tbm_surf_queue_mutex_unlock();
return 0;
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, surface);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, surface);
node = _queue_get_node(surface_queue, 0, surface, &queue_type);
if (node == NULL || queue_type != NODE_LIST) {
- TBM_LOG_E("tbm_surface_queue_release::Surface is existed in free_queue or dirty_queue node:%p, type:%d\n",
+ TBM_ERR("tbm_surface_queue_release::Surface is existed in free_queue or dirty_queue node:%p, type:%d\n",
node, queue_type);
pthread_mutex_unlock(&surface_queue->lock);
}
if (node->delete_pending) {
- TBM_QUEUE_TRACE("delete pending tbm_surface_queue(%p) surface(%p)\n", surface_queue, node->surface);
+ TBM_TRACE_SURFACE_QUEUE("delete pending tbm_surface_queue(%p) surface(%p)\n", surface_queue, node->surface);
_queue_delete_node(surface_queue, node);
}
if (surface_queue->queue_size < surface_queue->num_attached) {
- TBM_QUEUE_TRACE("deatch tbm_surface_queue(%p) surface(%p)\n", surface_queue, node->surface);
+ TBM_TRACE_SURFACE_QUEUE("deatch tbm_surface_queue(%p) surface(%p)\n", surface_queue, node->surface);
if (surface_queue->impl && surface_queue->impl->need_detach)
surface_queue->impl->need_detach(surface_queue, node);
_tbm_surface_queue_release(surface_queue, node, 1);
if (!_queue_get_node(surface_queue, FREE_QUEUE, surface, NULL)) {
- TBM_LOG_E("release surface(%p) but surface isn't present in the free_queue\n", surface);
+ TBM_ERR("release surface(%p) but surface isn't present in the free_queue\n", surface);
pthread_mutex_unlock(&surface_queue->lock);
_tbm_surf_queue_mutex_unlock();
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, surface);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, surface);
node = _queue_get_node(surface_queue, 0, surface, &queue_type);
if (node == NULL || queue_type != NODE_LIST) {
- TBM_LOG_E("tbm_surface_queue_cancel_acquire::Surface is existed in free_queue or dirty_queue node:%p, type:%d\n",
+ TBM_ERR("tbm_surface_queue_cancel_acquire::Surface is existed in free_queue or dirty_queue node:%p, type:%d\n",
node, queue_type);
pthread_mutex_unlock(&surface_queue->lock);
_tbm_surface_queue_enqueue(surface_queue, node, 1);
if (_queue_is_empty(&surface_queue->dirty_queue)) {
- TBM_LOG_E("enqueue surface but queue is empty node:%p\n", node);
+ TBM_ERR("enqueue surface but queue is empty node:%p\n", node);
pthread_mutex_unlock(&surface_queue->lock);
_tbm_surf_queue_mutex_unlock();
node = _tbm_surface_queue_acquire(surface_queue);
if (node == NULL || node->surface == NULL) {
- TBM_LOG_E("_queue_node_pop_front failed\n");
+ TBM_ERR("_queue_node_pop_front failed\n");
pthread_mutex_unlock(&surface_queue->lock);
_tbm_surf_queue_mutex_unlock();
tbm_surface_info_s info;
int ret;
- TBM_LOG_E("start map surface:%p", *surface);
+ TBM_ERR("start map surface:%p", *surface);
ret = tbm_surface_map(*surface, TBM_SURF_OPTION_READ, &info);
- TBM_LOG_E("end map surface:%p", *surface);
+ TBM_ERR("end map surface:%p", *surface);
if (ret == TBM_SURFACE_ERROR_NONE)
tbm_surface_unmap(*surface);
}
if (surface_queue->acquire_sync_count > 0) surface_queue->acquire_sync_count--;
- TBM_QUEUE_TRACE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, *surface);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, *surface);
pthread_mutex_unlock(&surface_queue->lock);
pthread_mutex_lock(&surface_queue->lock);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
if (!_queue_is_empty(&surface_queue->dirty_queue)) {
pthread_mutex_unlock(&surface_queue->lock);
TBM_SURF_QUEUE_RETURN_IF_FAIL(_tbm_surface_queue_is_valid(surface_queue));
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
LIST_DEL(&surface_queue->item_link);
TBM_SURF_QUEUE_RETURN_VAL_IF_FAIL(_tbm_surface_queue_is_valid(surface_queue),
TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
if (width == surface_queue->width && height == surface_queue->height &&
format == surface_queue->format) {
TBM_SURF_QUEUE_RETURN_VAL_IF_FAIL(queue_size > 0,
TBM_SURFACE_QUEUE_ERROR_INVALID_PARAMETER);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
if ((surface_queue->queue_size == queue_size) && !flush) {
_tbm_surf_queue_mutex_unlock();
int need_del = surface_queue->queue_size - queue_size;
LIST_FOR_EACH_ENTRY_SAFE(node, tmp, &surface_queue->free_queue.head, item_link) {
- TBM_QUEUE_TRACE("deatch tbm_surface_queue(%p) surface(%p)\n", surface_queue, node->surface);
+ TBM_TRACE_SURFACE_QUEUE("deatch tbm_surface_queue(%p) surface(%p)\n", surface_queue, node->surface);
if (surface_queue->impl && surface_queue->impl->need_detach)
surface_queue->impl->need_detach(surface_queue, node);
TBM_SURF_QUEUE_RETURN_VAL_IF_FAIL(_tbm_surface_queue_is_valid(surface_queue),
TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
if (surface_queue->num_attached == 0) {
_tbm_surf_queue_mutex_unlock();
TBM_SURF_QUEUE_RETURN_VAL_IF_FAIL(_tbm_surface_queue_is_valid(surface_queue),
TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
if (surface_queue->num_attached == 0) {
_tbm_surf_queue_mutex_unlock();
sizeof(struct _tbm_surface_queue));
TBM_SURF_QUEUE_RETURN_VAL_IF_FAIL(surface_queue != NULL, NULL);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
tbm_queue_default *data = (tbm_queue_default *) calloc(1,
sizeof(tbm_queue_default));
if (data == NULL) {
- TBM_LOG_E("cannot allocate the tbm_queue_default.\n");
+ TBM_ERR("cannot allocate the tbm_queue_default.\n");
free(surface_queue);
_tbm_surf_queue_mutex_unlock();
return NULL;
sizeof(struct _tbm_surface_queue));
TBM_SURF_QUEUE_RETURN_VAL_IF_FAIL(surface_queue != NULL, NULL);
- TBM_QUEUE_TRACE("tbm_surface_queue(%p)\n", surface_queue);
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p)\n", surface_queue);
tbm_queue_sequence *data = (tbm_queue_sequence *) calloc(1,
sizeof(tbm_queue_sequence));
if (data == NULL) {
- TBM_LOG_E("cannot allocate the tbm_queue_sequence.\n");
+ TBM_ERR("cannot allocate the tbm_queue_sequence.\n");
free(surface_queue);
_tbm_surf_queue_mutex_unlock();
return NULL;
else
surface_queue->enqueue_sync_count = dequeue_num + sync_count;
- TBM_QUEUE_TRACE("tbm_surface_queue(%p) enqueue_sync_count:(%d) acquire_sync_count:(%d)\n",
+ TBM_TRACE_SURFACE_QUEUE("tbm_surface_queue(%p) enqueue_sync_count:(%d) acquire_sync_count:(%d)\n",
surface_queue, surface_queue->enqueue_sync_count, surface_queue->acquire_sync_count);
pthread_mutex_unlock(&surface_queue->lock);
char buf[ERRNO_BUF_SIZE];
if (strerror_r(errnum, buf, ERRNO_BUF_SIZE) == 0) {
- TBM_LOG_E("errno : %d(%s)\n", errnum, buf);
+ TBM_ERR("errno : %d(%s)\n", errnum, buf);
return;
} else {
- TBM_LOG_E("errno : %d()\n", errnum);
+ TBM_ERR("errno : %d()\n", errnum);
return;
}
}
*/
typedef void (*tbm_data_free) (void *user_data);
+/**
+ * @brief Enumeration of the trace log for debug
+ * @since_tizen 5.0
+ */
+typedef enum {
+ TBM_BUFGMR_DEBUG_TRACE_NONE = 0,
+ TBM_BUFGMR_DEBUG_TRACE_BO = (1 << 0),
+ TBM_BUFGMR_DEBUG_TRACE_SURFACE_INTERNAL = (1 << 1),
+ TBM_BUFGMR_DEBUG_TRACE_SURFACE = (1 << 2),
+ TBM_BUFGMR_DEBUG_TRACE_SURFACE_QUEUE = (1 << 3),
+} tbm_bufmgr_debug_trace_mask;
+
#endif /* _TBM_TYPE_INT_H_ */
ut_tbm_backend.cpp
tbm_utests_CXXFLAGS = \
+ @DLOG_CFLAGS@ \
${CXXFLAGS} \
-I$(top_builddir)/src \
-I$(includedir)/gtest
tbm_utests_LDFLAGS = \
+ @DLOG_LIBS@ \
${LDFLAGS} \
$(top_builddir)/src/libtbm.la \
-lgtest \
#include <pthread.h>
#include <gtest/gtest.h>
#include <stdlib.h>
-#include <tbm_bufmgr.h>
-#include <tbm_bo.h>
#include <tbm_bufmgr_int.h>
-#include <tbm_surface.h>
-#include <tbm_surface_internal.h>
-#include <tbm_surface_queue.h>
#include <wayland-server-protocol.h>
-#undef TBM_DBG
-#define TBM_DBG(fmt, args...) \
- TBM_LOG_D(fmt, ##args);
-#undef TBM_INFO
-#define TBM_INFO(fmt, args...) \
- TBM_LOG_I(fmt, ##args);
-#undef TBM_WRN
-#define TBM_WRN(fmt, args...) \
- TBM_LOG_W(fmt, ##args);
-#undef TBM_ERR
-#define TBM_ERR(fmt, args...) \
- TBM_LOG_E(fmt, ##args);
-
#define TBM_UT_ENTRY() \
TBM_INFO("--------------------------------------------- %s", typeid(*this).name())