android_stub: Update platform headers to include gralloc1.h.

This header is used in anv and radv, and soon turnip.  Since the script
just checks out master, this also bumps the headers to upstream
02dfcc7c1562 ("Merge "Merge Android R"")

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6821>
This commit is contained in:
Eric Anholt 2020-09-22 10:55:53 -07:00 committed by Marge Bot
parent 72799886e7
commit e92f4ac9f4
10 changed files with 1548 additions and 55 deletions

View File

@ -27,6 +27,7 @@ cp -av platform-frameworks-native/libs/nativewindow/include/vndk \
platform-system-core/libbacktrace/include/backtrace \
platform-system-core/libsystem/include/system \
platform-system-core/liblog/include/log \
platform-frameworks-native/libs/nativewindow/include/apex \
platform-frameworks-native/libs/nativewindow/include/system \
platform-frameworks-native/libs/nativebase/include/nativebase \
${dest}
@ -35,7 +36,7 @@ cp -av platform-frameworks-native/libs/nativewindow/include/vndk \
# We only need a few files from these big directories so just copy those
mkdir ${dest}/hardware
cp -av platform-hardware-libhardware/include/hardware/{hardware,gralloc,fb}.h ${dest}/hardware
cp -av platform-hardware-libhardware/include/hardware/{hardware,gralloc,gralloc1,fb}.h ${dest}/hardware
cp -av platform-frameworks-native/vulkan/include/hardware/hwvulkan.h ${dest}/hardware
mkdir ${dest}/cutils

View File

@ -101,6 +101,56 @@ enum ADataSpace {
* Use full range, SMPTE 2084 (PQ) transfer and BT2020 standard
*/
ADATASPACE_BT2020_PQ = 163971072, // STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_FULL
/**
* Adobe RGB
*
* Use full range, gamma 2.2 transfer and Adobe RGB primaries
* Note: Application is responsible for gamma encoding the data as
* a 2.2 gamma encoding is not supported in HW.
*/
ADATASPACE_ADOBE_RGB = 151715840, // STANDARD_ADOBE_RGB | TRANSFER_GAMMA2_2 | RANGE_FULL
/**
* ITU-R Recommendation 2020 (BT.2020)
*
* Ultra High-definition television
*
* Use full range, BT.709 transfer and BT2020 standard
*/
ADATASPACE_BT2020 = 147193856, // STANDARD_BT2020 | TRANSFER_SMPTE_170M | RANGE_FULL
/**
* ITU-R Recommendation 709 (BT.709)
*
* High-definition television
*
* Use limited range, BT.709 transfer and BT.709 standard.
*/
ADATASPACE_BT709 = 281083904, // STANDARD_BT709 | TRANSFER_SMPTE_170M | RANGE_LIMITED
/**
* SMPTE EG 432-1 and SMPTE RP 431-2.
*
* Digital Cinema DCI-P3
*
* Use full range, gamma 2.6 transfer and D65 DCI-P3 standard
* Note: Application is responsible for gamma encoding the data as
* a 2.6 gamma encoding is not supported in HW.
*/
ADATASPACE_DCI_P3 = 155844608, // STANDARD_DCI_P3 | TRANSFER_GAMMA2_6 | RANGE_FULL
/**
* sRGB linear encoding:
*
* The red, green, and blue components are stored in sRGB space, but
* are linear, not gamma-encoded.
* The RGB primaries and the white point are the same as BT.709.
*
* The values are encoded using the full range ([0,255] for 8-bit) for all
* components.
*/
ADATASPACE_SRGB_LINEAR = 138477568, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_FULL
};
__END_DECLS

View File

