minigbm: Fix consistency in return values
minigbm functions don't use errno; however drmIoctl does. So we need to return -errno instead of returning exactly what drmIoctl returns. BUG=none TEST=builds Change-Id: I20e00141782ac1407133ee72259fe43381954d26 Reviewed-on: https://chromium-review.googlesource.com/1534878 Commit-Ready: Stéphane Marchesin <marcheu@chromium.org> Tested-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This commit is contained in:
parent
cc35e699f3
commit
6ac299f3d3
9 changed files with 18 additions and 13 deletions
1
exynos.c
1
exynos.c
|
|
@ -73,6 +73,7 @@ static int exynos_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint
|
||||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_EXYNOS_GEM_CREATE, &gem_create);
|
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_EXYNOS_GEM_CREATE, &gem_create);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_EXYNOS_GEM_CREATE failed (size=%zu)\n", size);
|
drv_log("DRM_IOCTL_EXYNOS_GEM_CREATE failed (size=%zu)\n", size);
|
||||||
|
ret = -errno;
|
||||||
goto cleanup_planes;
|
goto cleanup_planes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,7 @@ int drv_dumb_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t
|
||||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_dumb);
|
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_dumb);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_MODE_CREATE_DUMB failed (%d, %d)\n", bo->drv->fd, errno);
|
drv_log("DRM_IOCTL_MODE_CREATE_DUMB failed (%d, %d)\n", bo->drv->fd, errno);
|
||||||
return ret;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
drv_bo_from_format(bo, create_dumb.pitch, height, format);
|
drv_bo_from_format(bo, create_dumb.pitch, height, format);
|
||||||
|
|
@ -313,7 +313,7 @@ int drv_dumb_bo_destroy(struct bo *bo)
|
||||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
|
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_MODE_DESTROY_DUMB failed (handle=%x)\n", bo->handles[0].u32);
|
drv_log("DRM_IOCTL_MODE_DESTROY_DUMB failed (handle=%x)\n", bo->handles[0].u32);
|
||||||
return ret;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -340,7 +340,7 @@ int drv_gem_bo_destroy(struct bo *bo)
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_GEM_CLOSE failed (handle=%x) error %d\n",
|
drv_log("DRM_IOCTL_GEM_CLOSE failed (handle=%x) error %d\n",
|
||||||
bo->handles[plane].u32, ret);
|
bo->handles[plane].u32, ret);
|
||||||
error = ret;
|
error = -errno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -370,7 +370,7 @@ int drv_prime_bo_import(struct bo *bo, struct drv_import_fd_data *data)
|
||||||
*/
|
*/
|
||||||
bo->num_planes = plane;
|
bo->num_planes = plane;
|
||||||
drv_gem_bo_destroy(bo);
|
drv_gem_bo_destroy(bo);
|
||||||
return ret;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
bo->handles[plane].u32 = prime_handle.handle;
|
bo->handles[plane].u32 = prime_handle.handle;
|
||||||
|
|
|
||||||
2
i915.c
2
i915.c
|
|
@ -384,7 +384,7 @@ static int i915_bo_create_for_modifier(struct bo *bo, uint32_t width, uint32_t h
|
||||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_I915_GEM_CREATE, &gem_create);
|
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_I915_GEM_CREATE, &gem_create);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_I915_GEM_CREATE failed (size=%llu)\n", gem_create.size);
|
drv_log("DRM_IOCTL_I915_GEM_CREATE failed (size=%llu)\n", gem_create.size);
|
||||||
return ret;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (plane = 0; plane < bo->num_planes; plane++)
|
for (plane = 0; plane < bo->num_planes; plane++)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#ifdef DRV_MEDIATEK
|
#ifdef DRV_MEDIATEK
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -81,7 +82,7 @@ static int mediatek_bo_create(struct bo *bo, uint32_t width, uint32_t height, ui
|
||||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MTK_GEM_CREATE, &gem_create);
|
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MTK_GEM_CREATE, &gem_create);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_MTK_GEM_CREATE failed (size=%llu)\n", gem_create.size);
|
drv_log("DRM_IOCTL_MTK_GEM_CREATE failed (size=%llu)\n", gem_create.size);
|
||||||
return ret;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (plane = 0; plane < bo->num_planes; plane++)
|
for (plane = 0; plane < bo->num_planes; plane++)
|
||||||
|
|
|
||||||
2
msm.c
2
msm.c
|
|
@ -204,7 +204,7 @@ static int msm_bo_create_for_modifier(struct bo *bo, uint32_t width, uint32_t he
|
||||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MSM_GEM_NEW, &req);
|
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MSM_GEM_NEW, &req);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_MSM_GEM_NEW failed with %s\n", strerror(errno));
|
drv_log("DRM_IOCTL_MSM_GEM_NEW failed with %s\n", strerror(errno));
|
||||||
return ret;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ static int rockchip_bo_create_with_modifiers(struct bo *bo, uint32_t width, uint
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_ROCKCHIP_GEM_CREATE failed (size=%llu)\n",
|
drv_log("DRM_IOCTL_ROCKCHIP_GEM_CREATE failed (size=%llu)\n",
|
||||||
(unsigned long long)gem_create.size);
|
(unsigned long long)gem_create.size);
|
||||||
return ret;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (plane = 0; plane < bo->num_planes; plane++)
|
for (plane = 0; plane < bo->num_planes; plane++)
|
||||||
|
|
|
||||||
5
tegra.c
5
tegra.c
|
|
@ -7,6 +7,7 @@
|
||||||
#ifdef DRV_TEGRA
|
#ifdef DRV_TEGRA
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
@ -229,7 +230,7 @@ static int tegra_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint3
|
||||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_TEGRA_GEM_CREATE, &gem_create);
|
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_TEGRA_GEM_CREATE, &gem_create);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_TEGRA_GEM_CREATE failed (size=%zu)\n", size);
|
drv_log("DRM_IOCTL_TEGRA_GEM_CREATE failed (size=%zu)\n", size);
|
||||||
return ret;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
bo->handles[0].u32 = gem_create.handle;
|
bo->handles[0].u32 = gem_create.handle;
|
||||||
|
|
@ -276,7 +277,7 @@ static int tegra_bo_import(struct bo *bo, struct drv_import_fd_data *data)
|
||||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_TEGRA_GEM_GET_TILING, &gem_get_tiling);
|
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_TEGRA_GEM_GET_TILING, &gem_get_tiling);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_gem_bo_destroy(bo);
|
drv_gem_bo_destroy(bo);
|
||||||
return ret;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTE(djmk): we only know about one tiled format, so if our drmIoctl call tells us we are
|
/* NOTE(djmk): we only know about one tiled format, so if our drmIoctl call tells us we are
|
||||||
|
|
|
||||||
3
vc4.c
3
vc4.c
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#ifdef DRV_VC4
|
#ifdef DRV_VC4
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
@ -49,7 +50,7 @@ static int vc4_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_
|
||||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_VC4_CREATE_BO, &bo_create);
|
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_VC4_CREATE_BO, &bo_create);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_VC4_GEM_CREATE failed (size=%zu)\n", bo->total_size);
|
drv_log("DRM_IOCTL_VC4_GEM_CREATE failed (size=%zu)\n", bo->total_size);
|
||||||
return ret;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (plane = 0; plane < bo->num_planes; plane++)
|
for (plane = 0; plane < bo->num_planes; plane++)
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ static int virtio_virgl_bo_create(struct bo *bo, uint32_t width, uint32_t height
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_VIRTGPU_RESOURCE_CREATE failed with %s\n",
|
drv_log("DRM_IOCTL_VIRTGPU_RESOURCE_CREATE failed with %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
ret = -errno;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -251,7 +252,7 @@ static int virtio_gpu_bo_invalidate(struct bo *bo, struct mapping *mapping)
|
||||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST, &xfer);
|
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST, &xfer);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST failed with %s\n", strerror(errno));
|
drv_log("DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST failed with %s\n", strerror(errno));
|
||||||
return ret;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -280,7 +281,7 @@ static int virtio_gpu_bo_flush(struct bo *bo, struct mapping *mapping)
|
||||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST, &xfer);
|
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST, &xfer);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
drv_log("DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST failed with %s\n", strerror(errno));
|
drv_log("DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST failed with %s\n", strerror(errno));
|
||||||
return ret;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue