diff options
-rw-r--r-- | include/android/surface_control.h | 42 | ||||
-rw-r--r-- | include/android/thermal.h | 2 | ||||
-rw-r--r-- | services/gpuservice/gpuwork/bpfprogs/Android.bp | 2 |
3 files changed, 39 insertions, 7 deletions
diff --git a/include/android/surface_control.h b/include/android/surface_control.h index 0765e01004..665d9c6db0 100644 --- a/include/android/surface_control.h +++ b/include/android/surface_control.h @@ -369,6 +369,28 @@ void ASurfaceTransaction_setColor(ASurfaceTransaction* _Nonnull transaction, float b, float alpha, enum ADataSpace dataspace) __INTRODUCED_IN(29); +// These APIs (setGeometry and setCrop) were originally written in a +// C-incompatible form using references instead of pointers, and the OS shipped +// that version for years before it was noticed. Fortunately the compiled code +// for callers is the same regardless of whether it's a pointer or a reference, +// so we can declare this as a nonnull pointer for C and keep the existing C++ +// decl and definition. +// +// We could alternatively change the decl and the definition to both be a +// pointer (with an inline definition using references to preserve source compat +// for existing C++ callers), but that requires changing the definition of an +// API that has been in the OS for years. It's theoretically a safe change, but +// without being able to prove it that's a very big risk to take. By keeping the +// C-compatibility hack in the header, we can be sure that we haven't changed +// anything for existing callers. By definition there were no C users of the +// reference-based decl; if there were any C callers of the API at all, they were +// using the same workaround that is now used below. +// +// Even if this workaround turns out to not work for C, there's no permanent +// damage done to the platform (unlike if we were to change the definition). At +// worst it continues to work for C++ (since the preprocessed header as seen by +// C++ hasn't changed, nor has the definition) and continues to not work for C. + /** * \param source The sub-rect within the buffer's content to be rendered inside the surface's area * The surface's source rect is clipped by the bounds of its current buffer. The source rect's width @@ -379,7 +401,7 @@ void ASurfaceTransaction_setColor(ASurfaceTransaction* _Nonnull transaction, * clipped by the bounds of its parent. The destination rect's width and height must be > 0. * * \param transform The transform applied after the source rect is applied to the buffer. This - * parameter should be set to 0 for no transform. To specify a transfrom use the + * parameter should be set to 0 for no transform. To specify a transform use the * NATIVE_WINDOW_TRANSFORM_* enum. * * Available since API level 29. @@ -390,9 +412,14 @@ void ASurfaceTransaction_setColor(ASurfaceTransaction* _Nonnull transaction, * properties at once. */ void ASurfaceTransaction_setGeometry(ASurfaceTransaction* _Nonnull transaction, - ASurfaceControl* _Nonnull surface_control, const ARect& source, - const ARect& destination, int32_t transform) - __INTRODUCED_IN(29); + ASurfaceControl* _Nonnull surface_control, +#if defined(__cplusplus) + const ARect& source, const ARect& destination, +#else + const ARect* _Nonnull source, + const ARect* _Nonnull destination, +#endif + int32_t transform) __INTRODUCED_IN(29); /** * Bounds the surface and its children to the bounds specified. The crop and buffer size will be @@ -404,7 +431,12 @@ void ASurfaceTransaction_setGeometry(ASurfaceTransaction* _Nonnull transaction, * Available since API level 31. */ void ASurfaceTransaction_setCrop(ASurfaceTransaction* _Nonnull transaction, - ASurfaceControl* _Nonnull surface_control, const ARect& crop) + ASurfaceControl* _Nonnull surface_control, +#if defined(__cplusplus) + const ARect& crop) +#else + const ARect* _Nonnull crop) +#endif __INTRODUCED_IN(31); /** diff --git a/include/android/thermal.h b/include/android/thermal.h index fa168cdecb..7f9d2edfc7 100644 --- a/include/android/thermal.h +++ b/include/android/thermal.h @@ -85,6 +85,7 @@ enum AThermalStatus { /** Need shutdown immediately. */ ATHERMAL_STATUS_SHUTDOWN = 6, }; +typedef enum AThermalStatus AThermalStatus; /** * An opaque type representing a handle to a thermal manager. @@ -240,6 +241,7 @@ struct AThermalHeadroomThreshold { float headroom; AThermalStatus thermalStatus; }; +typedef struct AThermalHeadroomThreshold AThermalHeadroomThreshold; /** * Gets the thermal headroom thresholds for all available thermal status. diff --git a/services/gpuservice/gpuwork/bpfprogs/Android.bp b/services/gpuservice/gpuwork/bpfprogs/Android.bp index 8e872fb950..2e444fefa9 100644 --- a/services/gpuservice/gpuwork/bpfprogs/Android.bp +++ b/services/gpuservice/gpuwork/bpfprogs/Android.bp @@ -19,8 +19,6 @@ package { bpf { name: "gpuWork.o", srcs: ["gpuWork.c"], - // Without btf disabled, presubmits will fail. - btf: false, cflags: [ "-Wthread-safety", "-Wunreachable-code", |