From 9a01ec830ba1eeff575eddd925d1845494000dec Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 29 Mar 2018 20:47:46 +0900 Subject: use TBM_ERROR_INVALID_OPERATION Change-Id: I71e899a32134a753e44378a196c068b34d9539d2 --- src/tbm_bufmgr_vc4.c | 58 ++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/tbm_bufmgr_vc4.c b/src/tbm_bufmgr_vc4.c index cd28dfc..d1f7d4e 100644 --- a/src/tbm_bufmgr_vc4.c +++ b/src/tbm_bufmgr_vc4.c @@ -971,7 +971,7 @@ tbm_vc4_bufmgr_bind_native_display(tbm_backend_bufmgr_data *bufmgr_data, tbm_nat if (!tbm_drm_helper_wl_auth_server_init(native_display, bufmgr_vc4->fd, bufmgr_vc4->device_name, 0)) { TBM_ERR("fail to tbm_drm_helper_wl_server_init\n"); - return TBM_ERROR_OPERATION_FAILED; + return TBM_ERROR_INVALID_OPERATION; } bufmgr_vc4->bind_display = native_display; @@ -1316,7 +1316,7 @@ tbm_vc4_bufmgr_alloc_bo(tbm_backend_bufmgr_data *bufmgr_data, unsigned int size, (unsigned int)arg.size); free(bo_vc4); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; return NULL; } @@ -1330,7 +1330,7 @@ tbm_vc4_bufmgr_alloc_bo(tbm_backend_bufmgr_data *bufmgr_data, unsigned int size, TBM_ERR("fail init cache state(%d)\n", bo_vc4->name); free(bo_vc4); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; return NULL; } @@ -1344,7 +1344,7 @@ tbm_vc4_bufmgr_alloc_bo(tbm_backend_bufmgr_data *bufmgr_data, unsigned int size, TBM_ERR("Cannot dmabuf=%d\n", bo_vc4->gem); free(bo_vc4); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; return NULL; } bo_vc4->dmabuf = arg.fd; @@ -1392,7 +1392,7 @@ tbm_vc4_bufmgr_import_fd(tbm_backend_bufmgr_data *bufmgr_data, tbm_fd key, tbm_e 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; + *error = TBM_ERROR_INVALID_OPERATION; return NULL; } gem = arg.handle; @@ -1402,7 +1402,7 @@ tbm_vc4_bufmgr_import_fd(tbm_backend_bufmgr_data *bufmgr_data, tbm_fd key, tbm_e 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; + *error = TBM_ERROR_INVALID_OPERATION; return NULL; } @@ -1431,7 +1431,7 @@ tbm_vc4_bufmgr_import_fd(tbm_backend_bufmgr_data *bufmgr_data, tbm_fd key, tbm_e 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; + *error = TBM_ERROR_INVALID_OPERATION; return NULL; } @@ -1443,7 +1443,7 @@ tbm_vc4_bufmgr_import_fd(tbm_backend_bufmgr_data *bufmgr_data, tbm_fd key, tbm_e TBM_ERR("Cannot close gem_handle.\n", strerror_r(errno, buf, STRERR_BUFSIZE)); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; return NULL; } @@ -1469,7 +1469,7 @@ tbm_vc4_bufmgr_import_fd(tbm_backend_bufmgr_data *bufmgr_data, tbm_fd key, tbm_e TBM_ERR("fail init cache state(%d)\n", bo_vc4->name); free(bo_vc4); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; return NULL; } @@ -1519,7 +1519,7 @@ tbm_vc4_bufmgr_import_key(tbm_backend_bufmgr_data *bufmgr_data, tbm_key key, tbm if (drmIoctl(bufmgr_vc4->fd, DRM_IOCTL_GEM_OPEN, &arg)) { TBM_ERR("Cannot open gem name=%d\n", key); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; return NULL; } @@ -1542,7 +1542,7 @@ tbm_vc4_bufmgr_import_key(tbm_backend_bufmgr_data *bufmgr_data, tbm_key key, tbm TBM_ERR("fail init cache state(%d)\n", bo_vc4->name); free(bo_vc4); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; return NULL; } @@ -1553,7 +1553,7 @@ tbm_vc4_bufmgr_import_key(tbm_backend_bufmgr_data *bufmgr_data, tbm_key key, tbm if (drmIoctl(bo_vc4->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &arg)) { TBM_ERR("fail to DRM_IOCTL_PRIME_HANDLE_TO_FD gem=%d\n", bo_vc4->gem); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; free(bo_vc4); return NULL; } @@ -1703,7 +1703,7 @@ tbm_vc4_bo_get_handle(tbm_backend_bo_data *bo_data, tbm_bo_device_type device, t TBM_ERR("Cannot get handle: gem:%d, device:%d\n", bo_vc4->gem, device); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; return (tbm_bo_handle) NULL; } @@ -1754,7 +1754,7 @@ tbm_vc4_bo_map(tbm_backend_bo_data *bo_data, tbm_bo_device_type device, TBM_ERR("Cannot get handle: gem:%d, device:%d, opt:%d\n", bo_vc4->gem, device, opt); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; return (tbm_bo_handle) NULL; } @@ -1828,7 +1828,7 @@ tbm_vc4_bo_lock(tbm_backend_bo_data *bo_data, tbm_bo_device_type device, if (device != TBM_DEVICE_3D && device != TBM_DEVICE_CPU) { TBM_DBG("Not support device type,\n"); - return TBM_ERROR_OPERATION_FAILED; + return TBM_ERROR_INVALID_OPERATION; } memset(&fence, 0, sizeof(struct dma_buf_fence)); @@ -1848,7 +1848,7 @@ tbm_vc4_bo_lock(tbm_backend_bo_data *bo_data, tbm_bo_device_type device, /* Check if the tbm manager supports dma fence or not. */ if (!bufmgr_vc4->use_dma_fence) { TBM_ERR("Not support DMA FENCE(%s)\n", strerror_r(errno, buf, STRERR_BUFSIZE)); - return TBM_ERROR_OPERATION_FAILED; + return TBM_ERROR_INVALID_OPERATION; } @@ -1856,7 +1856,7 @@ tbm_vc4_bo_lock(tbm_backend_bo_data *bo_data, tbm_bo_device_type device, ret = ioctl(bo_vc4->dmabuf, DMABUF_IOCTL_GET_FENCE, &fence); if (ret < 0) { TBM_ERR("Cannot set GET FENCE(%s)\n", strerror_r(errno, buf, STRERR_BUFSIZE)); - return TBM_ERROR_OPERATION_FAILED; + return TBM_ERROR_INVALID_OPERATION; } } else { if (opt & TBM_OPTION_WRITE) @@ -1869,7 +1869,7 @@ tbm_vc4_bo_lock(tbm_backend_bo_data *bo_data, tbm_bo_device_type device, filelock.l_len = 0; if (-1 == fcntl(bo_vc4->dmabuf, F_SETLKW, &filelock)) - return TBM_ERROR_OPERATION_FAILED; + return TBM_ERROR_INVALID_OPERATION; } pthread_mutex_lock(&bo_vc4->mutex); @@ -1922,12 +1922,12 @@ tbm_vc4_bo_unlock(tbm_backend_bo_data *bo_data) if (!bo_vc4->dma_fence[0].ctx && dma_type) { TBM_DBG("FENCE not support or ignored,\n"); - return TBM_ERROR_OPERATION_FAILED; + return TBM_ERROR_INVALID_OPERATION; } if (!bo_vc4->dma_fence[0].ctx && dma_type) { TBM_DBG("device type is not 3D/CPU,\n"); - return TBM_ERROR_OPERATION_FAILED; + return TBM_ERROR_INVALID_OPERATION; } pthread_mutex_lock(&bo_vc4->mutex); @@ -1951,7 +1951,7 @@ tbm_vc4_bo_unlock(tbm_backend_bo_data *bo_data) ret = ioctl(bo_vc4->dmabuf, DMABUF_IOCTL_PUT_FENCE, &fence); if (ret < 0) { TBM_ERR("Can not set PUT FENCE(%s)\n", strerror_r(errno, buf, STRERR_BUFSIZE)); - return TBM_ERROR_OPERATION_FAILED; + return TBM_ERROR_INVALID_OPERATION; } } else { filelock.l_type = F_UNLCK; @@ -1960,7 +1960,7 @@ tbm_vc4_bo_unlock(tbm_backend_bo_data *bo_data) filelock.l_len = 0; if (-1 == fcntl(bo_vc4->dmabuf, F_SETLKW, &filelock)) - return TBM_ERROR_OPERATION_FAILED; + return TBM_ERROR_INVALID_OPERATION; } TBM_DBG("DMABUF_IOCTL_PUT_FENCE! bo_vc4:%p, gem:%d(%d), fd:%ds\n", @@ -1993,7 +1993,7 @@ tbm_vc4_bo_export_fd(tbm_backend_bo_data *bo_data, tbm_error_e *error) TBM_ERR("bo_vc4:%p Cannot dmabuf=%d (%s)\n", bo_vc4, bo_vc4->gem, strerror_r(errno, buf, STRERR_BUFSIZE)); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; return (tbm_fd) ret; } @@ -2120,7 +2120,7 @@ tbm_vc4_init(tbm_bufmgr bufmgr, tbm_error_e *error) if (bufmgr_vc4->fd < 0) { TBM_ERR("fail to open drm!\n"); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; goto fail_open_drm; } } @@ -2132,7 +2132,7 @@ tbm_vc4_init(tbm_bufmgr bufmgr, tbm_error_e *error) TBM_ERR("fail to get device name!\n"); tbm_drm_helper_unset_tbm_master_fd(); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; goto fail_get_device_name; } tbm_drm_helper_set_fd(bufmgr_vc4->fd); @@ -2142,7 +2142,7 @@ tbm_vc4_init(tbm_bufmgr bufmgr, tbm_error_e *error) if (bufmgr_vc4->fd < 0) { TBM_ERR("fail to get render node\n"); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; goto fail_get_render_node; } TBM_DBG("Use render node:%d\n", bufmgr_vc4->fd); @@ -2150,7 +2150,7 @@ tbm_vc4_init(tbm_bufmgr bufmgr, tbm_error_e *error) if (!tbm_drm_helper_get_auth_info(&(bufmgr_vc4->fd), &(bufmgr_vc4->device_name), NULL)) { TBM_ERR("fail to get auth drm info!\n"); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; goto fail_get_auth_info; } tbm_drm_helper_set_fd(bufmgr_vc4->fd); @@ -2200,7 +2200,7 @@ tbm_vc4_init(tbm_bufmgr bufmgr, tbm_error_e *error) if (err != TBM_ERROR_NONE) { TBM_ERR("fail to register bufmgr_func! err(%d)\n", err); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; goto fail_register_bufmgr_func; } bufmgr_vc4->bufmgr_func = bufmgr_func; @@ -2229,7 +2229,7 @@ tbm_vc4_init(tbm_bufmgr bufmgr, tbm_error_e *error) if (err != TBM_ERROR_NONE) { TBM_ERR("fail to register bo_func! err(%d)\n", err); if (error) - *error = TBM_ERROR_OPERATION_FAILED; + *error = TBM_ERROR_INVALID_OPERATION; goto fail_register_bo_func; } bufmgr_vc4->bo_func = bo_func; -- cgit v1.2.3