udev = udev_new();
if (!udev) {
- TBM_BACKEND_ERR("udev_new() failed.\n");
+ TBM_BACKEND_ERR("udev_new() failed.");
return -1;
}
/* Get device file path. */
filepath = udev_device_get_devnode(drm_device);
if (!filepath) {
- TBM_BACKEND_ERR("udev_device_get_devnode() failed.\n");
+ TBM_BACKEND_ERR("udev_device_get_devnode() failed.");
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_BACKEND_ERR("open(%s, O_RDWR | O_CLOEXEC) failed.\n");
+ TBM_BACKEND_ERR("open(%s, O_RDWR | O_CLOEXEC) failed.");
udev_device_unref(drm_device);
udev_unref(udev);
return -1;
ret = fstat(fd, &s);
if (ret) {
- TBM_BACKEND_ERR("fstat() failed %s.\n");
+ TBM_BACKEND_ERR("fstat() failed %s.");
close(fd);
udev_device_unref(drm_device);
udev_unref(udev);
udev = udev_new();
if (!udev) {
- TBM_BACKEND_ERR("udev_new() failed.\n");
+ TBM_BACKEND_ERR("udev_new() failed.");
return -1;
}
if (device_parent) {
if (strcmp(udev_device_get_sysname(device_parent), "vc4-drm") == 0) {
drm_device = device;
- TBM_BACKEND_DBG("Found render device: '%s' (%s)\n",
+ TBM_BACKEND_DBG("Found render device: '%s' (%s)",
udev_device_get_syspath(drm_device),
udev_device_get_sysname(device_parent));
break;
udev = udev_new();
if (!udev) {
- TBM_BACKEND_ERR("udev_new() failed.\n");
+ TBM_BACKEND_ERR("udev_new() failed.");
return -1;
}
if (device_parent) {
if (strcmp(udev_device_get_sysname(device_parent), "vc4-drm") == 0) {
drm_device = device;
- TBM_BACKEND_DBG("Found render device: '%s' (%s)\n",
+ TBM_BACKEND_DBG("Found render device: '%s' (%s)",
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_BACKEND_ERR("udev_device_get_devnode() failed.\n");
+ TBM_BACKEND_ERR("udev_device_get_devnode() failed.");
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_BACKEND_ERR("open(%s, O_RDWR | O_CLOEXEC) failed.\n");
+ TBM_BACKEND_ERR("open(%s, O_RDWR | O_CLOEXEC) failed.");
udev_device_unref(drm_device);
udev_unref(udev);
return -1;
ret = fstat(fd, &s);
if (ret) {
- TBM_BACKEND_ERR("fstat() failed %s.\n");
+ TBM_BACKEND_ERR("fstat() failed %s.");
udev_device_unref(drm_device);
udev_unref(udev);
close(fd);
arg.handle = bo_data->gem;
if (drmIoctl(bo_data->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg)) {
- TBM_BACKEND_ERR("Cannot map_vc4 gem=%d\n", bo_data->gem);
+ TBM_BACKEND_ERR("Cannot map_vc4 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;
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;
}
*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;
}
tbm_vc4_bo *bo_data;
if (bufmgr_data == NULL) {
- TBM_BACKEND_ERR("bufmgr is null\n");
+ TBM_BACKEND_ERR("bufmgr is null");
if (error)
*error = HAL_TBM_ERROR_INVALID_PARAMETER;
return NULL;
bo_data = calloc(1, sizeof(struct _tbm_vc4_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 = flags;/*currently no values for the flags,but it may be used in future extension*/
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)arg.size);
free(bo_data);
if (error)
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);
free(bo_data);
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
/* add bo_data 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), flags:%d, size:%d\n",
+ TBM_BACKEND_DBG(" bo_data:%p, gem:%d(%d), flags:%d, size:%d",
bo_data,
bo_data->gem, bo_data->name,
bo_data->flags_tbm,
char buf[STRERR_BUFSIZE];
if (bufmgr_data == NULL) {
- TBM_BACKEND_ERR("bufmgr is null\n");
+ TBM_BACKEND_ERR("bufmgr 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 (%s)\n",
+ TBM_BACKEND_ERR("Cannot get gem handle from fd:%d (%s)",
arg.fd, strerror_r(errno, buf, STRERR_BUFSIZE));
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
name = _get_name(bufmgr_data->fd, gem);
if (!name) {
- TBM_BACKEND_ERR("Cannot get name from gem:%d, fd:%d (%s)\n",
+ TBM_BACKEND_ERR("Cannot get name from gem:%d, fd:%d (%s)",
gem, key, strerror_r(errno, buf, STRERR_BUFSIZE));
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
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 (%s)\n",
+ TBM_BACKEND_ERR("Cannot get gem info from gem:%d, fd:%d (%s)",
gem, key, strerror_r(errno, buf, STRERR_BUFSIZE));
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
memset(&close_arg, 0, sizeof(close_arg));
close_arg.handle = open_arg.handle;
if (drmIoctl(bufmgr_data->fd, DRM_IOCTL_GEM_CLOSE, &close_arg)) {
- TBM_BACKEND_ERR("Cannot close gem_handle.\n",
+ TBM_BACKEND_ERR("Cannot close gem_handle.",
strerror_r(errno, buf, STRERR_BUFSIZE));
if (error)
*error = HAL_TBM_ERROR_INVALID_OPERATION;
bo_data = calloc(1, sizeof(struct _tbm_vc4_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 is null\n");
+ TBM_BACKEND_ERR("bufmgr 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_vc4_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_data 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, 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,
hal_tbm_surface **bos;
if (surface_data == NULL) {
- TBM_BACKEND_ERR("surface_data is null\n");
+ TBM_BACKEND_ERR("surface_data is null");
if (error)
*error = HAL_TBM_ERROR_INVALID_PARAMETER;
return NULL;
}
if (num_bos == NULL) {
- TBM_BACKEND_ERR("num_bos is null\n");
+ TBM_BACKEND_ERR("num_bos is null");
if (error)
*error = HAL_TBM_ERROR_INVALID_PARAMETER;
return NULL;
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(%s)\n",
+ TBM_BACKEND_ERR("bo_data:%p fail to munmap(%s)",
bo_data, strerror_r(errno, buf, STRERR_BUFSIZE));
}
}
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.(%s)\n",
+ TBM_BACKEND_ERR("bo_data:%p fail to gem close.(%s)",
bo_data, strerror_r(errno, buf, STRERR_BUFSIZE));
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 = _vc4_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 = _vc4_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_OPERATION;
bo_data->last_map_device = -1;
- 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 (%s)\n",
+ TBM_BACKEND_ERR("bo_data:%p Cannot dmabuf=%d (%s)",
bo_data, bo_data->gem, strerror_r(errno, buf, STRERR_BUFSIZE));
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_vc4_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_vc4_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;
}
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_vc4_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 surface_funcs */
surface_funcs = calloc(1, sizeof(struct _hal_tbm_surface_funcs));
if (!surface_funcs) {
- TBM_BACKEND_ERR("fail to alloc surface_funcs!\n");
+ TBM_BACKEND_ERR("fail to alloc surface_funcs!");
goto fail_alloc_surface_funcs;
}
backend_data->surface_funcs = surface_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_vc4_bo_export_fd;
bo_funcs->bo_export_key = tbm_vc4_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;