android_external_minigbm/rust/gbm_wrapper.h
Marcin Radomski 65742c01dd minigbm: add bindgen-generated Rust bindings
This provides the bindings necessary to use the Rust gbm crate within
Android source tree. Bindgen flags used in the rust_bindgen definition,
as well as the workaround described in wrapper.h were based on upstream
gbm-sys crate's build.rs [1].

Looking at other rust_bindgen modules, they are generally defined
alongside the native module they provide bindings to.

Details: go/drm-gbm-rust-crates-for-android

[1] 606c4260e0/gbm-sys/build.rs (L78)

Bug: b/328181805
Test: lunch aosp_cf_x86_64_only_phone-trunk_staging-userdebug && m
Test: m libgbm_sys
Change-Id: I3065f7fe35f4a86b72ac90c34476da6304155daf
2024-03-18 18:48:46 +00:00

28 lines
1.2 KiB
C

/*
* Copyright 2024 Google LLC
*/
#include <gbm.h>
// bindgen doesn't create constants for macros that expand to other macros
// https://github.com/Smithay/gbm.rs/blob/606c4260e0147256fb5c2901bbe837c0dc7d9f2d/gbm-sys/build.rs#L16
const unsigned int __BINDGEN_TMP_GBM_BO_IMPORT_WL_BUFFER = GBM_BO_IMPORT_WL_BUFFER;
#undef GBM_BO_IMPORT_WL_BUFFER
const unsigned int GBM_BO_IMPORT_WL_BUFFER = __BINDGEN_TMP_GBM_BO_IMPORT_WL_BUFFER;
#define GBM_BO_IMPORT_WL_BUFFER GBM_BO_IMPORT_WL_BUFFER
const unsigned int __BINDGEN_TMP_GBM_BO_IMPORT_EGL_IMAGE = GBM_BO_IMPORT_EGL_IMAGE;
#undef GBM_BO_IMPORT_EGL_IMAGE
const unsigned int GBM_BO_IMPORT_EGL_IMAGE = __BINDGEN_TMP_GBM_BO_IMPORT_EGL_IMAGE;
#define GBM_BO_IMPORT_EGL_IMAGE GBM_BO_IMPORT_EGL_IMAGE
const unsigned int __BINDGEN_TMP_GBM_BO_IMPORT_FD = GBM_BO_IMPORT_FD;
#undef GBM_BO_IMPORT_FD
const unsigned int GBM_BO_IMPORT_FD = __BINDGEN_TMP_GBM_BO_IMPORT_FD;
#define GBM_BO_IMPORT_FD GBM_BO_IMPORT_FD
const unsigned int __BINDGEN_TMP_GBM_BO_IMPORT_FD_MODIFIER = GBM_BO_IMPORT_FD_MODIFIER;
#undef GBM_BO_IMPORT_FD_MODIFIER
const unsigned int GBM_BO_IMPORT_FD_MODIFIER = __BINDGEN_TMP_GBM_BO_IMPORT_FD_MODIFIER;
#define GBM_BO_IMPORT_FD_MODIFIER GBM_BO_IMPORT_FD_MODIFIER