android: Update Android headers
Import the latest version of the Android headers from Chrome OS (commit a30340e77ec8 ("camera: Uprev Android camera headers")). This brings in the Camera HAL v3.5 support. The headers are imported verbatim, except for the addition of the SPDX headers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Tested-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
parent
b602bbe811
commit
1ac84feab8
13 changed files with 680 additions and 1660 deletions
|
@ -1,6 +1,6 @@
|
|||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
* Copyright (C) 2013-2018 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.
|
||||
|
@ -22,21 +22,21 @@
|
|||
#include "camera_common.h"
|
||||
|
||||
/**
|
||||
* Camera device HAL 3.3 [ CAMERA_DEVICE_API_VERSION_3_3 ]
|
||||
* Camera device HAL 3.5[ CAMERA_DEVICE_API_VERSION_3_5 ]
|
||||
*
|
||||
* This is the current recommended version of the camera device HAL.
|
||||
*
|
||||
* Supports the android.hardware.Camera API, and as of v3.2, the
|
||||
* android.hardware.camera2 API in LIMITED or FULL modes.
|
||||
* android.hardware.camera2 API as LIMITED or above hardware level.
|
||||
*
|
||||
* Camera devices that support this version of the HAL must return
|
||||
* CAMERA_DEVICE_API_VERSION_3_3 in camera_device_t.common.version and in
|
||||
* CAMERA_DEVICE_API_VERSION_3_5 in camera_device_t.common.version and in
|
||||
* camera_info_t.device_version (from camera_module_t.get_camera_info).
|
||||
*
|
||||
* CAMERA_DEVICE_API_VERSION_3_3:
|
||||
* Camera modules that may contain version 3.3 devices must implement at
|
||||
* least version 2.2 of the camera module interface (as defined by
|
||||
* camera_module_t.common.module_api_version).
|
||||
* CAMERA_DEVICE_API_VERSION_3_3 and above:
|
||||
* Camera modules that may contain version 3.3 or above devices must
|
||||
* implement at least version 2.2 of the camera module interface (as defined
|
||||
* by camera_module_t.common.module_api_version).
|
||||
*
|
||||
* CAMERA_DEVICE_API_VERSION_3_2:
|
||||
* Camera modules that may contain version 3.2 devices must implement at
|
||||
|
@ -138,6 +138,52 @@
|
|||
*
|
||||
* - Addition of camera3 stream configuration operation mode to camera3_stream_configuration_t
|
||||
*
|
||||
* 3.4: Minor additions to supported metadata and changes to data_space support
|
||||
*
|
||||
* - Add ANDROID_SENSOR_OPAQUE_RAW_SIZE static metadata as mandatory if
|
||||
* RAW_OPAQUE format is supported.
|
||||
*
|
||||
* - Add ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE static metadata as
|
||||
* mandatory if any RAW format is supported
|
||||
*
|
||||
* - Switch camera3_stream_t data_space field to a more flexible definition,
|
||||
* using the version 0 definition of dataspace encoding.
|
||||
*
|
||||
* - General metadata additions which are available to use for HALv3.2 or
|
||||
* newer:
|
||||
* - ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_3
|
||||
* - ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST
|
||||
* - ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE
|
||||
* - ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL
|
||||
* - ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL
|
||||
* - ANDROID_SENSOR_OPAQUE_RAW_SIZE
|
||||
* - ANDROID_SENSOR_OPTICAL_BLACK_REGIONS
|
||||
*
|
||||
* 3.5: Minor revisions to support session parameters and logical multi camera:
|
||||
*
|
||||
* - Add ANDROID_REQUEST_AVAILABLE_SESSION_KEYS static metadata, which is
|
||||
* optional for implementations that want to support session parameters. If support is
|
||||
* needed, then Hal should populate the list with all available capture request keys
|
||||
* that can cause severe processing delays when modified by client. Typical examples
|
||||
* include parameters that require time-consuming HW re-configuration or internal camera
|
||||
* pipeline update.
|
||||
*
|
||||
* - Add a session parameter field to camera3_stream_configuration which can be populated
|
||||
* by clients with initial values for the keys found in ANDROID_REQUEST_AVAILABLE_SESSION_KEYS.
|
||||
*
|
||||
* - Metadata additions for logical multi camera capability:
|
||||
* - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA
|
||||
* - ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS
|
||||
* - ANDROID_LOGICAL_MULTI_CAMERA_SYNC_TYPE
|
||||
*
|
||||
* - Add physical camera id field in camera3_stream, so that for a logical
|
||||
* multi camera, the application has the option to specify which physical camera
|
||||
* a particular stream is configured on.
|
||||
*
|
||||
* - Add physical camera id and settings field in camera3_capture_request, so that
|
||||
* for a logical multi camera, the application has the option to specify individual
|
||||
* settings for a particular physical device.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -1460,6 +1506,13 @@ typedef enum camera3_stream_configuration_mode {
|
|||
* android.lens.opticalStabilizationMode (if it is supported)
|
||||
* android.scaler.cropRegion
|
||||
* android.statistics.faceDetectMode (if it is supported)
|
||||
* 6. To reduce the amount of data passed across process boundaries at
|
||||
* high frame rate, within one batch, camera framework only propagates
|
||||
* the last shutter notify and the last capture results (including partial
|
||||
* results and final result) to the app. The shutter notifies and capture
|
||||
* results for the other requests in the batch are derived by
|
||||
* the camera framework. As a result, the HAL can return empty metadata
|
||||
* except for the last result in the batch.
|
||||
*
|
||||
* For more details about high speed stream requirements, see
|
||||
* android.control.availableHighSpeedVideoConfigurations and CONSTRAINED_HIGH_SPEED_VIDEO
|
||||
|
@ -1578,6 +1631,13 @@ typedef struct camera3_stream {
|
|||
* value of this is 0.
|
||||
* For all streams passed via configure_streams(), the HAL must write
|
||||
* over this field with its usage flags.
|
||||
*
|
||||
* From Android O, the usage flag for an output stream may be bitwise
|
||||
* combination of usage flags for multiple consumers, for the purpose of
|
||||
* sharing one camera stream between those consumers. The HAL must fail
|
||||
* configure_streams call with -EINVAL if the combined flags cannot be
|
||||
* supported due to imcompatible buffer format, dataSpace, or other hardware
|
||||
* limitations.
|
||||
*/
|
||||
uint32_t usage;
|
||||
|
||||
|
@ -1612,11 +1672,19 @@ typedef struct camera3_stream {
|
|||
* be HAL_DATASPACE_UNKNOWN, and the appropriate color space, etc, should
|
||||
* be determined from the usage flags and the format.
|
||||
*
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_3:
|
||||
* = CAMERA_DEVICE_API_VERSION_3_3:
|
||||
*
|
||||
* Always set by the camera service. HAL must use this dataSpace to
|
||||
* configure the stream to the correct colorspace, or to select between
|
||||
* color and depth outputs if supported.
|
||||
* color and depth outputs if supported. The dataspace values are the
|
||||
* legacy definitions in graphics.h
|
||||
*
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_4:
|
||||
*
|
||||
* Always set by the camera service. HAL must use this dataSpace to
|
||||
* configure the stream to the correct colorspace, or to select between
|
||||
* color and depth outputs if supported. The dataspace values are set
|
||||
* using the V0 dataspace definitions in graphics.h
|
||||
*/
|
||||
android_dataspace_t data_space;
|
||||
|
||||
|
@ -1646,6 +1714,29 @@ typedef struct camera3_stream {
|
|||
*/
|
||||
int rotation;
|
||||
|
||||
/**
|
||||
* The physical camera id this stream belongs to.
|
||||
*
|
||||
* <= CAMERA_DEVICE_API_VERISON_3_4:
|
||||
*
|
||||
* Not defined and must not be accessed.
|
||||
*
|
||||
* >= CAMERA_DEVICE_API_VERISON_3_5:
|
||||
*
|
||||
* Always set by camera service. If the camera device is not a logical
|
||||
* multi camera, or if the camera is a logical multi camera but the stream
|
||||
* is not a physical output stream, this field will point to a 0-length
|
||||
* string.
|
||||
*
|
||||
* A logical multi camera is a camera device backed by multiple physical
|
||||
* cameras that are also exposed to the application. And for a logical
|
||||
* multi camera, a physical output stream is an output stream specifically
|
||||
* requested on an underlying physical camera.
|
||||
*
|
||||
* For an input stream, this field is guaranteed to be a 0-length string.
|
||||
*/
|
||||
const char* physical_camera_id;
|
||||
|
||||
/**
|
||||
* This should be one of the camera3_stream_rotation_t values except for
|
||||
* CAMERA3_STREAM_ROTATION_180.
|
||||
|
@ -1663,7 +1754,7 @@ typedef struct camera3_stream {
|
|||
int crop_rotate_scale_degrees;
|
||||
|
||||
/* reserved for future use */
|
||||
void *reserved[6];
|
||||
void *reserved[5];
|
||||
|
||||
} camera3_stream_t;
|
||||
|
||||
|
@ -1697,16 +1788,30 @@ typedef struct camera3_stream_configuration {
|
|||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_3:
|
||||
*
|
||||
* The operation mode of streams in this configuration, one of the value defined in
|
||||
* camera3_stream_configuration_mode_t.
|
||||
* The HAL can use this mode as an indicator to set the stream property (e.g.,
|
||||
* camera3_stream->max_buffers) appropriately. For example, if the configuration is
|
||||
* CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE, the HAL may want to set aside more
|
||||
* buffers for batch mode operation (see android.control.availableHighSpeedVideoConfigurations
|
||||
* for batch mode definition).
|
||||
* The operation mode of streams in this configuration, one of the value
|
||||
* defined in camera3_stream_configuration_mode_t. The HAL can use this
|
||||
* mode as an indicator to set the stream property (e.g.,
|
||||
* camera3_stream->max_buffers) appropriately. For example, if the
|
||||
* configuration is
|
||||
* CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE, the HAL may
|
||||
* want to set aside more buffers for batch mode operation (see
|
||||
* android.control.availableHighSpeedVideoConfigurations for batch mode
|
||||
* definition).
|
||||
*
|
||||
*/
|
||||
uint32_t operation_mode;
|
||||
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
*
|
||||
* The session metadata buffer contains the initial values of
|
||||
* ANDROID_REQUEST_AVAILABLE_SESSION_KEYS. This field is optional
|
||||
* and camera clients can choose to ignore it, in which case it will
|
||||
* be set to NULL. If parameters are present, then Hal should examine
|
||||
* the parameter values and configure its internal camera pipeline
|
||||
* accordingly.
|
||||
*/
|
||||
const camera_metadata_t *session_parameters;
|
||||
} camera3_stream_configuration_t;
|
||||
|
||||
/**
|
||||
|
@ -1950,7 +2055,7 @@ typedef enum camera3_error_msg_code {
|
|||
* available. Subsequent requests are unaffected, and the device remains
|
||||
* operational. The frame_number field specifies the request for which the
|
||||
* buffer was dropped, and error_stream contains a pointer to the stream
|
||||
* that dropped the frame.u
|
||||
* that dropped the frame.
|
||||
*/
|
||||
CAMERA3_MSG_ERROR_BUFFER = 4,
|
||||
|
||||
|
@ -2190,6 +2295,44 @@ typedef struct camera3_capture_request {
|
|||
*/
|
||||
const camera3_stream_buffer_t *output_buffers;
|
||||
|
||||
/**
|
||||
* <= CAMERA_DEVICE_API_VERISON_3_4:
|
||||
*
|
||||
* Not defined and must not be accessed.
|
||||
*
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
* The number of physical camera settings to be applied. If 'num_physcam_settings'
|
||||
* equals 0 or a physical device is not included, then Hal must decide the
|
||||
* specific physical device settings based on the default 'settings'.
|
||||
*/
|
||||
uint32_t num_physcam_settings;
|
||||
|
||||
/**
|
||||
* <= CAMERA_DEVICE_API_VERISON_3_4:
|
||||
*
|
||||
* Not defined and must not be accessed.
|
||||
*
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
* The physical camera ids. The array will contain 'num_physcam_settings'
|
||||
* camera id strings for all physical devices that have specific settings.
|
||||
* In case some id is invalid, the process capture request must fail and return
|
||||
* -EINVAL.
|
||||
*/
|
||||
const char **physcam_id;
|
||||
|
||||
/**
|
||||
* <= CAMERA_DEVICE_API_VERISON_3_4:
|
||||
*
|
||||
* Not defined and must not be accessed.
|
||||
*
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
* The capture settings for the physical cameras. The array will contain
|
||||
* 'num_physcam_settings' settings for invididual physical devices. In
|
||||
* case the settings at some particular index are empty, the process capture
|
||||
* request must fail and return -EINVAL.
|
||||
*/
|
||||
const camera_metadata_t **physcam_settings;
|
||||
|
||||
} camera3_capture_request_t;
|
||||
|
||||
/**
|
||||
|
@ -2367,6 +2510,37 @@ typedef struct camera3_capture_result {
|
|||
*/
|
||||
uint32_t partial_result;
|
||||
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
*
|
||||
* Specifies the number of physical camera metadata this capture result
|
||||
* contains. It must be equal to the number of physical cameras being
|
||||
* requested from.
|
||||
*
|
||||
* If the current camera device is not a logical multi-camera, or the
|
||||
* corresponding capture_request doesn't request on any physical camera,
|
||||
* this field must be 0.
|
||||
*/
|
||||
uint32_t num_physcam_metadata;
|
||||
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
*
|
||||
* An array of strings containing the physical camera ids for the returned
|
||||
* physical camera metadata. The length of the array is
|
||||
* num_physcam_metadata.
|
||||
*/
|
||||
const char **physcam_ids;
|
||||
|
||||
/**
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_5:
|
||||
*
|
||||
* The array of physical camera metadata for the physical cameras being
|
||||
* requested upon. This array should have a 1-to-1 mapping with the
|
||||
* physcam_ids. The length of the array is num_physcam_metadata.
|
||||
*/
|
||||
const camera_metadata_t **physcam_metadata;
|
||||
|
||||
} camera3_capture_result_t;
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -2899,7 +3073,8 @@ typedef struct camera3_device_ops {
|
|||
* 0: On a successful start to processing the capture request
|
||||
*
|
||||
* -EINVAL: If the input is malformed (the settings are NULL when not
|
||||
* allowed, there are 0 output buffers, etc) and capture processing
|
||||
* allowed, invalid physical camera settings,
|
||||
* there are 0 output buffers, etc) and capture processing
|
||||
* cannot start. Failures during request processing should be
|
||||
* handled by calling camera3_callback_ops_t.notify(). In case of
|
||||
* this error, the framework will retain responsibility for the
|
||||
|
|
|
@ -141,17 +141,19 @@ __BEGIN_DECLS
|
|||
* All device versions <= HARDWARE_DEVICE_API_VERSION(1, 0xFF) must be treated
|
||||
* as CAMERA_DEVICE_API_VERSION_1_0
|
||||
*/
|
||||
#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
|
||||
#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0)
|
||||
#define CAMERA_DEVICE_API_VERSION_2_1 HARDWARE_DEVICE_API_VERSION(2, 1)
|
||||
#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0)
|
||||
#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1)
|
||||
#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) // DEPRECATED
|
||||
#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) // NO LONGER SUPPORTED
|
||||
#define CAMERA_DEVICE_API_VERSION_2_1 HARDWARE_DEVICE_API_VERSION(2, 1) // NO LONGER SUPPORTED
|
||||
#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0) // NO LONGER SUPPORTED
|
||||
#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1) // NO LONGER SUPPORTED
|
||||
#define CAMERA_DEVICE_API_VERSION_3_2 HARDWARE_DEVICE_API_VERSION(3, 2)
|
||||
#define CAMERA_DEVICE_API_VERSION_3_3 HARDWARE_DEVICE_API_VERSION(3, 3)
|
||||
#define CAMERA_DEVICE_API_VERSION_3_4 HARDWARE_DEVICE_API_VERSION(3, 4)
|
||||
#define CAMERA_DEVICE_API_VERSION_3_5 HARDWARE_DEVICE_API_VERSION(3, 5)
|
||||
|
||||
// Device version 3.3 is current, older HAL camera device versions are not
|
||||
// Device version 3.5 is current, older HAL camera device versions are not
|
||||
// recommended for new devices.
|
||||
#define CAMERA_DEVICE_API_VERSION_CURRENT CAMERA_DEVICE_API_VERSION_3_3
|
||||
#define CAMERA_DEVICE_API_VERSION_CURRENT CAMERA_DEVICE_API_VERSION_3_5
|
||||
|
||||
/**
|
||||
* Defined in /system/media/camera/include/system/camera_metadata.h
|
||||
|
|
|
@ -161,7 +161,7 @@ typedef struct framebuffer_device_t {
|
|||
static inline int framebuffer_open(const struct hw_module_t* module,
|
||||
struct framebuffer_device_t** device) {
|
||||
return module->methods->open(module,
|
||||
GRALLOC_HARDWARE_FB0, (struct hw_device_t**)device);
|
||||
GRALLOC_HARDWARE_FB0, TO_HW_DEVICE_T_OPEN(device));
|
||||
}
|
||||
|
||||
static inline int framebuffer_close(struct framebuffer_device_t* device) {
|
||||
|
|
|
@ -19,9 +19,8 @@
|
|||
#ifndef ANDROID_GRALLOC_INTERFACE_H
|
||||
#define ANDROID_GRALLOC_INTERFACE_H
|
||||
|
||||
#include <system/window.h>
|
||||
#include <system/graphics.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <system/graphics.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
@ -29,8 +28,8 @@
|
|||
|
||||
#include <cutils/native_handle.h>
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/fb.h>
|
||||
#include <hardware/hardware.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -69,69 +68,69 @@ __BEGIN_DECLS
|
|||
|
||||
enum {
|
||||
/* buffer is never read in software */
|
||||
GRALLOC_USAGE_SW_READ_NEVER = 0x00000000,
|
||||
GRALLOC_USAGE_SW_READ_NEVER = 0x00000000U,
|
||||
/* buffer is rarely read in software */
|
||||
GRALLOC_USAGE_SW_READ_RARELY = 0x00000002,
|
||||
GRALLOC_USAGE_SW_READ_RARELY = 0x00000002U,
|
||||
/* buffer is often read in software */
|
||||
GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003,
|
||||
GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003U,
|
||||
/* mask for the software read values */
|
||||
GRALLOC_USAGE_SW_READ_MASK = 0x0000000F,
|
||||
GRALLOC_USAGE_SW_READ_MASK = 0x0000000FU,
|
||||
|
||||
/* buffer is never written in software */
|
||||
GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000,
|
||||
GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000U,
|
||||
/* buffer is rarely written in software */
|
||||
GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020,
|
||||
GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020U,
|
||||
/* buffer is often written in software */
|
||||
GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030,
|
||||
GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030U,
|
||||
/* mask for the software write values */
|
||||
GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0,
|
||||
GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0U,
|
||||
|
||||
/* buffer will be used as an OpenGL ES texture */
|
||||
GRALLOC_USAGE_HW_TEXTURE = 0x00000100,
|
||||
GRALLOC_USAGE_HW_TEXTURE = 0x00000100U,
|
||||
/* buffer will be used as an OpenGL ES render target */
|
||||
GRALLOC_USAGE_HW_RENDER = 0x00000200,
|
||||
GRALLOC_USAGE_HW_RENDER = 0x00000200U,
|
||||
/* buffer will be used by the 2D hardware blitter */
|
||||
GRALLOC_USAGE_HW_2D = 0x00000400,
|
||||
GRALLOC_USAGE_HW_2D = 0x00000400U,
|
||||
/* buffer will be used by the HWComposer HAL module */
|
||||
GRALLOC_USAGE_HW_COMPOSER = 0x00000800,
|
||||
GRALLOC_USAGE_HW_COMPOSER = 0x00000800U,
|
||||
/* buffer will be used with the framebuffer device */
|
||||
GRALLOC_USAGE_HW_FB = 0x00001000,
|
||||
GRALLOC_USAGE_HW_FB = 0x00001000U,
|
||||
|
||||
/* buffer should be displayed full-screen on an external display when
|
||||
* possible */
|
||||
GRALLOC_USAGE_EXTERNAL_DISP = 0x00002000,
|
||||
GRALLOC_USAGE_EXTERNAL_DISP = 0x00002000U,
|
||||
|
||||
/* Must have a hardware-protected path to external display sink for
|
||||
* this buffer. If a hardware-protected path is not available, then
|
||||
* either don't composite only this buffer (preferred) to the
|
||||
* external sink, or (less desirable) do not route the entire
|
||||
* composition to the external sink. */
|
||||
GRALLOC_USAGE_PROTECTED = 0x00004000,
|
||||
GRALLOC_USAGE_PROTECTED = 0x00004000U,
|
||||
|
||||
/* buffer may be used as a cursor */
|
||||
GRALLOC_USAGE_CURSOR = 0x00008000,
|
||||
GRALLOC_USAGE_CURSOR = 0x00008000U,
|
||||
|
||||
/* buffer will be used with the HW video encoder */
|
||||
GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000,
|
||||
GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000U,
|
||||
/* buffer will be written by the HW camera pipeline */
|
||||
GRALLOC_USAGE_HW_CAMERA_WRITE = 0x00020000,
|
||||
GRALLOC_USAGE_HW_CAMERA_WRITE = 0x00020000U,
|
||||
/* buffer will be read by the HW camera pipeline */
|
||||
GRALLOC_USAGE_HW_CAMERA_READ = 0x00040000,
|
||||
GRALLOC_USAGE_HW_CAMERA_READ = 0x00040000U,
|
||||
/* buffer will be used as part of zero-shutter-lag queue */
|
||||
GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00060000,
|
||||
GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00060000U,
|
||||
/* mask for the camera access values */
|
||||
GRALLOC_USAGE_HW_CAMERA_MASK = 0x00060000,
|
||||
GRALLOC_USAGE_HW_CAMERA_MASK = 0x00060000U,
|
||||
/* mask for the software usage bit-mask */
|
||||
GRALLOC_USAGE_HW_MASK = 0x00071F00,
|
||||
GRALLOC_USAGE_HW_MASK = 0x00071F00U,
|
||||
|
||||
/* buffer will be used as a RenderScript Allocation */
|
||||
GRALLOC_USAGE_RENDERSCRIPT = 0x00100000,
|
||||
GRALLOC_USAGE_RENDERSCRIPT = 0x00100000U,
|
||||
|
||||
/* Set by the consumer to indicate to the producer that they may attach a
|
||||
* buffer that they did not detach from the BufferQueue. Will be filtered
|
||||
* out by GRALLOC_USAGE_ALLOC_MASK, so gralloc modules will not need to
|
||||
* handle this flag. */
|
||||
GRALLOC_USAGE_FOREIGN_BUFFERS = 0x00200000,
|
||||
GRALLOC_USAGE_FOREIGN_BUFFERS = 0x00200000U,
|
||||
|
||||
/* Mask of all flags which could be passed to a gralloc module for buffer
|
||||
* allocation. Any flags not in this mask do not need to be handled by
|
||||
|
@ -139,11 +138,11 @@ enum {
|
|||
GRALLOC_USAGE_ALLOC_MASK = ~(GRALLOC_USAGE_FOREIGN_BUFFERS),
|
||||
|
||||
/* implementation-specific private usage flags */
|
||||
GRALLOC_USAGE_PRIVATE_0 = 0x10000000,
|
||||
GRALLOC_USAGE_PRIVATE_1 = 0x20000000,
|
||||
GRALLOC_USAGE_PRIVATE_2 = 0x40000000,
|
||||
GRALLOC_USAGE_PRIVATE_3 = 0x80000000,
|
||||
GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000,
|
||||
GRALLOC_USAGE_PRIVATE_0 = 0x10000000U,
|
||||
GRALLOC_USAGE_PRIVATE_1 = 0x20000000U,
|
||||
GRALLOC_USAGE_PRIVATE_2 = 0x40000000U,
|
||||
GRALLOC_USAGE_PRIVATE_3 = 0x80000000U,
|
||||
GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000U,
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -373,13 +372,45 @@ typedef struct alloc_device_t {
|
|||
static inline int gralloc_open(const struct hw_module_t* module,
|
||||
struct alloc_device_t** device) {
|
||||
return module->methods->open(module,
|
||||
GRALLOC_HARDWARE_GPU0, (struct hw_device_t**)device);
|
||||
GRALLOC_HARDWARE_GPU0, TO_HW_DEVICE_T_OPEN(device));
|
||||
}
|
||||
|
||||
static inline int gralloc_close(struct alloc_device_t* device) {
|
||||
return device->common.close(&device->common);
|
||||
}
|
||||
|
||||
/**
|
||||
* map_usage_to_memtrack should be called after allocating a gralloc buffer.
|
||||
*
|
||||
* @param usage - it is the flag used when alloc function is called.
|
||||
*
|
||||
* This function maps the gralloc usage flags to appropriate memtrack bucket.
|
||||
* GrallocHAL implementers and users should make an additional ION_IOCTL_TAG
|
||||
* call using the memtrack tag returned by this function. This will help the
|
||||
* in-kernel memtack to categorize the memory allocated by different processes
|
||||
* according to their usage.
|
||||
*
|
||||
*/
|
||||
static inline const char* map_usage_to_memtrack(uint32_t usage) {
|
||||
usage &= GRALLOC_USAGE_ALLOC_MASK;
|
||||
|
||||
if ((usage & GRALLOC_USAGE_HW_CAMERA_WRITE) != 0) {
|
||||
return "camera";
|
||||
} else if ((usage & GRALLOC_USAGE_HW_VIDEO_ENCODER) != 0 ||
|
||||
(usage & GRALLOC_USAGE_EXTERNAL_DISP) != 0) {
|
||||
return "video";
|
||||
} else if ((usage & GRALLOC_USAGE_HW_RENDER) != 0 ||
|
||||
(usage & GRALLOC_USAGE_HW_TEXTURE) != 0) {
|
||||
return "gl";
|
||||
} else if ((usage & GRALLOC_USAGE_HW_CAMERA_READ) != 0) {
|
||||
return "camera";
|
||||
} else if ((usage & GRALLOC_USAGE_SW_READ_MASK) != 0 ||
|
||||
(usage & GRALLOC_USAGE_SW_WRITE_MASK) != 0) {
|
||||
return "cpu";
|
||||
}
|
||||
return "graphics";
|
||||
}
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // ANDROID_GRALLOC_INTERFACE_H
|
||||
|
|
|
@ -202,6 +202,12 @@ typedef struct hw_device_t {
|
|||
|
||||
} hw_device_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define TO_HW_DEVICE_T_OPEN(x) reinterpret_cast<struct hw_device_t**>(x)
|
||||
#else
|
||||
#define TO_HW_DEVICE_T_OPEN(x) (struct hw_device_t**)(x)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Name of the hal_module_info
|
||||
*/
|
||||
|
|
|
@ -18,18 +18,37 @@
|
|||
#ifndef NATIVE_HANDLE_H_
|
||||
#define NATIVE_HANDLE_H_
|
||||
|
||||
#include <stdalign.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NATIVE_HANDLE_MAX_FDS 1024
|
||||
#define NATIVE_HANDLE_MAX_INTS 1024
|
||||
|
||||
/* Declare a char array for use with native_handle_init */
|
||||
#define NATIVE_HANDLE_DECLARE_STORAGE(name, maxFds, maxInts) \
|
||||
alignas(native_handle_t) char (name)[ \
|
||||
sizeof(native_handle_t) + sizeof(int) * ((maxFds) + (maxInts))]
|
||||
|
||||
typedef struct native_handle
|
||||
{
|
||||
int version; /* sizeof(native_handle_t) */
|
||||
int numFds; /* number of file-descriptors at &data[0] */
|
||||
int numInts; /* number of ints at &data[numFds] */
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wzero-length-array"
|
||||
#endif
|
||||
int data[0]; /* numFds + numInts ints */
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
} native_handle_t;
|
||||
|
||||
typedef const native_handle_t* buffer_handle_t;
|
||||
|
||||
/*
|
||||
* native_handle_close
|
||||
*
|
||||
|
@ -40,6 +59,14 @@ typedef struct native_handle
|
|||
*/
|
||||
int native_handle_close(const native_handle_t* h);
|
||||
|
||||
/*
|
||||
* native_handle_init
|
||||
*
|
||||
* Initializes a native_handle_t from storage. storage must be declared with
|
||||
* NATIVE_HANDLE_DECLARE_STORAGE. numFds and numInts must not respectively
|
||||
* exceed maxFds and maxInts used to declare the storage.
|
||||
*/
|
||||
native_handle_t* native_handle_init(char* storage, int numFds, int numInts);
|
||||
|
||||
/*
|
||||
* native_handle_create
|
||||
|
@ -50,6 +77,15 @@ int native_handle_close(const native_handle_t* h);
|
|||
*/
|
||||
native_handle_t* native_handle_create(int numFds, int numInts);
|
||||
|
||||
/*
|
||||
* native_handle_clone
|
||||
*
|
||||
* creates a native_handle_t and initializes it from another native_handle_t.
|
||||
* Must be destroyed with native_handle_delete().
|
||||
*
|
||||
*/
|
||||
native_handle_t* native_handle_clone(const native_handle_t* handle);
|
||||
|
||||
/*
|
||||
* native_handle_delete
|
||||
*
|
||||
|
|
|
@ -204,6 +204,15 @@ enum {
|
|||
* (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
|
||||
};
|
||||
|
||||
|
|
140
include/android/system/core/include/system/graphics-base-v1.0.h
Normal file
140
include/android/system/core/include/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_
|
|
@ -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_
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef SYSTEM_CORE_GRAPHICS_BASE_H_
|
||||
#define SYSTEM_CORE_GRAPHICS_BASE_H_
|
||||
|
||||
#include "graphics-base-v1.0.h"
|
||||
#include "graphics-base-v1.1.h"
|
||||
|
||||
#endif // SYSTEM_CORE_GRAPHICS_BASE_H_
|
16
include/android/system/core/include/system/graphics-sw.h
Normal file
16
include/android/system/core/include/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_
|
|
@ -18,12 +18,32 @@
|
|||
#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
|
||||
|
@ -38,411 +58,6 @@ extern "C" {
|
|||
|
||||
#define HAL_PRIORITY_URGENT_DISPLAY (-8)
|
||||
|
||||
/**
|
||||
* pixel format definitions
|
||||
*/
|
||||
|
||||
enum {
|
||||
/*
|
||||
* "linear" color pixel formats:
|
||||
*
|
||||
* When used with ANativeWindow, the dataSpace field describes the color
|
||||
* space of the buffer.
|
||||
*
|
||||
* The color space determines, for example, if the formats are linear or
|
||||
* gamma-corrected; or whether any special operations are performed when
|
||||
* reading or writing into a buffer in one of these formats.
|
||||
*/
|
||||
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,
|
||||
|
||||
/*
|
||||
* 0x100 - 0x1FF
|
||||
*
|
||||
* This range is reserved for pixel formats that are specific to the HAL
|
||||
* implementation. Implementations can use any value in this range to
|
||||
* communicate video pixel formats between their HAL modules. These formats
|
||||
* must not have an alpha channel. Additionally, an EGLimage created from a
|
||||
* gralloc buffer of one of these formats must be supported for use with the
|
||||
* GL_OES_EGL_image_external OpenGL ES extension.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Android YUV format:
|
||||
*
|
||||
* This format is exposed outside of the HAL to software decoders and
|
||||
* applications. EGLImageKHR must support it in conjunction with the
|
||||
* OES_EGL_image_external extension.
|
||||
*
|
||||
* YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
|
||||
* by (W/2) x (H/2) Cr and Cb planes.
|
||||
*
|
||||
* This format assumes
|
||||
* - an even width
|
||||
* - an even height
|
||||
* - a horizontal stride multiple of 16 pixels
|
||||
* - a vertical stride equal to the height
|
||||
*
|
||||
* y_size = stride * height
|
||||
* c_stride = ALIGN(stride/2, 16)
|
||||
* c_size = c_stride * height/2
|
||||
* size = y_size + c_size * 2
|
||||
* cr_offset = y_size
|
||||
* cb_offset = y_size + c_size
|
||||
*
|
||||
* When used with ANativeWindow, the dataSpace field describes the color
|
||||
* space of the buffer.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar
|
||||
|
||||
|
||||
/*
|
||||
* Android Y8 format:
|
||||
*
|
||||
* This format is exposed outside of the HAL to the framework.
|
||||
* The expected gralloc usage flags are SW_* and HW_CAMERA_*,
|
||||
* and no other HW_ flags will be used.
|
||||
*
|
||||
* Y8 is a YUV planar format comprised of a WxH Y plane,
|
||||
* with each pixel being represented by 8 bits.
|
||||
*
|
||||
* It is equivalent to just the Y plane from YV12.
|
||||
*
|
||||
* This format assumes
|
||||
* - an even width
|
||||
* - an even height
|
||||
* - a horizontal stride multiple of 16 pixels
|
||||
* - a vertical stride equal to the height
|
||||
*
|
||||
* size = stride * height
|
||||
*
|
||||
* When used with ANativeWindow, the dataSpace field describes the color
|
||||
* space of the buffer.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_Y8 = 0x20203859,
|
||||
|
||||
/*
|
||||
* Android Y16 format:
|
||||
*
|
||||
* This format is exposed outside of the HAL to the framework.
|
||||
* The expected gralloc usage flags are SW_* and HW_CAMERA_*,
|
||||
* and no other HW_ flags will be used.
|
||||
*
|
||||
* Y16 is a YUV planar format comprised of a WxH Y plane,
|
||||
* with each pixel being represented by 16 bits.
|
||||
*
|
||||
* It is just like Y8, but has double the bits per pixel (little endian).
|
||||
*
|
||||
* This format assumes
|
||||
* - an even width
|
||||
* - an even height
|
||||
* - a horizontal stride multiple of 16 pixels
|
||||
* - a vertical stride equal to the height
|
||||
* - strides are specified in pixels, not in bytes
|
||||
*
|
||||
* size = stride * height * 2
|
||||
*
|
||||
* When used with ANativeWindow, the dataSpace field describes the color
|
||||
* space of the buffer, except that dataSpace field
|
||||
* HAL_DATASPACE_DEPTH indicates that this buffer contains a depth
|
||||
* image where each sample is a distance value measured by a depth camera,
|
||||
* plus an associated confidence value.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_Y16 = 0x20363159,
|
||||
|
||||
/*
|
||||
* Android RAW sensor format:
|
||||
*
|
||||
* This format is exposed outside of the camera HAL to applications.
|
||||
*
|
||||
* RAW16 is a single-channel, 16-bit, little endian format, typically
|
||||
* representing raw Bayer-pattern images from an image sensor, with minimal
|
||||
* processing.
|
||||
*
|
||||
* The exact pixel layout of the data in the buffer is sensor-dependent, and
|
||||
* needs to be queried from the camera device.
|
||||
*
|
||||
* Generally, not all 16 bits are used; more common values are 10 or 12
|
||||
* bits. If not all bits are used, the lower-order bits are filled first.
|
||||
* All parameters to interpret the raw data (black and white points,
|
||||
* color space, etc) must be queried from the camera device.
|
||||
*
|
||||
* This format assumes
|
||||
* - an even width
|
||||
* - an even height
|
||||
* - a horizontal stride multiple of 16 pixels
|
||||
* - a vertical stride equal to the height
|
||||
* - strides are specified in pixels, not in bytes
|
||||
*
|
||||
* size = stride * height * 2
|
||||
*
|
||||
* This format must be accepted by the gralloc module when used with the
|
||||
* following usage flags:
|
||||
* - GRALLOC_USAGE_HW_CAMERA_*
|
||||
* - GRALLOC_USAGE_SW_*
|
||||
* - GRALLOC_USAGE_RENDERSCRIPT
|
||||
*
|
||||
* When used with ANativeWindow, the dataSpace should be
|
||||
* HAL_DATASPACE_ARBITRARY, as raw image sensor buffers require substantial
|
||||
* extra metadata to define.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_RAW16 = 0x20,
|
||||
|
||||
/*
|
||||
* Android RAW10 format:
|
||||
*
|
||||
* This format is exposed outside of the camera HAL to applications.
|
||||
*
|
||||
* RAW10 is a single-channel, 10-bit per pixel, densely packed in each row,
|
||||
* unprocessed format, usually representing raw Bayer-pattern images coming from
|
||||
* an image sensor.
|
||||
*
|
||||
* In an image buffer with this format, starting from the first pixel of each
|
||||
* row, each 4 consecutive pixels are packed into 5 bytes (40 bits). Each one
|
||||
* of the first 4 bytes contains the top 8 bits of each pixel, The fifth byte
|
||||
* contains the 2 least significant bits of the 4 pixels, the exact layout data
|
||||
* for each 4 consecutive pixels is illustrated below (Pi[j] stands for the jth
|
||||
* bit of the ith pixel):
|
||||
*
|
||||
* bit 7 bit 0
|
||||
* =====|=====|=====|=====|=====|=====|=====|=====|
|
||||
* Byte 0: |P0[9]|P0[8]|P0[7]|P0[6]|P0[5]|P0[4]|P0[3]|P0[2]|
|
||||
* |-----|-----|-----|-----|-----|-----|-----|-----|
|
||||
* Byte 1: |P1[9]|P1[8]|P1[7]|P1[6]|P1[5]|P1[4]|P1[3]|P1[2]|
|
||||
* |-----|-----|-----|-----|-----|-----|-----|-----|
|
||||
* Byte 2: |P2[9]|P2[8]|P2[7]|P2[6]|P2[5]|P2[4]|P2[3]|P2[2]|
|
||||
* |-----|-----|-----|-----|-----|-----|-----|-----|
|
||||
* Byte 3: |P3[9]|P3[8]|P3[7]|P3[6]|P3[5]|P3[4]|P3[3]|P3[2]|
|
||||
* |-----|-----|-----|-----|-----|-----|-----|-----|
|
||||
* Byte 4: |P3[1]|P3[0]|P2[1]|P2[0]|P1[1]|P1[0]|P0[1]|P0[0]|
|
||||
* ===============================================
|
||||
*
|
||||
* This format assumes
|
||||
* - a width multiple of 4 pixels
|
||||
* - an even height
|
||||
* - a vertical stride equal to the height
|
||||
* - strides are specified in bytes, not in pixels
|
||||
*
|
||||
* size = stride * height
|
||||
*
|
||||
* When stride is equal to width * (10 / 8), there will be no padding bytes at
|
||||
* the end of each row, the entire image data is densely packed. When stride is
|
||||
* larger than width * (10 / 8), padding bytes will be present at the end of each
|
||||
* row (including the last row).
|
||||
*
|
||||
* This format must be accepted by the gralloc module when used with the
|
||||
* following usage flags:
|
||||
* - GRALLOC_USAGE_HW_CAMERA_*
|
||||
* - GRALLOC_USAGE_SW_*
|
||||
* - GRALLOC_USAGE_RENDERSCRIPT
|
||||
*
|
||||
* When used with ANativeWindow, the dataSpace field should be
|
||||
* HAL_DATASPACE_ARBITRARY, as raw image sensor buffers require substantial
|
||||
* extra metadata to define.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_RAW10 = 0x25,
|
||||
|
||||
/*
|
||||
* Android RAW12 format:
|
||||
*
|
||||
* This format is exposed outside of camera HAL to applications.
|
||||
*
|
||||
* RAW12 is a single-channel, 12-bit per pixel, densely packed in each row,
|
||||
* unprocessed format, usually representing raw Bayer-pattern images coming from
|
||||
* an image sensor.
|
||||
*
|
||||
* In an image buffer with this format, starting from the first pixel of each
|
||||
* row, each two consecutive pixels are packed into 3 bytes (24 bits). The first
|
||||
* and second byte contains the top 8 bits of first and second pixel. The third
|
||||
* byte contains the 4 least significant bits of the two pixels, the exact layout
|
||||
* data for each two consecutive pixels is illustrated below (Pi[j] stands for
|
||||
* the jth bit of the ith pixel):
|
||||
*
|
||||
* bit 7 bit 0
|
||||
* ======|======|======|======|======|======|======|======|
|
||||
* Byte 0: |P0[11]|P0[10]|P0[ 9]|P0[ 8]|P0[ 7]|P0[ 6]|P0[ 5]|P0[ 4]|
|
||||
* |------|------|------|------|------|------|------|------|
|
||||
* Byte 1: |P1[11]|P1[10]|P1[ 9]|P1[ 8]|P1[ 7]|P1[ 6]|P1[ 5]|P1[ 4]|
|
||||
* |------|------|------|------|------|------|------|------|
|
||||
* Byte 2: |P1[ 3]|P1[ 2]|P1[ 1]|P1[ 0]|P0[ 3]|P0[ 2]|P0[ 1]|P0[ 0]|
|
||||
* =======================================================
|
||||
*
|
||||
* This format assumes:
|
||||
* - a width multiple of 4 pixels
|
||||
* - an even height
|
||||
* - a vertical stride equal to the height
|
||||
* - strides are specified in bytes, not in pixels
|
||||
*
|
||||
* size = stride * height
|
||||
*
|
||||
* When stride is equal to width * (12 / 8), there will be no padding bytes at
|
||||
* the end of each row, the entire image data is densely packed. When stride is
|
||||
* larger than width * (12 / 8), padding bytes will be present at the end of
|
||||
* each row (including the last row).
|
||||
*
|
||||
* This format must be accepted by the gralloc module when used with the
|
||||
* following usage flags:
|
||||
* - GRALLOC_USAGE_HW_CAMERA_*
|
||||
* - GRALLOC_USAGE_SW_*
|
||||
* - GRALLOC_USAGE_RENDERSCRIPT
|
||||
*
|
||||
* When used with ANativeWindow, the dataSpace field should be
|
||||
* HAL_DATASPACE_ARBITRARY, as raw image sensor buffers require substantial
|
||||
* extra metadata to define.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_RAW12 = 0x26,
|
||||
|
||||
/*
|
||||
* Android opaque RAW format:
|
||||
*
|
||||
* This format is exposed outside of the camera HAL to applications.
|
||||
*
|
||||
* RAW_OPAQUE is a format for unprocessed raw image buffers coming from an
|
||||
* image sensor. The actual structure of buffers of this format is
|
||||
* implementation-dependent.
|
||||
*
|
||||
* This format must be accepted by the gralloc module when used with the
|
||||
* following usage flags:
|
||||
* - GRALLOC_USAGE_HW_CAMERA_*
|
||||
* - GRALLOC_USAGE_SW_*
|
||||
* - GRALLOC_USAGE_RENDERSCRIPT
|
||||
*
|
||||
* When used with ANativeWindow, the dataSpace field should be
|
||||
* HAL_DATASPACE_ARBITRARY, as raw image sensor buffers require substantial
|
||||
* extra metadata to define.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_RAW_OPAQUE = 0x24,
|
||||
|
||||
/*
|
||||
* Android binary blob graphics buffer format:
|
||||
*
|
||||
* This format is used to carry task-specific data which does not have a
|
||||
* standard image structure. The details of the format are left to the two
|
||||
* endpoints.
|
||||
*
|
||||
* A typical use case is for transporting JPEG-compressed images from the
|
||||
* Camera HAL to the framework or to applications.
|
||||
*
|
||||
* Buffers of this format must have a height of 1, and width equal to their
|
||||
* size in bytes.
|
||||
*
|
||||
* When used with ANativeWindow, the mapping of the dataSpace field to
|
||||
* buffer contents for BLOB is as follows:
|
||||
*
|
||||
* dataSpace value | Buffer contents
|
||||
* -------------------------------+-----------------------------------------
|
||||
* HAL_DATASPACE_JFIF | An encoded JPEG image
|
||||
* HAL_DATASPACE_DEPTH | An android_depth_points buffer
|
||||
* Other | Unsupported
|
||||
*
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_BLOB = 0x21,
|
||||
|
||||
/*
|
||||
* Android format indicating that the choice of format is entirely up to the
|
||||
* device-specific Gralloc implementation.
|
||||
*
|
||||
* The Gralloc implementation should examine the usage bits passed in when
|
||||
* allocating a buffer with this format, and it should derive the pixel
|
||||
* format from those usage flags. This format will never be used with any
|
||||
* of the GRALLOC_USAGE_SW_* usage flags.
|
||||
*
|
||||
* If a buffer of this format is to be used as an OpenGL ES texture, the
|
||||
* framework will assume that sampling the texture will always return an
|
||||
* alpha value of 1.0 (i.e. the buffer contains only opaque pixel values).
|
||||
*
|
||||
* When used with ANativeWindow, the dataSpace field describes the color
|
||||
* space of the buffer.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 0x22,
|
||||
|
||||
/*
|
||||
* Android flexible YCbCr 4:2:0 formats
|
||||
*
|
||||
* This format allows platforms to use an efficient YCbCr/YCrCb 4:2:0
|
||||
* buffer layout, while still describing the general format in a
|
||||
* layout-independent manner. While called YCbCr, it can be
|
||||
* used to describe formats with either chromatic ordering, as well as
|
||||
* whole planar or semiplanar layouts.
|
||||
*
|
||||
* struct android_ycbcr (below) is the the struct used to describe it.
|
||||
*
|
||||
* This format must be accepted by the gralloc module when
|
||||
* USAGE_SW_WRITE_* or USAGE_SW_READ_* are set.
|
||||
*
|
||||
* This format is locked for use by gralloc's (*lock_ycbcr) method, and
|
||||
* locking with the (*lock) method will return an error.
|
||||
*
|
||||
* When used with ANativeWindow, the dataSpace field describes the color
|
||||
* space of the buffer.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23,
|
||||
|
||||
/*
|
||||
* Android flexible YCbCr 4:2:2 formats
|
||||
*
|
||||
* This format allows platforms to use an efficient YCbCr/YCrCb 4:2:2
|
||||
* buffer layout, while still describing the general format in a
|
||||
* layout-independent manner. While called YCbCr, it can be
|
||||
* used to describe formats with either chromatic ordering, as well as
|
||||
* whole planar or semiplanar layouts.
|
||||
*
|
||||
* This format is currently only used by SW readable buffers
|
||||
* produced by MediaCodecs, so the gralloc module can ignore this format.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_YCbCr_422_888 = 0x27,
|
||||
|
||||
/*
|
||||
* Android flexible YCbCr 4:4:4 formats
|
||||
*
|
||||
* This format allows platforms to use an efficient YCbCr/YCrCb 4:4:4
|
||||
* buffer layout, while still describing the general format in a
|
||||
* layout-independent manner. While called YCbCr, it can be
|
||||
* used to describe formats with either chromatic ordering, as well as
|
||||
* whole planar or semiplanar layouts.
|
||||
*
|
||||
* This format is currently only used by SW readable buffers
|
||||
* produced by MediaCodecs, so the gralloc module can ignore this format.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_YCbCr_444_888 = 0x28,
|
||||
|
||||
/*
|
||||
* Android flexible RGB 888 formats
|
||||
*
|
||||
* This format allows platforms to use an efficient RGB/BGR/RGBX/BGRX
|
||||
* buffer layout, while still describing the general format in a
|
||||
* layout-independent manner. While called RGB, it can be
|
||||
* used to describe formats with either color ordering and optional
|
||||
* padding, as well as whole planar layout.
|
||||
*
|
||||
* This format is currently only used by SW readable buffers
|
||||
* produced by MediaCodecs, so the gralloc module can ignore this format.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_FLEX_RGB_888 = 0x29,
|
||||
|
||||
/*
|
||||
* Android flexible RGBA 8888 formats
|
||||
*
|
||||
* This format allows platforms to use an efficient RGBA/BGRA/ARGB/ABGR
|
||||
* buffer layout, while still describing the general format in a
|
||||
* layout-independent manner. While called RGBA, it can be
|
||||
* used to describe formats with any of the component orderings, as
|
||||
* well as whole planar layout.
|
||||
*
|
||||
* This format is currently only used by SW readable buffers
|
||||
* produced by MediaCodecs, so the gralloc module can ignore this format.
|
||||
*/
|
||||
HAL_PIXEL_FORMAT_FLEX_RGBA_8888 = 0x2A,
|
||||
|
||||
/* Legacy formats (deprecated), used by ImageFormat.java */
|
||||
HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16
|
||||
HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21
|
||||
HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure for describing YCbCr formats for consumption by applications.
|
||||
* This is used with HAL_PIXEL_FORMAT_YCbCr_*_888.
|
||||
|
@ -452,15 +67,15 @@ enum {
|
|||
*
|
||||
* Buffers must have a 8 bit depth.
|
||||
*
|
||||
* @y, @cb, and @cr point to the first byte of their respective planes.
|
||||
* 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.
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
|
@ -477,6 +92,102 @@ struct android_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.
|
||||
|
@ -489,9 +200,9 @@ struct android_ycbcr {
|
|||
* 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
|
||||
* num_points is the number of points in the list
|
||||
*
|
||||
* @xyz_points is the flexible array of floating-point values.
|
||||
* xyz_points is the flexible array of floating-point values.
|
||||
* It contains (num_points) * 4 floats.
|
||||
*
|
||||
* For example:
|
||||
|
@ -516,246 +227,40 @@ struct android_depth_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
|
||||
};
|
||||
|
||||
/**
|
||||
* Transformation definitions
|
||||
*
|
||||
* IMPORTANT NOTE:
|
||||
* HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}.
|
||||
*
|
||||
*/
|
||||
|
||||
enum {
|
||||
/* flip source image horizontally (around the vertical axis) */
|
||||
HAL_TRANSFORM_FLIP_H = 0x01,
|
||||
/* flip source image vertically (around the horizontal axis)*/
|
||||
HAL_TRANSFORM_FLIP_V = 0x02,
|
||||
/* rotate source image 90 degrees clockwise */
|
||||
HAL_TRANSFORM_ROT_90 = 0x04,
|
||||
/* rotate source image 180 degrees */
|
||||
HAL_TRANSFORM_ROT_180 = 0x03,
|
||||
/* rotate source image 270 degrees clockwise */
|
||||
HAL_TRANSFORM_ROT_270 = 0x07,
|
||||
/* don't use. see system/window.h */
|
||||
HAL_TRANSFORM_RESERVED = 0x08,
|
||||
* 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;
|
||||
};
|
||||
|
||||
/**
|
||||
* Dataspace Definitions
|
||||
* ======================
|
||||
*
|
||||
* Dataspace is the definition of how pixel values should be interpreted.
|
||||
*
|
||||
* For many formats, this is the colorspace of the image data, which includes
|
||||
* primaries (including white point) and the transfer characteristic function,
|
||||
* which describes both gamma curve and numeric range (within the bit depth).
|
||||
*
|
||||
* Other dataspaces include depth measurement data from a depth camera.
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
||||
typedef enum android_dataspace {
|
||||
/*
|
||||
* Default-assumption data space, when not explicitly specified.
|
||||
*
|
||||
* It is safest to assume the buffer is an image with sRGB primaries and
|
||||
* encoding ranges, but the consumer and/or the producer of the data may
|
||||
* simply be using defaults. No automatic gamma transform should be
|
||||
* expected, except for a possible display gamma transform when drawn to a
|
||||
* screen.
|
||||
*/
|
||||
HAL_DATASPACE_UNKNOWN = 0x0,
|
||||
|
||||
/*
|
||||
* Arbitrary dataspace with manually defined characteristics. Definition
|
||||
* for colorspaces or other meaning must be communicated separately.
|
||||
*
|
||||
* This is used when specifying primaries, transfer characteristics,
|
||||
* etc. separately.
|
||||
*
|
||||
* A typical use case is in video encoding parameters (e.g. for H.264),
|
||||
* where a colorspace can have separately defined primaries, transfer
|
||||
* characteristics, etc.
|
||||
*/
|
||||
HAL_DATASPACE_ARBITRARY = 0x1,
|
||||
|
||||
/*
|
||||
* RGB Colorspaces
|
||||
* -----------------
|
||||
*
|
||||
* Primaries are given using (x,y) coordinates in the CIE 1931 definition
|
||||
* of x and y specified by ISO 11664-1.
|
||||
*
|
||||
* Transfer characteristics are the opto-electronic transfer characteristic
|
||||
* at the source as a function of linear optical intensity (luminance).
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
HAL_DATASPACE_SRGB_LINEAR = 0x200,
|
||||
|
||||
/*
|
||||
* sRGB gamma encoding:
|
||||
*
|
||||
* The red, green and blue components are stored in sRGB space, and
|
||||
* converted to linear space when read, using the standard sRGB to linear
|
||||
* equation:
|
||||
*
|
||||
* Clinear = Csrgb / 12.92 for Csrgb <= 0.04045
|
||||
* = (Csrgb + 0.055 / 1.055)^2.4 for Csrgb > 0.04045
|
||||
*
|
||||
* When written the inverse transformation is performed:
|
||||
*
|
||||
* Csrgb = 12.92 * Clinear for Clinear <= 0.0031308
|
||||
* = 1.055 * Clinear^(1/2.4) - 0.055 for Clinear > 0.0031308
|
||||
*
|
||||
*
|
||||
* The alpha component, if present, is always stored in linear space and
|
||||
* is left unmodified when read or written.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
HAL_DATASPACE_SRGB = 0x201,
|
||||
|
||||
/*
|
||||
* YCbCr Colorspaces
|
||||
* -----------------
|
||||
*
|
||||
* Primaries are given using (x,y) coordinates in the CIE 1931 definition
|
||||
* of x and y specified by ISO 11664-1.
|
||||
*
|
||||
* Transfer characteristics are the opto-electronic transfer characteristic
|
||||
* at the source as a function of linear optical intensity (luminance).
|
||||
*/
|
||||
|
||||
/*
|
||||
* JPEG File Interchange Format (JFIF)
|
||||
*
|
||||
* Same model as BT.601-625, but all values (Y, Cb, Cr) range from 0 to 255
|
||||
*
|
||||
* Transfer characteristic curve:
|
||||
* E = 1.099 * L ^ 0.45 - 0.099, 1.00 >= L >= 0.018
|
||||
* E = 4.500 L, 0.018 > L >= 0
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal
|
||||
*
|
||||
* Primaries: x y
|
||||
* green 0.290 0.600
|
||||
* blue 0.150 0.060
|
||||
* red 0.640 0.330
|
||||
* white (D65) 0.3127 0.3290
|
||||
*/
|
||||
HAL_DATASPACE_JFIF = 0x101,
|
||||
|
||||
/*
|
||||
* ITU-R Recommendation 601 (BT.601) - 625-line
|
||||
*
|
||||
* Standard-definition television, 625 Lines (PAL)
|
||||
*
|
||||
* For 8-bit-depth formats:
|
||||
* Luma (Y) samples should range from 16 to 235, inclusive
|
||||
* Chroma (Cb, Cr) samples should range from 16 to 240, inclusive
|
||||
*
|
||||
* For 10-bit-depth formats:
|
||||
* Luma (Y) samples should range from 64 to 940, inclusive
|
||||
* Chroma (Cb, Cr) samples should range from 64 to 960, inclusive
|
||||
*
|
||||
* Transfer characteristic curve:
|
||||
* E = 1.099 * L ^ 0.45 - 0.099, 1.00 >= L >= 0.018
|
||||
* E = 4.500 L, 0.018 > L >= 0
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal
|
||||
*
|
||||
* Primaries: x y
|
||||
* green 0.290 0.600
|
||||
* blue 0.150 0.060
|
||||
* red 0.640 0.330
|
||||
* white (D65) 0.3127 0.3290
|
||||
*/
|
||||
HAL_DATASPACE_BT601_625 = 0x102,
|
||||
|
||||
/*
|
||||
* ITU-R Recommendation 601 (BT.601) - 525-line
|
||||
*
|
||||
* Standard-definition television, 525 Lines (NTSC)
|
||||
*
|
||||
* For 8-bit-depth formats:
|
||||
* Luma (Y) samples should range from 16 to 235, inclusive
|
||||
* Chroma (Cb, Cr) samples should range from 16 to 240, inclusive
|
||||
*
|
||||
* For 10-bit-depth formats:
|
||||
* Luma (Y) samples should range from 64 to 940, inclusive
|
||||
* Chroma (Cb, Cr) samples should range from 64 to 960, inclusive
|
||||
*
|
||||
* Transfer characteristic curve:
|
||||
* E = 1.099 * L ^ 0.45 - 0.099, 1.00 >= L >= 0.018
|
||||
* E = 4.500 L, 0.018 > L >= 0
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal
|
||||
*
|
||||
* Primaries: x y
|
||||
* green 0.310 0.595
|
||||
* blue 0.155 0.070
|
||||
* red 0.630 0.340
|
||||
* white (D65) 0.3127 0.3290
|
||||
*/
|
||||
HAL_DATASPACE_BT601_525 = 0x103,
|
||||
|
||||
/*
|
||||
* ITU-R Recommendation 709 (BT.709)
|
||||
*
|
||||
* High-definition television
|
||||
*
|
||||
* For 8-bit-depth formats:
|
||||
* Luma (Y) samples should range from 16 to 235, inclusive
|
||||
* Chroma (Cb, Cr) samples should range from 16 to 240, inclusive
|
||||
*
|
||||
* For 10-bit-depth formats:
|
||||
* Luma (Y) samples should range from 64 to 940, inclusive
|
||||
* Chroma (Cb, Cr) samples should range from 64 to 960, inclusive
|
||||
*
|
||||
* Primaries: x y
|
||||
* green 0.300 0.600
|
||||
* blue 0.150 0.060
|
||||
* red 0.640 0.330
|
||||
* white (D65) 0.3127 0.3290
|
||||
*/
|
||||
HAL_DATASPACE_BT709 = 0x104,
|
||||
|
||||
/*
|
||||
* The buffer contains depth ranging measurements from a depth camera.
|
||||
* This value is valid with formats:
|
||||
* HAL_PIXEL_FORMAT_Y16: 16-bit samples, consisting of a depth measurement
|
||||
* and an associated confidence value. The 3 MSBs of the sample make
|
||||
* up the confidence value, and the low 13 LSBs of the sample make up
|
||||
* the depth measurement.
|
||||
* For the confidence section, 0 means 100% confidence, 1 means 0%
|
||||
* confidence. The mapping to a linear float confidence value between
|
||||
* 0.f and 1.f can be obtained with
|
||||
* float confidence = (((depthSample >> 13) - 1) & 0x7) / 7.0f;
|
||||
* The depth measurement can be extracted simply with
|
||||
* uint16_t range = (depthSample & 0x1FFF);
|
||||
* HAL_PIXEL_FORMAT_BLOB: A depth point cloud, as
|
||||
* a variable-length float (x,y,z, confidence) coordinate point list.
|
||||
* The point cloud will be represented with the android_depth_points
|
||||
* structure.
|
||||
*/
|
||||
HAL_DATASPACE_DEPTH = 0x1000
|
||||
|
||||
} android_dataspace_t;
|
||||
struct android_cta861_3_metadata {
|
||||
float maxContentLightLevel;
|
||||
float maxFrameAverageLightLevel;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,955 +0,0 @@
|
|||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
/*
|
||||
* 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_WINDOW_H
|
||||
#define SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H
|
||||
|
||||
#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>
|
||||
|
||||
#ifndef __UNUSED
|
||||
#define __UNUSED __attribute__((__unused__))
|
||||
#endif
|
||||
#ifndef __deprecated
|
||||
#define __deprecated __attribute__((__deprecated__))
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define ANDROID_NATIVE_MAKE_CONSTANT(a,b,c,d) \
|
||||
(((unsigned)(a)<<24)|((unsigned)(b)<<16)|((unsigned)(c)<<8)|(unsigned)(d))
|
||||
|
||||
#define ANDROID_NATIVE_WINDOW_MAGIC \
|
||||
ANDROID_NATIVE_MAKE_CONSTANT('_','w','n','d')
|
||||
|
||||
#define ANDROID_NATIVE_BUFFER_MAGIC \
|
||||
ANDROID_NATIVE_MAKE_CONSTANT('_','b','f','r')
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// This #define may be used to conditionally compile device-specific code to
|
||||
// support either the prior ANativeWindow interface, which did not pass libsync
|
||||
// fences around, or the new interface that does. This #define is only present
|
||||
// when the ANativeWindow interface does include libsync support.
|
||||
#define ANDROID_NATIVE_WINDOW_HAS_SYNC 1
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
typedef const native_handle_t* buffer_handle_t;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
typedef struct android_native_rect_t
|
||||
{
|
||||
int32_t left;
|
||||
int32_t top;
|
||||
int32_t right;
|
||||
int32_t bottom;
|
||||
} android_native_rect_t;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
typedef struct android_native_base_t
|
||||
{
|
||||
/* a magic value defined by the actual EGL native type */
|
||||
int magic;
|
||||
|
||||
/* the sizeof() of the actual EGL native type */
|
||||
int version;
|
||||
|
||||
void* reserved[4];
|
||||
|
||||
/* reference-counting interface */
|
||||
void (*incRef)(struct android_native_base_t* base);
|
||||
void (*decRef)(struct android_native_base_t* base);
|
||||
} android_native_base_t;
|
||||
|
||||
typedef struct ANativeWindowBuffer
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
ANativeWindowBuffer() {
|
||||
common.magic = ANDROID_NATIVE_BUFFER_MAGIC;
|
||||
common.version = sizeof(ANativeWindowBuffer);
|
||||
memset(common.reserved, 0, sizeof(common.reserved));
|
||||
}
|
||||
|
||||
// Implement the methods that sp<ANativeWindowBuffer> expects so that it
|
||||
// can be used to automatically refcount ANativeWindowBuffer'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;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
int stride;
|
||||
int format;
|
||||
int usage;
|
||||
|
||||
void* reserved[2];
|
||||
|
||||
buffer_handle_t handle;
|
||||
|
||||
void* reserved_proc[8];
|
||||
} ANativeWindowBuffer_t;
|
||||
|
||||
// Old typedef for backwards compatibility.
|
||||
typedef ANativeWindowBuffer_t android_native_buffer_t;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* attributes queriable with query() */
|
||||
enum {
|
||||
NATIVE_WINDOW_WIDTH = 0,
|
||||
NATIVE_WINDOW_HEIGHT = 1,
|
||||
NATIVE_WINDOW_FORMAT = 2,
|
||||
|
||||
/* The minimum number of buffers that must remain un-dequeued after a buffer
|
||||
* has been queued. This value applies only if set_buffer_count was used to
|
||||
* override the number of buffers and if a buffer has since been queued.
|
||||
* Users of the set_buffer_count ANativeWindow method should query this
|
||||
* value before calling set_buffer_count. If it is necessary to have N
|
||||
* buffers simultaneously dequeued as part of the steady-state operation,
|
||||
* and this query returns M then N+M buffers should be requested via
|
||||
* native_window_set_buffer_count.
|
||||
*
|
||||
* Note that this value does NOT apply until a single buffer has been
|
||||
* queued. In particular this means that it is possible to:
|
||||
*
|
||||
* 1. Query M = min undequeued buffers
|
||||
* 2. Set the buffer count to N + M
|
||||
* 3. Dequeue all N + M buffers
|
||||
* 4. Cancel M buffers
|
||||
* 5. Queue, dequeue, queue, dequeue, ad infinitum
|
||||
*/
|
||||
NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS = 3,
|
||||
|
||||
/* 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 = 6,
|
||||
NATIVE_WINDOW_DEFAULT_HEIGHT = 7,
|
||||
|
||||
/*
|
||||
* transformation that will most-likely be applied to buffers. This is only
|
||||
* a hint, the actual transformation applied might be different.
|
||||
*
|
||||
* INTENDED USE:
|
||||
*
|
||||
* The transform hint can be used by a producer, for instance the GLES
|
||||
* driver, to pre-rotate the rendering such that the final transformation
|
||||
* in the composer is identity. This can be very useful when used in
|
||||
* conjunction with the h/w composer HAL, in situations where it
|
||||
* cannot handle arbitrary rotations.
|
||||
*
|
||||
* 1. Before dequeuing a buffer, the GL driver (or any other ANW client)
|
||||
* queries the ANW for NATIVE_WINDOW_TRANSFORM_HINT.
|
||||
*
|
||||
* 2. The GL driver overrides the width and height of the ANW to
|
||||
* account for NATIVE_WINDOW_TRANSFORM_HINT. This is done by querying
|
||||
* NATIVE_WINDOW_DEFAULT_{WIDTH | HEIGHT}, swapping the dimensions
|
||||
* according to NATIVE_WINDOW_TRANSFORM_HINT and calling
|
||||
* native_window_set_buffers_dimensions().
|
||||
*
|
||||
* 3. The GL driver dequeues a buffer of the new pre-rotated size.
|
||||
*
|
||||
* 4. The GL driver renders to the buffer such that the image is
|
||||
* already transformed, that is applying NATIVE_WINDOW_TRANSFORM_HINT
|
||||
* to the rendering.
|
||||
*
|
||||
* 5. The GL driver calls native_window_set_transform to apply
|
||||
* inverse transformation to the buffer it just rendered.
|
||||
* In order to do this, the GL driver needs
|
||||
* to calculate the inverse of NATIVE_WINDOW_TRANSFORM_HINT, this is
|
||||
* done easily:
|
||||
*
|
||||
* int hintTransform, inverseTransform;
|
||||
* query(..., NATIVE_WINDOW_TRANSFORM_HINT, &hintTransform);
|
||||
* inverseTransform = hintTransform;
|
||||
* if (hintTransform & HAL_TRANSFORM_ROT_90)
|
||||
* inverseTransform ^= HAL_TRANSFORM_ROT_180;
|
||||
*
|
||||
*
|
||||
* 6. The GL driver queues the pre-transformed buffer.
|
||||
*
|
||||
* 7. The composer combines the buffer transform with the display
|
||||
* transform. If the buffer transform happens to cancel out the
|
||||
* display transform then no rotation is needed.
|
||||
*
|
||||
*/
|
||||
NATIVE_WINDOW_TRANSFORM_HINT = 8,
|
||||
|
||||
/*
|
||||
* 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,
|
||||
|
||||
/**
|
||||
* 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,
|
||||
|
||||
/*
|
||||
* Returns the age of the contents of the most recently dequeued buffer as
|
||||
* the number of frames that have elapsed since it was last queued. For
|
||||
* example, if the window is double-buffered, the age of any given buffer in
|
||||
* steady state will be 2. If the dequeued buffer has never been queued, its
|
||||
* age will be 0.
|
||||
*/
|
||||
NATIVE_WINDOW_BUFFER_AGE = 13,
|
||||
};
|
||||
|
||||
/* 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 {
|
||||
NATIVE_WINDOW_SET_USAGE = 0,
|
||||
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, /* private */
|
||||
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 */
|
||||
};
|
||||
|
||||
/* 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 */
|
||||
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);
|
||||
|
||||
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 ANativeWindow;
|
||||
typedef struct ANativeWindow android_native_window_t __deprecated;
|
||||
|
||||
/*
|
||||
* native_window_set_usage(..., usage)
|
||||
* Sets the intended usage flags for the next buffers
|
||||
* acquired with (*lockBuffer)() and on.
|
||||
* By default (if this function is never called), a usage of
|
||||
* GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE
|
||||
* is assumed.
|
||||
* Calling this function will usually cause following buffers to be
|
||||
* reallocated.
|
||||
*/
|
||||
|
||||
static inline int native_window_set_usage(
|
||||
struct ANativeWindow* window, int usage)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_USAGE, 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_post_transform_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
|
||||
* post-transformed 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_post_transform_crop(
|
||||
struct ANativeWindow* window,
|
||||
android_native_rect_t const * crop)
|
||||
{
|
||||
return window->perform(window, NATIVE_WINDOW_SET_POST_TRANSFORM_CROP, crop);
|
||||
}
|
||||
|
||||
/*
|
||||
* native_window_set_active_rect(..., active_rect)
|
||||
*
|
||||
* This function is deprecated and will be removed soon. For now it simply
|
||||
* sets the post-transform crop for compatibility while multi-project commits
|
||||
* get checked.
|
||||
*/
|
||||
static inline int native_window_set_active_rect(
|
||||
struct ANativeWindow* window,
|
||||
android_native_rect_t const * active_rect) __deprecated;
|
||||
|
||||
static inline int native_window_set_active_rect(
|
||||
struct ANativeWindow* window,
|
||||
android_native_rect_t const * active_rect)
|
||||
{
|
||||
return native_window_set_post_transform_crop(window, active_rect);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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_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);
|
||||
}
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H */
|
Loading…
Add table
Add a link
Reference in a new issue