android: Update libhardware headers
* From hardware/libhardware/include/hardware/ in android-16.0.0_r1. * Needed for CAMERA_MODULE_API_VERSION_2_5.
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#include "camera_common.h"
|
||||
|
||||
/**
|
||||
* Camera device HAL 3.5[ CAMERA_DEVICE_API_VERSION_3_5 ]
|
||||
* Camera device HAL 3.6[ CAMERA_DEVICE_API_VERSION_3_6 ]
|
||||
*
|
||||
* This is the current recommended version of the camera device HAL.
|
||||
*
|
||||
@@ -30,7 +30,7 @@
|
||||
* 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_5 in camera_device_t.common.version and in
|
||||
* CAMERA_DEVICE_API_VERSION_3_6 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 and above:
|
||||
@@ -184,6 +184,25 @@
|
||||
* for a logical multi camera, the application has the option to specify individual
|
||||
* settings for a particular physical device.
|
||||
*
|
||||
* 3.6: Minor revisions to support HAL buffer management APIs:
|
||||
*
|
||||
* - Add ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION static metadata, which allows HAL to
|
||||
* opt in to the new buffer management APIs described below.
|
||||
*
|
||||
* - Add request_stream_buffers() and return_stream_buffers() to camera3_callback_ops_t for HAL to
|
||||
* request and return output buffers from camera service.
|
||||
*
|
||||
* - Add signal_stream_flush() to camera3_device_ops_t for camera service to notify HAL an
|
||||
* upcoming configure_streams() call requires HAL to return buffers of certain streams.
|
||||
*
|
||||
* - Add CAMERA3_JPEG_APP_SEGMENTS_BLOB_ID to support BLOB with only JPEG apps
|
||||
* segments and thumbnail (without main image bitstream). Camera framework
|
||||
* uses such stream togerther with a HAL YUV_420_888/IMPLEMENTATION_DEFINED
|
||||
* stream to encode HEIC (ISO/IEC 23008-12) image.
|
||||
*
|
||||
* - Add is_reconfiguration_required() to camera3_device_ops_t to enable HAL to skip or
|
||||
* trigger stream reconfiguration depending on new session parameter values.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -1314,7 +1333,7 @@
|
||||
* To avoid excessive amount of noise reduction and insufficient amount of edge enhancement
|
||||
* being applied to the input buffer, the application can hint the HAL how much effective
|
||||
* exposure time improvement has been done by the application, then the HAL can adjust the
|
||||
* noise reduction and edge enhancement paramters to get best reprocessed image quality.
|
||||
* noise reduction and edge enhancement parameters to get best reprocessed image quality.
|
||||
* Below tag can be used for this purpose:
|
||||
* - android.reprocess.effectiveExposureFactor
|
||||
* The value would be exposure time increase factor applied to the original output image,
|
||||
@@ -1737,24 +1756,8 @@ typedef struct camera3_stream {
|
||||
*/
|
||||
const char* physical_camera_id;
|
||||
|
||||
/**
|
||||
* This should be one of the camera3_stream_rotation_t values except for
|
||||
* CAMERA3_STREAM_ROTATION_180.
|
||||
* When setting to CAMERA3_STREAM_ROTATION_90 or CAMERA3_STREAM_ROTATION_270, HAL would crop,
|
||||
* rotate the frame by the specified degrees clockwise and scale it up to original size.
|
||||
* In Chrome OS, it's possible to have a portrait activity run in a landscape screen with
|
||||
* landscape-mounted camera. The activity would show stretched or rotated preview because it
|
||||
* does not expect to receive landscape preview frames. To solve this problem, we ask HAL to
|
||||
* crop, rotate and scale the frames and modify CameraCharacteristics.SENSOR_ORIENTATION
|
||||
* accordingly to imitate a portrait camera.
|
||||
* Setting it to CAMERA3_STREAM_ROTATION_0 means no crop-rotate-scale would be performed.
|
||||
* |cros_rotate_scale_degrees| in all camera3_stream_t of a configure_streams() call must be
|
||||
* identical. The HAL should return -EINVAL if the degrees are not the same for all the streams.
|
||||
*/
|
||||
int crop_rotate_scale_degrees;
|
||||
|
||||
/* reserved for future use */
|
||||
void *reserved[5];
|
||||
void *reserved[6];
|
||||
|
||||
} camera3_stream_t;
|
||||
|
||||
@@ -1958,21 +1961,25 @@ typedef struct camera3_stream_buffer_set {
|
||||
/**
|
||||
* camera3_jpeg_blob:
|
||||
*
|
||||
* Transport header for compressed JPEG buffers in output streams.
|
||||
* Transport header for compressed JPEG or JPEG_APP_SEGMENTS buffers in output streams.
|
||||
*
|
||||
* To capture JPEG images, a stream is created using the pixel format
|
||||
* To capture JPEG or JPEG_APP_SEGMENTS images, a stream is created using the pixel format
|
||||
* HAL_PIXEL_FORMAT_BLOB. The buffer size for the stream is calculated by the
|
||||
* framework, based on the static metadata field android.jpeg.maxSize. Since
|
||||
* compressed JPEG images are of variable size, the HAL needs to include the
|
||||
* final size of the compressed image using this structure inside the output
|
||||
* stream buffer. The JPEG blob ID field must be set to CAMERA3_JPEG_BLOB_ID.
|
||||
* framework, based on the static metadata field android.jpeg.maxSize for JPEG,
|
||||
* and android.jpeg.maxAppsSegments for JPEG_APP_SEGMENTS.
|
||||
*
|
||||
* Transport header should be at the end of the JPEG output stream buffer. That
|
||||
* Since compressed JPEG/JPEG_APP_SEGMENTS images are of variable size, the HAL needs to
|
||||
* include the final size of the image using this structure inside the output
|
||||
* stream buffer. The JPEG blob ID field must be set to CAMERA3_JPEG_BLOB_ID for
|
||||
* JPEG and CAMERA3_JPEG_APP_SEGMENTS_BLOB_ID for APP segments.
|
||||
*
|
||||
* Transport header should be at the end of the output stream buffer. That
|
||||
* means the jpeg_blob_id must start at byte[buffer_size -
|
||||
* sizeof(camera3_jpeg_blob)], where the buffer_size is the size of gralloc buffer.
|
||||
* Any HAL using this transport header must account for it in android.jpeg.maxSize
|
||||
* The JPEG data itself starts at the beginning of the buffer and should be
|
||||
* jpeg_size bytes long.
|
||||
* The blob data itself starts at the beginning of the buffer and should be
|
||||
* jpeg_size bytes long. HAL using this transport header for JPEG must account for
|
||||
* it in android.jpeg.maxSize. For JPEG APP segments, camera framework makes
|
||||
* sure that the output stream buffer is large enough for the transport header.
|
||||
*/
|
||||
typedef struct camera3_jpeg_blob {
|
||||
uint16_t jpeg_blob_id;
|
||||
@@ -1980,7 +1987,8 @@ typedef struct camera3_jpeg_blob {
|
||||
} camera3_jpeg_blob_t;
|
||||
|
||||
enum {
|
||||
CAMERA3_JPEG_BLOB_ID = 0x00FF
|
||||
CAMERA3_JPEG_BLOB_ID = 0x00FF,
|
||||
CAMERA3_JPEG_APP_SEGMENTS_BLOB_ID = 0x0100,
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
@@ -2046,6 +2054,14 @@ 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
|
||||
* result metadata won't be available.
|
||||
*
|
||||
* >= CAMERA_DEVICE_API_VERSION_3_6:
|
||||
*
|
||||
* In case the result metadata is absent for a logical camera device, then the
|
||||
* error_stream pointer must be set to NULL.
|
||||
* If the result metadata cannot be produced for a physical camera device, then
|
||||
* error_stream must contain a pointer to a respective stream associated with
|
||||
* that physical device.
|
||||
*/
|
||||
CAMERA3_MSG_ERROR_RESULT = 3,
|
||||
|
||||
@@ -2143,6 +2159,153 @@ typedef struct camera3_notify_msg {
|
||||
|
||||
} camera3_notify_msg_t;
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Types definition for request_stream_buffers() callback.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* camera3_buffer_request_status_t:
|
||||
*
|
||||
* The overall buffer request status returned by request_stream_buffers()
|
||||
*/
|
||||
typedef enum camera3_buffer_request_status {
|
||||
/**
|
||||
* request_stream_buffers() call succeeded and all requested buffers are
|
||||
* returned.
|
||||
*/
|
||||
CAMERA3_BUF_REQ_OK = 0,
|
||||
|
||||
/**
|
||||
* request_stream_buffers() call failed for some streams.
|
||||
* Check per stream status for each returned camera3_stream_buffer_ret_t.
|
||||
*/
|
||||
CAMERA3_BUF_REQ_FAILED_PARTIAL = 1,
|
||||
|
||||
/**
|
||||
* request_stream_buffers() call failed for all streams and no buffers are
|
||||
* returned at all. Camera service is about to or is performing
|
||||
* configure_streams() call. HAL must wait until next configure_streams()
|
||||
* call is finished before requesting buffers again.
|
||||
*/
|
||||
CAMERA3_BUF_REQ_FAILED_CONFIGURING = 2,
|
||||
|
||||
/**
|
||||
* request_stream_buffers() call failed for all streams and no buffers are
|
||||
* returned at all. Failure due to bad camera3_buffer_request input, eg:
|
||||
* unknown stream or repeated stream in the list of buffer requests.
|
||||
*/
|
||||
CAMERA3_BUF_REQ_FAILED_ILLEGAL_ARGUMENTS = 3,
|
||||
|
||||
/**
|
||||
* request_stream_buffers() call failed for all streams and no buffers are
|
||||
* returned at all. This can happen for unknown reasons or a combination
|
||||
* of different failure reasons per stream. For the latter case, caller can
|
||||
* check per stream failure reason returned in camera3_stream_buffer_ret.
|
||||
*/
|
||||
CAMERA3_BUF_REQ_FAILED_UNKNOWN = 4,
|
||||
|
||||
/**
|
||||
* Number of buffer request status
|
||||
*/
|
||||
CAMERA3_BUF_REQ_NUM_STATUS
|
||||
|
||||
} camera3_buffer_request_status_t;
|
||||
|
||||
/**
|
||||
* camera3_stream_buffer_req_status_t:
|
||||
*
|
||||
* The per stream buffer request status returned by request_stream_buffers()
|
||||
*/
|
||||
typedef enum camera3_stream_buffer_req_status {
|
||||
/**
|
||||
* Get buffer succeeds and all requested buffers are returned.
|
||||
*/
|
||||
CAMERA3_PS_BUF_REQ_OK = 0,
|
||||
|
||||
/**
|
||||
* Get buffer failed due to timeout waiting for an available buffer. This is
|
||||
* likely due to the client application holding too many buffers, or the
|
||||
* system is under memory pressure.
|
||||
* This is not a fatal error. HAL can try to request buffer for this stream
|
||||
* later. If HAL cannot get a buffer for certain capture request in time
|
||||
* due to this error, HAL can send an ERROR_REQUEST to camera service and
|
||||
* drop processing that request.
|
||||
*/
|
||||
CAMERA3_PS_BUF_REQ_NO_BUFFER_AVAILABLE = 1,
|
||||
|
||||
/**
|
||||
* Get buffer failed due to HAL has reached its maxBuffer count. This is not
|
||||
* a fatal error. HAL can try to request buffer for this stream again after
|
||||
* it returns at least one buffer of that stream to camera service.
|
||||
*/
|
||||
CAMERA3_PS_BUF_REQ_MAX_BUFFER_EXCEEDED = 2,
|
||||
|
||||
/**
|
||||
* Get buffer failed due to the stream is disconnected by client
|
||||
* application, has been removed, or not recognized by camera service.
|
||||
* This means application is no longer interested in this stream.
|
||||
* Requesting buffer for this stream will never succeed after this error is
|
||||
* returned. HAL must safely return all buffers of this stream after
|
||||
* getting this error. If HAL gets another capture request later targeting
|
||||
* a disconnected stream, HAL must send an ERROR_REQUEST to camera service
|
||||
* and drop processing that request.
|
||||
*/
|
||||
CAMERA3_PS_BUF_REQ_STREAM_DISCONNECTED = 3,
|
||||
|
||||
/**
|
||||
* Get buffer failed for unknown reason. This is a fatal error and HAL must
|
||||
* send ERROR_DEVICE to camera service and be ready to be closed.
|
||||
*/
|
||||
CAMERA3_PS_BUF_REQ_UNKNOWN_ERROR = 4,
|
||||
|
||||
/**
|
||||
* Number of buffer request status
|
||||
*/
|
||||
CAMERA3_PS_BUF_REQ_NUM_STATUS
|
||||
} camera3_stream_buffer_req_status_t;
|
||||
|
||||
typedef struct camera3_buffer_request {
|
||||
/**
|
||||
* The stream HAL wants to request buffer from
|
||||
*/
|
||||
camera3_stream_t *stream;
|
||||
|
||||
/**
|
||||
* The number of buffers HAL requested
|
||||
*/
|
||||
uint32_t num_buffers_requested;
|
||||
} camera3_buffer_request_t;
|
||||
|
||||
typedef struct camera3_stream_buffer_ret {
|
||||
/**
|
||||
* The stream HAL wants to request buffer from
|
||||
*/
|
||||
camera3_stream_t *stream;
|
||||
|
||||
/**
|
||||
* The status of buffer request of this stream
|
||||
*/
|
||||
camera3_stream_buffer_req_status_t status;
|
||||
|
||||
/**
|
||||
* Number of output buffers returned. Must be 0 when above status is not
|
||||
* CAMERA3_PS_BUF_REQ_OK; otherwise the value must be equal to
|
||||
* num_buffers_requested in the corresponding camera3_buffer_request_t
|
||||
*/
|
||||
uint32_t num_output_buffers;
|
||||
|
||||
/**
|
||||
* The returned output buffers for the stream.
|
||||
* Caller of request_stream_buffers() should supply this with enough memory
|
||||
* (num_buffers_requested * sizeof(camera3_stream_buffer_t))
|
||||
*/
|
||||
camera3_stream_buffer_t *output_buffers;
|
||||
} camera3_stream_buffer_ret_t;
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Capture request/result definitions for the HAL process_capture_request()
|
||||
@@ -2660,6 +2823,65 @@ typedef struct camera3_callback_ops {
|
||||
void (*notify)(const struct camera3_callback_ops *,
|
||||
const camera3_notify_msg_t *msg);
|
||||
|
||||
/**
|
||||
* request_stream_buffers:
|
||||
*
|
||||
* <= CAMERA_DEVICE_API_VERISON_3_5:
|
||||
*
|
||||
* DO NOT USE: not defined and must be NULL.
|
||||
*
|
||||
* >= CAMERA_DEVICE_API_VERISON_3_6:
|
||||
*
|
||||
* Synchronous callback for HAL to ask for output buffer from camera service.
|
||||
*
|
||||
* This call may be serialized in camera service so it is strongly
|
||||
* recommended to only call this method from one thread.
|
||||
*
|
||||
* When camera device advertises
|
||||
* (android.info.supportedBufferManagementVersion ==
|
||||
* ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5), HAL
|
||||
* can use this method to request buffers from camera service.
|
||||
*
|
||||
* Caller is responsible for allocating enough memory for returned_buf_reqs
|
||||
* argument (num_buffer_reqs * sizeof(camera3_stream_buffer_ret_t)) bytes
|
||||
* and also the memory for the output_buffers field in each
|
||||
* camera3_stream_buffer_ret_t
|
||||
* (num_buffers_requested * sizeof(camera3_stream_buffer_t)) bytes
|
||||
*
|
||||
* Performance requirements:
|
||||
* This is a blocking call that takes more time with more buffers requested.
|
||||
* HAL should not request large amount of buffers on a latency critical code
|
||||
* path. It is highly recommended to use a dedicated thread to perform
|
||||
* all requestStreamBuffer calls, and adjust the thread priority and/or
|
||||
* timing of making the call in order for buffers to arrive before HAL is
|
||||
* ready to fill the buffer.
|
||||
*/
|
||||
camera3_buffer_request_status_t (*request_stream_buffers)(
|
||||
const struct camera3_callback_ops *,
|
||||
uint32_t num_buffer_reqs,
|
||||
const camera3_buffer_request_t *buffer_reqs,
|
||||
/*out*/uint32_t *num_returned_buf_reqs,
|
||||
/*out*/camera3_stream_buffer_ret_t *returned_buf_reqs);
|
||||
|
||||
/**
|
||||
* return_stream_buffers:
|
||||
*
|
||||
* <= CAMERA_DEVICE_API_VERISON_3_5:
|
||||
*
|
||||
* DO NOT USE: not defined and must be NULL.
|
||||
*
|
||||
* >= CAMERA_DEVICE_API_VERISON_3_6:
|
||||
*
|
||||
* Synchronous callback for HAL to return output buffers to camera service.
|
||||
*
|
||||
* If this method is called during a configure_streams() call, it will be
|
||||
* blocked until camera service finishes the ongoing configure_streams() call.
|
||||
*/
|
||||
void (*return_stream_buffers)(
|
||||
const struct camera3_callback_ops *,
|
||||
uint32_t num_buffers,
|
||||
const camera3_stream_buffer_t* const* buffers);
|
||||
|
||||
} camera3_callback_ops_t;
|
||||
|
||||
/**********************************************************************
|
||||
@@ -3238,8 +3460,82 @@ typedef struct camera3_device_ops {
|
||||
*/
|
||||
int (*flush)(const struct camera3_device *);
|
||||
|
||||
/**
|
||||
* signal_stream_flush:
|
||||
*
|
||||
* <= CAMERA_DEVICE_API_VERISON_3_5:
|
||||
*
|
||||
* Not defined and must be NULL
|
||||
*
|
||||
* >= CAMERA_DEVICE_API_VERISON_3_6:
|
||||
*
|
||||
* Signaling HAL camera service is about to perform configure_streams() call
|
||||
* and HAL must return all buffers of designated streams. HAL must finish
|
||||
* inflight requests normally and return all buffers belonging to the
|
||||
* designated streams through process_capture_result() or
|
||||
* return_stream_buffers() API in a timely manner, or camera service will run
|
||||
* into a fatal error.
|
||||
*
|
||||
* Note that this call serves as an optional hint and camera service may
|
||||
* skip calling this if all buffers are already returned.
|
||||
*
|
||||
*/
|
||||
void (*signal_stream_flush)(const struct camera3_device*,
|
||||
uint32_t num_streams,
|
||||
const camera3_stream_t* const* streams);
|
||||
|
||||
/**
|
||||
* is_reconfiguration_required:
|
||||
*
|
||||
* <= CAMERA_DEVICE_API_VERISON_3_5:
|
||||
*
|
||||
* Not defined and must be NULL
|
||||
*
|
||||
* >= CAMERA_DEVICE_API_VERISON_3_6:
|
||||
*
|
||||
* Check whether complete stream reconfiguration is required for possible new session
|
||||
* parameter values.
|
||||
*
|
||||
* This method must be called by the camera framework in case the client changes
|
||||
* the value of any advertised session parameters. Depending on the specific values
|
||||
* the HAL can decide whether a complete stream reconfiguration is required. In case
|
||||
* the HAL returns -ENVAL, the camera framework must skip the internal reconfiguration.
|
||||
* In case Hal returns 0, the framework must reconfigure the streams and pass the
|
||||
* new session parameter values accordingly.
|
||||
* This call may be done by the framework some time before the request with new parameters
|
||||
* is submitted to the HAL, and the request may be cancelled before it ever gets submitted.
|
||||
* Therefore, the HAL must not use this query as an indication to change its behavior in any
|
||||
* way.
|
||||
* ------------------------------------------------------------------------
|
||||
*
|
||||
* Preconditions:
|
||||
*
|
||||
* The framework can call this method at any time after active
|
||||
* session configuration. There must be no impact on the performance of
|
||||
* pending camera requests in any way. In particular there must not be
|
||||
* any glitches or delays during normal camera streaming.
|
||||
*
|
||||
* Performance requirements:
|
||||
* HW and SW camera settings must not be changed and there must not be
|
||||
* a user-visible impact on camera performance.
|
||||
*
|
||||
* @param oldSessionParams The currently applied session parameters.
|
||||
* @param newSessionParams The new session parameters set by client.
|
||||
*
|
||||
* @return Status Status code for the operation, one of:
|
||||
* 0: In case the stream reconfiguration is required
|
||||
*
|
||||
* -EINVAL: In case the stream reconfiguration is not required.
|
||||
*
|
||||
* -ENOSYS: In case the camera device does not support the
|
||||
* reconfiguration query.
|
||||
*/
|
||||
int (*is_reconfiguration_required)(const struct camera3_device*,
|
||||
const camera_metadata_t* old_session_params,
|
||||
const camera_metadata_t* new_session_params);
|
||||
|
||||
/* reserved for future use */
|
||||
void *reserved[8];
|
||||
void *reserved[6];
|
||||
} camera3_device_ops_t;
|
||||
|
||||
/**********************************************************************
|
||||
|
||||
@@ -118,6 +118,22 @@ __BEGIN_DECLS
|
||||
* 4. Module initialization method. This will be called by the camera service
|
||||
* right after the HAL module is loaded, to allow for one-time initialization
|
||||
* of the HAL. It is called before any other module methods are invoked.
|
||||
*
|
||||
*******************************************************************************
|
||||
* Version: 2.5 [CAMERA_MODULE_API_VERSION_2_5]
|
||||
*
|
||||
* This camera module version adds below API changes:
|
||||
*
|
||||
* 1. Support to query characteristics of a non-standalone physical camera, which can
|
||||
* only be accessed as part of a logical camera. It also adds camera stream combination
|
||||
* query.
|
||||
*
|
||||
* 2. Ability to query whether a particular camera stream combination is
|
||||
* supported by the camera device.
|
||||
*
|
||||
* 3. Device state change notification. This module version also supports
|
||||
* notification about the overall device state change, such as
|
||||
* folding/unfolding, or covering/uncovering of shutter.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -134,8 +150,9 @@ __BEGIN_DECLS
|
||||
#define CAMERA_MODULE_API_VERSION_2_2 HARDWARE_MODULE_API_VERSION(2, 2)
|
||||
#define CAMERA_MODULE_API_VERSION_2_3 HARDWARE_MODULE_API_VERSION(2, 3)
|
||||
#define CAMERA_MODULE_API_VERSION_2_4 HARDWARE_MODULE_API_VERSION(2, 4)
|
||||
#define CAMERA_MODULE_API_VERSION_2_5 HARDWARE_MODULE_API_VERSION(2, 5)
|
||||
|
||||
#define CAMERA_MODULE_API_VERSION_CURRENT CAMERA_MODULE_API_VERSION_2_4
|
||||
#define CAMERA_MODULE_API_VERSION_CURRENT CAMERA_MODULE_API_VERSION_2_5
|
||||
|
||||
/**
|
||||
* All device versions <= HARDWARE_DEVICE_API_VERSION(1, 0xFF) must be treated
|
||||
@@ -150,6 +167,7 @@ __BEGIN_DECLS
|
||||
#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)
|
||||
#define CAMERA_DEVICE_API_VERSION_3_6 HARDWARE_DEVICE_API_VERSION(3, 6)
|
||||
|
||||
// Device version 3.5 is current, older HAL camera device versions are not
|
||||
// recommended for new devices.
|
||||
@@ -645,6 +663,192 @@ typedef struct camera_module_callbacks {
|
||||
|
||||
} camera_module_callbacks_t;
|
||||
|
||||
/**
|
||||
* camera_stream_t:
|
||||
*
|
||||
* A handle to a single camera input or output stream. A stream is defined by
|
||||
* the framework by its buffer resolution and format and gralloc usage flags.
|
||||
*
|
||||
* The stream structures are owned by the framework and pointers to a
|
||||
* camera_stream passed into the HAL by is_stream_combination_supported() are
|
||||
* only valid within the scope of the call.
|
||||
*
|
||||
* All camera_stream members are immutable.
|
||||
*/
|
||||
typedef struct camera_stream {
|
||||
/**
|
||||
* The type of the stream, one of the camera3_stream_type_t values.
|
||||
*/
|
||||
int stream_type;
|
||||
|
||||
/**
|
||||
* The width in pixels of the buffers in this stream
|
||||
*/
|
||||
uint32_t width;
|
||||
|
||||
/**
|
||||
* The height in pixels of the buffers in this stream
|
||||
*/
|
||||
uint32_t height;
|
||||
|
||||
/**
|
||||
* The pixel format for the buffers in this stream. Format is a value from
|
||||
* the HAL_PIXEL_FORMAT_* list in system/core/include/system/graphics.h, or
|
||||
* from device-specific headers.
|
||||
*
|
||||
* If HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED is used, then the platform
|
||||
* gralloc module will select a format based on the usage flags provided by
|
||||
* the camera device and the other endpoint of the stream.
|
||||
*
|
||||
*/
|
||||
int format;
|
||||
|
||||
/**
|
||||
* The gralloc usage flags for this stream, as needed by the HAL. The usage
|
||||
* flags are defined in gralloc.h (GRALLOC_USAGE_*), or in device-specific
|
||||
* headers.
|
||||
*
|
||||
* For output streams, these are the HAL's producer usage flags. For input
|
||||
* streams, these are the HAL's consumer usage flags. The usage flags from
|
||||
* the producer and the consumer will be combined together and then passed
|
||||
* to the platform gralloc HAL module for allocating the gralloc buffers for
|
||||
* each stream.
|
||||
*
|
||||
* 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
|
||||
* the stream combination query call with -EINVAL if the combined flags cannot be
|
||||
* supported due to imcompatible buffer format, dataSpace, or other hardware
|
||||
* limitations.
|
||||
*/
|
||||
uint32_t usage;
|
||||
|
||||
/**
|
||||
* A field that describes the contents of the buffer. The format and buffer
|
||||
* dimensions define the memory layout and structure of the stream buffers,
|
||||
* while dataSpace defines the meaning of the data within the buffer.
|
||||
*
|
||||
* For most formats, dataSpace defines the color space of the image data.
|
||||
* In addition, for some formats, dataSpace indicates whether image- or
|
||||
* depth-based data is requested. See system/core/include/system/graphics.h
|
||||
* for details of formats and valid dataSpace values for each format.
|
||||
*
|
||||
* Always set by the camera service. The dataspace values are set
|
||||
* using the V0 dataspace definitions in graphics.h
|
||||
*/
|
||||
android_dataspace_t data_space;
|
||||
|
||||
/**
|
||||
* The required output rotation of the stream, one of
|
||||
* the camera3_stream_rotation_t values. This must be inspected by HAL along
|
||||
* with stream width and height. For example, if the rotation is 90 degree
|
||||
* and the stream width and height is 720 and 1280 respectively, camera service
|
||||
* will supply buffers of size 720x1280, and HAL should capture a 1280x720 image
|
||||
* and rotate the image by 90 degree counterclockwise. The rotation field is
|
||||
* no-op when the stream type is input. Camera HAL must ignore the rotation
|
||||
* field for an input stream.
|
||||
*
|
||||
* Always set by camera service. HAL must inspect this field during stream
|
||||
* combination query and return -EINVAL if it cannot perform such rotation.
|
||||
* HAL must always support CAMERA3_STREAM_ROTATION_0, so a
|
||||
* is_stream_combination_supported() call must not fail for unsupported rotation if
|
||||
* rotation field of all streams is CAMERA3_STREAM_ROTATION_0.
|
||||
*
|
||||
*/
|
||||
int rotation;
|
||||
|
||||
/**
|
||||
* The physical camera id this stream belongs to.
|
||||
* 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;
|
||||
|
||||
} camera_stream_t;
|
||||
|
||||
/**
|
||||
* camera_stream_combination_t:
|
||||
*
|
||||
* A structure of stream definitions, used by is_stream_combination_supported(). This
|
||||
* structure defines all the input & output streams for specific camera use case.
|
||||
*/
|
||||
typedef struct camera_stream_combination {
|
||||
/**
|
||||
* The total number of streams by the framework. This includes
|
||||
* both input and output streams. The number of streams will be at least 1,
|
||||
* and there will be at least one output-capable stream.
|
||||
*/
|
||||
uint32_t num_streams;
|
||||
|
||||
/**
|
||||
* An array of camera streams, defining the input/output
|
||||
* stream combination for the camera HAL device.
|
||||
*
|
||||
* At most one input-capable stream may be defined.
|
||||
*
|
||||
* At least one output-capable stream must be defined.
|
||||
*/
|
||||
camera_stream_t *streams;
|
||||
|
||||
/**
|
||||
* The operation mode of streams in this stream combination, one of the value
|
||||
* defined in camera3_stream_configuration_mode_t.
|
||||
*
|
||||
*/
|
||||
uint32_t operation_mode;
|
||||
|
||||
} camera_stream_combination_t;
|
||||
|
||||
/**
|
||||
* device_state_t:
|
||||
*
|
||||
* Possible physical states of the overall device, for use with
|
||||
* notify_device_state_change.
|
||||
*/
|
||||
typedef enum device_state {
|
||||
/**
|
||||
* The device is in its normal physical configuration. This is the default if the
|
||||
* device does not support multiple different states.
|
||||
*/
|
||||
NORMAL = 0,
|
||||
|
||||
/**
|
||||
* Camera device(s) facing backward are covered.
|
||||
*/
|
||||
BACK_COVERED = 1 << 0,
|
||||
|
||||
/**
|
||||
* Camera device(s) facing foward are covered.
|
||||
*/
|
||||
FRONT_COVERED = 1 << 1,
|
||||
|
||||
/**
|
||||
* The device is folded. If not set, the device is unfolded or does not
|
||||
* support folding.
|
||||
*
|
||||
* The exact point when this status change happens during the folding
|
||||
* operation is device-specific.
|
||||
*/
|
||||
FOLDED = 1 << 2,
|
||||
|
||||
/**
|
||||
* First vendor-specific device state. All bits above and including this one
|
||||
* are for vendor state values. Values below this one must only be used
|
||||
* for framework-defined states.
|
||||
*/
|
||||
VENDOR_STATE_START = 1LL << 32
|
||||
|
||||
} device_state_t;
|
||||
|
||||
typedef struct camera_module {
|
||||
/**
|
||||
* Common methods of the camera module. This *must* be the first member of
|
||||
@@ -910,8 +1114,104 @@ typedef struct camera_module {
|
||||
*/
|
||||
int (*init)();
|
||||
|
||||
/**
|
||||
* get_physical_camera_info:
|
||||
*
|
||||
* Return the static metadata for a physical camera as a part of a logical
|
||||
* camera device. This function is only called for those physical camera
|
||||
* ID(s) that are not exposed independently. In other words, camera_id will
|
||||
* be greater or equal to the return value of get_number_of_cameras().
|
||||
*
|
||||
* Return values:
|
||||
*
|
||||
* 0: On a successful operation
|
||||
*
|
||||
* -ENODEV: The information cannot be provided due to an internal
|
||||
* error.
|
||||
*
|
||||
* -EINVAL: The input arguments are invalid, i.e. the id is invalid,
|
||||
* and/or the module is invalid.
|
||||
*
|
||||
* Version information (based on camera_module_t.common.module_api_version):
|
||||
*
|
||||
* CAMERA_MODULE_API_VERSION_1_x/2_0/2_1/2_2/2_3/2_4:
|
||||
* Not provided by HAL module. Framework will not call this function.
|
||||
*
|
||||
* CAMERA_MODULE_API_VERSION_2_5 or higher:
|
||||
* If any of the camera devices accessible through this camera module is
|
||||
* a logical multi-camera, and at least one of the physical cameras isn't
|
||||
* a stand-alone camera device, this function will be called by the camera
|
||||
* framework. Calling this function with invalid physical_camera_id will
|
||||
* get -EINVAL, and NULL static_metadata.
|
||||
*/
|
||||
int (*get_physical_camera_info)(int physical_camera_id,
|
||||
camera_metadata_t **static_metadata);
|
||||
|
||||
/**
|
||||
* is_stream_combination_supported:
|
||||
*
|
||||
* Check for device support of specific camera stream combination.
|
||||
*
|
||||
* Return values:
|
||||
*
|
||||
* 0: In case the stream combination is supported.
|
||||
*
|
||||
* -EINVAL: In case the stream combination is not supported.
|
||||
*
|
||||
* -ENOSYS: In case stream combination query is not supported.
|
||||
*
|
||||
* Version information (based on camera_module_t.common.module_api_version):
|
||||
*
|
||||
* CAMERA_MODULE_API_VERSION_1_x/2_0/2_1/2_2/2_3/2_4:
|
||||
* Not provided by HAL module. Framework will not call this function.
|
||||
*
|
||||
* CAMERA_MODULE_API_VERSION_2_5 or higher:
|
||||
* Valid to be called by the framework.
|
||||
*/
|
||||
int (*is_stream_combination_supported)(int camera_id,
|
||||
const camera_stream_combination_t *streams);
|
||||
|
||||
/**
|
||||
* notify_device_state_change:
|
||||
*
|
||||
* Notify the camera module that the state of the overall device has
|
||||
* changed in some way that the HAL may want to know about.
|
||||
*
|
||||
* For example, a physical shutter may have been uncovered or covered,
|
||||
* or a camera may have been covered or uncovered by an add-on keyboard
|
||||
* or other accessory.
|
||||
*
|
||||
* The state is a bitfield of potential states, and some physical configurations
|
||||
* could plausibly correspond to multiple different combinations of state bits.
|
||||
* The HAL must ignore any state bits it is not actively using to determine
|
||||
* the appropriate camera configuration.
|
||||
*
|
||||
* For example, on some devices the FOLDED state could mean that
|
||||
* backward-facing cameras are covered by the fold, so FOLDED by itself implies
|
||||
* BACK_COVERED. But other devices may support folding but not cover any cameras
|
||||
* when folded, so for those FOLDED would not imply any of the other flags.
|
||||
* Since these relationships are very device-specific, it is difficult to specify
|
||||
* a comprehensive policy. But as a recommendation, it is suggested that if a flag
|
||||
* necessarily implies other flags are set as well, then those flags should be set.
|
||||
* So even though FOLDED would be enough to infer BACK_COVERED on some devices, the
|
||||
* BACK_COVERED flag should also be set for clarity.
|
||||
*
|
||||
* This method may be invoked by the HAL client at any time. It must not
|
||||
* cause any active camera device sessions to be closed, but may dynamically
|
||||
* change which physical camera a logical multi-camera is using for its
|
||||
* active and future output.
|
||||
*
|
||||
* The method must be invoked by the HAL client at least once before the
|
||||
* client calls ICameraDevice::open on any camera device interfaces listed
|
||||
* by this provider, to establish the initial device state.
|
||||
*
|
||||
* Note that the deviceState is 64-bit bitmask, with system defined states in
|
||||
* lower 32-bit and vendor defined states in upper 32-bit.
|
||||
*/
|
||||
void (*notify_device_state_change)(uint64_t deviceState);
|
||||
|
||||
/* reserved for future use */
|
||||
void* reserved[5];
|
||||
void* reserved[2];
|
||||
} camera_module_t;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#ifndef ANDROID_GRALLOC_INTERFACE_H
|
||||
#define ANDROID_GRALLOC_INTERFACE_H
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include <system/graphics.h>
|
||||
#include <hardware/hardware.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
#include <cutils/native_handle.h>
|
||||
|
||||
#include <hardware/fb.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/fb.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -132,6 +132,9 @@ enum {
|
||||
* handle this flag. */
|
||||
GRALLOC_USAGE_FOREIGN_BUFFERS = 0x00200000U,
|
||||
|
||||
/* buffer will be used as input to HW HEIC image encoder */
|
||||
GRALLOC_USAGE_HW_IMAGE_ENCODER = 0x08000000U,
|
||||
|
||||
/* 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
|
||||
* gralloc modules. */
|
||||
@@ -312,8 +315,38 @@ typedef struct gralloc_module_t {
|
||||
int l, int t, int w, int h,
|
||||
struct android_ycbcr *ycbcr, int fenceFd);
|
||||
|
||||
/* getTransportSize(..., outNumFds, outNumInts)
|
||||
* This function is mandatory on devices running IMapper2.1 or higher.
|
||||
*
|
||||
* Get the transport size of a buffer. An imported buffer handle is a raw
|
||||
* buffer handle with the process-local runtime data appended. This
|
||||
* function, for example, allows a caller to omit the process-local
|
||||
* runtime data at the tail when serializing the imported buffer handle.
|
||||
*
|
||||
* Note that a client might or might not omit the process-local runtime
|
||||
* data when sending an imported buffer handle. The mapper must support
|
||||
* both cases on the receiving end.
|
||||
*/
|
||||
int32_t (*getTransportSize)(
|
||||
struct gralloc_module_t const* module, buffer_handle_t handle, uint32_t *outNumFds,
|
||||
uint32_t *outNumInts);
|
||||
|
||||
/* validateBufferSize(..., w, h, format, usage, stride)
|
||||
* This function is mandatory on devices running IMapper2.1 or higher.
|
||||
*
|
||||
* Validate that the buffer can be safely accessed by a caller who assumes
|
||||
* the specified width, height, format, usage, and stride. This must at least validate
|
||||
* that the buffer size is large enough. Validating the buffer against
|
||||
* individual buffer attributes is optional.
|
||||
*/
|
||||
int32_t (*validateBufferSize)(
|
||||
struct gralloc_module_t const* device, buffer_handle_t handle,
|
||||
uint32_t w, uint32_t h, int32_t format, int usage,
|
||||
uint32_t stride);
|
||||
|
||||
/* reserved for future use */
|
||||
void* reserved_proc[3];
|
||||
void* reserved_proc[1];
|
||||
|
||||
} gralloc_module_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user