@ -33,6 +33,7 @@
#ifndef ANDROID_NATIVE_WINDOW_H
#define ANDROID_NATIVE_WINDOW_H
#include <stdint.h>
#include <sys/cdefs.h>
#include <android/data_space.h>
@ -230,6 +231,78 @@ int32_t ANativeWindow_getBuffersDataSpace(ANativeWindow* window) __INTRODUCED_IN
#endif // __ANDROID_API__ >= 28
#if __ANDROID_API__ >= 30
/** Compatibility value for ANativeWindow_setFrameRate. */
enum ANativeWindow_FrameRateCompatibility {
/**
* There are no inherent restrictions on the frame rate of this window. When
* the system selects a frame rate other than what the app requested, the
* app will be able to run at the system frame rate without requiring pull
* down. This value should be used when displaying game content, UIs, and
* anything that isn't video.
*/
ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT = 0,
/**
* This window is being used to display content with an inherently fixed
* frame rate, e.g.\ a video that has a specific frame rate. When the system
* selects a frame rate other than what the app requested, the app will need
* to do pull down or use some other technique to adapt to the system's
* frame rate. The user experience is likely to be worse (e.g. more frame
* stuttering) than it would be if the system had chosen the app's requested
* frame rate. This value should be used for video content.
*/
ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1
};
/**
* Sets the intended frame rate for this window.
*
* On devices that are capable of running the display at different refresh
* rates, the system may choose a display refresh rate to better match this
* window's frame rate. Usage of this API won't introduce frame rate throttling,
* or affect other aspects of the application's frame production
* pipeline. However, because the system may change the display refresh rate,
* calls to this function may result in changes to Choreographer callback
* timings, and changes to the time interval at which the system releases
* buffers back to the application.
*
* Note that this only has an effect for windows presented on the display. If
* this ANativeWindow is consumed by something other than the system compositor,
* e.g. a media codec, this call has no effect.
*
* Available since API level 30.
*
* \param frameRate The intended frame rate of this window, in frames per
* second. 0 is a special value that indicates the app will accept the system's
* choice for the display frame rate, which is the default behavior if this
* function isn't called. The frameRate param does <em>not</em> need to be a
* valid refresh rate for this device's display - e.g., it's fine to pass 30fps
* to a device that can only run the display at 60fps.
*
* \param compatibility The frame rate compatibility of this window. The
* compatibility value may influence the system's choice of display refresh
* rate. See the ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_* values for more info.
*
* \return 0 for success, -EINVAL if the window, frame rate, or compatibility
* value are invalid.
*/
int32_t ANativeWindow_setFrameRate(ANativeWindow* window, float frameRate, int8_t compatibility)
__INTRODUCED_IN(30);
/**
* Provides a hint to the window that buffers should be preallocated ahead of
* time. Note that the window implementation is not guaranteed to preallocate
* any buffers, for instance if an implementation disallows allocation of new
* buffers, or if there is insufficient memory in the system to preallocate
* additional buffers
*
* Available since API level 30.
*/
void ANativeWindow_tryAllocateBuffers(ANativeWindow* window);
#endif // __ANDROID_API__ >= 30
#ifdef __cplusplus
};
#endif

View File

