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 <dbehr@chromium.org>
Commit-Queue: Marcin Radomski <dextero@google.com>
Tested-by: Marcin Radomski <dextero@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This commit is contained in:
Marcin Radomski 2024-03-07 12:08:08 +00:00 committed by Chromeos LUCI
parent e950d82ae2
commit 3b508e145f
2 changed files with 6 additions and 6 deletions

6
gbm.c
View file

@ -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);
}

6
gbm.h
View file

@ -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);