vulkan: fix glibc AOSP build

Certain AOSP targets feature a glibc or musl-based build,
where (__ANDROID__) isn't defined, but:

- ANDROID is defined
- the relevant headers are present.

For such builds, buffer_handle_t shouldn't be defined
internally.

Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31030>
This commit is contained in:
Gurchetan Singh
2024-09-03 15:31:46 -07:00
committed by Marge Bot
parent 6378bbaa82
commit bcc1950886

View File

@@ -1,5 +1,23 @@
/* MESA: A hack to avoid #ifdefs in driver code. */
#ifdef __ANDROID__
/*
* MESA: buffer_handle_t is defined by all Mesa builds, even if
* one is building for a non-Android target. This avoids unnecessary
* conditionals in driver code.
*
* We don't need to define buffer_handle_t locally when (__ANDROID__)
* or ANDROID are set. Here's the distinction between the two:
*
* - AOSP always defines ANDROID, since it just means one is using the
* AOSP tree. It means the build environment is Android, roughly.
* - __ANDROID__ is defined by the toolchain. This typically means the
* build target is Android.
*
* If the build environment is Android, AOSP can provide common Android
* headers, such as <cutils/native_handle.h>. This allows one to build
* and test certain aspects of Android window system code, on the host
* system rather the build target.
*/
#if defined(__ANDROID__) || defined(ANDROID)
#include <cutils/native_handle.h>
#if ANDROID_API_LEVEL < 28