#include <pthread.h>
#include <tbm_backend.h>
#include <tbm_drm_helper.h>
+#include <tbm_log.h>
#include <system_info.h>
#include "tbm_bufmgr_tgl.h"
-#define DEBUG
#define USE_DMAIMPORT
#define TBM_COLOR_FORMAT_COUNT 4
-#ifdef DEBUG
-#define LOG_TAG "TBM_BACKEND"
-#include <dlog.h>
-static int bDebug;
-
#define EXYNOS_DRM_NAME "exynos"
-char *target_name()
-{
- static char app_name[128] = {0, };
- static int initialized = 0;
- char *slash;
- FILE *f;
-
- if (initialized)
- return app_name;
-
- /* get the application name */
- f = fopen("/proc/self/cmdline", "r");
- if (!f)
- return NULL;
-
- memset(app_name, 0x00, sizeof(app_name));
-
- if (fgets(app_name, 100, f) == NULL) {
- fclose(f);
- return NULL;
- }
-
- fclose(f);
-
- slash = strrchr(app_name, '/');
- if (slash != NULL)
- memmove(app_name, slash + 1, strlen(slash));
-
- initialized = 1;
-
- return app_name;
-}
-
-#define TBM_EXYNOS_ERROR(fmt, args...) LOGE("\033[31m" "[%s] " fmt "\033[0m", target_name(), ##args)
-#define TBM_EXYNOS_DEBUG(fmt, args...) {if (bDebug&01) LOGD("[%s] " fmt, target_name(), ##args); }
-#else
-#define TBM_EXYNOS_ERROR(...)
-#define TBM_EXYNOS_DEBUG(...)
-#endif
-
#define STRERR_BUFSIZE 128
#define SIZE_ALIGN(value, base) (((value) + ((base) - 1)) & ~((base) - 1))
/* check condition */
#define EXYNOS_RETURN_IF_FAIL(cond) {\
if (!(cond)) {\
- TBM_EXYNOS_ERROR("[%s] : '%s' failed.\n", __func__, #cond);\
+ TBM_ERR("[%s] : '%s' failed.\n", __func__, #cond);\
return;\
} \
}
#define EXYNOS_RETURN_VAL_IF_FAIL(cond, val) {\
if (!(cond)) {\
- TBM_EXYNOS_ERROR("[%s] : '%s' failed.\n", __func__, #cond);\
+ TBM_ERR("[%s] : '%s' failed.\n", __func__, #cond);\
return val;\
} \
}
err = ioctl(fd, TGL_IOCTL_GET_VERSION, &data);
if (err) {
- TBM_EXYNOS_ERROR("error(%s) %s:%d\n",
+ TBM_ERR("error(%s) %s:%d\n",
strerror_r(errno, buf, STRERR_BUFSIZE));
return 0;
}
- TBM_EXYNOS_DEBUG("tgl version is (%u, %u).\n", data.major, data.minor);
+ TBM_DBG("tgl version is (%u, %u).\n", data.major, data.minor);
return 1;
}
err = ioctl(fd, TGL_IOCTL_REGISTER, &data);
if (err) {
- TBM_EXYNOS_ERROR("error(%s) key:%d\n",
+ TBM_ERR("error(%s) key:%d\n",
strerror_r(errno, buf, STRERR_BUFSIZE), key);
return 0;
}
data.key = key;
err = ioctl(fd, TGL_IOCTL_UNREGISTER, &data);
if (err) {
- TBM_EXYNOS_ERROR("error(%s) key:%d\n",
+ TBM_ERR("error(%s) key:%d\n",
strerror_r(errno, buf, STRERR_BUFSIZE), key);
return 0;
}
err = ioctl(fd, TGL_IOCTL_LOCK, &data);
if (err) {
- TBM_EXYNOS_ERROR("error(%s) key:%d opt:%d\n",
+ TBM_ERR("error(%s) key:%d opt:%d\n",
strerror_r(errno, buf, STRERR_BUFSIZE), key, opt);
return 0;
}
err = ioctl(fd, TGL_IOCTL_UNLOCK, &data);
if (err) {
- TBM_EXYNOS_ERROR("error(%s) key:%d\n",
+ TBM_ERR("error(%s) key:%d\n",
strerror_r(errno, buf, STRERR_BUFSIZE), key);
return 0;
}
err = ioctl(fd, TGL_IOCTL_SET_DATA, &data);
if (err) {
- TBM_EXYNOS_ERROR("error(%s) key:%d\n",
+ TBM_ERR("error(%s) key:%d\n",
strerror_r(errno, buf, STRERR_BUFSIZE), key);
return 0;
}
err = ioctl(fd, TGL_IOCTL_GET_DATA, &data);
if (err) {
- TBM_EXYNOS_ERROR("error(%s) key:%d\n",
+ TBM_ERR("error(%s) key:%d\n",
strerror_r(errno, buf, STRERR_BUFSIZE), key);
return 0;
}
ret = drmCommandWriteRead(bufmgr_exynos->fd, DRM_EXYNOS_GEM_CACHE_OP, &cache_op,
sizeof(cache_op));
if (ret) {
- TBM_EXYNOS_ERROR("fail to flush the cache.\n");
+ TBM_ERR("fail to flush the cache.\n");
return 0;
}
/* call cache flush */
_exynos_cache_flush(bufmgr_exynos, bo_exynos, need_flush);
- TBM_EXYNOS_DEBUG(" \tcache(%d,%d)....flush:0x%x, cntFlush(%d)\n",
+ TBM_DBG(" \tcache(%d,%d)....flush:0x%x, cntFlush(%d)\n",
bo_exynos->cache_state.data.isCached,
bo_exynos->cache_state.data.isDirtied,
need_flush,
if (bufmgr_exynos->tgl_fd < 0) {
bufmgr_exynos->tgl_fd = open(tgl_devfile1, O_RDWR);
if (bufmgr_exynos->tgl_fd < 0) {
- TBM_EXYNOS_ERROR("fail to open global_lock:%s\n",
+ TBM_ERR("fail to open global_lock:%s\n",
tgl_devfile1);
return 0;
}
#ifdef TGL_GET_VERSION
if (!_tgl_get_version(bufmgr_exynos->tgl_fd)) {
- TBM_EXYNOS_ERROR("fail to get tgl_version. tgl init failed.\n");
+ TBM_ERR("fail to get tgl_version. tgl init failed.\n");
close(bufmgr_exynos->tgl_fd);
return 0;
}
#endif
if (!_tgl_init(bufmgr_exynos->tgl_fd, GLOBAL_KEY)) {
- TBM_EXYNOS_ERROR("fail to initialize the tgl\n");
+ TBM_ERR("fail to initialize the tgl\n");
close(bufmgr_exynos->tgl_fd);
return 0;
}
fd = drmOpen(EXYNOS_DRM_NAME, NULL);
if (fd < 0) {
- TBM_EXYNOS_ERROR("fail to open drm.(%s)\n", EXYNOS_DRM_NAME);
+ TBM_ERR("fail to open drm.(%s)\n", EXYNOS_DRM_NAME);
}
if (fd < 0) {
struct stat s;
int ret;
- TBM_EXYNOS_DEBUG("search drm-device by udev\n");
+ TBM_DBG("search drm-device by udev\n");
udev = udev_new();
if (!udev) {
- TBM_EXYNOS_ERROR("udev_new() failed.\n");
+ TBM_ERR("udev_new() failed.\n");
return -1;
}
if (device_parent) {
if (strcmp(udev_device_get_sysname(device_parent), "exynos-drm") == 0) {
drm_device = device;
- TBM_EXYNOS_DEBUG("[%s] Found render device: '%s' (%s)\n",
- target_name(),
+ TBM_DBG("Found render device: '%s' (%s)\n",
udev_device_get_syspath(drm_device),
udev_device_get_sysname(device_parent));
break;
/* Get device file path. */
filepath = udev_device_get_devnode(drm_device);
if (!filepath) {
- TBM_EXYNOS_ERROR("udev_device_get_devnode() failed.\n");
+ TBM_ERR("udev_device_get_devnode() failed.\n");
udev_device_unref(drm_device);
udev_unref(udev);
return -1;
/* Open DRM device file and check validity. */
fd = open(filepath, O_RDWR | O_CLOEXEC);
if (fd < 0) {
- TBM_EXYNOS_ERROR("open(%s, O_RDWR | O_CLOEXEC) failed.\n");
+ TBM_ERR("open(%s, O_RDWR | O_CLOEXEC) failed.\n");
udev_device_unref(drm_device);
udev_unref(udev);
return -1;
ret = fstat(fd, &s);
if (ret) {
- TBM_EXYNOS_ERROR("fstat() failed %s.\n");
+ TBM_ERR("fstat() failed %s.\n");
close(fd);
udev_device_unref(drm_device);
udev_unref(udev);
udev = udev_new();
if (!udev) {
- TBM_EXYNOS_ERROR("udev_new() failed.\n");
+ TBM_ERR("udev_new() failed.\n");
return -1;
}
if (device_parent) {
if (strcmp(udev_device_get_sysname(device_parent), "exynos-drm") == 0) {
drm_device = device;
- TBM_EXYNOS_DEBUG("Found render device: '%s' (%s)\n",
+ TBM_DBG("Found render device: '%s' (%s)\n",
udev_device_get_syspath(drm_device),
udev_device_get_sysname(device_parent));
break;
udev = udev_new();
if (!udev) {
- TBM_EXYNOS_ERROR("udev_new() failed.\n");
+ TBM_ERR("udev_new() failed.\n");
return -1;
}
if (device_parent) {
if (strcmp(udev_device_get_sysname(device_parent), "exynos-drm") == 0) {
drm_device = device;
- TBM_EXYNOS_DEBUG("Found render device: '%s' (%s)\n",
+ TBM_DBG("Found render device: '%s' (%s)\n",
udev_device_get_syspath(drm_device),
udev_device_get_sysname(device_parent));
break;
/* Get device file path. */
filepath = udev_device_get_devnode(drm_device);
if (!filepath) {
- TBM_EXYNOS_ERROR("udev_device_get_devnode() failed.\n");
+ TBM_ERR("udev_device_get_devnode() failed.\n");
udev_device_unref(drm_device);
udev_unref(udev);
return -1;
/* Open DRM device file and check validity. */
fd = open(filepath, O_RDWR | O_CLOEXEC);
if (fd < 0) {
- TBM_EXYNOS_ERROR("open(%s, O_RDWR | O_CLOEXEC) failed.\n");
+ TBM_ERR("open(%s, O_RDWR | O_CLOEXEC) failed.\n");
udev_device_unref(drm_device);
udev_unref(udev);
return -1;
ret = fstat(fd, &s);
if (ret) {
- TBM_EXYNOS_ERROR("fstat() failed %s.\n");
+ TBM_ERR("fstat() failed %s.\n");
udev_device_unref(drm_device);
udev_unref(udev);
close(fd);
arg.handle = gem;
if (drmIoctl(fd, DRM_IOCTL_GEM_FLINK, &arg)) {
- TBM_EXYNOS_ERROR("fail to DRM_IOCTL_GEM_FLINK gem:%d", gem);
+ TBM_ERR("fail to DRM_IOCTL_GEM_FLINK gem:%d", gem);
return 0;
}
arg.handle = bo_exynos->gem;
if (drmCommandWriteRead(bo_exynos->fd, DRM_EXYNOS_GEM_MAP, &arg,
sizeof(arg))) {
- TBM_EXYNOS_ERROR("Cannot map_dumb gem=%d\n", bo_exynos->gem);
+ TBM_ERR("Cannot map_dumb gem=%d\n", bo_exynos->gem);
return (tbm_bo_handle) NULL;
}
map = mmap(NULL, bo_exynos->size, PROT_READ | PROT_WRITE, MAP_SHARED,
bo_exynos->fd, arg.offset);
if (map == MAP_FAILED) {
- TBM_EXYNOS_ERROR("Cannot usrptr gem=%d\n", bo_exynos->gem);
+ TBM_ERR("Cannot usrptr gem=%d\n", bo_exynos->gem);
return (tbm_bo_handle) NULL;
}
bo_exynos->pBase = map;
arg.handle = bo_exynos->gem;
if (drmIoctl(bo_exynos->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg)) {
- TBM_EXYNOS_ERROR("Cannot dmabuf=%d\n", bo_exynos->gem);
+ TBM_ERR("Cannot dmabuf=%d\n", bo_exynos->gem);
return (tbm_bo_handle) NULL;
}
bo_exynos->dmabuf = arg.fd;
arg.handle = bo_exynos->gem;
if (drmIoctl(bo_exynos->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg)) {
- TBM_EXYNOS_ERROR("Cannot dmabuf=%d\n", bo_exynos->gem);
+ TBM_ERR("Cannot dmabuf=%d\n", bo_exynos->gem);
return (tbm_bo_handle) NULL;
}
bo_exynos->dmabuf = arg.fd;
bo_handle.u32 = (uint32_t)bo_exynos->dmabuf;
break;
default:
- TBM_EXYNOS_ERROR("Not supported device:%d\n", device);
+ TBM_ERR("Not supported device:%d\n", device);
bo_handle.ptr = (void *) NULL;
break;
}
if (!tbm_drm_helper_wl_auth_server_init(native_display, bufmgr_exynos->fd,
bufmgr_exynos->device_name, 0)) {
- TBM_EXYNOS_ERROR("fail to tbm_drm_helper_wl_server_init\n");
+ TBM_ERR("fail to tbm_drm_helper_wl_server_init\n");
return TBM_ERROR_OPERATION_FAILED;
}
*formats = color_formats;
*num = TBM_COLOR_FORMAT_COUNT;
- TBM_EXYNOS_DEBUG("supported format count = %d\n", *num);
+ TBM_DBG("supported format count = %d\n", *num);
return TBM_ERROR_NONE;
}
unsigned int exynos_flags;
if (bufmgr_exynos == NULL) {
- TBM_EXYNOS_ERROR("bufmgr_data is null\n");
+ TBM_ERR("bufmgr_data is null\n");
if (error)
*error = TBM_ERROR_INVALID_PARAMETER;
return NULL;
bo_exynos = calloc(1, sizeof(struct _tbm_bo_exynos));
if (!bo_exynos) {
- TBM_EXYNOS_ERROR("fail to allocate the bo_exynos private\n");
+ TBM_ERR("fail to allocate the bo_exynos private\n");
if (error)
*error = TBM_ERROR_OUT_OF_MEMORY;
return NULL;
arg.flags = exynos_flags;
if (drmCommandWriteRead(bufmgr_exynos->fd, DRM_EXYNOS_GEM_CREATE, &arg,
sizeof(arg))) {
- TBM_EXYNOS_ERROR("Cannot create bo_exynos(flag:%x, size:%d)\n", arg.flags,
+ TBM_ERR("Cannot create bo_exynos(flag:%x, size:%d)\n", arg.flags,
(unsigned int)arg.size);
free(bo_exynos);
if (error)
bo_exynos->name = _get_name(bo_exynos->fd, bo_exynos->gem);
if (!_bo_init_cache_state(bufmgr_exynos, bo_exynos, 0)) {
- TBM_EXYNOS_ERROR("fail init cache state(%d)\n", bo_exynos->name);
+ TBM_ERR("fail init cache state(%d)\n", bo_exynos->name);
free(bo_exynos);
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
arg.handle = bo_exynos->gem;
if (drmIoctl(bo_exynos->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg)) {
- TBM_EXYNOS_ERROR("Cannot dmabuf=%d\n", bo_exynos->gem);
+ TBM_ERR("Cannot dmabuf=%d\n", bo_exynos->gem);
free(bo_exynos);
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
/* add bo_exynos to hash */
if (drmHashInsert(bufmgr_exynos->hashBos, bo_exynos->name, (void *)bo_exynos) < 0)
- TBM_EXYNOS_ERROR("Cannot insert bo_exynos to Hash(%d)\n", bo_exynos->name);
+ TBM_ERR("Cannot insert bo_exynos to Hash(%d)\n", bo_exynos->name);
- TBM_EXYNOS_DEBUG(" bo_exynos:%p, gem:%d(%d), flags:%d(%d), size:%d\n",
+ TBM_DBG(" bo_exynos:%p, gem:%d(%d), flags:%d(%d), size:%d\n",
bo_exynos,
bo_exynos->gem, bo_exynos->name,
flags, exynos_flags,
char buf[STRERR_BUFSIZE];
if (bufmgr_exynos == NULL) {
- TBM_EXYNOS_ERROR("bufmgr_data is null\n");
+ TBM_ERR("bufmgr_data is null\n");
if (error)
*error = TBM_ERROR_INVALID_PARAMETER;
return NULL;
arg.fd = key;
arg.flags = 0;
if (drmIoctl(bufmgr_exynos->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &arg)) {
- TBM_EXYNOS_ERROR("Cannot get gem handle from fd:%d (%s)\n",
+ TBM_ERR("Cannot get gem handle from fd:%d (%s)\n",
arg.fd, strerror_r(errno, buf, STRERR_BUFSIZE));
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
name = _get_name(bufmgr_exynos->fd, gem);
if (!name) {
- TBM_EXYNOS_ERROR("Cannot get name from gem:%d, fd:%d (%s)\n",
+ TBM_ERR("Cannot get name from gem:%d, fd:%d (%s)\n",
gem, key, strerror_r(errno, buf, STRERR_BUFSIZE));
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
DRM_EXYNOS_GEM_GET,
&info,
sizeof(struct drm_exynos_gem_info))) {
- TBM_EXYNOS_ERROR("Cannot get gem info from gem:%d, fd:%d (%s)\n",
+ TBM_ERR("Cannot get gem info from gem:%d, fd:%d (%s)\n",
gem, key, strerror_r(errno, buf, STRERR_BUFSIZE));
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
bo_exynos = calloc(1, sizeof(struct _tbm_bo_exynos));
if (!bo_exynos) {
- TBM_EXYNOS_ERROR("bo_exynos:%p fail to allocate the bo_exynos\n", bo_exynos);
+ TBM_ERR("bo_exynos:%p fail to allocate the bo_exynos\n", bo_exynos);
if (error)
*error = TBM_ERROR_OUT_OF_MEMORY;
return NULL;
bo_exynos->name = name;
if (!_bo_init_cache_state(bufmgr_exynos, bo_exynos, 1)) {
- TBM_EXYNOS_ERROR("fail init cache state(%d)\n", bo_exynos->name);
+ TBM_ERR("fail init cache state(%d)\n", bo_exynos->name);
free(bo_exynos);
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
/* add bo_exynos to hash */
if (drmHashInsert(bufmgr_exynos->hashBos, bo_exynos->name, (void *)bo_exynos) < 0)
- TBM_EXYNOS_ERROR("bo_exynos:%p Cannot insert bo_exynos to Hash(%d) from gem:%d, fd:%d\n",
+ TBM_ERR("bo_exynos:%p Cannot insert bo_exynos to Hash(%d) from gem:%d, fd:%d\n",
bo_exynos, bo_exynos->name, gem, key);
- TBM_EXYNOS_DEBUG(" bo_exynos:%p, gem:%d(%d), fd:%d, key_fd:%d, flags:%d(%d), size:%d\n",
+ TBM_DBG(" bo_exynos:%p, gem:%d(%d), fd:%d, key_fd:%d, flags:%d(%d), size:%d\n",
bo_exynos,
bo_exynos->gem, bo_exynos->name,
bo_exynos->dmabuf,
int ret;
if (bufmgr_exynos == NULL) {
- TBM_EXYNOS_ERROR("bufmgr_data is null\n");
+ TBM_ERR("bufmgr_data is null\n");
if (error)
*error = TBM_ERROR_INVALID_PARAMETER;
return NULL;
arg.name = key;
if (drmIoctl(bufmgr_exynos->fd, DRM_IOCTL_GEM_OPEN, &arg)) {
- TBM_EXYNOS_ERROR("Cannot open gem name=%d\n", key);
+ TBM_ERR("Cannot open gem name=%d\n", key);
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
return NULL;
DRM_EXYNOS_GEM_GET,
&info,
sizeof(struct drm_exynos_gem_info))) {
- TBM_EXYNOS_ERROR("Cannot get gem info=%d\n", key);
+ TBM_ERR("Cannot get gem info=%d\n", key);
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
return NULL;
bo_exynos = calloc(1, sizeof(struct _tbm_bo_exynos));
if (!bo_exynos) {
- TBM_EXYNOS_ERROR("fail to allocate the bo_exynos private\n");
+ TBM_ERR("fail to allocate the bo_exynos private\n");
if (error)
*error = TBM_ERROR_OUT_OF_MEMORY;
return NULL;
bo_exynos->flags_tbm = _get_tbm_flag_from_exynos(bo_exynos->flags_exynos);
if (!_bo_init_cache_state(bufmgr_exynos, bo_exynos, 1)) {
- TBM_EXYNOS_ERROR("fail init cache state(%d)\n", bo_exynos->name);
+ TBM_ERR("fail init cache state(%d)\n", bo_exynos->name);
free(bo_exynos);
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
arg.handle = bo_exynos->gem;
if (drmIoctl(bo_exynos->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg)) {
- TBM_EXYNOS_ERROR("fail to DRM_IOCTL_PRIME_HANDLE_TO_FD gem=%d\n", bo_exynos->gem);
+ TBM_ERR("fail to DRM_IOCTL_PRIME_HANDLE_TO_FD gem=%d\n", bo_exynos->gem);
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
free(bo_exynos);
/* add bo_exynos to hash */
if (drmHashInsert(bufmgr_exynos->hashBos, bo_exynos->name, (void *)bo_exynos) < 0)
- TBM_EXYNOS_ERROR("Cannot insert bo_exynos to Hash(%d)\n", bo_exynos->name);
+ TBM_ERR("Cannot insert bo_exynos to Hash(%d)\n", bo_exynos->name);
- TBM_EXYNOS_DEBUG(" bo_exynos:%p, gem:%d(%d), fd:%d, flags:%d(%d), size:%d\n",
+ TBM_DBG(" bo_exynos:%p, gem:%d(%d), fd:%d, flags:%d(%d), size:%d\n",
bo_exynos,
bo_exynos->gem, bo_exynos->name,
bo_exynos->dmabuf,
if (!bufmgr_exynos)
return;
- TBM_EXYNOS_DEBUG(" bo_exynos:%p, gem:%d(%d), fd:%d, size:%d\n",
+ TBM_DBG(" bo_exynos:%p, gem:%d(%d), fd:%d, size:%d\n",
bo_exynos,
bo_exynos->gem, bo_exynos->name,
bo_exynos->dmabuf,
if (bo_exynos->pBase) {
if (munmap(bo_exynos->pBase, bo_exynos->size) == -1) {
- TBM_EXYNOS_ERROR("bo_exynos:%p fail to munmap(%s)\n",
+ TBM_ERR("bo_exynos:%p fail to munmap(%s)\n",
bo_exynos, strerror_r(errno, buf, STRERR_BUFSIZE));
}
}
if (ret == 0)
drmHashDelete(bufmgr_exynos->hashBos, bo_exynos->name);
else
- TBM_EXYNOS_ERROR("Cannot find bo_exynos to Hash(%d), ret=%d\n", bo_exynos->name, ret);
+ TBM_ERR("Cannot find bo_exynos to Hash(%d), ret=%d\n", bo_exynos->name, ret);
if (temp != bo_exynos)
- TBM_EXYNOS_ERROR("hashBos probably has several BOs with same name!!!\n");
+ TBM_ERR("hashBos probably has several BOs with same name!!!\n");
_bo_destroy_cache_state(bufmgr_exynos, bo_exynos);
memset(&arg, 0, sizeof(arg));
arg.handle = bo_exynos->gem;
if (drmIoctl(bo_exynos->fd, DRM_IOCTL_GEM_CLOSE, &arg))
- TBM_EXYNOS_ERROR("bo_exynos:%p fail to gem close.(%s)\n",
+ TBM_ERR("bo_exynos:%p fail to gem close.(%s)\n",
bo_exynos, strerror_r(errno, buf, STRERR_BUFSIZE));
free(bo_exynos);
}
if (!bo_exynos->gem) {
- TBM_EXYNOS_ERROR("Cannot map gem=%d\n", bo_exynos->gem);
+ TBM_ERR("Cannot map gem=%d\n", bo_exynos->gem);
if (error)
*error = TBM_ERROR_INVALID_PARAMETER;
return (tbm_bo_handle) NULL;
}
- TBM_EXYNOS_DEBUG("bo_exynos:%p, gem:%d(%d), fd:%d, flags:%d(%d), size:%d, %s\n",
+ TBM_DBG("bo_exynos:%p, gem:%d(%d), fd:%d, flags:%d(%d), size:%d, %s\n",
bo_exynos,
bo_exynos->gem, bo_exynos->name,
bo_exynos->dmabuf,
/*Get mapped bo_handle*/
bo_handle = _exynos_bo_handle(bo_exynos, device);
if (bo_handle.ptr == NULL) {
- TBM_EXYNOS_ERROR("Cannot get handle: gem:%d, device:%d\n",
+ TBM_ERR("Cannot get handle: gem:%d, device:%d\n",
bo_exynos->gem, device);
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
}
if (!bo_exynos->gem) {
- TBM_EXYNOS_ERROR("Cannot map gem=%d\n", bo_exynos->gem);
+ TBM_ERR("Cannot map gem=%d\n", bo_exynos->gem);
if (error)
*error = TBM_ERROR_INVALID_PARAMETER;
return (tbm_bo_handle) NULL;
}
- TBM_EXYNOS_DEBUG(" bo_exynos:%p, gem:%d(%d), fd:%d, %s, %s\n",
+ TBM_DBG(" bo_exynos:%p, gem:%d(%d), fd:%d, %s, %s\n",
bo_exynos,
bo_exynos->gem, bo_exynos->name,
bo_exynos->dmabuf,
/*Get mapped bo_handle*/
bo_handle = _exynos_bo_handle(bo_exynos, device);
if (bo_handle.ptr == NULL) {
- TBM_EXYNOS_ERROR("Cannot get handle: gem:%d, device:%d, opt:%d\n",
+ TBM_ERR("Cannot get handle: gem:%d, device:%d, opt:%d\n",
bo_exynos->gem, device, opt);
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
bo_exynos->last_map_device = -1;
- TBM_EXYNOS_DEBUG(" bo_exynos:%p, gem:%d(%d), fd:%d\n",
+ TBM_DBG(" bo_exynos:%p, gem:%d(%d), fd:%d\n",
bo_exynos,
bo_exynos->gem, bo_exynos->name,
bo_exynos->dmabuf);
return TBM_ERROR_INVALID_PARAMETER;
if (device != TBM_DEVICE_3D && device != TBM_DEVICE_CPU) {
- TBM_EXYNOS_DEBUG("Not support device type,\n");
+ TBM_DBG("Not support device type,\n");
return TBM_ERROR_OPERATION_FAILED;
}
if (device == TBM_DEVICE_3D)
fence.type = DMA_BUF_ACCESS_READ | DMA_BUF_ACCESS_DMA;
} else {
- TBM_EXYNOS_ERROR("Invalid argument\n");
+ TBM_ERR("Invalid argument\n");
return TBM_ERROR_INVALID_PARAMETER;
}
/* Check if the tbm manager supports dma fence or not. */
if (!bufmgr_exynos->use_dma_fence) {
- TBM_EXYNOS_ERROR("Not support DMA FENCE(%s)\n", strerror_r(errno, buf, STRERR_BUFSIZE));
+ TBM_ERR("Not support DMA FENCE(%s)\n", strerror_r(errno, buf, STRERR_BUFSIZE));
return TBM_ERROR_OPERATION_FAILED;
}
if (device == TBM_DEVICE_3D) {
ret = ioctl(bo_exynos->dmabuf, DMABUF_IOCTL_GET_FENCE, &fence);
if (ret < 0) {
- TBM_EXYNOS_ERROR("Cannot set GET FENCE(%s)\n", strerror_r(errno, buf, STRERR_BUFSIZE));
+ TBM_ERR("Cannot set GET FENCE(%s)\n", strerror_r(errno, buf, STRERR_BUFSIZE));
return TBM_ERROR_OPERATION_FAILED;
}
} else {
if (i == DMA_FENCE_LIST_MAX) {
/*TODO: if dma_fence list is full, it needs realloc. I will fix this. by minseok3.kim*/
- TBM_EXYNOS_ERROR("fence list is full\n");
+ TBM_ERR("fence list is full\n");
}
}
pthread_mutex_unlock(&bo_exynos->mutex);
- TBM_EXYNOS_DEBUG("DMABUF_IOCTL_GET_FENCE! bo_exynos:%p, gem:%d(%d), fd:%ds\n",
+ TBM_DBG("DMABUF_IOCTL_GET_FENCE! bo_exynos:%p, gem:%d(%d), fd:%ds\n",
bo_exynos,
bo_exynos->gem, bo_exynos->name,
bo_exynos->dmabuf);
dma_type = 1;
if (!bo_exynos->dma_fence[0].ctx && dma_type) {
- TBM_EXYNOS_DEBUG("FENCE not support or ignored,\n");
+ TBM_DBG("FENCE not support or ignored,\n");
return TBM_ERROR_OPERATION_FAILED;
}
if (!bo_exynos->dma_fence[0].ctx && dma_type) {
- TBM_EXYNOS_DEBUG("device type is not 3D/CPU,\n");
+ TBM_DBG("device type is not 3D/CPU,\n");
return TBM_ERROR_OPERATION_FAILED;
}
if (dma_type) {
ret = ioctl(bo_exynos->dmabuf, DMABUF_IOCTL_PUT_FENCE, &fence);
if (ret < 0) {
- TBM_EXYNOS_ERROR("Can not set PUT FENCE(%s)\n", strerror_r(errno, buf, STRERR_BUFSIZE));
+ TBM_ERR("Can not set PUT FENCE(%s)\n", strerror_r(errno, buf, STRERR_BUFSIZE));
return TBM_ERROR_OPERATION_FAILED;
}
} else {
return TBM_ERROR_OPERATION_FAILED;
}
- TBM_EXYNOS_DEBUG("DMABUF_IOCTL_PUT_FENCE! bo_exynos:%p, gem:%d(%d), fd:%ds\n",
+ TBM_DBG("DMABUF_IOCTL_PUT_FENCE! bo_exynos:%p, gem:%d(%d), fd:%ds\n",
bo_exynos,
bo_exynos->gem, bo_exynos->name,
bo_exynos->dmabuf);
arg.handle = bo_exynos->gem;
ret = drmIoctl(bo_exynos->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg);
if (ret) {
- TBM_EXYNOS_ERROR("bo_exynos:%p Cannot dmabuf=%d (%s)\n",
+ TBM_ERR("bo_exynos:%p Cannot dmabuf=%d (%s)\n",
bo_exynos, bo_exynos->gem, strerror_r(errno, buf, STRERR_BUFSIZE));
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
return (tbm_fd) ret;
}
- TBM_EXYNOS_DEBUG(" bo_exynos:%p, gem:%d(%d), fd:%d, key_fd:%d, flags:%d(%d), size:%d\n",
+ TBM_DBG(" bo_exynos:%p, gem:%d(%d), fd:%d, key_fd:%d, flags:%d(%d), size:%d\n",
bo_exynos,
bo_exynos->gem, bo_exynos->name,
bo_exynos->dmabuf,
if (!bo_exynos->name) {
bo_exynos->name = _get_name(bo_exynos->fd, bo_exynos->gem);
if (!bo_exynos->name) {
- TBM_EXYNOS_ERROR("error Cannot get name\n");
+ TBM_ERR("error Cannot get name\n");
if (error)
*error = TBM_ERROR_INVALID_PARAMETER;
return 0;
}
}
- TBM_EXYNOS_DEBUG(" bo_exynos:%p, gem:%d(%d), fd:%d, flags:%d(%d), size:%d\n",
+ TBM_DBG(" bo_exynos:%p, gem:%d(%d), fd:%d, flags:%d(%d), size:%d\n",
bo_exynos,
bo_exynos->gem, bo_exynos->name,
bo_exynos->dmabuf,
char *value = NULL;
if (!bufmgr) {
- TBM_EXYNOS_ERROR("bufmgr is null.\n");
+ TBM_ERR("bufmgr is null.\n");
if (error)
*error = TBM_ERROR_INVALID_PARAMETER;
return NULL;
bufmgr_exynos = calloc(1, sizeof(struct _tbm_bufmgr_exynos));
if (!bufmgr_exynos) {
- TBM_EXYNOS_ERROR("fail to alloc bufmgr_exynos!\n");
+ TBM_ERR("fail to alloc bufmgr_exynos!\n");
if (error)
*error = TBM_ERROR_OUT_OF_MEMORY;
return NULL;
if (bufmgr_exynos->fd < 0) {
bufmgr_exynos->fd = _tbm_exynos_open_drm();
if (bufmgr_exynos->fd < 0) {
- TBM_EXYNOS_ERROR("fail to open drm!\n");
+ TBM_ERR("fail to open drm!\n");
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
goto fail_open_drm;
bufmgr_exynos->device_name = drmGetDeviceNameFromFd(bufmgr_exynos->fd);
if (!bufmgr_exynos->device_name) {
- TBM_EXYNOS_ERROR("fail to get device name!\n");
+ TBM_ERR("fail to get device name!\n");
tbm_drm_helper_unset_tbm_master_fd();
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
if (_check_render_node()) {
bufmgr_exynos->fd = _get_render_node();
if (bufmgr_exynos->fd < 0) {
- TBM_EXYNOS_ERROR("fail to get render node\n");
+ TBM_ERR("fail to get render node\n");
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
goto fail_get_render_node;
}
- TBM_EXYNOS_DEBUG("Use render node:%d\n", bufmgr_exynos->fd);
+ TBM_DBG("Use render node:%d\n", bufmgr_exynos->fd);
} else {
if (!tbm_drm_helper_get_auth_info(&(bufmgr_exynos->fd), &(bufmgr_exynos->device_name), NULL)) {
- TBM_EXYNOS_ERROR("fail to get auth drm info!\n");
+ TBM_ERR("fail to get auth drm info!\n");
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
goto fail_get_auth_info;
* is not set to the backend.
*/
if (system_info_get_platform_string("http://tizen.org/system/model_name", &value) != SYSTEM_INFO_ERROR_NONE) {
- TBM_EXYNOS_ERROR("Cannot get the \"http://tizen.org/system/model_name\" key value from system-info.\n");
- TBM_EXYNOS_ERROR("May not set the right value on libtbm-exynos backend.\n");
+ TBM_ERR("Cannot get the \"http://tizen.org/system/model_name\" key value from system-info.\n");
+ TBM_ERR("May not set the right value on libtbm-exynos backend.\n");
} else {
if (!strncmp(value, "TW1", 4)) {
g_tbm_surface_alignment_plane = 8;
free(value);
if (!_bufmgr_init_cache_state(bufmgr_exynos)) {
- TBM_EXYNOS_ERROR("fail to init bufmgr cache state\n");
+ TBM_ERR("fail to init bufmgr cache state\n");
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
goto fail_init_cache_state;
/* alloc and register bufmgr_funcs */
bufmgr_func = tbm_backend_bufmgr_alloc_bufmgr_func(bufmgr, &err);
if (!bufmgr_func) {
- TBM_EXYNOS_ERROR("fail to alloc bufmgr_func! err(%d)\n", err);
+ TBM_ERR("fail to alloc bufmgr_func! err(%d)\n", err);
if (error)
*error = TBM_ERROR_OUT_OF_MEMORY;
goto fail_alloc_bufmgr_func;
err = tbm_backend_bufmgr_register_bufmgr_func(bufmgr, bufmgr_func);
if (err != TBM_ERROR_NONE) {
- TBM_EXYNOS_ERROR("fail to register bufmgr_func! err(%d)\n", err);
+ TBM_ERR("fail to register bufmgr_func! err(%d)\n", err);
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
goto fail_register_bufmgr_func;
/* alloc and register bo_funcs */
bo_func = tbm_backend_bufmgr_alloc_bo_func(bufmgr, &err);
if (!bo_func) {
- TBM_EXYNOS_ERROR("fail to alloc bo_func! err(%d)\n", err);
+ TBM_ERR("fail to alloc bo_func! err(%d)\n", err);
if (error)
*error = TBM_ERROR_OUT_OF_MEMORY;
goto fail_alloc_bo_func;
err = tbm_backend_bufmgr_register_bo_func(bufmgr, bo_func);
if (err != TBM_ERROR_NONE) {
- TBM_EXYNOS_ERROR("fail to register bo_func! err(%d)\n", err);
+ TBM_ERR("fail to register bo_func! err(%d)\n", err);
if (error)
*error = TBM_ERROR_OPERATION_FAILED;
goto fail_register_bo_func;
}
bufmgr_exynos->bo_func = bo_func;
-#ifdef DEBUG
- {
- char *env;
-
- env = getenv("TBM_EXYNOS_DEBUG");
- if (env) {
- bDebug = atoi(env);
- TBM_EXYNOS_ERROR("TBM_EXYNOS_DEBUG=%s\n", env);
- } else
- bDebug = 0;
- }
-#endif
-
- TBM_EXYNOS_DEBUG("drm_fd:%d\n", bufmgr_exynos->fd);
+ TBM_DBG("drm_fd:%d\n", bufmgr_exynos->fd);
if (error)
*error = TBM_ERROR_NONE;