@ -0,0 +1,210 @@
/*
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <nativebase/nativebase.h>
#include <stdarg.h>
// apex is a superset of the NDK
#include <android/native_window.h>
__BEGIN_DECLS
/*
* perform bits that can be used with ANativeWindow_perform()
*
* This is only to support the intercepting methods below - these should notbe
* used directly otherwise.
*/
enum ANativeWindowPerform {
// clang-format off
ANATIVEWINDOW_PERFORM_SET_USAGE = 0,
ANATIVEWINDOW_PERFORM_SET_BUFFERS_GEOMETRY = 5,
ANATIVEWINDOW_PERFORM_SET_BUFFERS_FORMAT = 9,
ANATIVEWINDOW_PERFORM_SET_USAGE64 = 30,
// clang-format on
};
/**
* Prototype of the function that an ANativeWindow implementation would call
* when ANativeWindow_cancelBuffer is called.
*/
typedef int (*ANativeWindow_cancelBufferFn)(ANativeWindow* window, ANativeWindowBuffer* buffer,
int fenceFd);
/**
* Prototype of the function that intercepts an invocation of
* ANativeWindow_cancelBufferFn, along with a data pointer that's passed by the
* caller who set the interceptor, as well as arguments that would be
* passed to ANativeWindow_cancelBufferFn if it were to be called.
*/
typedef int (*ANativeWindow_cancelBufferInterceptor)(ANativeWindow* window,
ANativeWindow_cancelBufferFn cancelBuffer,
void* data, ANativeWindowBuffer* buffer,
int fenceFd);
/**
* Prototype of the function that an ANativeWindow implementation would call
* when ANativeWindow_dequeueBuffer is called.
*/
typedef int (*ANativeWindow_dequeueBufferFn)(ANativeWindow* window, ANativeWindowBuffer** buffer,
int* fenceFd);
/**
* Prototype of the function that intercepts an invocation of
* ANativeWindow_dequeueBufferFn, along with a data pointer that's passed by the
* caller who set the interceptor, as well as arguments that would be
* passed to ANativeWindow_dequeueBufferFn if it were to be called.
*/
typedef int (*ANativeWindow_dequeueBufferInterceptor)(ANativeWindow* window,
ANativeWindow_dequeueBufferFn dequeueBuffer,
void* data, ANativeWindowBuffer** buffer,
int* fenceFd);
/**
* Prototype of the function that an ANativeWindow implementation would call
* when ANativeWindow_perform is called.
*/
typedef int (*ANativeWindow_performFn)(ANativeWindow* window, int operation, va_list args);
/**
* Prototype of the function that intercepts an invocation of
* ANativeWindow_performFn, along with a data pointer that's passed by the
* caller who set the interceptor, as well as arguments that would be
* passed to ANativeWindow_performFn if it were to be called.
*/
typedef int (*ANativeWindow_performInterceptor)(ANativeWindow* window,
ANativeWindow_performFn perform, void* data,
int operation, va_list args);
/**
* Prototype of the function that an ANativeWindow implementation would call
* when ANativeWindow_queueBuffer is called.
*/
typedef int (*ANativeWindow_queueBufferFn)(ANativeWindow* window, ANativeWindowBuffer* buffer,
int fenceFd);
/**
* Prototype of the function that intercepts an invocation of
* ANativeWindow_queueBufferFn, along with a data pointer that's passed by the
* caller who set the interceptor, as well as arguments that would be
* passed to ANativeWindow_queueBufferFn if it were to be called.
*/
typedef int (*ANativeWindow_queueBufferInterceptor)(ANativeWindow* window,
ANativeWindow_queueBufferFn queueBuffer,
void* data, ANativeWindowBuffer* buffer,
int fenceFd);
/**
* Registers an interceptor for ANativeWindow_cancelBuffer. Instead of calling
* the underlying cancelBuffer function, instead the provided interceptor is
* called, which may optionally call the underlying cancelBuffer function. An
* optional data pointer is also provided to side-channel additional arguments.
*
* Note that usage of this should only be used for specialized use-cases by
* either the system partition or to Mainline modules. This should never be
* exposed to NDK or LL-NDK.
*
* Returns NO_ERROR on success, -errno if registration failed.
*/
int ANativeWindow_setCancelBufferInterceptor(ANativeWindow* window,
ANativeWindow_cancelBufferInterceptor interceptor,
void* data);
/**
* Registers an interceptor for ANativeWindow_dequeueBuffer. Instead of calling
* the underlying dequeueBuffer function, instead the provided interceptor is
* called, which may optionally call the underlying dequeueBuffer function. An
* optional data pointer is also provided to side-channel additional arguments.
*
* Note that usage of this should only be used for specialized use-cases by
* either the system partition or to Mainline modules. This should never be
* exposed to NDK or LL-NDK.
*
* Returns NO_ERROR on success, -errno if registration failed.
*/
int ANativeWindow_setDequeueBufferInterceptor(ANativeWindow* window,
ANativeWindow_dequeueBufferInterceptor interceptor,
void* data);
/**
* Registers an interceptor for ANativeWindow_perform. Instead of calling
* the underlying perform function, instead the provided interceptor is
* called, which may optionally call the underlying perform function. An
* optional data pointer is also provided to side-channel additional arguments.
*
* Note that usage of this should only be used for specialized use-cases by
* either the system partition or to Mainline modules. This should never be
* exposed to NDK or LL-NDK.
*
* Returns NO_ERROR on success, -errno if registration failed.
*/
int ANativeWindow_setPerformInterceptor(ANativeWindow* window,
ANativeWindow_performInterceptor interceptor, void* data);
/**
* Registers an interceptor for ANativeWindow_queueBuffer. Instead of calling
* the underlying queueBuffer function, instead the provided interceptor is
* called, which may optionally call the underlying queueBuffer function. An
* optional data pointer is also provided to side-channel additional arguments.
*
* Note that usage of this should only be used for specialized use-cases by
* either the system partition or to Mainline modules. This should never be
* exposed to NDK or LL-NDK.
*
* Returns NO_ERROR on success, -errno if registration failed.
*/
int ANativeWindow_setQueueBufferInterceptor(ANativeWindow* window,
ANativeWindow_queueBufferInterceptor interceptor,
void* data);
/**
* Retrieves how long it took for the last time a buffer was dequeued.
*
* \return the dequeue duration in nanoseconds
*/
int64_t ANativeWindow_getLastDequeueDuration(ANativeWindow* window);
/**
* Retrieves how long it took for the last time a buffer was queued.
*
* \return the queue duration in nanoseconds
*/
int64_t ANativeWindow_getLastQueueDuration(ANativeWindow* window);
/**
* Retrieves the system time in nanoseconds when the last time a buffer
* started to be dequeued.
*
* \return the start time in nanoseconds
*/
int64_t ANativeWindow_getLastDequeueStartTime(ANativeWindow* window);
/**
* Sets a timeout in nanoseconds for dequeue calls. All subsequent dequeue calls
* made by the window will return -ETIMEDOUT after the timeout if the dequeue
* takes too long.
*
* If the provided timeout is negative, hen this removes the previously configured
* timeout. The window then behaves as if ANativeWindow_setDequeueTimeout was
* never called.
*
* \return NO_ERROR on success
* \return BAD_VALUE if the dequeue timeout was unabled to be updated, as
* updating the dequeue timeout may change internals of the underlying window.
*/
int ANativeWindow_setDequeueTimeout(ANativeWindow* window, int64_t timeout);
__END_DECLS

