From 46d8ea7d6541a0090e6007f4647097a42c49b356 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Wed, 12 Jul 2023 15:40:33 +0900 Subject: Remove define USE_DMAIMPORT and STRERR_BUFSIZE Change-Id: I6dba51898d6c7606735dd524037e4581934af097 --- src/tbm_backend_dumb.c | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/src/tbm_backend_dumb.c b/src/tbm_backend_dumb.c index b3bbd2c..64abcf0 100644 --- a/src/tbm_backend_dumb.c +++ b/src/tbm_backend_dumb.c @@ -53,11 +53,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include "tbm_backend_log.h" -#define USE_DMAIMPORT #define TBM_COLOR_FORMAT_COUNT 4 -#define STRERR_BUFSIZE 128 - #define SIZE_ALIGN(value, base) (((value) + ((base) - 1)) & ~((base) - 1)) #define TBM_SURFACE_ALIGNMENT_PLANE (64) @@ -351,7 +348,6 @@ _dumb_bo_handle(tbm_dumb_bo *bo_data, int device) bo_handle.ptr = (void *)bo_data->pBase; break; case HAL_TBM_DEVICE_3D: -#ifdef USE_DMAIMPORT if (!bo_data->dmabuf) { struct drm_prime_handle arg = {0, }; @@ -364,7 +360,6 @@ _dumb_bo_handle(tbm_dumb_bo *bo_data, int device) } bo_handle.u32 = (uint32_t)bo_data->dmabuf; -#endif break; case HAL_TBM_DEVICE_MM: if (!bo_data->dmabuf) { @@ -768,7 +763,6 @@ tbm_dumb_bufmgr_import_fd(hal_tbm_bufmgr *bufmgr, hal_tbm_fd key, hal_tbm_error unsigned int gem = 0; unsigned int name; int ret; - char buf[STRERR_BUFSIZE]; if (bufmgr_data == NULL) { TBM_BACKEND_ERR("bufmgr_data is null\n"); @@ -783,8 +777,8 @@ tbm_dumb_bufmgr_import_fd(hal_tbm_bufmgr *bufmgr, hal_tbm_fd key, hal_tbm_error 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", - arg.fd, strerror_r(errno, buf, STRERR_BUFSIZE)); + TBM_BACKEND_ERR("Cannot get gem handle from fd:%d (%m)\n", + arg.fd); if (error) *error = HAL_TBM_ERROR_INVALID_OPERATION; return NULL; @@ -793,8 +787,8 @@ tbm_dumb_bufmgr_import_fd(hal_tbm_bufmgr *bufmgr, hal_tbm_fd key, hal_tbm_error name = _get_name(bufmgr_data->fd, gem); if (name == 0) { - TBM_BACKEND_ERR("Cannot get name from gem:%d, fd:%d (%s)\n", - gem, key, strerror_r(errno, buf, STRERR_BUFSIZE)); + TBM_BACKEND_ERR("Cannot get name from gem:%d, fd:%d (%m)\n", + gem, key); if (error) *error = HAL_TBM_ERROR_INVALID_OPERATION; return NULL; @@ -822,8 +816,8 @@ tbm_dumb_bufmgr_import_fd(hal_tbm_bufmgr *bufmgr, hal_tbm_fd key, hal_tbm_error /* 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 (%s)\n", - gem, key, strerror_r(errno, buf, STRERR_BUFSIZE)); + TBM_BACKEND_ERR("Cannot get gem info from gem:%d, fd:%d (%m)\n", + gem, key); if (error) *error = HAL_TBM_ERROR_INVALID_OPERATION; return NULL; @@ -833,8 +827,7 @@ tbm_dumb_bufmgr_import_fd(hal_tbm_bufmgr *bufmgr, hal_tbm_fd key, hal_tbm_error 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.\n", - strerror_r(errno, buf, STRERR_BUFSIZE)); + TBM_BACKEND_ERR("Cannot close gem_handle (%m)\n"); if (error) *error = HAL_TBM_ERROR_INVALID_OPERATION; return NULL; @@ -963,7 +956,6 @@ tbm_dumb_bo_free(hal_tbm_bo *bo) tbm_dumb_bo *bo_data = (tbm_dumb_bo *)bo; tbm_dumb_bo *temp; tbm_dumb_bufmgr *bufmgr_data; - char buf[STRERR_BUFSIZE]; int ret; if (!bo_data) @@ -981,8 +973,8 @@ tbm_dumb_bo_free(hal_tbm_bo *bo) if (bo_data->pBase) { if (munmap(bo_data->pBase, bo_data->size) == -1) { - TBM_BACKEND_ERR("bo_data:%p fail to munmap(%s)\n", - bo_data, strerror_r(errno, buf, STRERR_BUFSIZE)); + TBM_BACKEND_ERR("bo_data:%p fail to munmap (%m)\n", + bo_data); } } @@ -1008,8 +1000,8 @@ tbm_dumb_bo_free(hal_tbm_bo *bo) 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", - bo_data, strerror_r(errno, buf, STRERR_BUFSIZE)); + TBM_BACKEND_ERR("bo_data:%p fail to gem close (%m)\n", + bo_data); free(bo_data); } @@ -1176,7 +1168,6 @@ tbm_dumb_bo_lock(hal_tbm_bo *bo, hal_tbm_bo_device_type device, struct dma_buf_fence fence; struct flock filelock; int ret = 0; - char buf[STRERR_BUFSIZE]; if (!bo_data) return HAL_TBM_ERROR_INVALID_PARAMETER; @@ -1209,14 +1200,14 @@ tbm_dumb_bo_lock(hal_tbm_bo *bo, hal_tbm_bo_device_type device, /* Check if the tbm manager supports dma fence or not. */ if (!bufmgr_data->use_dma_fence) { - TBM_BACKEND_ERR("Not support DMA FENCE(%s)\n", strerror_r(errno, buf, STRERR_BUFSIZE)); + TBM_BACKEND_ERR("Not support DMA FENCE (%m)\n"); return HAL_TBM_ERROR_INVALID_OPERATION; } if (device == HAL_TBM_DEVICE_3D) { ret = ioctl(bo_data->dmabuf, DMABUF_IOCTL_GET_FENCE, &fence); if (ret < 0) { - TBM_BACKEND_ERR("Cannot set GET FENCE(%s)\n", strerror_r(errno, buf, STRERR_BUFSIZE)); + TBM_BACKEND_ERR("Cannot set GET FENCE (%m)\n"); return HAL_TBM_ERROR_INVALID_OPERATION; } } else { @@ -1272,7 +1263,6 @@ tbm_dumb_bo_unlock(hal_tbm_bo *bo) struct flock filelock; unsigned int dma_type = 0; int ret = 0; - char buf[STRERR_BUFSIZE]; bufmgr_data = bo_data->bufmgr_data; if (!bufmgr_data) @@ -1313,7 +1303,7 @@ tbm_dumb_bo_unlock(hal_tbm_bo *bo) if (dma_type) { ret = ioctl(bo_data->dmabuf, DMABUF_IOCTL_PUT_FENCE, &fence); if (ret < 0) { - TBM_BACKEND_ERR("Can not set PUT FENCE(%s)\n", strerror_r(errno, buf, STRERR_BUFSIZE)); + TBM_BACKEND_ERR("Can not set PUT FENCE (%m)\n"); return HAL_TBM_ERROR_INVALID_OPERATION; } } else { @@ -1340,7 +1330,6 @@ tbm_dumb_bo_export_fd(hal_tbm_bo *bo, hal_tbm_error *error) { tbm_dumb_bo *bo_data = (tbm_dumb_bo *)bo; int ret; - char buf[STRERR_BUFSIZE]; if (!bo_data) { if (error) @@ -1353,8 +1342,8 @@ tbm_dumb_bo_export_fd(hal_tbm_bo *bo, hal_tbm_error *error) 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", - bo_data, bo_data->gem, strerror_r(errno, buf, STRERR_BUFSIZE)); + TBM_BACKEND_ERR("bo_data:%p Cannot dmabuf=%d (%m)\n", + bo_data, bo_data->gem); if (error) *error = HAL_TBM_ERROR_INVALID_OPERATION; return (hal_tbm_fd)ret; -- cgit v1.2.3