udev = udev_new();
if (!udev) {
- TBM_BACKEND_ERR("fail to initialize udev context\n");
+ TBM_BACKEND_ERR("fail to initialize udev context");
return NULL;
}
arg.handle = bo_data->gem;
if (drmIoctl(bo_data->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg)) {
- TBM_BACKEND_ERR("Cannot map_ gem=%d\n", bo_data->gem);
+ TBM_BACKEND_ERR("Cannot map_ gem=%d", bo_data->gem);
return (hal_tbm_bo_handle) NULL;
}
map = mmap(NULL, bo_data->size, PROT_READ | PROT_WRITE, MAP_SHARED,
bo_data->fd, arg.offset);
if (map == MAP_FAILED) {
- TBM_BACKEND_ERR("Cannot usrptr gem=%d\n", bo_data->gem);
+ TBM_BACKEND_ERR("Cannot usrptr gem=%d", bo_data->gem);
return (hal_tbm_bo_handle) NULL;
}
bo_data->pBase = map;
arg.handle = bo_data->gem;
if (drmIoctl(bo_data->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg)) {
- TBM_BACKEND_ERR("Cannot dmabuf=%d\n", bo_data->gem);
+ TBM_BACKEND_ERR("Cannot dmabuf=%d", bo_data->gem);
return (hal_tbm_bo_handle) NULL;
}
bo_data->dmabuf = arg.fd;
arg.handle = bo_data->gem;
if (drmIoctl(bo_data->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg)) {
- TBM_BACKEND_ERR("Cannot dmabuf=%d\n", bo_data->gem);
+ TBM_BACKEND_ERR("Cannot dmabuf=%d", bo_data->gem);
return (hal_tbm_bo_handle) NULL;
}
bo_data->dmabuf = arg.fd;
bo_handle.u32 = (uint32_t)bo_data->dmabuf;
break;
default:
- TBM_BACKEND_ERR("Not supported device:%d\n", device);
+ TBM_BACKEND_ERR("Not supported device:%d", device);
bo_handle.ptr = (void *) NULL;
break;
}
static int
_dumb_cache_flush(int fd, tbm_dumb_bo *bo_data, int flags)
{
- TBM_BACKEND_ERR("warning fail to flush the cache.\n");
+ TBM_BACKEND_ERR("warning fail to flush the cache.");
return 1;
}
#endif
*formats = color_formats;
*num = TBM_COLOR_FORMAT_COUNT;
- TBM_BACKEND_DBG("supported format count = %d\n", *num);
+ TBM_BACKEND_DBG("supported format count = %d", *num);
return HAL_TBM_ERROR_NONE;
}
unsigned int dumb_flags;
if (bufmgr_data == NULL) {
- TBM_BACKEND_ERR("bufmgr_data is null\n");
+ TBM_BACKEND_ERR("bufmgr_data is null");
if (error)
*error = HAL_TBM_ERROR_INVALID_PARAMETER;
return NULL;
bo_data = calloc(1, sizeof(struct _tbm_dumb_bo));
if (!bo_data) {
- TBM_BACKEND_ERR("fail to allocate the bo_data private\n");
+ TBM_BACKEND_ERR("fail to allocate the bo_data private");
if (error)
*error = HAL_TBM_ERROR_OUT_OF_MEMORY;
return NULL;
arg.width = size;
arg.flags = dumb_flags;
if (drmIoctl(bufmgr_data->fd, DRM_IOCTL_MODE_CREATE_DUMB, &arg)) {
- TBM_BACKEND_ERR("Cannot create bo_data(flag:%x, size:%d)\n", arg.flags,
+ TBM_BACKEND_ERR("Cannot create bo_data(flag:%x, size:%d)", arg.flags,
(unsigned int)size);
free(bo_data);
if (error)
/* add bo to hash */
if (drmHashInsert(bufmgr_data->hashBos, bo_data->name, (void *)bo_data) < 0)
- TBM_BACKEND_ERR("error Cannot insert bo to Hash(%d)\n", bo_data->name);
+ TBM_BACKEND_ERR("error Cannot insert bo to Hash(%d)", bo_data->name);
- TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), flags:%d(%d), size:%d\n",
+ TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), flags:%d(%d), size:%d",
bo_data,
bo_data->gem, bo_data->name,
bo_data->flags_tbm,
int ret;
if (bufmgr_data == NULL) {
- TBM_BACKEND_ERR("bufmgr_data is null\n");
+ TBM_BACKEND_ERR("bufmgr_data is null");
if (error)
*error = HAL_TBM_ERROR_INVALID_PARAMETER;
return NULL;
arg.fd = key;
arg.flags = 0;
if (drmIoctl(bufmgr_data->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &arg)) {
- TBM_BACKEND_ERR("Cannot get gem handle from fd:%d (%m)\n",
+ TBM_BACKEND_ERR("Cannot get gem handle from fd:%d (%m)",
arg.fd);
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
name = _get_name(bufmgr_data->fd, gem);
if (name == 0) {
- TBM_BACKEND_ERR("Cannot get name from gem:%d, fd:%d (%m)\n",
+ TBM_BACKEND_ERR("Cannot get name from gem:%d, fd:%d (%m)",
gem, key);
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
/* Open the same GEM object only for finding out its size */
open_arg.name = name;
if (drmIoctl(bufmgr_data->fd, DRM_IOCTL_GEM_OPEN, &open_arg)) {
- TBM_BACKEND_ERR("Cannot get gem info from gem:%d, fd:%d (%m)\n",
+ TBM_BACKEND_ERR("Cannot get gem info from gem:%d, fd:%d (%m)",
gem, key);
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
struct drm_gem_close gem_close;
gem_close.handle = open_arg.handle;
if (drmIoctl(bufmgr_data->fd, DRM_IOCTL_GEM_CLOSE, &gem_close)) {
- TBM_BACKEND_ERR("Cannot close gem_handle (%m)\n");
+ TBM_BACKEND_ERR("Cannot close gem_handle (%m)");
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
return NULL;
bo_data = calloc(1, sizeof(struct _tbm_dumb_bo));
if (!bo_data) {
- TBM_BACKEND_ERR("bo_data:%p fail to allocate the bo_data\n", bo_data);
+ TBM_BACKEND_ERR("bo_data:%p fail to allocate the bo_data", bo_data);
if (error)
*error = HAL_TBM_ERROR_OUT_OF_MEMORY;
return NULL;
/* add bo_data to hash */
if (drmHashInsert(bufmgr_data->hashBos, bo_data->name, (void *)bo_data) < 0)
- TBM_BACKEND_ERR("bo_data:%p Cannot insert bo_data to Hash(%d) from gem:%d, fd:%d\n",
+ TBM_BACKEND_ERR("bo_data:%p Cannot insert bo_data to Hash(%d) from gem:%d, fd:%d",
bo_data, bo_data->name, gem, key);
- TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d, key_fd:%d, flags:%d, size:%d\n",
+ TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d, key_fd:%d, flags:%d, size:%d",
bo_data,
bo_data->gem, bo_data->name,
bo_data->dmabuf,
int ret;
if (bufmgr_data == NULL) {
- TBM_BACKEND_ERR("bufmgr_data is null\n");
+ TBM_BACKEND_ERR("bufmgr_data is null");
if (error)
*error = HAL_TBM_ERROR_INVALID_PARAMETER;
return NULL;
arg.name = key;
if (drmIoctl(bufmgr_data->fd, DRM_IOCTL_GEM_OPEN, &arg)) {
- TBM_BACKEND_ERR("Cannot open gem name=%d\n", key);
+ TBM_BACKEND_ERR("Cannot open gem name=%d", key);
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
return NULL;
bo_data = calloc(1, sizeof(struct _tbm_dumb_bo));
if (!bo_data) {
- TBM_BACKEND_ERR("fail to allocate the bo_data private\n");
+ TBM_BACKEND_ERR("fail to allocate the bo_data private");
if (error)
*error = HAL_TBM_ERROR_OUT_OF_MEMORY;
return NULL;
arg.handle = bo_data->gem;
if (drmIoctl(bo_data->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg)) {
- TBM_BACKEND_ERR("fail to DRM_IOCTL_PRIME_HANDLE_TO_FD gem=%d\n", bo_data->gem);
+ TBM_BACKEND_ERR("fail to DRM_IOCTL_PRIME_HANDLE_TO_FD gem=%d", bo_data->gem);
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
free(bo_data);
/* add bo to hash */
if (drmHashInsert(bufmgr_data->hashBos, bo_data->name, (void *)bo_data) < 0)
- TBM_BACKEND_ERR("Cannot insert bo_data to Hash(%d)\n", bo_data->name);
+ TBM_BACKEND_ERR("Cannot insert bo_data to Hash(%d)", bo_data->name);
- TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d, flags:%d(%d), size:%d\n",
+ TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d, flags:%d(%d), size:%d",
bo_data,
bo_data->gem, bo_data->name,
bo_data->dmabuf,
if (!bufmgr_data)
return;
- TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d, size:%d\n",
+ TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d, size:%d",
bo_data,
bo_data->gem, bo_data->name,
bo_data->dmabuf,
if (bo_data->pBase) {
if (munmap(bo_data->pBase, bo_data->size) == -1) {
- TBM_BACKEND_ERR("bo_data:%p fail to munmap (%m)\n",
+ TBM_BACKEND_ERR("bo_data:%p fail to munmap (%m)",
bo_data);
}
}
if (ret == 0)
drmHashDelete(bufmgr_data->hashBos, bo_data->name);
else
- TBM_BACKEND_ERR("Cannot find bo_data to Hash(%d), ret=%d\n", bo_data->name, ret);
+ TBM_BACKEND_ERR("Cannot find bo_data to Hash(%d), ret=%d", bo_data->name, ret);
if (temp != bo_data)
- TBM_BACKEND_ERR("hashBos probably has several BOs with same name!!!\n");
+ TBM_BACKEND_ERR("hashBos probably has several BOs with same name!!!");
/* Free gem handle */
struct drm_gem_close arg = {0, };
memset(&arg, 0, sizeof(arg));
arg.handle = bo_data->gem;
if (drmIoctl(bo_data->fd, DRM_IOCTL_GEM_CLOSE, &arg))
- TBM_BACKEND_ERR("bo_data:%p fail to gem close (%m)\n",
+ TBM_BACKEND_ERR("bo_data:%p fail to gem close (%m)",
bo_data);
free(bo_data);
}
if (!bo_data->gem) {
- TBM_BACKEND_ERR("Cannot map gem=%d\n", bo_data->gem);
+ TBM_BACKEND_ERR("Cannot map gem=%d", bo_data->gem);
if (error)
*error = HAL_TBM_ERROR_INVALID_PARAMETER;
return (hal_tbm_bo_handle) NULL;
}
- TBM_BACKEND_DBG("bo_data:%p, gem:%d(%d), fd:%d, flags:%d, size:%d, %s\n",
+ TBM_BACKEND_DBG("bo_data:%p, gem:%d(%d), fd:%d, flags:%d, size:%d, %s",
bo_data,
bo_data->gem, bo_data->name,
bo_data->dmabuf,
/*Get mapped bo_handle*/
bo_handle = _dumb_bo_handle(bo_data, device);
if (bo_handle.ptr == NULL) {
- TBM_BACKEND_ERR("Cannot get handle: gem:%d, device:%d\n",
+ TBM_BACKEND_ERR("Cannot get handle: gem:%d, device:%d",
bo_data->gem, device);
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
}
if (!bo_data->gem) {
- TBM_BACKEND_ERR("Cannot map gem=%d\n", bo_data->gem);
+ TBM_BACKEND_ERR("Cannot map gem=%d", bo_data->gem);
if (error)
*error = HAL_TBM_ERROR_INVALID_PARAMETER;
return (hal_tbm_bo_handle) NULL;
}
- TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d, %s, %s\n",
+ TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d, %s, %s",
bo_data,
bo_data->gem, bo_data->name,
bo_data->dmabuf,
/*Get mapped bo_handle*/
bo_handle = _dumb_bo_handle(bo_data, device);
if (bo_handle.ptr == NULL) {
- TBM_BACKEND_ERR("Cannot get handle: gem:%d, device:%d, opt:%d\n",
+ TBM_BACKEND_ERR("Cannot get handle: gem:%d, device:%d, opt:%d",
bo_data->gem, device, opt);
if (error)
*error = HAL_TBM_ERROR_INVALID_PARAMETER;
if (!bo_data->gem)
return HAL_TBM_ERROR_INVALID_PARAMETER;
- TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d\n",
+ TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d",
bo_data,
bo_data->gem, bo_data->name,
bo_data->dmabuf);
arg.handle = bo_data->gem;
ret = drmIoctl(bo_data->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg);
if (ret) {
- TBM_BACKEND_ERR("bo_data:%p Cannot dmabuf=%d (%m)\n",
+ TBM_BACKEND_ERR("bo_data:%p Cannot dmabuf=%d (%m)",
bo_data, bo_data->gem);
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
return (hal_tbm_fd)ret;
}
- TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d, key_fd:%d, flags:%d, size:%d\n",
+ TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d, key_fd:%d, flags:%d, size:%d",
bo_data,
bo_data->gem, bo_data->name,
bo_data->dmabuf,
if (!bo_data->name) {
bo_data->name = _get_name(bo_data->fd, bo_data->gem);
if (!bo_data->name) {
- TBM_BACKEND_ERR("error Cannot get name\n");
+ TBM_BACKEND_ERR("error Cannot get name");
if (error)
*error = HAL_TBM_ERROR_INVALID_PARAMETER;
return 0;
}
}
- TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d, flags:%d, size:%d\n",
+ TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), fd:%d, flags:%d, size:%d",
bo_data,
bo_data->gem, bo_data->name,
bo_data->dmabuf,
TBM_BACKEND_RETURN_VAL_IF_FAIL(bufmgr_data != NULL, HAL_TBM_ERROR_INVALID_PARAMETER);
bufmgr_data->fd = auth_fd;
- TBM_BACKEND_INFO("Get the authenticated drm_fd(%d)!\n", bufmgr_data->fd);
+ TBM_BACKEND_INFO("Get the authenticated drm_fd(%d)!", bufmgr_data->fd);
return HAL_TBM_ERROR_NONE;
}
/* allocate a hal_tbm_backend_data */
backend_data = calloc(1, sizeof(struct _hal_tbm_backend_data));
if (!backend_data) {
- TBM_BACKEND_ERR("fail to alloc backend_data!\n");
+ TBM_BACKEND_ERR("fail to alloc backend_data!");
*data = NULL;
return -1;
}
/* allocate a hal_tbm_bufmgr */
bufmgr_data = calloc(1, sizeof(struct _tbm_dumb_bufmgr));
if (!bufmgr_data) {
- TBM_BACKEND_ERR("fail to alloc bufmgr_data!\n");
+ TBM_BACKEND_ERR("fail to alloc bufmgr_data!");
goto fail_alloc_bufmgr_data;
}
backend_data->bufmgr = (hal_tbm_bufmgr *)bufmgr_data;
// open drm_fd
drm_fd = _tbm_dumb_open_drm();
if (drm_fd < 0) {
- TBM_BACKEND_ERR("fail to open drm!\n");
+ TBM_BACKEND_ERR("fail to open drm!");
goto fail_open_drm;
}
ret = drmGetCap(drm_fd, DRM_CAP_DUMB_BUFFER, &cap);
if (ret || cap == 0) {
- TBM_BACKEND_ERR("drm buffer isn't supported !\n");
+ TBM_BACKEND_ERR("drm buffer isn't supported !");
goto fail_get_cap;
}
backend_data->drm_info.is_master = 1;
bufmgr_data->fd = drm_fd;
- TBM_BACKEND_INFO("Get the master drm_fd(%d)!\n", bufmgr_data->fd);
+ TBM_BACKEND_INFO("Get the master drm_fd(%d)!", bufmgr_data->fd);
} else {
// drm_fd is not a master_drm_fd.
// request authenticated fd
backend_data->drm_info.auth_drm_fd_func = _tbm_dumb_authenticated_drm_fd_handler;
backend_data->drm_info.user_data = bufmgr_data;
- TBM_BACKEND_INFO("A backend requests an authenticated drm_fd.\n");
+ TBM_BACKEND_INFO("A backend requests an authenticated drm_fd.");
}
/*Create Hash Table*/
/* alloc and register bufmgr_funcs */
bufmgr_funcs = calloc(1, sizeof(struct _hal_tbm_bufmgr_funcs));
if (!bufmgr_funcs) {
- TBM_BACKEND_ERR("fail to alloc bufmgr_funcs!\n");
+ TBM_BACKEND_ERR("fail to alloc bufmgr_funcs!");
goto fail_alloc_bufmgr_funcs;
}
backend_data->bufmgr_funcs = bufmgr_funcs;
/* alloc and register bo_funcs */
bo_funcs = calloc(1, sizeof(struct _hal_tbm_bo_funcs));
if (!bo_funcs) {
- TBM_BACKEND_ERR("fail to alloc bo_funcs!\n");
+ TBM_BACKEND_ERR("fail to alloc bo_funcs!");
goto fail_alloc_bo_funcs;
}
backend_data->bo_funcs = bo_funcs;
bo_funcs->bo_export_fd = tbm_dumb_bo_export_fd;
bo_funcs->bo_export_key = tbm_dumb_bo_export_key;
- TBM_BACKEND_DBG("drm_fd:%d\n", bufmgr_data->fd);
+ TBM_BACKEND_DBG("drm_fd:%d", bufmgr_data->fd);
return HAL_TBM_ERROR_NONE;