File diff suppressed because it is too large Load Diff

View File

@ -39,14 +39,6 @@ EventTagMap* android_openEventTagMap(const char* fileName);
*/
void android_closeEventTagMap(EventTagMap* map);
/*
* Look up a tag by index. Returns the tag string, or NULL if not found.
*/
const char* android_lookupEventTag(const EventTagMap* map, unsigned int tag)
__attribute__((
deprecated("use android_lookupEventTag_len() instead to minimize "
"MAP_PRIVATE copy-on-write memory impact")));
/*
* Look up a tag by index. Returns the tag string & string length, or NULL if
* not found. Returned string is not guaranteed to be nul terminated.
@ -61,12 +53,6 @@ const char* android_lookupEventTag_len(const EventTagMap* map, size_t* len,
const char* android_lookupEventFormat_len(const EventTagMap* map, size_t* len,
unsigned int tag);
/*
* Look up tagname, generate one if necessary, and return a tag
*/
int android_lookupEventTagNum(EventTagMap* map, const char* tagname,
const char* format, int prio);
#ifdef __cplusplus
}
#endif

View File

@ -20,6 +20,7 @@
extern "C" {
#endif
/* Returns `1` if the device is debuggable or `0` if not. */
int __android_log_is_debuggable();
#ifdef __cplusplus

View File

@ -81,10 +81,17 @@ struct logger;
log_id_t android_logger_get_id(struct logger* logger);
/* Clears the given log buffer. */
int android_logger_clear(struct logger* logger);
/* Return the allotted size for the given log buffer. */
long android_logger_get_log_size(struct logger* logger);
/* Set the allotted size for the given log buffer. */
int android_logger_set_log_size(struct logger* logger, unsigned long size);
/* Return the actual, uncompressed size that can be read from the given log buffer. */
long android_logger_get_log_readable_size(struct logger* logger);
/* Return the actual, compressed size that the given log buffer is consuming. */
long android_logger_get_log_consumed_size(struct logger* logger);
/* Deprecated. Always returns '4' regardless of input. */
int android_logger_get_log_version(struct logger* logger);
struct logger_list;

View File

@ -34,14 +34,15 @@
#include <cutils/native_handle.h>
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <sys/cdefs.h>
#include <system/graphics.h>
#include <unistd.h>
#include <stdbool.h>
// system/window.h is a superset of the vndk
// system/window.h is a superset of the vndk and apex apis
#include <apex/window.h>
#include <vndk/window.h>
@ -62,9 +63,9 @@ __BEGIN_DECLS
/* attributes queriable with query() */
enum {
NATIVE_WINDOW_WIDTH = 0,
NATIVE_WINDOW_HEIGHT = 1,
NATIVE_WINDOW_FORMAT = 2,
NATIVE_WINDOW_WIDTH = 0,
NATIVE_WINDOW_HEIGHT = 1,
NATIVE_WINDOW_FORMAT = 2,
/* see ANativeWindowQuery in vndk/window.h */
NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS = ANATIVEWINDOW_QUERY_MIN_UNDEQUEUED_BUFFERS,
@ -92,7 +93,6 @@ enum {
*/
NATIVE_WINDOW_CONCRETE_TYPE = 5,
/*
* Default width and height of ANativeWindow buffers, these are the
* dimensions of the window buffers irrespective of the
@ -147,11 +147,15 @@ enum {
/*
* Returns the duration of the last dequeueBuffer call in microseconds
* Deprecated: please use NATIVE_WINDOW_GET_LAST_DEQUEUE_DURATION in
* perform() instead, which supports nanosecond precision.
*/
NATIVE_WINDOW_LAST_DEQUEUE_DURATION = 14,
/*
* Returns the duration of the last queueBuffer call in microseconds
* Deprecated: please use NATIVE_WINDOW_GET_LAST_QUEUE_DURATION in
* perform() instead, which supports nanosecond precision.
*/
NATIVE_WINDOW_LAST_QUEUE_DURATION = 15,
@ -203,41 +207,54 @@ enum {
*/
enum {
// clang-format off
NATIVE_WINDOW_SET_USAGE = 0, /* deprecated */
NATIVE_WINDOW_CONNECT = 1, /* deprecated */
NATIVE_WINDOW_DISCONNECT = 2, /* deprecated */
NATIVE_WINDOW_SET_CROP = 3, /* private */
NATIVE_WINDOW_SET_BUFFER_COUNT = 4,
NATIVE_WINDOW_SET_BUFFERS_GEOMETRY = 5, /* deprecated */
NATIVE_WINDOW_SET_BUFFERS_TRANSFORM = 6,
NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP = 7,
NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS = 8,
NATIVE_WINDOW_SET_BUFFERS_FORMAT = 9,
NATIVE_WINDOW_SET_SCALING_MODE = 10, /* private */
NATIVE_WINDOW_LOCK = 11, /* private */
NATIVE_WINDOW_UNLOCK_AND_POST = 12, /* private */
NATIVE_WINDOW_API_CONNECT = 13, /* private */
NATIVE_WINDOW_API_DISCONNECT = 14, /* private */
NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS = 15, /* private */
NATIVE_WINDOW_SET_POST_TRANSFORM_CROP = 16, /* deprecated, unimplemented */
NATIVE_WINDOW_SET_BUFFERS_STICKY_TRANSFORM = 17, /* private */
NATIVE_WINDOW_SET_SIDEBAND_STREAM = 18,
NATIVE_WINDOW_SET_BUFFERS_DATASPACE = 19,
NATIVE_WINDOW_SET_SURFACE_DAMAGE = 20, /* private */
NATIVE_WINDOW_SET_SHARED_BUFFER_MODE = 21,
NATIVE_WINDOW_SET_AUTO_REFRESH = 22,
NATIVE_WINDOW_GET_REFRESH_CYCLE_DURATION = 23,
NATIVE_WINDOW_GET_NEXT_FRAME_ID = 24,
NATIVE_WINDOW_ENABLE_FRAME_TIMESTAMPS = 25,
NATIVE_WINDOW_GET_COMPOSITOR_TIMING = 26,
NATIVE_WINDOW_GET_FRAME_TIMESTAMPS = 27,
NATIVE_WINDOW_GET_WIDE_COLOR_SUPPORT = 28,
NATIVE_WINDOW_GET_HDR_SUPPORT = 29,
NATIVE_WINDOW_SET_USAGE64 = 30,
NATIVE_WINDOW_GET_CONSUMER_USAGE64 = 31,
NATIVE_WINDOW_SET_BUFFERS_SMPTE2086_METADATA = 32,
NATIVE_WINDOW_SET_BUFFERS_CTA861_3_METADATA = 33,
NATIVE_WINDOW_SET_USAGE = ANATIVEWINDOW_PERFORM_SET_USAGE, /* deprecated */
NATIVE_WINDOW_CONNECT = 1, /* deprecated */
NATIVE_WINDOW_DISCONNECT = 2, /* deprecated */
NATIVE_WINDOW_SET_CROP = 3, /* private */
NATIVE_WINDOW_SET_BUFFER_COUNT = 4,
NATIVE_WINDOW_SET_BUFFERS_GEOMETRY = ANATIVEWINDOW_PERFORM_SET_BUFFERS_GEOMETRY, /* deprecated */
NATIVE_WINDOW_SET_BUFFERS_TRANSFORM = 6,
NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP = 7,
NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS = 8,
NATIVE_WINDOW_SET_BUFFERS_FORMAT = ANATIVEWINDOW_PERFORM_SET_BUFFERS_FORMAT,
NATIVE_WINDOW_SET_SCALING_MODE = 10, /* private */
NATIVE_WINDOW_LOCK = 11, /* private */
NATIVE_WINDOW_UNLOCK_AND_POST = 12, /* private */
NATIVE_WINDOW_API_CONNECT = 13, /* private */
NATIVE_WINDOW_API_DISCONNECT = 14, /* private */
NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS = 15, /* private */
NATIVE_WINDOW_SET_POST_TRANSFORM_CROP = 16, /* deprecated, unimplemented */
NATIVE_WINDOW_SET_BUFFERS_STICKY_TRANSFORM = 17, /* private */
NATIVE_WINDOW_SET_SIDEBAND_STREAM = 18,
NATIVE_WINDOW_SET_BUFFERS_DATASPACE = 19,
NATIVE_WINDOW_SET_SURFACE_DAMAGE = 20, /* private */
NATIVE_WINDOW_SET_SHARED_BUFFER_MODE = 21,
NATIVE_WINDOW_SET_AUTO_REFRESH = 22,
NATIVE_WINDOW_GET_REFRESH_CYCLE_DURATION = 23,
NATIVE_WINDOW_GET_NEXT_FRAME_ID = 24,
NATIVE_WINDOW_ENABLE_FRAME_TIMESTAMPS = 25,
NATIVE_WINDOW_GET_COMPOSITOR_TIMING = 26,
NATIVE_WINDOW_GET_FRAME_TIMESTAMPS = 27,
NATIVE_WINDOW_GET_WIDE_COLOR_SUPPORT = 28,
NATIVE_WINDOW_GET_HDR_SUPPORT = 29,
NATIVE_WINDOW_SET_USAGE64 = ANATIVEWINDOW_PERFORM_SET_USAGE64,
NATIVE_WINDOW_GET_CONSUMER_USAGE64 = 31,
NATIVE_WINDOW_SET_BUFFERS_SMPTE2086_METADATA = 32,
NATIVE_WINDOW_SET_BUFFERS_CTA861_3_METADATA = 33,
NATIVE_WINDOW_SET_BUFFERS_HDR10_PLUS_METADATA = 34,
NATIVE_WINDOW_SET_AUTO_PREROTATION = 35,
NATIVE_WINDOW_GET_LAST_DEQUEUE_START = 36, /* private */
NATIVE_WINDOW_SET_DEQUEUE_TIMEOUT = 37, /* private */
NATIVE_WINDOW_GET_LAST_DEQUEUE_DURATION = 38, /* private */
NATIVE_WINDOW_GET_LAST_QUEUE_DURATION = 39, /* private */
NATIVE_WINDOW_SET_FRAME_RATE = 40,
NATIVE_WINDOW_SET_CANCEL_INTERCEPTOR = 41, /* private */
NATIVE_WINDOW_SET_DEQUEUE_INTERCEPTOR = 42, /* private */
NATIVE_WINDOW_SET_PERFORM_INTERCEPTOR = 43, /* private */
NATIVE_WINDOW_SET_QUEUE_INTERCEPTOR = 44, /* private */
NATIVE_WINDOW_ALLOCATE_BUFFERS = 45, /* private */
NATIVE_WINDOW_GET_LAST_QUEUED_BUFFER = 46, /* private */
NATIVE_WINDOW_SET_QUERY_INTERCEPTOR = 47, /* private */
// clang-format on
};
@ -985,4 +1002,99 @@ static inline int native_window_get_consumer_usage(struct ANativeWindow* window,
return window->perform(window, NATIVE_WINDOW_GET_CONSUMER_USAGE64, outUsage);
}
/*
* native_window_set_auto_prerotation(..., autoPrerotation)
* Enable/disable the auto prerotation at buffer allocation when the buffer size
* is driven by the consumer.
*
* When buffer size is driven by the consumer and the transform hint specifies
* a 90 or 270 degree rotation, if auto prerotation is enabled, the width and
* height used for dequeueBuffer will be additionally swapped.
*/
static inline int native_window_set_auto_prerotation(struct ANativeWindow* window,
bool autoPrerotation) {
return window->perform(window, NATIVE_WINDOW_SET_AUTO_PREROTATION, autoPrerotation);
}
static inline int native_window_set_frame_rate(struct ANativeWindow* window, float frameRate,
int8_t compatibility) {
return window->perform(window, NATIVE_WINDOW_SET_FRAME_RATE, (double)frameRate,
(int)compatibility);
}
// ------------------------------------------------------------------------------------------------
// Candidates for APEX visibility
// These functions are planned to be made stable for APEX modules, but have not
// yet been stabilized to a specific api version.
// ------------------------------------------------------------------------------------------------
/**
* Retrieves the last queued buffer for this window, along with the fence that
* fires when the buffer is ready to be read, and the 4x4 coordinate
* transform matrix that should be applied to the buffer's content. The
* transform matrix is represented in column-major order.
*
* If there was no buffer previously queued, then outBuffer will be NULL and
* the value of outFence will be -1.
*
* Note that if outBuffer is not NULL, then the caller will hold a reference
* onto the buffer. Accordingly, the caller must call AHardwareBuffer_release
* when the buffer is no longer needed so that the system may reclaim the
* buffer.
*
* \return NO_ERROR on success.
* \return NO_MEMORY if there was insufficient memory.
*/
static inline int ANativeWindow_getLastQueuedBuffer(ANativeWindow* window,
AHardwareBuffer** outBuffer, int* outFence,
float outTransformMatrix[16]) {
return window->perform(window, NATIVE_WINDOW_GET_LAST_QUEUED_BUFFER, outBuffer, outFence,
outTransformMatrix);
}
/**
* Retrieves an identifier for the next frame to be queued by this window.
*
* \return the next frame id.
*/
static inline int64_t ANativeWindow_getNextFrameId(ANativeWindow* window) {
int64_t value;
window->perform(window, NATIVE_WINDOW_GET_NEXT_FRAME_ID, &value);
return value;
}
/**
* Prototype of the function that an ANativeWindow implementation would call
* when ANativeWindow_query is called.
*/
typedef int (*ANativeWindow_queryFn)(const ANativeWindow* window, int what, int* value);
/**
* Prototype of the function that intercepts an invocation of
* ANativeWindow_queryFn, along with a data pointer that's passed by the
* caller who set the interceptor, as well as arguments that would be
* passed to ANativeWindow_queryFn if it were to be called.
*/
typedef int (*ANativeWindow_queryInterceptor)(const ANativeWindow* window,
ANativeWindow_queryFn perform, void* data,
int what, int* value);
/**
* Registers an interceptor for ANativeWindow_query. Instead of calling
* the underlying query function, instead the provided interceptor is
* called, which may optionally call the underlying query function. An
* optional data pointer is also provided to side-channel additional arguments.
*
* Note that usage of this should only be used for specialized use-cases by
* either the system partition or to Mainline modules. This should never be
* exposed to NDK or LL-NDK.
*
* Returns NO_ERROR on success, -errno if registration failed.
*/
static inline int ANativeWindow_setQueryInterceptor(ANativeWindow* window,
ANativeWindow_queryInterceptor interceptor,
void* data) {
return window->perform(window, NATIVE_WINDOW_SET_QUERY_INTERCEPTOR, interceptor, data);
}
__END_DECLS

View File

@ -316,6 +316,15 @@ int ANativeWindow_setSharedBufferMode(ANativeWindow* window, bool sharedBufferMo
*/
int ANativeWindow_setAutoRefresh(ANativeWindow* window, bool autoRefresh);
/*
* Enable/disable the auto prerotation at buffer allocation when the buffer size
* is driven by the consumer.
*
* When buffer size is driven by the consumer and the transform hint specifies
* a 90 or 270 degree rotation, if auto prerotation is enabled, the width and
* height used for dequeueBuffer will be additionally swapped.
*/
int ANativeWindow_setAutoPrerotation(ANativeWindow* window, bool autoPrerotation);
/*****************************************************************************/