ci: Include enough Android headers to let us compile test EGL
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
This commit is contained in:

committed by
Marge Bot

parent
5ae7098eba
commit
932f51d593
307
include/android_stub/system/camera.h
Normal file
307
include/android_stub/system/camera.h
Normal file
@@ -0,0 +1,307 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#ifndef SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H
|
||||
#define SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <cutils/native_handle.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/gralloc.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* A set of bit masks for specifying how the received preview frames are
|
||||
* handled before the previewCallback() call.
|
||||
*
|
||||
* The least significant 3 bits of an "int" value are used for this purpose:
|
||||
*
|
||||
* ..... 0 0 0
|
||||
* ^ ^ ^
|
||||
* | | |---------> determine whether the callback is enabled or not
|
||||
* | |-----------> determine whether the callback is one-shot or not
|
||||
* |-------------> determine whether the frame is copied out or not
|
||||
*
|
||||
* WARNING: When a frame is sent directly without copying, it is the frame
|
||||
* receiver's responsiblity to make sure that the frame data won't get
|
||||
* corrupted by subsequent preview frames filled by the camera. This flag is
|
||||
* recommended only when copying out data brings significant performance price
|
||||
* and the handling/processing of the received frame data is always faster than
|
||||
* the preview frame rate so that data corruption won't occur.
|
||||
*
|
||||
* For instance,
|
||||
* 1. 0x00 disables the callback. In this case, copy out and one shot bits
|
||||
* are ignored.
|
||||
* 2. 0x01 enables a callback without copying out the received frames. A
|
||||
* typical use case is the Camcorder application to avoid making costly
|
||||
* frame copies.
|
||||
* 3. 0x05 is enabling a callback with frame copied out repeatedly. A typical
|
||||
* use case is the Camera application.
|
||||
* 4. 0x07 is enabling a callback with frame copied out only once. A typical
|
||||
* use case is the Barcode scanner application.
|
||||
*/
|
||||
|
||||
enum {
|
||||
CAMERA_FRAME_CALLBACK_FLAG_ENABLE_MASK = 0x01,
|
||||
CAMERA_FRAME_CALLBACK_FLAG_ONE_SHOT_MASK = 0x02,
|
||||
CAMERA_FRAME_CALLBACK_FLAG_COPY_OUT_MASK = 0x04,
|
||||
/** Typical use cases */
|
||||
CAMERA_FRAME_CALLBACK_FLAG_NOOP = 0x00,
|
||||
CAMERA_FRAME_CALLBACK_FLAG_CAMCORDER = 0x01,
|
||||
CAMERA_FRAME_CALLBACK_FLAG_CAMERA = 0x05,
|
||||
CAMERA_FRAME_CALLBACK_FLAG_BARCODE_SCANNER = 0x07
|
||||
};
|
||||
|
||||
/** msgType in notifyCallback and dataCallback functions */
|
||||
enum {
|
||||
CAMERA_MSG_ERROR = 0x0001, // notifyCallback
|
||||
CAMERA_MSG_SHUTTER = 0x0002, // notifyCallback
|
||||
CAMERA_MSG_FOCUS = 0x0004, // notifyCallback
|
||||
CAMERA_MSG_ZOOM = 0x0008, // notifyCallback
|
||||
CAMERA_MSG_PREVIEW_FRAME = 0x0010, // dataCallback
|
||||
CAMERA_MSG_VIDEO_FRAME = 0x0020, // data_timestamp_callback
|
||||
CAMERA_MSG_POSTVIEW_FRAME = 0x0040, // dataCallback
|
||||
CAMERA_MSG_RAW_IMAGE = 0x0080, // dataCallback
|
||||
CAMERA_MSG_COMPRESSED_IMAGE = 0x0100, // dataCallback
|
||||
CAMERA_MSG_RAW_IMAGE_NOTIFY = 0x0200, // dataCallback
|
||||
// Preview frame metadata. This can be combined with
|
||||
// CAMERA_MSG_PREVIEW_FRAME in dataCallback. For example, the apps can
|
||||
// request FRAME and METADATA. Or the apps can request only FRAME or only
|
||||
// METADATA.
|
||||
CAMERA_MSG_PREVIEW_METADATA = 0x0400, // dataCallback
|
||||
// Notify on autofocus start and stop. This is useful in continuous
|
||||
// autofocus - FOCUS_MODE_CONTINUOUS_VIDEO and FOCUS_MODE_CONTINUOUS_PICTURE.
|
||||
CAMERA_MSG_FOCUS_MOVE = 0x0800, // notifyCallback
|
||||
CAMERA_MSG_ALL_MSGS = 0xFFFF
|
||||
};
|
||||
|
||||
/** cmdType in sendCommand functions */
|
||||
enum {
|
||||
CAMERA_CMD_START_SMOOTH_ZOOM = 1,
|
||||
CAMERA_CMD_STOP_SMOOTH_ZOOM = 2,
|
||||
|
||||
/**
|
||||
* Set the clockwise rotation of preview display (setPreviewDisplay) in
|
||||
* degrees. This affects the preview frames and the picture displayed after
|
||||
* snapshot. This method is useful for portrait mode applications. Note
|
||||
* that preview display of front-facing cameras is flipped horizontally
|
||||
* before the rotation, that is, the image is reflected along the central
|
||||
* vertical axis of the camera sensor. So the users can see themselves as
|
||||
* looking into a mirror.
|
||||
*
|
||||
* This does not affect the order of byte array of
|
||||
* CAMERA_MSG_PREVIEW_FRAME, CAMERA_MSG_VIDEO_FRAME,
|
||||
* CAMERA_MSG_POSTVIEW_FRAME, CAMERA_MSG_RAW_IMAGE, or
|
||||
* CAMERA_MSG_COMPRESSED_IMAGE. This is allowed to be set during preview
|
||||
* since API level 14.
|
||||
*/
|
||||
CAMERA_CMD_SET_DISPLAY_ORIENTATION = 3,
|
||||
|
||||
/**
|
||||
* cmdType to disable/enable shutter sound. In sendCommand passing arg1 =
|
||||
* 0 will disable, while passing arg1 = 1 will enable the shutter sound.
|
||||
*/
|
||||
CAMERA_CMD_ENABLE_SHUTTER_SOUND = 4,
|
||||
|
||||
/* cmdType to play recording sound */
|
||||
CAMERA_CMD_PLAY_RECORDING_SOUND = 5,
|
||||
|
||||
/**
|
||||
* Start the face detection. This should be called after preview is started.
|
||||
* The camera will notify the listener of CAMERA_MSG_FACE and the detected
|
||||
* faces in the preview frame. The detected faces may be the same as the
|
||||
* previous ones. Apps should call CAMERA_CMD_STOP_FACE_DETECTION to stop
|
||||
* the face detection. This method is supported if CameraParameters
|
||||
* KEY_MAX_NUM_HW_DETECTED_FACES or KEY_MAX_NUM_SW_DETECTED_FACES is
|
||||
* bigger than 0. Hardware and software face detection should not be running
|
||||
* at the same time. If the face detection has started, apps should not send
|
||||
* this again.
|
||||
*
|
||||
* In hardware face detection mode, CameraParameters KEY_WHITE_BALANCE,
|
||||
* KEY_FOCUS_AREAS and KEY_METERING_AREAS have no effect.
|
||||
*
|
||||
* arg1 is the face detection type. It can be CAMERA_FACE_DETECTION_HW or
|
||||
* CAMERA_FACE_DETECTION_SW. If the type of face detection requested is not
|
||||
* supported, the HAL must return BAD_VALUE.
|
||||
*/
|
||||
CAMERA_CMD_START_FACE_DETECTION = 6,
|
||||
|
||||
/**
|
||||
* Stop the face detection.
|
||||
*/
|
||||
CAMERA_CMD_STOP_FACE_DETECTION = 7,
|
||||
|
||||
/**
|
||||
* Enable/disable focus move callback (CAMERA_MSG_FOCUS_MOVE). Passing
|
||||
* arg1 = 0 will disable, while passing arg1 = 1 will enable the callback.
|
||||
*/
|
||||
CAMERA_CMD_ENABLE_FOCUS_MOVE_MSG = 8,
|
||||
|
||||
/**
|
||||
* Ping camera service to see if camera hardware is released.
|
||||
*
|
||||
* When any camera method returns error, the client can use ping command
|
||||
* to see if the camera has been taken away by other clients. If the result
|
||||
* is OK, it means the camera hardware is not released. If the result
|
||||
* is not OK, the camera has been released and the existing client
|
||||
* can silently finish itself or show a dialog.
|
||||
*/
|
||||
CAMERA_CMD_PING = 9,
|
||||
|
||||
/**
|
||||
* Configure the number of video buffers used for recording. The intended
|
||||
* video buffer count for recording is passed as arg1, which must be
|
||||
* greater than 0. This command must be sent before recording is started.
|
||||
* This command returns INVALID_OPERATION error if it is sent after video
|
||||
* recording is started, or the command is not supported at all. This
|
||||
* command also returns a BAD_VALUE error if the intended video buffer
|
||||
* count is non-positive or too big to be realized.
|
||||
*/
|
||||
CAMERA_CMD_SET_VIDEO_BUFFER_COUNT = 10,
|
||||
|
||||
/**
|
||||
* Configure an explicit format to use for video recording metadata mode.
|
||||
* This can be used to switch the format from the
|
||||
* default IMPLEMENTATION_DEFINED gralloc format to some other
|
||||
* device-supported format, and the default dataspace from the BT_709 color
|
||||
* space to some other device-supported dataspace. arg1 is the HAL pixel
|
||||
* format, and arg2 is the HAL dataSpace. This command returns
|
||||
* INVALID_OPERATION error if it is sent after video recording is started,
|
||||
* or the command is not supported at all.
|
||||
*
|
||||
* If the gralloc format is set to a format other than
|
||||
* IMPLEMENTATION_DEFINED, then HALv3 devices will use gralloc usage flags
|
||||
* of SW_READ_OFTEN.
|
||||
*/
|
||||
CAMERA_CMD_SET_VIDEO_FORMAT = 11
|
||||
};
|
||||
|
||||
/** camera fatal errors */
|
||||
enum {
|
||||
CAMERA_ERROR_UNKNOWN = 1,
|
||||
/**
|
||||
* Camera was released because another client has connected to the camera.
|
||||
* The original client should call Camera::disconnect immediately after
|
||||
* getting this notification. Otherwise, the camera will be released by
|
||||
* camera service in a short time. The client should not call any method
|
||||
* (except disconnect and sending CAMERA_CMD_PING) after getting this.
|
||||
*/
|
||||
CAMERA_ERROR_RELEASED = 2,
|
||||
|
||||
/**
|
||||
* Camera was released because device policy change or the client application
|
||||
* is going to background. The client should call Camera::disconnect
|
||||
* immediately after getting this notification. Otherwise, the camera will be
|
||||
* released by camera service in a short time. The client should not call any
|
||||
* method (except disconnect and sending CAMERA_CMD_PING) after getting this.
|
||||
*/
|
||||
CAMERA_ERROR_DISABLED = 3,
|
||||
CAMERA_ERROR_SERVER_DIED = 100
|
||||
};
|
||||
|
||||
enum {
|
||||
/** The facing of the camera is opposite to that of the screen. */
|
||||
CAMERA_FACING_BACK = 0,
|
||||
/** The facing of the camera is the same as that of the screen. */
|
||||
CAMERA_FACING_FRONT = 1,
|
||||
/**
|
||||
* The facing of the camera is not fixed relative to the screen.
|
||||
* The cameras with this facing are external cameras, e.g. USB cameras.
|
||||
*/
|
||||
CAMERA_FACING_EXTERNAL = 2
|
||||
};
|
||||
|
||||
enum {
|
||||
/** Hardware face detection. It does not use much CPU. */
|
||||
CAMERA_FACE_DETECTION_HW = 0,
|
||||
/**
|
||||
* Software face detection. It uses some CPU. Applications must use
|
||||
* Camera.setPreviewTexture for preview in this mode.
|
||||
*/
|
||||
CAMERA_FACE_DETECTION_SW = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* The information of a face from camera face detection.
|
||||
*/
|
||||
typedef struct camera_face {
|
||||
/**
|
||||
* Bounds of the face [left, top, right, bottom]. (-1000, -1000) represents
|
||||
* the top-left of the camera field of view, and (1000, 1000) represents the
|
||||
* bottom-right of the field of view. The width and height cannot be 0 or
|
||||
* negative. This is supported by both hardware and software face detection.
|
||||
*
|
||||
* The direction is relative to the sensor orientation, that is, what the
|
||||
* sensor sees. The direction is not affected by the rotation or mirroring
|
||||
* of CAMERA_CMD_SET_DISPLAY_ORIENTATION.
|
||||
*/
|
||||
int32_t rect[4];
|
||||
|
||||
/**
|
||||
* The confidence level of the face. The range is 1 to 100. 100 is the
|
||||
* highest confidence. This is supported by both hardware and software
|
||||
* face detection.
|
||||
*/
|
||||
int32_t score;
|
||||
|
||||
/**
|
||||
* An unique id per face while the face is visible to the tracker. If
|
||||
* the face leaves the field-of-view and comes back, it will get a new
|
||||
* id. If the value is 0, id is not supported.
|
||||
*/
|
||||
int32_t id;
|
||||
|
||||
/**
|
||||
* The coordinates of the center of the left eye. The range is -1000 to
|
||||
* 1000. -2000, -2000 if this is not supported.
|
||||
*/
|
||||
int32_t left_eye[2];
|
||||
|
||||
/**
|
||||
* The coordinates of the center of the right eye. The range is -1000 to
|
||||
* 1000. -2000, -2000 if this is not supported.
|
||||
*/
|
||||
int32_t right_eye[2];
|
||||
|
||||
/**
|
||||
* The coordinates of the center of the mouth. The range is -1000 to 1000.
|
||||
* -2000, -2000 if this is not supported.
|
||||
*/
|
||||
int32_t mouth[2];
|
||||
|
||||
} camera_face_t;
|
||||
|
||||
/**
|
||||
* The metadata of the frame data.
|
||||
*/
|
||||
typedef struct camera_frame_metadata {
|
||||
/**
|
||||
* The number of detected faces in the frame.
|
||||
*/
|
||||
int32_t number_of_faces;
|
||||
|
||||
/**
|
||||
* An array of the detected faces. The length is number_of_faces.
|
||||
*/
|
||||
camera_face_t *faces;
|
||||
} camera_frame_metadata_t;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H */
|
140
include/android_stub/system/graphics-base-v1.0.h
Normal file
140
include/android_stub/system/graphics-base-v1.0.h
Normal file
@@ -0,0 +1,140 @@
|
||||
// This file is autogenerated by hidl-gen. Do not edit manually.
|
||||
// Source: android.hardware.graphics.common@1.0
|
||||
// Location: hardware/interfaces/graphics/common/1.0/
|
||||
|
||||
#ifndef HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_COMMON_V1_0_EXPORTED_CONSTANTS_H_
|
||||
#define HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_COMMON_V1_0_EXPORTED_CONSTANTS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
HAL_PIXEL_FORMAT_RGBA_8888 = 1,
|
||||
HAL_PIXEL_FORMAT_RGBX_8888 = 2,
|
||||
HAL_PIXEL_FORMAT_RGB_888 = 3,
|
||||
HAL_PIXEL_FORMAT_RGB_565 = 4,
|
||||
HAL_PIXEL_FORMAT_BGRA_8888 = 5,
|
||||
HAL_PIXEL_FORMAT_YCBCR_422_SP = 16,
|
||||
HAL_PIXEL_FORMAT_YCRCB_420_SP = 17,
|
||||
HAL_PIXEL_FORMAT_YCBCR_422_I = 20,
|
||||
HAL_PIXEL_FORMAT_RGBA_FP16 = 22,
|
||||
HAL_PIXEL_FORMAT_RAW16 = 32,
|
||||
HAL_PIXEL_FORMAT_BLOB = 33,
|
||||
HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 34,
|
||||
HAL_PIXEL_FORMAT_YCBCR_420_888 = 35,
|
||||
HAL_PIXEL_FORMAT_RAW_OPAQUE = 36,
|
||||
HAL_PIXEL_FORMAT_RAW10 = 37,
|
||||
HAL_PIXEL_FORMAT_RAW12 = 38,
|
||||
HAL_PIXEL_FORMAT_RGBA_1010102 = 43,
|
||||
HAL_PIXEL_FORMAT_Y8 = 538982489,
|
||||
HAL_PIXEL_FORMAT_Y16 = 540422489,
|
||||
HAL_PIXEL_FORMAT_YV12 = 842094169,
|
||||
} android_pixel_format_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_TRANSFORM_FLIP_H = 1, // (1 << 0)
|
||||
HAL_TRANSFORM_FLIP_V = 2, // (1 << 1)
|
||||
HAL_TRANSFORM_ROT_90 = 4, // (1 << 2)
|
||||
HAL_TRANSFORM_ROT_180 = 3, // (FLIP_H | FLIP_V)
|
||||
HAL_TRANSFORM_ROT_270 = 7, // ((FLIP_H | FLIP_V) | ROT_90)
|
||||
} android_transform_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_DATASPACE_UNKNOWN = 0,
|
||||
HAL_DATASPACE_ARBITRARY = 1,
|
||||
HAL_DATASPACE_STANDARD_SHIFT = 16,
|
||||
HAL_DATASPACE_STANDARD_MASK = 4128768, // (63 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_STANDARD_UNSPECIFIED = 0, // (0 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_STANDARD_BT709 = 65536, // (1 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_STANDARD_BT601_625 = 131072, // (2 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_STANDARD_BT601_625_UNADJUSTED = 196608, // (3 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_STANDARD_BT601_525 = 262144, // (4 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_STANDARD_BT601_525_UNADJUSTED = 327680, // (5 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_STANDARD_BT2020 = 393216, // (6 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_STANDARD_BT2020_CONSTANT_LUMINANCE = 458752, // (7 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_STANDARD_BT470M = 524288, // (8 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_STANDARD_FILM = 589824, // (9 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_STANDARD_DCI_P3 = 655360, // (10 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_STANDARD_ADOBE_RGB = 720896, // (11 << STANDARD_SHIFT)
|
||||
HAL_DATASPACE_TRANSFER_SHIFT = 22,
|
||||
HAL_DATASPACE_TRANSFER_MASK = 130023424, // (31 << TRANSFER_SHIFT)
|
||||
HAL_DATASPACE_TRANSFER_UNSPECIFIED = 0, // (0 << TRANSFER_SHIFT)
|
||||
HAL_DATASPACE_TRANSFER_LINEAR = 4194304, // (1 << TRANSFER_SHIFT)
|
||||
HAL_DATASPACE_TRANSFER_SRGB = 8388608, // (2 << TRANSFER_SHIFT)
|
||||
HAL_DATASPACE_TRANSFER_SMPTE_170M = 12582912, // (3 << TRANSFER_SHIFT)
|
||||
HAL_DATASPACE_TRANSFER_GAMMA2_2 = 16777216, // (4 << TRANSFER_SHIFT)
|
||||
HAL_DATASPACE_TRANSFER_GAMMA2_6 = 20971520, // (5 << TRANSFER_SHIFT)
|
||||
HAL_DATASPACE_TRANSFER_GAMMA2_8 = 25165824, // (6 << TRANSFER_SHIFT)
|
||||
HAL_DATASPACE_TRANSFER_ST2084 = 29360128, // (7 << TRANSFER_SHIFT)
|
||||
HAL_DATASPACE_TRANSFER_HLG = 33554432, // (8 << TRANSFER_SHIFT)
|
||||
HAL_DATASPACE_RANGE_SHIFT = 27,
|
||||
HAL_DATASPACE_RANGE_MASK = 939524096, // (7 << RANGE_SHIFT)
|
||||
HAL_DATASPACE_RANGE_UNSPECIFIED = 0, // (0 << RANGE_SHIFT)
|
||||
HAL_DATASPACE_RANGE_FULL = 134217728, // (1 << RANGE_SHIFT)
|
||||
HAL_DATASPACE_RANGE_LIMITED = 268435456, // (2 << RANGE_SHIFT)
|
||||
HAL_DATASPACE_RANGE_EXTENDED = 402653184, // (3 << RANGE_SHIFT)
|
||||
HAL_DATASPACE_SRGB_LINEAR = 512,
|
||||
HAL_DATASPACE_V0_SRGB_LINEAR = 138477568, // ((STANDARD_BT709 | TRANSFER_LINEAR) | RANGE_FULL)
|
||||
HAL_DATASPACE_V0_SCRGB_LINEAR =
|
||||
406913024, // ((STANDARD_BT709 | TRANSFER_LINEAR) | RANGE_EXTENDED)
|
||||
HAL_DATASPACE_SRGB = 513,
|
||||
HAL_DATASPACE_V0_SRGB = 142671872, // ((STANDARD_BT709 | TRANSFER_SRGB) | RANGE_FULL)
|
||||
HAL_DATASPACE_V0_SCRGB = 411107328, // ((STANDARD_BT709 | TRANSFER_SRGB) | RANGE_EXTENDED)
|
||||
HAL_DATASPACE_JFIF = 257,
|
||||
HAL_DATASPACE_V0_JFIF = 146931712, // ((STANDARD_BT601_625 | TRANSFER_SMPTE_170M) | RANGE_FULL)
|
||||
HAL_DATASPACE_BT601_625 = 258,
|
||||
HAL_DATASPACE_V0_BT601_625 =
|
||||
281149440, // ((STANDARD_BT601_625 | TRANSFER_SMPTE_170M) | RANGE_LIMITED)
|
||||
HAL_DATASPACE_BT601_525 = 259,
|
||||
HAL_DATASPACE_V0_BT601_525 =
|
||||
281280512, // ((STANDARD_BT601_525 | TRANSFER_SMPTE_170M) | RANGE_LIMITED)
|
||||
HAL_DATASPACE_BT709 = 260,
|
||||
HAL_DATASPACE_V0_BT709 = 281083904, // ((STANDARD_BT709 | TRANSFER_SMPTE_170M) | RANGE_LIMITED)
|
||||
HAL_DATASPACE_DCI_P3_LINEAR = 139067392, // ((STANDARD_DCI_P3 | TRANSFER_LINEAR) | RANGE_FULL)
|
||||
HAL_DATASPACE_DCI_P3 = 155844608, // ((STANDARD_DCI_P3 | TRANSFER_GAMMA2_6) | RANGE_FULL)
|
||||
HAL_DATASPACE_DISPLAY_P3_LINEAR =
|
||||
139067392, // ((STANDARD_DCI_P3 | TRANSFER_LINEAR) | RANGE_FULL)
|
||||
HAL_DATASPACE_DISPLAY_P3 = 143261696, // ((STANDARD_DCI_P3 | TRANSFER_SRGB) | RANGE_FULL)
|
||||
HAL_DATASPACE_ADOBE_RGB = 151715840, // ((STANDARD_ADOBE_RGB | TRANSFER_GAMMA2_2) | RANGE_FULL)
|
||||
HAL_DATASPACE_BT2020_LINEAR = 138805248, // ((STANDARD_BT2020 | TRANSFER_LINEAR) | RANGE_FULL)
|
||||
HAL_DATASPACE_BT2020 = 147193856, // ((STANDARD_BT2020 | TRANSFER_SMPTE_170M) | RANGE_FULL)
|
||||
HAL_DATASPACE_BT2020_PQ = 163971072, // ((STANDARD_BT2020 | TRANSFER_ST2084) | RANGE_FULL)
|
||||
HAL_DATASPACE_DEPTH = 4096,
|
||||
HAL_DATASPACE_SENSOR = 4097,
|
||||
} android_dataspace_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_COLOR_MODE_NATIVE = 0,
|
||||
HAL_COLOR_MODE_STANDARD_BT601_625 = 1,
|
||||
HAL_COLOR_MODE_STANDARD_BT601_625_UNADJUSTED = 2,
|
||||
HAL_COLOR_MODE_STANDARD_BT601_525 = 3,
|
||||
HAL_COLOR_MODE_STANDARD_BT601_525_UNADJUSTED = 4,
|
||||
HAL_COLOR_MODE_STANDARD_BT709 = 5,
|
||||
HAL_COLOR_MODE_DCI_P3 = 6,
|
||||
HAL_COLOR_MODE_SRGB = 7,
|
||||
HAL_COLOR_MODE_ADOBE_RGB = 8,
|
||||
HAL_COLOR_MODE_DISPLAY_P3 = 9,
|
||||
} android_color_mode_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_COLOR_TRANSFORM_IDENTITY = 0,
|
||||
HAL_COLOR_TRANSFORM_ARBITRARY_MATRIX = 1,
|
||||
HAL_COLOR_TRANSFORM_VALUE_INVERSE = 2,
|
||||
HAL_COLOR_TRANSFORM_GRAYSCALE = 3,
|
||||
HAL_COLOR_TRANSFORM_CORRECT_PROTANOPIA = 4,
|
||||
HAL_COLOR_TRANSFORM_CORRECT_DEUTERANOPIA = 5,
|
||||
HAL_COLOR_TRANSFORM_CORRECT_TRITANOPIA = 6,
|
||||
} android_color_transform_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_HDR_DOLBY_VISION = 1,
|
||||
HAL_HDR_HDR10 = 2,
|
||||
HAL_HDR_HLG = 3,
|
||||
} android_hdr_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_COMMON_V1_0_EXPORTED_CONSTANTS_H_
|
48
include/android_stub/system/graphics-base-v1.1.h
Normal file
48
include/android_stub/system/graphics-base-v1.1.h
Normal file
@@ -0,0 +1,48 @@
|
||||
// This file is autogenerated by hidl-gen. Do not edit manually.
|
||||
// Source: android.hardware.graphics.common@1.1
|
||||
// Location: hardware/interfaces/graphics/common/1.1/
|
||||
|
||||
#ifndef HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_COMMON_V1_1_EXPORTED_CONSTANTS_H_
|
||||
#define HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_COMMON_V1_1_EXPORTED_CONSTANTS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
HAL_PIXEL_FORMAT_DEPTH_16 = 48,
|
||||
HAL_PIXEL_FORMAT_DEPTH_24 = 49,
|
||||
HAL_PIXEL_FORMAT_DEPTH_24_STENCIL_8 = 50,
|
||||
HAL_PIXEL_FORMAT_DEPTH_32F = 51,
|
||||
HAL_PIXEL_FORMAT_DEPTH_32F_STENCIL_8 = 52,
|
||||
HAL_PIXEL_FORMAT_STENCIL_8 = 53,
|
||||
HAL_PIXEL_FORMAT_YCBCR_P010 = 54,
|
||||
} android_pixel_format_v1_1_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_DATASPACE_BT2020_ITU =
|
||||
281411584, // ((STANDARD_BT2020 | TRANSFER_SMPTE_170M) | RANGE_LIMITED)
|
||||
HAL_DATASPACE_BT2020_ITU_PQ =
|
||||
298188800, // ((STANDARD_BT2020 | TRANSFER_ST2084) | RANGE_LIMITED)
|
||||
HAL_DATASPACE_BT2020_ITU_HLG = 302383104, // ((STANDARD_BT2020 | TRANSFER_HLG) | RANGE_LIMITED)
|
||||
HAL_DATASPACE_BT2020_HLG = 168165376, // ((STANDARD_BT2020 | TRANSFER_HLG) | RANGE_FULL)
|
||||
} android_dataspace_v1_1_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_COLOR_MODE_BT2020 = 10,
|
||||
HAL_COLOR_MODE_BT2100_PQ = 11,
|
||||
HAL_COLOR_MODE_BT2100_HLG = 12,
|
||||
} android_color_mode_v1_1_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_RENDER_INTENT_COLORIMETRIC = 0,
|
||||
HAL_RENDER_INTENT_ENHANCE = 1,
|
||||
HAL_RENDER_INTENT_TONE_MAP_COLORIMETRIC = 2,
|
||||
HAL_RENDER_INTENT_TONE_MAP_ENHANCE = 3,
|
||||
} android_render_intent_v1_1_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_COMMON_V1_1_EXPORTED_CONSTANTS_H_
|
31
include/android_stub/system/graphics-base-v1.2.h
Normal file
31
include/android_stub/system/graphics-base-v1.2.h
Normal file
@@ -0,0 +1,31 @@
|
||||
// This file is autogenerated by hidl-gen. Do not edit manually.
|
||||
// Source: android.hardware.graphics.common@1.2
|
||||
// Location: hardware/interfaces/graphics/common/1.2/
|
||||
|
||||
#ifndef HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_COMMON_V1_2_EXPORTED_CONSTANTS_H_
|
||||
#define HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_COMMON_V1_2_EXPORTED_CONSTANTS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
HAL_HDR_HDR10_PLUS = 4,
|
||||
} android_hdr_v1_2_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_DATASPACE_DISPLAY_BT2020 = 142999552 /* ((STANDARD_BT2020 | TRANSFER_SRGB) | RANGE_FULL) */,
|
||||
HAL_DATASPACE_DYNAMIC_DEPTH = 4098 /* 0x1002 */,
|
||||
HAL_DATASPACE_JPEG_APP_SEGMENTS = 4099 /* 0x1003 */,
|
||||
HAL_DATASPACE_HEIF = 4100 /* 0x1004 */,
|
||||
} android_dataspace_v1_2_t;
|
||||
|
||||
typedef enum {
|
||||
HAL_PIXEL_FORMAT_HSV_888 = 55 /* 0x37 */,
|
||||
} android_pixel_format_v1_2_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_COMMON_V1_2_EXPORTED_CONSTANTS_H_
|
8
include/android_stub/system/graphics-base.h
Normal file
8
include/android_stub/system/graphics-base.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef SYSTEM_CORE_GRAPHICS_BASE_H_
|
||||
#define SYSTEM_CORE_GRAPHICS_BASE_H_
|
||||
|
||||
#include "graphics-base-v1.0.h"
|
||||
#include "graphics-base-v1.1.h"
|
||||
#include "graphics-base-v1.2.h"
|
||||
|
||||
#endif // SYSTEM_CORE_GRAPHICS_BASE_H_
|
16
include/android_stub/system/graphics-sw.h
Normal file
16
include/android_stub/system/graphics-sw.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef SYSTEM_CORE_GRAPHICS_SW_H_
|
||||
#define SYSTEM_CORE_GRAPHICS_SW_H_
|
||||
|
||||
/* Software formats not in the HAL definitions. */
|
||||
typedef enum {
|
||||
HAL_PIXEL_FORMAT_YCBCR_422_888 = 39, // 0x27
|
||||
HAL_PIXEL_FORMAT_YCBCR_444_888 = 40, // 0x28
|
||||
HAL_PIXEL_FORMAT_FLEX_RGB_888 = 41, // 0x29
|
||||
HAL_PIXEL_FORMAT_FLEX_RGBA_8888 = 42, // 0x2A
|
||||
} android_pixel_format_sw_t;
|
||||
|
||||
/* for compatibility */
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_422_888 HAL_PIXEL_FORMAT_YCBCR_422_888
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_444_888 HAL_PIXEL_FORMAT_YCBCR_444_888
|
||||
|
||||
#endif // SYSTEM_CORE_GRAPHICS_SW_H_
|
268
include/android_stub/system/graphics.h
Normal file
268
include/android_stub/system/graphics.h
Normal file
@@ -0,0 +1,268 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#ifndef SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H
|
||||
#define SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Some of the enums are now defined in HIDL in hardware/interfaces and are
|
||||
* generated.
|
||||
*/
|
||||
#include "graphics-base.h"
|
||||
#include "graphics-sw.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* for compatibility */
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_888 HAL_PIXEL_FORMAT_YCBCR_420_888
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_422_SP HAL_PIXEL_FORMAT_YCBCR_422_SP
|
||||
#define HAL_PIXEL_FORMAT_YCrCb_420_SP HAL_PIXEL_FORMAT_YCRCB_420_SP
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_422_I HAL_PIXEL_FORMAT_YCBCR_422_I
|
||||
typedef android_pixel_format_t android_pixel_format;
|
||||
typedef android_transform_t android_transform;
|
||||
typedef android_dataspace_t android_dataspace;
|
||||
typedef android_color_mode_t android_color_mode;
|
||||
typedef android_color_transform_t android_color_transform;
|
||||
typedef android_hdr_t android_hdr;
|
||||
|
||||
/*
|
||||
* If the HAL needs to create service threads to handle graphics related
|
||||
* tasks, these threads need to run at HAL_PRIORITY_URGENT_DISPLAY priority
|
||||
* if they can block the main rendering thread in any way.
|
||||
*
|
||||
* the priority of the current thread can be set with:
|
||||
*
|
||||
* #include <sys/resource.h>
|
||||
* setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY);
|
||||
*
|
||||
*/
|
||||
|
||||
#define HAL_PRIORITY_URGENT_DISPLAY (-8)
|
||||
|
||||
/*
|
||||
* Structure for describing YCbCr formats for consumption by applications.
|
||||
* This is used with HAL_PIXEL_FORMAT_YCbCr_*_888.
|
||||
*
|
||||
* Buffer chroma subsampling is defined in the format.
|
||||
* e.g. HAL_PIXEL_FORMAT_YCbCr_420_888 has subsampling 4:2:0.
|
||||
*
|
||||
* Buffers must have a 8 bit depth.
|
||||
*
|
||||
* y, cb, and cr point to the first byte of their respective planes.
|
||||
*
|
||||
* Stride describes the distance in bytes from the first value of one row of
|
||||
* the image to the first value of the next row. It includes the width of the
|
||||
* image plus padding.
|
||||
* ystride is the stride of the luma plane.
|
||||
* cstride is the stride of the chroma planes.
|
||||
*
|
||||
* chroma_step is the distance in bytes from one chroma pixel value to the
|
||||
* next. This is 2 bytes for semiplanar (because chroma values are interleaved
|
||||
* and each chroma value is one byte) and 1 for planar.
|
||||
*/
|
||||
|
||||
struct android_ycbcr {
|
||||
void *y;
|
||||
void *cb;
|
||||
void *cr;
|
||||
size_t ystride;
|
||||
size_t cstride;
|
||||
size_t chroma_step;
|
||||
|
||||
/** reserved for future use, set to 0 by gralloc's (*lock_ycbcr)() */
|
||||
uint32_t reserved[8];
|
||||
};
|
||||
|
||||
/*
|
||||
* Structures for describing flexible YUVA/RGBA formats for consumption by
|
||||
* applications. Such flexible formats contain a plane for each component (e.g.
|
||||
* red, green, blue), where each plane is laid out in a grid-like pattern
|
||||
* occupying unique byte addresses and with consistent byte offsets between
|
||||
* neighboring pixels.
|
||||
*
|
||||
* The android_flex_layout structure is used with any pixel format that can be
|
||||
* represented by it, such as:
|
||||
* - HAL_PIXEL_FORMAT_YCbCr_*_888
|
||||
* - HAL_PIXEL_FORMAT_FLEX_RGB*_888
|
||||
* - HAL_PIXEL_FORMAT_RGB[AX]_888[8],BGRA_8888,RGB_888
|
||||
* - HAL_PIXEL_FORMAT_YV12,Y8,Y16,YCbCr_422_SP/I,YCrCb_420_SP
|
||||
* - even implementation defined formats that can be represented by
|
||||
* the structures
|
||||
*
|
||||
* Vertical increment (aka. row increment or stride) describes the distance in
|
||||
* bytes from the first pixel of one row to the first pixel of the next row
|
||||
* (below) for the component plane. This can be negative.
|
||||
*
|
||||
* Horizontal increment (aka. column or pixel increment) describes the distance
|
||||
* in bytes from one pixel to the next pixel (to the right) on the same row for
|
||||
* the component plane. This can be negative.
|
||||
*
|
||||
* Each plane can be subsampled either vertically or horizontally by
|
||||
* a power-of-two factor.
|
||||
*
|
||||
* The bit-depth of each component can be arbitrary, as long as the pixels are
|
||||
* laid out on whole bytes, in native byte-order, using the most significant
|
||||
* bits of each unit.
|
||||
*/
|
||||
|
||||
typedef enum android_flex_component {
|
||||
/* luma */
|
||||
FLEX_COMPONENT_Y = 1 << 0,
|
||||
/* chroma blue */
|
||||
FLEX_COMPONENT_Cb = 1 << 1,
|
||||
/* chroma red */
|
||||
FLEX_COMPONENT_Cr = 1 << 2,
|
||||
|
||||
/* red */
|
||||
FLEX_COMPONENT_R = 1 << 10,
|
||||
/* green */
|
||||
FLEX_COMPONENT_G = 1 << 11,
|
||||
/* blue */
|
||||
FLEX_COMPONENT_B = 1 << 12,
|
||||
|
||||
/* alpha */
|
||||
FLEX_COMPONENT_A = 1 << 30,
|
||||
} android_flex_component_t;
|
||||
|
||||
typedef struct android_flex_plane {
|
||||
/* pointer to the first byte of the top-left pixel of the plane. */
|
||||
uint8_t *top_left;
|
||||
|
||||
android_flex_component_t component;
|
||||
|
||||
/* bits allocated for the component in each pixel. Must be a positive
|
||||
multiple of 8. */
|
||||
int32_t bits_per_component;
|
||||
/* number of the most significant bits used in the format for this
|
||||
component. Must be between 1 and bits_per_component, inclusive. */
|
||||
int32_t bits_used;
|
||||
|
||||
/* horizontal increment */
|
||||
int32_t h_increment;
|
||||
/* vertical increment */
|
||||
int32_t v_increment;
|
||||
/* horizontal subsampling. Must be a positive power of 2. */
|
||||
int32_t h_subsampling;
|
||||
/* vertical subsampling. Must be a positive power of 2. */
|
||||
int32_t v_subsampling;
|
||||
} android_flex_plane_t;
|
||||
|
||||
typedef enum android_flex_format {
|
||||
/* not a flexible format */
|
||||
FLEX_FORMAT_INVALID = 0x0,
|
||||
FLEX_FORMAT_Y = FLEX_COMPONENT_Y,
|
||||
FLEX_FORMAT_YCbCr = FLEX_COMPONENT_Y | FLEX_COMPONENT_Cb | FLEX_COMPONENT_Cr,
|
||||
FLEX_FORMAT_YCbCrA = FLEX_FORMAT_YCbCr | FLEX_COMPONENT_A,
|
||||
FLEX_FORMAT_RGB = FLEX_COMPONENT_R | FLEX_COMPONENT_G | FLEX_COMPONENT_B,
|
||||
FLEX_FORMAT_RGBA = FLEX_FORMAT_RGB | FLEX_COMPONENT_A,
|
||||
} android_flex_format_t;
|
||||
|
||||
typedef struct android_flex_layout {
|
||||
/* the kind of flexible format */
|
||||
android_flex_format_t format;
|
||||
|
||||
/* number of planes; 0 for FLEX_FORMAT_INVALID */
|
||||
uint32_t num_planes;
|
||||
/* a plane for each component; ordered in increasing component value order.
|
||||
E.g. FLEX_FORMAT_RGBA maps 0 -> R, 1 -> G, etc.
|
||||
Can be NULL for FLEX_FORMAT_INVALID */
|
||||
android_flex_plane_t *planes;
|
||||
} android_flex_layout_t;
|
||||
|
||||
/**
|
||||
* Structure used to define depth point clouds for format HAL_PIXEL_FORMAT_BLOB
|
||||
* with dataSpace value of HAL_DATASPACE_DEPTH.
|
||||
* When locking a native buffer of the above format and dataSpace value,
|
||||
* the vaddr pointer can be cast to this structure.
|
||||
*
|
||||
* A variable-length list of (x,y,z, confidence) 3D points, as floats. (x, y,
|
||||
* z) represents a measured point's position, with the coordinate system defined
|
||||
* by the data source. Confidence represents the estimated likelihood that this
|
||||
* measurement is correct. It is between 0.f and 1.f, inclusive, with 1.f ==
|
||||
* 100% confidence.
|
||||
*
|
||||
* num_points is the number of points in the list
|
||||
*
|
||||
* xyz_points is the flexible array of floating-point values.
|
||||
* It contains (num_points) * 4 floats.
|
||||
*
|
||||
* For example:
|
||||
* android_depth_points d = get_depth_buffer();
|
||||
* struct {
|
||||
* float x; float y; float z; float confidence;
|
||||
* } firstPoint, lastPoint;
|
||||
*
|
||||
* firstPoint.x = d.xyzc_points[0];
|
||||
* firstPoint.y = d.xyzc_points[1];
|
||||
* firstPoint.z = d.xyzc_points[2];
|
||||
* firstPoint.confidence = d.xyzc_points[3];
|
||||
* lastPoint.x = d.xyzc_points[(d.num_points - 1) * 4 + 0];
|
||||
* lastPoint.y = d.xyzc_points[(d.num_points - 1) * 4 + 1];
|
||||
* lastPoint.z = d.xyzc_points[(d.num_points - 1) * 4 + 2];
|
||||
* lastPoint.confidence = d.xyzc_points[(d.num_points - 1) * 4 + 3];
|
||||
*/
|
||||
|
||||
struct android_depth_points {
|
||||
uint32_t num_points;
|
||||
|
||||
/** reserved for future use, set to 0 by gralloc's (*lock)() */
|
||||
uint32_t reserved[8];
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wc99-extensions"
|
||||
#endif
|
||||
float xyzc_points[];
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* These structures are used to define the reference display's
|
||||
* capabilities for HDR content. Display engine can use this
|
||||
* to better tone map content to user's display.
|
||||
* Color is defined in CIE XYZ coordinates
|
||||
*/
|
||||
struct android_xy_color {
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
struct android_smpte2086_metadata {
|
||||
struct android_xy_color displayPrimaryRed;
|
||||
struct android_xy_color displayPrimaryGreen;
|
||||
struct android_xy_color displayPrimaryBlue;
|
||||
struct android_xy_color whitePoint;
|
||||
float maxLuminance;
|
||||
float minLuminance;
|
||||
};
|
||||
|
||||
struct android_cta861_3_metadata {
|
||||
float maxContentLightLevel;
|
||||
float maxFrameAverageLightLevel;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H */
|
254
include/android_stub/system/radio.h
Normal file
254
include/android_stub/system/radio.h
Normal file
@@ -0,0 +1,254 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_RADIO_H
|
||||
#define ANDROID_RADIO_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
#define RADIO_NUM_BANDS_MAX 16
|
||||
#define RADIO_NUM_SPACINGS_MAX 16
|
||||
#define RADIO_STRING_LEN_MAX 128
|
||||
|
||||
/*
|
||||
* Radio hardware module class. A given radio hardware module HAL is of one class
|
||||
* only. The platform can not have more than one hardware module of each class.
|
||||
* Current version of the framework only supports RADIO_CLASS_AM_FM.
|
||||
*/
|
||||
typedef enum {
|
||||
RADIO_CLASS_AM_FM = 0, /* FM (including HD radio) and AM */
|
||||
RADIO_CLASS_SAT = 1, /* Satellite Radio */
|
||||
RADIO_CLASS_DT = 2, /* Digital Radio (DAB) */
|
||||
} radio_class_t;
|
||||
|
||||
/* value for field "type" of radio band described in struct radio_hal_band_config */
|
||||
typedef enum {
|
||||
RADIO_BAND_AM = 0, /* Amplitude Modulation band: LW, MW, SW */
|
||||
RADIO_BAND_FM = 1, /* Frequency Modulation band: FM */
|
||||
RADIO_BAND_FM_HD = 2, /* FM HD Radio / DRM (IBOC) */
|
||||
RADIO_BAND_AM_HD = 3, /* AM HD Radio / DRM (IBOC) */
|
||||
} radio_band_t;
|
||||
|
||||
/* RDS variant implemented. A struct radio_hal_fm_band_config can list none or several. */
|
||||
enum {
|
||||
RADIO_RDS_NONE = 0x0,
|
||||
RADIO_RDS_WORLD = 0x01,
|
||||
RADIO_RDS_US = 0x02,
|
||||
};
|
||||
typedef unsigned int radio_rds_t;
|
||||
|
||||
/* FM deemphasis variant implemented. A struct radio_hal_fm_band_config can list one or more. */
|
||||
enum {
|
||||
RADIO_DEEMPHASIS_50 = 0x1,
|
||||
RADIO_DEEMPHASIS_75 = 0x2,
|
||||
};
|
||||
typedef unsigned int radio_deemphasis_t;
|
||||
|
||||
/* Region a particular radio band configuration corresponds to. Not used at the HAL.
|
||||
* Derived by the framework when converting the band descriptors retrieved from the HAL to
|
||||
* individual band descriptors for each supported region. */
|
||||
typedef enum {
|
||||
RADIO_REGION_NONE = -1,
|
||||
RADIO_REGION_ITU_1 = 0,
|
||||
RADIO_REGION_ITU_2 = 1,
|
||||
RADIO_REGION_OIRT = 2,
|
||||
RADIO_REGION_JAPAN = 3,
|
||||
RADIO_REGION_KOREA = 4,
|
||||
} radio_region_t;
|
||||
|
||||
/* scanning direction for scan() and step() tuner APIs */
|
||||
typedef enum {
|
||||
RADIO_DIRECTION_UP,
|
||||
RADIO_DIRECTION_DOWN
|
||||
} radio_direction_t;
|
||||
|
||||
/* unique handle allocated to a radio module */
|
||||
typedef uint32_t radio_handle_t;
|
||||
|
||||
/* Opaque meta data structure used by radio meta data API (see system/radio_metadata.h) */
|
||||
typedef struct radio_metadata radio_metadata_t;
|
||||
|
||||
|
||||
/* Additional attributes for an FM band configuration */
|
||||
typedef struct radio_hal_fm_band_config {
|
||||
radio_deemphasis_t deemphasis; /* deemphasis variant */
|
||||
bool stereo; /* stereo supported */
|
||||
radio_rds_t rds; /* RDS variants supported */
|
||||
bool ta; /* Traffic Announcement supported */
|
||||
bool af; /* Alternate Frequency supported */
|
||||
bool ea; /* Emergency announcements supported */
|
||||
} radio_hal_fm_band_config_t;
|
||||
|
||||
/* Additional attributes for an AM band configuration */
|
||||
typedef struct radio_hal_am_band_config {
|
||||
bool stereo; /* stereo supported */
|
||||
} radio_hal_am_band_config_t;
|
||||
|
||||
/* Radio band configuration. Describes a given band supported by the radio module.
|
||||
* The HAL can expose only one band per type with the the maximum range supported and all options.
|
||||
* THe framework will derive the actual regions were this module can operate and expose separate
|
||||
* band configurations for applications to chose from. */
|
||||
typedef struct radio_hal_band_config {
|
||||
radio_band_t type;
|
||||
bool antenna_connected;
|
||||
uint32_t lower_limit;
|
||||
uint32_t upper_limit;
|
||||
uint32_t num_spacings;
|
||||
uint32_t spacings[RADIO_NUM_SPACINGS_MAX];
|
||||
union {
|
||||
radio_hal_fm_band_config_t fm;
|
||||
radio_hal_am_band_config_t am;
|
||||
};
|
||||
} radio_hal_band_config_t;
|
||||
|
||||
/* Used internally by the framework to represent a band for s specific region */
|
||||
typedef struct radio_band_config {
|
||||
radio_region_t region;
|
||||
radio_hal_band_config_t band;
|
||||
} radio_band_config_t;
|
||||
|
||||
|
||||
/* Exposes properties of a given hardware radio module.
|
||||
* NOTE: current framework implementation supports only one audio source (num_audio_sources = 1).
|
||||
* The source corresponds to AUDIO_DEVICE_IN_FM_TUNER.
|
||||
* If more than one tuner is supported (num_tuners > 1), only one can be connected to the audio
|
||||
* source. */
|
||||
typedef struct radio_hal_properties {
|
||||
radio_class_t class_id; /* Class of this module. E.g RADIO_CLASS_AM_FM */
|
||||
char implementor[RADIO_STRING_LEN_MAX]; /* implementor name */
|
||||
char product[RADIO_STRING_LEN_MAX]; /* product name */
|
||||
char version[RADIO_STRING_LEN_MAX]; /* product version */
|
||||
char serial[RADIO_STRING_LEN_MAX]; /* serial number (for subscription services) */
|
||||
uint32_t num_tuners; /* number of tuners controllable independently */
|
||||
uint32_t num_audio_sources; /* number of audio sources driven simultaneously */
|
||||
bool supports_capture; /* the hardware supports capture of audio source audio HAL */
|
||||
uint32_t num_bands; /* number of band descriptors */
|
||||
radio_hal_band_config_t bands[RADIO_NUM_BANDS_MAX]; /* band descriptors */
|
||||
} radio_hal_properties_t;
|
||||
|
||||
/* Used internally by the framework. Same information as in struct radio_hal_properties plus a
|
||||
* unique handle and one band configuration per region. */
|
||||
typedef struct radio_properties {
|
||||
radio_handle_t handle;
|
||||
radio_class_t class_id;
|
||||
char implementor[RADIO_STRING_LEN_MAX];
|
||||
char product[RADIO_STRING_LEN_MAX];
|
||||
char version[RADIO_STRING_LEN_MAX];
|
||||
char serial[RADIO_STRING_LEN_MAX];
|
||||
uint32_t num_tuners;
|
||||
uint32_t num_audio_sources;
|
||||
bool supports_capture;
|
||||
uint32_t num_bands;
|
||||
radio_band_config_t bands[RADIO_NUM_BANDS_MAX];
|
||||
} radio_properties_t;
|
||||
|
||||
/* Radio program information. Returned by the HAL with event RADIO_EVENT_TUNED.
|
||||
* Contains information on currently tuned channel.
|
||||
*/
|
||||
typedef struct radio_program_info {
|
||||
uint32_t channel; /* current channel. (e.g kHz for band type RADIO_BAND_FM) */
|
||||
uint32_t sub_channel; /* current sub channel. (used for RADIO_BAND_FM_HD) */
|
||||
bool tuned; /* tuned to a program or not */
|
||||
bool stereo; /* program is stereo or not */
|
||||
bool digital; /* digital program or not (e.g HD Radio program) */
|
||||
uint32_t signal_strength; /* signal strength from 0 to 100 */
|
||||
/* meta data (e.g PTY, song title ...), must not be NULL */
|
||||
__attribute__((aligned(8))) radio_metadata_t *metadata;
|
||||
} radio_program_info_t;
|
||||
|
||||
|
||||
/* Events sent to the framework via the HAL callback. An event can notify the completion of an
|
||||
* asynchronous command (configuration, tune, scan ...) or a spontaneous change (antenna connection,
|
||||
* failure, AF switching, meta data reception... */
|
||||
enum {
|
||||
RADIO_EVENT_HW_FAILURE = 0, /* hardware module failure. Requires reopening the tuner */
|
||||
RADIO_EVENT_CONFIG = 1, /* configuration change completed */
|
||||
RADIO_EVENT_ANTENNA = 2, /* Antenna connected, disconnected */
|
||||
RADIO_EVENT_TUNED = 3, /* tune, step, scan completed */
|
||||
RADIO_EVENT_METADATA = 4, /* New meta data received */
|
||||
RADIO_EVENT_TA = 5, /* Traffic announcement start or stop */
|
||||
RADIO_EVENT_AF_SWITCH = 6, /* Switch to Alternate Frequency */
|
||||
RADIO_EVENT_EA = 7, /* Emergency announcement start or stop */
|
||||
// begin framework only events
|
||||
RADIO_EVENT_CONTROL = 100, /* loss/gain of tuner control */
|
||||
RADIO_EVENT_SERVER_DIED = 101, /* radio service died */
|
||||
};
|
||||
typedef unsigned int radio_event_type_t;
|
||||
|
||||
/* Event passed to the framework by the HAL callback */
|
||||
typedef struct radio_hal_event {
|
||||
radio_event_type_t type; /* event type */
|
||||
int32_t status; /* used by RADIO_EVENT_CONFIG, RADIO_EVENT_TUNED */
|
||||
union {
|
||||
/* RADIO_EVENT_ANTENNA, RADIO_EVENT_TA, RADIO_EVENT_EA */
|
||||
bool on;
|
||||
radio_hal_band_config_t config; /* RADIO_EVENT_CONFIG */
|
||||
radio_program_info_t info; /* RADIO_EVENT_TUNED, RADIO_EVENT_AF_SWITCH */
|
||||
radio_metadata_t *metadata; /* RADIO_EVENT_METADATA */
|
||||
};
|
||||
} radio_hal_event_t;
|
||||
|
||||
/* Used internally by the framework. Same information as in struct radio_hal_event */
|
||||
typedef struct radio_event {
|
||||
radio_event_type_t type;
|
||||
int32_t status;
|
||||
union {
|
||||
bool on;
|
||||
radio_band_config_t config;
|
||||
radio_program_info_t info;
|
||||
/* meta data (e.g PTY, song title ...), must not be NULL */
|
||||
__attribute__((aligned(8))) radio_metadata_t *metadata;
|
||||
};
|
||||
} radio_event_t;
|
||||
|
||||
|
||||
static inline
|
||||
radio_rds_t radio_rds_for_region(bool rds, radio_region_t region) {
|
||||
if (!rds)
|
||||
return RADIO_RDS_NONE;
|
||||
switch(region) {
|
||||
case RADIO_REGION_ITU_1:
|
||||
case RADIO_REGION_OIRT:
|
||||
case RADIO_REGION_JAPAN:
|
||||
case RADIO_REGION_KOREA:
|
||||
return RADIO_RDS_WORLD;
|
||||
case RADIO_REGION_ITU_2:
|
||||
return RADIO_RDS_US;
|
||||
default:
|
||||
return RADIO_REGION_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static inline
|
||||
radio_deemphasis_t radio_demephasis_for_region(radio_region_t region) {
|
||||
switch(region) {
|
||||
case RADIO_REGION_KOREA:
|
||||
case RADIO_REGION_ITU_2:
|
||||
return RADIO_DEEMPHASIS_75;
|
||||
case RADIO_REGION_ITU_1:
|
||||
case RADIO_REGION_OIRT:
|
||||
case RADIO_REGION_JAPAN:
|
||||
default:
|
||||
return RADIO_DEEMPHASIS_50;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ANDROID_RADIO_H
|
80
include/android_stub/system/thread_defs.h
Normal file
80
include/android_stub/system/thread_defs.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (C) 2013 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.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_THREAD_DEFS_H
|
||||
#define ANDROID_THREAD_DEFS_H
|
||||
|
||||
#include "graphics.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
/*
|
||||
* ***********************************************
|
||||
* ** Keep in sync with android.os.Process.java **
|
||||
* ***********************************************
|
||||
*
|
||||
* This maps directly to the "nice" priorities we use in Android.
|
||||
* A thread priority should be chosen inverse-proportionally to
|
||||
* the amount of work the thread is expected to do. The more work
|
||||
* a thread will do, the less favorable priority it should get so that
|
||||
* it doesn't starve the system. Threads not behaving properly might
|
||||
* be "punished" by the kernel.
|
||||
* Use the levels below when appropriate. Intermediate values are
|
||||
* acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below.
|
||||
*/
|
||||
ANDROID_PRIORITY_LOWEST = 19,
|
||||
|
||||
/* use for background tasks */
|
||||
ANDROID_PRIORITY_BACKGROUND = 10,
|
||||
|
||||
/* most threads run at normal priority */
|
||||
ANDROID_PRIORITY_NORMAL = 0,
|
||||
|
||||
/* threads currently running a UI that the user is interacting with */
|
||||
ANDROID_PRIORITY_FOREGROUND = -2,
|
||||
|
||||
/* the main UI thread has a slightly more favorable priority */
|
||||
ANDROID_PRIORITY_DISPLAY = -4,
|
||||
|
||||
/* ui service treads might want to run at a urgent display (uncommon) */
|
||||
ANDROID_PRIORITY_URGENT_DISPLAY = HAL_PRIORITY_URGENT_DISPLAY,
|
||||
|
||||
/* all normal video threads */
|
||||
ANDROID_PRIORITY_VIDEO = -10,
|
||||
|
||||
/* all normal audio threads */
|
||||
ANDROID_PRIORITY_AUDIO = -16,
|
||||
|
||||
/* service audio threads (uncommon) */
|
||||
ANDROID_PRIORITY_URGENT_AUDIO = -19,
|
||||
|
||||
/* should never be used in practice. regular process might not
|
||||
* be allowed to use this level */
|
||||
ANDROID_PRIORITY_HIGHEST = -20,
|
||||
|
||||
ANDROID_PRIORITY_DEFAULT = ANDROID_PRIORITY_NORMAL,
|
||||
ANDROID_PRIORITY_MORE_FAVORABLE = -1,
|
||||
ANDROID_PRIORITY_LESS_FAVORABLE = +1,
|
||||
};
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ANDROID_THREAD_DEFS_H */
|
988
include/android_stub/system/window.h
Normal file
988
include/android_stub/system/window.h
Normal file
@@ -0,0 +1,988 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
/*************************************************************************************************
|
||||
*
|
||||
* IMPORTANT:
|
||||
*
|
||||
* There is an old copy of this file in system/core/include/system/window.h, which exists only
|
||||
* for backward source compatibility.
|
||||
* But there are binaries out there as well, so this version of window.h must stay binary
|
||||
* backward compatible with the one found in system/core.
|
||||
*
|
||||
*
|
||||
* Source compatibility is also required for now, because this is how we're handling the
|
||||
* transition from system/core/include (global include path) to nativewindow/include.
|
||||
*
|
||||
*************************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cutils/native_handle.h>
|
||||
#include <errno.h>
|
||||
#include <limits.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
|
||||
#include <vndk/window.h>
|
||||
|
||||
|
||||
#ifndef __UNUSED
|
||||
#define __UNUSED __attribute__((__unused__))
|
||||
#endif
|
||||
#ifndef __deprecated
|
||||
#define __deprecated __attribute__((__deprecated__))
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define ANDROID_NATIVE_WINDOW_MAGIC ANDROID_NATIVE_MAKE_CONSTANT('_','w','n','d')
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* attributes queriable with query() */
|
||||
enum {
|
||||
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,
|
||||
|
||||
/* Check whether queueBuffer operations on the ANativeWindow send the buffer
|
||||
* to the window compositor. The query sets the returned 'value' argument
|
||||
* to 1 if the ANativeWindow DOES send queued buffers directly to the window
|
||||
* compositor and 0 if the buffers do not go directly to the window
|
||||
* compositor.
|
||||
*
|
||||
* This can be used to determine whether protected buffer content should be
|
||||
* sent to the ANativeWindow. Note, however, that a result of 1 does NOT
|
||||
* indicate that queued buffers will be protected from applications or users
|
||||
* capturing their contents. If that behavior is desired then some other
|
||||
* mechanism (e.g. the GRALLOC_USAGE_PROTECTED flag) should be used in
|
||||
* conjunction with this query.
|
||||
*/
|
||||
NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER = 4,
|
||||
|
||||
/* Get the concrete type of a ANativeWindow. See below for the list of
|
||||
* possible return values.
|
||||
*
|
||||
* This query should not be used outside the Android framework and will
|
||||
* likely be removed in the near future.
|
||||
*/
|
||||
NATIVE_WINDOW_CONCRETE_TYPE = 5,
|
||||
|
||||
|
||||
/*
|
||||
* Default width and height of ANativeWindow buffers, these are the
|
||||
* dimensions of the window buffers irrespective of the
|
||||
* NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS call and match the native window
|
||||
* size unless overridden by NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS.
|
||||
*/
|
||||
NATIVE_WINDOW_DEFAULT_WIDTH = ANATIVEWINDOW_QUERY_DEFAULT_WIDTH,
|
||||
NATIVE_WINDOW_DEFAULT_HEIGHT = ANATIVEWINDOW_QUERY_DEFAULT_HEIGHT,
|
||||
|
||||
/* see ANativeWindowQuery in vndk/window.h */
|
||||
NATIVE_WINDOW_TRANSFORM_HINT = ANATIVEWINDOW_QUERY_TRANSFORM_HINT,
|
||||
|
||||
/*
|
||||
* Boolean that indicates whether the consumer is running more than
|
||||
* one buffer behind the producer.
|
||||
*/
|
||||
NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND = 9,
|
||||
|
||||
/*
|
||||
* The consumer gralloc usage bits currently set by the consumer.
|
||||
* The values are defined in hardware/libhardware/include/gralloc.h.
|
||||
*/
|
||||
NATIVE_WINDOW_CONSUMER_USAGE_BITS = 10, /* deprecated */
|
||||
|
||||
/**
|
||||
* Transformation that will by applied to buffers by the hwcomposer.
|
||||
* This must not be set or checked by producer endpoints, and will
|
||||
* disable the transform hint set in SurfaceFlinger (see
|
||||
* NATIVE_WINDOW_TRANSFORM_HINT).
|
||||
*
|
||||
* INTENDED USE:
|
||||
* Temporary - Please do not use this. This is intended only to be used
|
||||
* by the camera's LEGACY mode.
|
||||
*
|
||||
* In situations where a SurfaceFlinger client wishes to set a transform
|
||||
* that is not visible to the producer, and will always be applied in the
|
||||
* hardware composer, the client can set this flag with
|
||||
* native_window_set_buffers_sticky_transform. This can be used to rotate
|
||||
* and flip buffers consumed by hardware composer without actually changing
|
||||
* the aspect ratio of the buffers produced.
|
||||
*/
|
||||
NATIVE_WINDOW_STICKY_TRANSFORM = 11,
|
||||
|
||||
/**
|
||||
* The default data space for the buffers as set by the consumer.
|
||||
* The values are defined in graphics.h.
|
||||
*/
|
||||
NATIVE_WINDOW_DEFAULT_DATASPACE = 12,
|
||||
|
||||
/* see ANativeWindowQuery in vndk/window.h */
|
||||
NATIVE_WINDOW_BUFFER_AGE = ANATIVEWINDOW_QUERY_BUFFER_AGE,
|
||||
|
||||
/*
|
||||
* Returns the duration of the last dequeueBuffer call in microseconds
|
||||
*/
|
||||
NATIVE_WINDOW_LAST_DEQUEUE_DURATION = 14,
|
||||
|
||||
/*
|
||||
* Returns the duration of the last queueBuffer call in microseconds
|
||||
*/
|
||||
NATIVE_WINDOW_LAST_QUEUE_DURATION = 15,
|
||||
|
||||
/*
|
||||
* Returns the number of image layers that the ANativeWindow buffer
|
||||
* contains. By default this is 1, unless a buffer is explicitly allocated
|
||||
* to contain multiple layers.
|
||||
*/
|
||||
NATIVE_WINDOW_LAYER_COUNT = 16,
|
||||
|
||||
/*
|
||||
* Returns 1 if the native window is valid, 0 otherwise. native window is valid
|
||||
* if it is safe (i.e. no crash will occur) to call any method on it.
|
||||
*/
|
||||
NATIVE_WINDOW_IS_VALID = 17,
|
||||
|
||||
/*
|
||||
* Returns 1 if NATIVE_WINDOW_GET_FRAME_TIMESTAMPS will return display
|
||||
* present info, 0 if it won't.
|
||||
*/
|
||||
NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_PRESENT = 18,
|
||||
|
||||
/*
|
||||
* The consumer end is capable of handling protected buffers, i.e. buffer
|
||||
* with GRALLOC_USAGE_PROTECTED usage bits on.
|
||||
*/
|
||||
NATIVE_WINDOW_CONSUMER_IS_PROTECTED = 19,
|
||||
|
||||
/*
|
||||
* Returns data space for the buffers.
|
||||
*/
|
||||
NATIVE_WINDOW_DATASPACE = 20,
|
||||
|
||||
/*
|
||||
* Returns maxBufferCount set by BufferQueueConsumer
|
||||
*/
|
||||
NATIVE_WINDOW_MAX_BUFFER_COUNT = 21,
|
||||
};
|
||||
|
||||
/* Valid operations for the (*perform)() hook.
|
||||
*
|
||||
* Values marked as 'deprecated' are supported, but have been superceded by
|
||||
* other functionality.
|
||||
*
|
||||
* Values marked as 'private' should be considered private to the framework.
|
||||
* HAL implementation code with access to an ANativeWindow should not use these,
|
||||
* as it may not interact properly with the framework's use of the
|
||||
* ANativeWindow.
|
||||
*/
|
||||
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_BUFFERS_HDR10_PLUS_METADATA = 34,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
/* parameter for NATIVE_WINDOW_[API_][DIS]CONNECT */
|
||||
enum {
|
||||
/* Buffers will be queued by EGL via eglSwapBuffers after being filled using
|
||||
* OpenGL ES.
|
||||
*/
|
||||
NATIVE_WINDOW_API_EGL = 1,
|
||||
|
||||
/* Buffers will be queued after being filled using the CPU
|
||||
*/
|
||||
NATIVE_WINDOW_API_CPU = 2,
|
||||
|
||||
/* Buffers will be queued by Stagefright after being filled by a video
|
||||
* decoder. The video decoder can either be a software or hardware decoder.
|
||||
*/
|
||||
NATIVE_WINDOW_API_MEDIA = 3,
|
||||
|
||||
/* Buffers will be queued by the the camera HAL.
|
||||
*/
|
||||
NATIVE_WINDOW_API_CAMERA = 4,
|
||||
};
|
||||
|
||||
/* parameter for NATIVE_WINDOW_SET_BUFFERS_TRANSFORM */
|
||||
enum {
|
||||
/* flip source image horizontally */
|
||||
NATIVE_WINDOW_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H ,
|
||||
/* flip source image vertically */
|
||||
NATIVE_WINDOW_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,
|
||||
/* rotate source image 90 degrees clock-wise, and is applied after TRANSFORM_FLIP_{H|V} */
|
||||
NATIVE_WINDOW_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,
|
||||
/* rotate source image 180 degrees */
|
||||
NATIVE_WINDOW_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,
|
||||
/* rotate source image 270 degrees clock-wise */
|
||||
NATIVE_WINDOW_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
|
||||
/* transforms source by the inverse transform of the screen it is displayed onto. This
|
||||
* transform is applied last */
|
||||
NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY = 0x08
|
||||
};
|
||||
|
||||
/* parameter for NATIVE_WINDOW_SET_SCALING_MODE
|
||||
* keep in sync with Surface.java in frameworks/base */
|
||||
enum {
|
||||
/* the window content is not updated (frozen) until a buffer of
|
||||
* the window size is received (enqueued)
|
||||
*/
|
||||
NATIVE_WINDOW_SCALING_MODE_FREEZE = 0,
|
||||
/* the buffer is scaled in both dimensions to match the window size */
|
||||
NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW = 1,
|
||||
/* the buffer is scaled uniformly such that the smaller dimension
|
||||
* of the buffer matches the window size (cropping in the process)
|
||||
*/
|
||||
NATIVE_WINDOW_SCALING_MODE_SCALE_CROP = 2,
|
||||
/* the window is clipped to the size of the buffer's crop rectangle; pixels
|
||||
* outside the crop rectangle are treated as if they are completely
|
||||
* transparent.
|
||||
*/
|
||||
NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP = 3,
|
||||
};
|
||||
|
||||
/* values returned by the NATIVE_WINDOW_CONCRETE_TYPE query */
|
||||
enum {
|
||||
NATIVE_WINDOW_FRAMEBUFFER = 0, /* FramebufferNativeWindow */
|
||||
NATIVE_WINDOW_SURFACE = 1, /* Surface */
|
||||
};
|
||||
|
||||
/* parameter for NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP
|
||||
*
|
||||
* Special timestamp value to indicate that timestamps should be auto-generated
|
||||
* by the native window when queueBuffer is called. This is equal to INT64_MIN,
|
||||
* defined directly to avoid problems with C99/C++ inclusion of stdint.h.
|
||||
*/
|
||||
static const int64_t NATIVE_WINDOW_TIMESTAMP_AUTO = (-9223372036854775807LL-1);
|
||||
|
||||
/* parameter for NATIVE_WINDOW_GET_FRAME_TIMESTAMPS
|
||||
*
|
||||
* Special timestamp value to indicate the timestamps aren't yet known or
|
||||
* that they are invalid.
|
||||
*/
|
||||
static const int64_t NATIVE_WINDOW_TIMESTAMP_PENDING = -2;
|
||||
static const int64_t NATIVE_WINDOW_TIMESTAMP_INVALID = -1;
|
||||
|
||||
struct ANativeWindow
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
ANativeWindow()
|
||||
: flags(0), minSwapInterval(0), maxSwapInterval(0), xdpi(0), ydpi(0)
|
||||
{
|
||||
common.magic = ANDROID_NATIVE_WINDOW_MAGIC;
|
||||
common.version = sizeof(ANativeWindow);
|
||||
memset(common.reserved, 0, sizeof(common.reserved));
|
||||
}
|
||||
|
||||
/* Implement the methods that sp<ANativeWindow> expects so that it
|
||||
can be used to automatically refcount ANativeWindow's. */
|
||||
void incStrong(const void* /*id*/) const {
|
||||
common.incRef(const_cast<android_native_base_t*>(&common));
|
||||
}
|
||||
void decStrong(const void* /*id*/) const {
|
||||
common.decRef(const_cast<android_native_base_t*>(&common));
|
||||
}
|
||||
#endif
|
||||
|
||||
struct android_native_base_t common;
|
||||
|
||||
/* flags describing some attributes of this surface or its updater */
|
||||
const uint32_t flags;
|
||||
|
||||
/* min swap interval supported by this updated */
|
||||
const int minSwapInterval;
|
||||
|
||||
/* max swap interval supported by this updated */
|
||||
const int maxSwapInterval;
|
||||
|
||||
/* horizontal and vertical resolution in DPI */
|
||||
const float xdpi;
|
||||
const float ydpi;
|
||||
|
||||
/* Some storage reserved for the OEM's driver. */
|
||||
intptr_t oem[4];
|
||||
|
||||
/*
|
||||
* Set the swap interval for this surface.
|
||||
*
|
||||
* Returns 0 on success or -errno on error.
|
||||
*/
|
||||
int (*setSwapInterval)(struct ANativeWindow* window,
|
||||
int interval);
|
||||
|
||||
/*
|
||||
* Hook called by EGL to acquire a buffer. After this call, the buffer
|
||||
* is not locked, so its content cannot be modified. This call may block if
|
||||
* no buffers are available.
|
||||
*
|
||||
* The window holds a reference to the buffer between dequeueBuffer and
|
||||
* either queueBuffer or cancelBuffer, so clients only need their own
|
||||
* reference if they might use the buffer after queueing or canceling it.
|
||||
* Holding a reference to a buffer after queueing or canceling it is only
|
||||
* allowed if a specific buffer count has been set.
|
||||
*
|
||||
* Returns 0 on success or -errno on error.
|
||||
*
|
||||
* XXX: This function is deprecated. It will continue to work for some
|
||||
* time for binary compatibility, but the new dequeueBuffer function that
|
||||
* outputs a fence file descriptor should be used in its place.
|
||||
*/
|
||||
int (*dequeueBuffer_DEPRECATED)(struct ANativeWindow* window,
|
||||
struct ANativeWindowBuffer** buffer);
|
||||
|
||||
/*
|
||||
* hook called by EGL to lock a buffer. This MUST be called before modifying
|
||||
* the content of a buffer. The buffer must have been acquired with
|
||||
* dequeueBuffer first.
|
||||
*
|
||||
* Returns 0 on success or -errno on error.
|
||||
*
|
||||
* XXX: This function is deprecated. It will continue to work for some
|
||||
* time for binary compatibility, but it is essentially a no-op, and calls
|
||||
* to it should be removed.
|
||||
*/
|
||||
int (*lockBuffer_DEPRECATED)(struct ANativeWindow* window,
|
||||
struct ANativeWindowBuffer* buffer);
|
||||
|
||||
/*
|
||||
* Hook called by EGL when modifications to the render buffer are done.
|
||||
* This unlocks and post the buffer.
|
||||
*
|
||||
* The window holds a reference to the buffer between dequeueBuffer and
|
||||
* either queueBuffer or cancelBuffer, so clients only need their own
|
||||
* reference if they might use the buffer after queueing or canceling it.
|
||||
* Holding a reference to a buffer after queueing or canceling it is only
|
||||
* allowed if a specific buffer count has been set.
|
||||
*
|
||||
* Buffers MUST be queued in the same order than they were dequeued.
|
||||
*
|
||||
* Returns 0 on success or -errno on error.
|
||||
*
|
||||
* XXX: This function is deprecated. It will continue to work for some
|
||||
* time for binary compatibility, but the new queueBuffer function that
|
||||
* takes a fence file descriptor should be used in its place (pass a value
|
||||
* of -1 for the fence file descriptor if there is no valid one to pass).
|
||||
*/
|
||||
int (*queueBuffer_DEPRECATED)(struct ANativeWindow* window,
|
||||
struct ANativeWindowBuffer* buffer);
|
||||
|
||||
/*
|
||||
* hook used to retrieve information about the native window.
|
||||
*
|
||||
* Returns 0 on success or -errno on error.
|
||||
*/
|
||||
int (*query)(const struct ANativeWindow* window,
|
||||
int what, int* value);
|
||||
|
||||
/*
|
||||
* hook used to perform various operations on the surface.
|
||||
* (*perform)() is a generic mechanism to add functionality to
|
||||
* ANativeWindow while keeping backward binary compatibility.
|
||||
*
|
||||
* DO NOT CALL THIS HOOK DIRECTLY. Instead, use the helper functions
|
||||
* defined below.
|
||||
*
|
||||
* (*perform)() returns -ENOENT if the 'what' parameter is not supported
|
||||
* by the surface's implementation.
|
||||
*
|
||||
* See above for a list of valid operations, such as
|
||||
* NATIVE_WINDOW_SET_USAGE or NATIVE_WINDOW_CONNECT
|
||||
*/
|
||||
int (*perform)(struct ANativeWindow* window,
|
||||
int operation, ... );
|
||||
|
||||
/*
|
||||
* Hook used to cancel a buffer that has been dequeued.
|
||||
* No synchronization is performed between dequeue() and cancel(), so
|
||||
* either external synchronization is needed, or these functions must be
|
||||
* called from the same thread.
|
||||
*
|
||||
* The window holds a reference to the buffer between dequeueBuffer and
|
||||
* either queueBuffer or cancelBuffer, so clients only need their own
|
||||
* reference if they might use the buffer after queueing or canceling it.
|
||||
* Holding a reference to a buffer after queueing or canceling it is only
|
||||
* allowed if a specific buffer count has been set.
|
||||
*
|
||||
* XXX: This function is deprecated. It will continue to work for some
|
||||
* time for binary compatibility, but the new cancelBuffer function that
|
||||
* takes a fence file descriptor should be used in its place (pass a value
|
||||
* of -1 for the fence file descriptor if there is no valid one to pass).
|
||||
*/
|
||||
int (*cancelBuffer_DEPRECATED)(struct ANativeWindow* window,
|
||||
struct ANativeWindowBuffer* buffer);
|
||||
|
||||
/*
|
||||
* Hook called by EGL to acquire a buffer. This call may block if no
|
||||
* buffers are available.
|
||||
*
|
||||
* The window holds a reference to the buffer between dequeueBuffer and
|
||||
* either queueBuffer or cancelBuffer, so clients only need their own
|
||||
* reference if they might use the buffer after queueing or canceling it.
|
||||
* Holding a reference to a buffer after queueing or canceling it is only
|
||||
* allowed if a specific buffer count has been set.
|
||||
*
|
||||
* The libsync fence file descriptor returned in the int pointed to by the
|
||||
* fenceFd argument will refer to the fence that must signal before the
|
||||
* dequeued buffer may be written to. A value of -1 indicates that the
|
||||
* caller may access the buffer immediately without waiting on a fence. If
|
||||
* a valid file descriptor is returned (i.e. any value except -1) then the
|
||||
* caller is responsible for closing the file descriptor.
|
||||
*
|
||||
* Returns 0 on success or -errno on error.
|
||||
*/
|
||||
int (*dequeueBuffer)(struct ANativeWindow* window,
|
||||
struct ANativeWindowBuffer** buffer, int* fenceFd);
|
||||
|
||||
/*
|
||||
* Hook called by EGL when modifications to the render buffer are done.
|
||||
* This unlocks and post the buffer.
|
||||
*
|
||||
* The window holds a reference to the buffer between dequeueBuffer and
|
||||
* either queueBuffer or cancelBuffer, so clients only need their own
|
||||
* reference if they might use the buffer after queueing or canceling it.
|
||||
* Holding a reference to a buffer after queueing or canceling it is only
|
||||
* allowed if a specific buffer count has been set.
|
||||
*
|
||||
* The fenceFd argument specifies a libsync fence file descriptor for a
|
||||
* fence that must signal before the buffer can be accessed. If the buffer
|
||||
* can be accessed immediately then a value of -1 should be used. The
|
||||
* caller must not use the file descriptor after it is passed to
|
||||
* queueBuffer, and the ANativeWindow implementation is responsible for
|
||||
* closing it.
|
||||
*
|
||||
* Returns 0 on success or -errno on error.
|
||||
*/
|
||||
int (*queueBuffer)(struct ANativeWindow* window,
|
||||
struct ANativeWindowBuffer* buffer, int fenceFd);
|
||||
|
||||
/*
|
||||
* Hook used to cancel a buffer that has been dequeued.
|
||||
* No synchronization is performed between dequeue() and cancel(), so
|
||||
* either external synchronization is needed, or these functions must be
|
||||
* called from the same thread.
|
||||
*
|
||||
* The window holds a reference to the buffer between dequeueBuffer and
|
||||
* either queueBuffer or cancelBuffer, so clients only need their own
|
||||
* reference if they might use the buffer after queueing or canceling it.
|
||||
* Holding a reference to a buffer after queueing or canceling it is only
|
||||
* allowed if a specific buffer count has been set.
|
||||
*
|
||||
* The fenceFd argument specifies a libsync fence file decsriptor for a
|
||||
* fence that must signal before the buffer can be accessed. If the buffer
|
||||
* can be accessed immediately then a value of -1 should be used.
|
||||
*
|
||||
* Note that if the client has not waited on the fence that was returned
|
||||
* from dequeueBuffer, that same fence should be passed to cancelBuffer to
|
||||
* ensure that future uses of the buffer are preceded by a wait on that
|
||||
* fence. The caller must not use the file descriptor after it is passed
|
||||
* to cancelBuffer, and the ANativeWindow implementation is responsible for
|
||||
* closing it.
|
||||
*
|
||||
* Returns 0 on success or -errno on error.
|
||||
*/
|
||||
int (*cancelBuffer)(struct ANativeWindow* window,
|
||||
struct ANativeWindowBuffer* buffer, int fenceFd);
|
||||
};
|
||||
|
||||
/* Backwards compatibility: use ANativeWindow (struct ANativeWindow in C).
|
||||
* android_native_window_t is deprecated.
|
||||
*/
|
||||
typedef struct ANativeWindow android_native_window_t __deprecated;
|
||||
|
||||
/*
|
||||
* native_window_set_usage64(..., usage)
|
||||
* Sets the intended usage flags for the next buffers
|
||||
* acquired with (*lockBuffer)() and on.
|
||||
*
|
||||
* Valid usage flags are defined in android/hardware_buffer.h
|
||||
* All AHARDWAREBUFFER_USAGE_* flags can be specified as needed.
|
||||
*
|
||||
* Calling this function will usually cause following buffers to be
|
||||
* reallocated.
|
||||
*/
|
||||
static inline int native_window_set_usage(struct ANativeWindow* window, uint64_t usage) {
|
||||
return window->perform(window, NATIVE_WINDOW_SET_USAGE64, usage);
|
||||
}
|
||||
|
||||
/* deprecated. Always returns 0. Don't call. */
|
||||
static inline int native_window_connect(
|
||||
struct ANativeWindow* window __UNUSED, int api __UNUSED) __deprecated;
|
||||
|
||||
static inline int native_window_connect(
|
||||
struct ANativeWindow* window __UNUSED, int api __UNUSED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* deprecated. Always returns 0. Don't call. */
|
||||
static inline int native_window_disconnect(
|
||||
struct ANativeWindow* window __UNUSED, int api __UNUSED) __deprecated;
|
||||
|
||||
static inline int native_window_disconnect(
|
||||
struct ANativeWindow* window __UNUSED, int api __UNUSED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_crop(..., crop)
|
||||
* Sets which region of the next queued buffers needs to be considered.
|
||||
* Depending on the scaling mode, a buffer's crop region is scaled and/or
|
||||
* cropped to match the surface's size. This function sets the crop in
|
||||
* pre-transformed buffer pixel coordinates.
|
||||
*
|
||||
* The specified crop region applies to all buffers queued after it is called.
|
||||
*
|
||||
* If 'crop' is NULL, subsequently queued buffers won't be cropped.
|
||||
*
|
||||
* An error is returned if for instance the crop region is invalid, out of the
|
||||
* buffer's bound or if the window is invalid.
|
||||
*/
|
||||
static inline int native_window_set_crop(
|
||||
struct ANativeWindow* window,
|
||||
android_native_rect_t const * crop)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_CROP, crop);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffer_count(..., count)
|
||||
* Sets the number of buffers associated with this native window.
|
||||
*/
|
||||
static inline int native_window_set_buffer_count(
|
||||
struct ANativeWindow* window,
|
||||
size_t bufferCount)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFER_COUNT, bufferCount);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_geometry(..., int w, int h, int format)
|
||||
* All buffers dequeued after this call will have the dimensions and format
|
||||
* specified. A successful call to this function has the same effect as calling
|
||||
* native_window_set_buffers_size and native_window_set_buffers_format.
|
||||
*
|
||||
* XXX: This function is deprecated. The native_window_set_buffers_dimensions
|
||||
* and native_window_set_buffers_format functions should be used instead.
|
||||
*/
|
||||
static inline int native_window_set_buffers_geometry(
|
||||
struct ANativeWindow* window,
|
||||
int w, int h, int format) __deprecated;
|
||||
|
||||
static inline int native_window_set_buffers_geometry(
|
||||
struct ANativeWindow* window,
|
||||
int w, int h, int format)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_GEOMETRY,
|
||||
w, h, format);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_dimensions(..., int w, int h)
|
||||
* All buffers dequeued after this call will have the dimensions specified.
|
||||
* In particular, all buffers will have a fixed-size, independent from the
|
||||
* native-window size. They will be scaled according to the scaling mode
|
||||
* (see native_window_set_scaling_mode) upon window composition.
|
||||
*
|
||||
* If w and h are 0, the normal behavior is restored. That is, dequeued buffers
|
||||
* following this call will be sized to match the window's size.
|
||||
*
|
||||
* Calling this function will reset the window crop to a NULL value, which
|
||||
* disables cropping of the buffers.
|
||||
*/
|
||||
static inline int native_window_set_buffers_dimensions(
|
||||
struct ANativeWindow* window,
|
||||
int w, int h)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS,
|
||||
w, h);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_user_dimensions(..., int w, int h)
|
||||
*
|
||||
* Sets the user buffer size for the window, which overrides the
|
||||
* window's size. All buffers dequeued after this call will have the
|
||||
* dimensions specified unless overridden by
|
||||
* native_window_set_buffers_dimensions. All buffers will have a
|
||||
* fixed-size, independent from the native-window size. They will be
|
||||
* scaled according to the scaling mode (see
|
||||
* native_window_set_scaling_mode) upon window composition.
|
||||
*
|
||||
* If w and h are 0, the normal behavior is restored. That is, the
|
||||
* default buffer size will match the windows's size.
|
||||
*
|
||||
* Calling this function will reset the window crop to a NULL value, which
|
||||
* disables cropping of the buffers.
|
||||
*/
|
||||
static inline int native_window_set_buffers_user_dimensions(
|
||||
struct ANativeWindow* window,
|
||||
int w, int h)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS,
|
||||
w, h);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_format(..., int format)
|
||||
* All buffers dequeued after this call will have the format specified.
|
||||
*
|
||||
* If the specified format is 0, the default buffer format will be used.
|
||||
*/
|
||||
static inline int native_window_set_buffers_format(
|
||||
struct ANativeWindow* window,
|
||||
int format)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_FORMAT, format);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_data_space(..., int dataSpace)
|
||||
* All buffers queued after this call will be associated with the dataSpace
|
||||
* parameter specified.
|
||||
*
|
||||
* dataSpace specifies additional information about the buffer that's dependent
|
||||
* on the buffer format and the endpoints. For example, it can be used to convey
|
||||
* the color space of the image data in the buffer, or it can be used to
|
||||
* indicate that the buffers contain depth measurement data instead of color
|
||||
* images. The default dataSpace is 0, HAL_DATASPACE_UNKNOWN, unless it has been
|
||||
* overridden by the consumer.
|
||||
*/
|
||||
static inline int native_window_set_buffers_data_space(
|
||||
struct ANativeWindow* window,
|
||||
android_dataspace_t dataSpace)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_DATASPACE,
|
||||
dataSpace);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_smpte2086_metadata(..., metadata)
|
||||
* All buffers queued after this call will be associated with the SMPTE
|
||||
* ST.2086 metadata specified.
|
||||
*
|
||||
* metadata specifies additional information about the contents of the buffer
|
||||
* that may affect how it's displayed. When it is nullptr, it means no such
|
||||
* information is available. No SMPTE ST.2086 metadata is associated with the
|
||||
* buffers by default.
|
||||
*/
|
||||
static inline int native_window_set_buffers_smpte2086_metadata(
|
||||
struct ANativeWindow* window,
|
||||
const struct android_smpte2086_metadata* metadata)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_SMPTE2086_METADATA,
|
||||
metadata);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_cta861_3_metadata(..., metadata)
|
||||
* All buffers queued after this call will be associated with the CTA-861.3
|
||||
* metadata specified.
|
||||
*
|
||||
* metadata specifies additional information about the contents of the buffer
|
||||
* that may affect how it's displayed. When it is nullptr, it means no such
|
||||
* information is available. No CTA-861.3 metadata is associated with the
|
||||
* buffers by default.
|
||||
*/
|
||||
static inline int native_window_set_buffers_cta861_3_metadata(
|
||||
struct ANativeWindow* window,
|
||||
const struct android_cta861_3_metadata* metadata)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_CTA861_3_METADATA,
|
||||
metadata);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_hdr10_plus_metadata(..., metadata)
|
||||
* All buffers queued after this call will be associated with the
|
||||
* HDR10+ dynamic metadata specified.
|
||||
*
|
||||
* metadata specifies additional dynamic information about the
|
||||
* contents of the buffer that may affect how it is displayed. When
|
||||
* it is nullptr, it means no such information is available. No
|
||||
* HDR10+ dynamic emtadata is associated with the buffers by default.
|
||||
*
|
||||
* Parameter "size" refers to the length of the metadata blob pointed to
|
||||
* by parameter "data". The metadata blob will adhere to the HDR10+ SEI
|
||||
* message standard.
|
||||
*/
|
||||
static inline int native_window_set_buffers_hdr10_plus_metadata(struct ANativeWindow* window,
|
||||
const size_t size,
|
||||
const uint8_t* metadata) {
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_HDR10_PLUS_METADATA, size,
|
||||
metadata);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_transform(..., int transform)
|
||||
* All buffers queued after this call will be displayed transformed according
|
||||
* to the transform parameter specified.
|
||||
*/
|
||||
static inline int native_window_set_buffers_transform(
|
||||
struct ANativeWindow* window,
|
||||
int transform)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_TRANSFORM,
|
||||
transform);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_sticky_transform(..., int transform)
|
||||
* All buffers queued after this call will be displayed transformed according
|
||||
* to the transform parameter specified applied on top of the regular buffer
|
||||
* transform. Setting this transform will disable the transform hint.
|
||||
*
|
||||
* Temporary - This is only intended to be used by the LEGACY camera mode, do
|
||||
* not use this for anything else.
|
||||
*/
|
||||
static inline int native_window_set_buffers_sticky_transform(
|
||||
struct ANativeWindow* window,
|
||||
int transform)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_STICKY_TRANSFORM,
|
||||
transform);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_buffers_timestamp(..., int64_t timestamp)
|
||||
* All buffers queued after this call will be associated with the timestamp
|
||||
* parameter specified. If the timestamp is set to NATIVE_WINDOW_TIMESTAMP_AUTO
|
||||
* (the default), timestamps will be generated automatically when queueBuffer is
|
||||
* called. The timestamp is measured in nanoseconds, and is normally monotonically
|
||||
* increasing. The timestamp should be unaffected by time-of-day adjustments,
|
||||
* and for a camera should be strictly monotonic but for a media player may be
|
||||
* reset when the position is set.
|
||||
*/
|
||||
static inline int native_window_set_buffers_timestamp(
|
||||
struct ANativeWindow* window,
|
||||
int64_t timestamp)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_scaling_mode(..., int mode)
|
||||
* All buffers queued after this call will be associated with the scaling mode
|
||||
* specified.
|
||||
*/
|
||||
static inline int native_window_set_scaling_mode(
|
||||
struct ANativeWindow* window,
|
||||
int mode)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_SCALING_MODE,
|
||||
mode);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_api_connect(..., int api)
|
||||
* connects an API to this window. only one API can be connected at a time.
|
||||
* Returns -EINVAL if for some reason the window cannot be connected, which
|
||||
* can happen if it's connected to some other API.
|
||||
*/
|
||||
static inline int native_window_api_connect(
|
||||
struct ANativeWindow* window, int api)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_API_CONNECT, api);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_api_disconnect(..., int api)
|
||||
* disconnect the API from this window.
|
||||
* An error is returned if for instance the window wasn't connected in the
|
||||
* first place.
|
||||
*/
|
||||
static inline int native_window_api_disconnect(
|
||||
struct ANativeWindow* window, int api)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_API_DISCONNECT, api);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_dequeue_buffer_and_wait(...)
|
||||
* Dequeue a buffer and wait on the fence associated with that buffer. The
|
||||
* buffer may safely be accessed immediately upon this function returning. An
|
||||
* error is returned if either of the dequeue or the wait operations fail.
|
||||
*/
|
||||
static inline int native_window_dequeue_buffer_and_wait(ANativeWindow *anw,
|
||||
struct ANativeWindowBuffer** anb) {
|
||||
return anw->dequeueBuffer_DEPRECATED(anw, anb);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_sideband_stream(..., native_handle_t*)
|
||||
* Attach a sideband buffer stream to a native window.
|
||||
*/
|
||||
static inline int native_window_set_sideband_stream(
|
||||
struct ANativeWindow* window,
|
||||
native_handle_t* sidebandHandle)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_SIDEBAND_STREAM,
|
||||
sidebandHandle);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_surface_damage(..., android_native_rect_t* rects, int numRects)
|
||||
* Set the surface damage (i.e., the region of the surface that has changed
|
||||
* since the previous frame). The damage set by this call will be reset (to the
|
||||
* default of full-surface damage) after calling queue, so this must be called
|
||||
* prior to every frame with damage that does not cover the whole surface if the
|
||||
* caller desires downstream consumers to use this optimization.
|
||||
*
|
||||
* The damage region is specified as an array of rectangles, with the important
|
||||
* caveat that the origin of the surface is considered to be the bottom-left
|
||||
* corner, as in OpenGL ES.
|
||||
*
|
||||
* If numRects is set to 0, rects may be NULL, and the surface damage will be
|
||||
* set to the full surface (the same as if this function had not been called for
|
||||
* this frame).
|
||||
*/
|
||||
static inline int native_window_set_surface_damage(
|
||||
struct ANativeWindow* window,
|
||||
const android_native_rect_t* rects, size_t numRects)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_SURFACE_DAMAGE,
|
||||
rects, numRects);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_shared_buffer_mode(..., bool sharedBufferMode)
|
||||
* Enable/disable shared buffer mode
|
||||
*/
|
||||
static inline int native_window_set_shared_buffer_mode(
|
||||
struct ANativeWindow* window,
|
||||
bool sharedBufferMode)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_SHARED_BUFFER_MODE,
|
||||
sharedBufferMode);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_auto_refresh(..., autoRefresh)
|
||||
* Enable/disable auto refresh when in shared buffer mode
|
||||
*/
|
||||
static inline int native_window_set_auto_refresh(
|
||||
struct ANativeWindow* window,
|
||||
bool autoRefresh)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_AUTO_REFRESH, autoRefresh);
|
||||
}
|
||||
|
||||
static inline int native_window_get_refresh_cycle_duration(
|
||||
struct ANativeWindow* window,
|
||||
int64_t* outRefreshDuration)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_GET_REFRESH_CYCLE_DURATION,
|
||||
outRefreshDuration);
|
||||
}
|
||||
|
||||
static inline int native_window_get_next_frame_id(
|
||||
struct ANativeWindow* window, uint64_t* frameId)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_GET_NEXT_FRAME_ID, frameId);
|
||||
}
|
||||
|
||||
static inline int native_window_enable_frame_timestamps(
|
||||
struct ANativeWindow* window, bool enable)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_ENABLE_FRAME_TIMESTAMPS,
|
||||
enable);
|
||||
}
|
||||
|
||||
static inline int native_window_get_compositor_timing(
|
||||
struct ANativeWindow* window,
|
||||
int64_t* compositeDeadline, int64_t* compositeInterval,
|
||||
int64_t* compositeToPresentLatency)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_GET_COMPOSITOR_TIMING,
|
||||
compositeDeadline, compositeInterval, compositeToPresentLatency);
|
||||
}
|
||||
|
||||
static inline int native_window_get_frame_timestamps(
|
||||
struct ANativeWindow* window, uint64_t frameId,
|
||||
int64_t* outRequestedPresentTime, int64_t* outAcquireTime,
|
||||
int64_t* outLatchTime, int64_t* outFirstRefreshStartTime,
|
||||
int64_t* outLastRefreshStartTime, int64_t* outGpuCompositionDoneTime,
|
||||
int64_t* outDisplayPresentTime, int64_t* outDequeueReadyTime,
|
||||
int64_t* outReleaseTime)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_GET_FRAME_TIMESTAMPS,
|
||||
frameId, outRequestedPresentTime, outAcquireTime, outLatchTime,
|
||||
outFirstRefreshStartTime, outLastRefreshStartTime,
|
||||
outGpuCompositionDoneTime, outDisplayPresentTime,
|
||||
outDequeueReadyTime, outReleaseTime);
|
||||
}
|
||||
|
||||
static inline int native_window_get_wide_color_support(
|
||||
struct ANativeWindow* window, bool* outSupport) {
|
||||
return window->perform(window, NATIVE_WINDOW_GET_WIDE_COLOR_SUPPORT,
|
||||
outSupport);
|
||||
}
|
||||
|
||||
static inline int native_window_get_hdr_support(struct ANativeWindow* window,
|
||||
bool* outSupport) {
|
||||
return window->perform(window, NATIVE_WINDOW_GET_HDR_SUPPORT, outSupport);
|
||||
}
|
||||
|
||||
static inline int native_window_get_consumer_usage(struct ANativeWindow* window,
|
||||
uint64_t* outUsage) {
|
||||
return window->perform(window, NATIVE_WINDOW_GET_CONSUMER_USAGE64, outUsage);
|
||||
}
|
||||
|
||||
__END_DECLS
|
Reference in New Issue
Block a user