From 3b508e145f1acfd3895daab0089ebd54cd924bb2 Mon Sep 17 00:00:00 2001 From: Marcin Radomski Date: Thu, 7 Mar 2024 12:08:08 +0000 Subject: [PATCH] minigbm: use int instead of size_t for plane index Rationale: this will help get Rust gbm bindings into Android (go/drm-gbm-rust-crates-for-android) without needing minigbm-specific patches to upstream Rust code. Mesa gbm defines the plane argument for some functions as int rather than size_t. While this doesn't bother C/C++ compilers too much, attempting to use bindgen-generated Rust bindings to minigbm with gbm Rust crate[1] fails. [1] https://crates.io/crates/gbm Bug: 328363177 Test: cros build-packages --board=amd64-generic minigbm drm-tests Change-Id: I5938633e0936bf1b9aafb856bfb966ceb1fb1a2b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5352370 Reviewed-by: Dominik Behr Commit-Queue: Marcin Radomski Tested-by: Marcin Radomski Reviewed-by: Gurchetan Singh --- gbm.c | 6 +++--- gbm.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gbm.c b/gbm.c index cf14ac4..b432b38 100644 --- a/gbm.c +++ b/gbm.c @@ -330,7 +330,7 @@ PUBLIC int gbm_bo_get_plane_count(struct gbm_bo *bo) return drv_bo_get_num_planes(bo->bo); } -PUBLIC union gbm_bo_handle gbm_bo_get_handle_for_plane(struct gbm_bo *bo, size_t plane) +PUBLIC union gbm_bo_handle gbm_bo_get_handle_for_plane(struct gbm_bo *bo, int plane) { return (union gbm_bo_handle)drv_bo_get_plane_handle(bo->bo, (size_t)plane).u64; } @@ -340,12 +340,12 @@ PUBLIC int gbm_bo_get_fd_for_plane(struct gbm_bo *bo, int plane) return drv_bo_get_plane_fd(bo->bo, plane); } -PUBLIC uint32_t gbm_bo_get_offset(struct gbm_bo *bo, size_t plane) +PUBLIC uint32_t gbm_bo_get_offset(struct gbm_bo *bo, int plane) { return drv_bo_get_plane_offset(bo->bo, (size_t)plane); } -PUBLIC uint32_t gbm_bo_get_stride_for_plane(struct gbm_bo *bo, size_t plane) +PUBLIC uint32_t gbm_bo_get_stride_for_plane(struct gbm_bo *bo, int plane) { return drv_bo_get_plane_stride(bo->bo, (size_t)plane); } diff --git a/gbm.h b/gbm.h index 5216899..ab614f7 100644 --- a/gbm.h +++ b/gbm.h @@ -434,7 +434,7 @@ uint32_t gbm_bo_get_stride(struct gbm_bo *bo); uint32_t -gbm_bo_get_stride_for_plane(struct gbm_bo *bo, size_t plane); +gbm_bo_get_stride_for_plane(struct gbm_bo *bo, int plane); uint32_t gbm_bo_get_format(struct gbm_bo *bo); @@ -443,7 +443,7 @@ uint32_t gbm_bo_get_bpp(struct gbm_bo *bo); uint32_t -gbm_bo_get_offset(struct gbm_bo *bo, size_t plane); +gbm_bo_get_offset(struct gbm_bo *bo, int plane); struct gbm_device * gbm_bo_get_device(struct gbm_bo *bo); @@ -461,7 +461,7 @@ int gbm_bo_get_plane_count(struct gbm_bo *bo); union gbm_bo_handle -gbm_bo_get_handle_for_plane(struct gbm_bo *bo, size_t plane); +gbm_bo_get_handle_for_plane(struct gbm_bo *bo, int plane); int gbm_bo_get_fd_for_plane(struct gbm_bo *bo, int plane);