summaryrefslogtreecommitdiffstats
path: root/include/hardware
diff options
context:
space:
mode:
Diffstat (limited to 'include/hardware')
-rwxr-xr-xinclude/hardware/camera.h384
-rw-r--r--include/hardware/camera_common.h434
-rw-r--r--include/hardware/hwcomposer.h900
3 files changed, 0 insertions, 1718 deletions
diff --git a/include/hardware/camera.h b/include/hardware/camera.h
deleted file mode 100755
index 3854022..0000000
--- a/include/hardware/camera.h
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * Copyright (C) 2010-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 ANDROID_INCLUDE_CAMERA_H
-#define ANDROID_INCLUDE_CAMERA_H
-
-#include "camera_common.h"
-
-/**
- * Camera device HAL, initial version [ CAMERA_DEVICE_API_VERSION_1_0 ]
- *
- * Supports the android.hardware.Camera API.
- *
- * Camera devices that support this version of the HAL must return a value in
- * the range HARDWARE_DEVICE_API_VERSION(0,0)-(1,FF) in
- * camera_device_t.common.version. CAMERA_DEVICE_API_VERSION_1_0 is the
- * recommended value.
- *
- * Camera modules that implement version 2.0 or higher of camera_module_t must
- * also return the value of camera_device_t.common.version in
- * camera_info_t.device_version.
- *
- * See camera_common.h for more details.
- */
-
-__BEGIN_DECLS
-
-struct camera_memory;
-typedef void (*camera_release_memory)(struct camera_memory *mem);
-
-typedef struct camera_memory {
- void *data;
- size_t size;
- void *handle;
- camera_release_memory release;
-} camera_memory_t;
-
-typedef camera_memory_t* (*camera_request_memory)(int fd, size_t buf_size, unsigned int num_bufs,
- void *user);
-
-typedef void (*camera_notify_callback)(int32_t msg_type,
- int32_t ext1,
- int32_t ext2,
- void *user);
-
-typedef void (*camera_data_callback)(int32_t msg_type,
- const camera_memory_t *data, unsigned int index,
- camera_frame_metadata_t *metadata, void *user);
-
-typedef void (*camera_data_timestamp_callback)(int64_t timestamp,
- int32_t msg_type,
- const camera_memory_t *data, unsigned int index,
- void *user);
-
-#define HAL_CAMERA_PREVIEW_WINDOW_TAG 0xcafed00d
-
-typedef struct preview_stream_ops {
- int (*dequeue_buffer)(struct preview_stream_ops* w,
- buffer_handle_t** buffer, int *stride);
- int (*enqueue_buffer)(struct preview_stream_ops* w,
- buffer_handle_t* buffer);
- int (*cancel_buffer)(struct preview_stream_ops* w,
- buffer_handle_t* buffer);
- int (*set_buffer_count)(struct preview_stream_ops* w, int count);
- int (*set_buffers_geometry)(struct preview_stream_ops* pw,
- int w, int h, int format);
- int (*set_crop)(struct preview_stream_ops *w,
- int left, int top, int right, int bottom);
- int (*set_usage)(struct preview_stream_ops* w, int usage);
- int (*set_swap_interval)(struct preview_stream_ops *w, int interval);
- int (*get_min_undequeued_buffer_count)(const struct preview_stream_ops *w,
- int *count);
- int (*lock_buffer)(struct preview_stream_ops* w,
- buffer_handle_t* buffer);
- // Timestamps are measured in nanoseconds, and must be comparable
- // and monotonically increasing between two frames in the same
- // preview stream. They do not need to be comparable between
- // consecutive or parallel preview streams, cameras, or app runs.
- int (*set_timestamp)(struct preview_stream_ops *w, int64_t timestamp);
-} preview_stream_ops_t;
-
-#ifdef OMAP_ENHANCEMENT
-/** Use below structure to extend operations to ANativeWindow/SurfaceTexture from CameraHAL */
-typedef struct preview_stream_extended_ops {
-
-/** CPCAM specific extensions */
-#ifdef OMAP_ENHANCEMENT_CPCAM
- /** tap in functions */
- int (*update_and_get_buffer)(struct preview_stream_ops* w,
- buffer_handle_t** buffer, int *stride, int *slot);
- int (*release_buffer)(struct preview_stream_ops* w, int slot);
- int (*get_buffer_dimension)(struct preview_stream_ops *w, int *width, int *height);
- int (*get_buffer_format)(struct preview_stream_ops *w, int *format);
-
- /**
- * The data is a shared memory created with camera_request_memory().
- * The contents is a populated instance of camera_metadata_t applicable
- * for next queued frame.
- */
- int (*set_metadata)(struct preview_stream_ops *w, const camera_memory_t *data);
-
- int (*get_id)(struct preview_stream_ops *w, char *data, unsigned int data_size);
- int (*get_buffer_count)(struct preview_stream_ops *w, int *count);
- int (*get_crop) (struct preview_stream_ops *w,
- int *left, int *top, int *right, int *bottom);
- int (*get_current_size) (struct preview_stream_ops *w,
- int *width, int *height);
-#endif
-
-} preview_stream_extended_ops_t;
-#endif
-
-struct camera_device;
-typedef struct camera_device_ops {
- /** Set the ANativeWindow to which preview frames are sent */
- int (*set_preview_window)(struct camera_device *,
- struct preview_stream_ops *window);
-
- /** Set the notification and data callbacks */
- void (*set_callbacks)(struct camera_device *,
- camera_notify_callback notify_cb,
- camera_data_callback data_cb,
- camera_data_timestamp_callback data_cb_timestamp,
- camera_request_memory get_memory,
- void *user);
-
- /**
- * The following three functions all take a msg_type, which is a bitmask of
- * the messages defined in include/ui/Camera.h
- */
-
- /**
- * Enable a message, or set of messages.
- */
- void (*enable_msg_type)(struct camera_device *, int32_t msg_type);
-
- /**
- * Disable a message, or a set of messages.
- *
- * Once received a call to disableMsgType(CAMERA_MSG_VIDEO_FRAME), camera
- * HAL should not rely on its client to call releaseRecordingFrame() to
- * release video recording frames sent out by the cameral HAL before and
- * after the disableMsgType(CAMERA_MSG_VIDEO_FRAME) call. Camera HAL
- * clients must not modify/access any video recording frame after calling
- * disableMsgType(CAMERA_MSG_VIDEO_FRAME).
- */
- void (*disable_msg_type)(struct camera_device *, int32_t msg_type);
-
- /**
- * Query whether a message, or a set of messages, is enabled. Note that
- * this is operates as an AND, if any of the messages queried are off, this
- * will return false.
- */
- int (*msg_type_enabled)(struct camera_device *, int32_t msg_type);
-
- /**
- * Start preview mode.
- */
- int (*start_preview)(struct camera_device *);
-
- /**
- * Stop a previously started preview.
- */
- void (*stop_preview)(struct camera_device *);
-
- /**
- * Returns true if preview is enabled.
- */
- int (*preview_enabled)(struct camera_device *);
-
- /**
- * Request the camera HAL to store meta data or real YUV data in the video
- * buffers sent out via CAMERA_MSG_VIDEO_FRAME for a recording session. If
- * it is not called, the default camera HAL behavior is to store real YUV
- * data in the video buffers.
- *
- * This method should be called before startRecording() in order to be
- * effective.
- *
- * If meta data is stored in the video buffers, it is up to the receiver of
- * the video buffers to interpret the contents and to find the actual frame
- * data with the help of the meta data in the buffer. How this is done is
- * outside of the scope of this method.
- *
- * Some camera HALs may not support storing meta data in the video buffers,
- * but all camera HALs should support storing real YUV data in the video
- * buffers. If the camera HAL does not support storing the meta data in the
- * video buffers when it is requested to do do, INVALID_OPERATION must be
- * returned. It is very useful for the camera HAL to pass meta data rather
- * than the actual frame data directly to the video encoder, since the
- * amount of the uncompressed frame data can be very large if video size is
- * large.
- *
- * @param enable if true to instruct the camera HAL to store
- * meta data in the video buffers; false to instruct
- * the camera HAL to store real YUV data in the video
- * buffers.
- *
- * @return OK on success.
- */
- int (*store_meta_data_in_buffers)(struct camera_device *, int enable);
-
- /**
- * Start record mode. When a record image is available, a
- * CAMERA_MSG_VIDEO_FRAME message is sent with the corresponding
- * frame. Every record frame must be released by a camera HAL client via
- * releaseRecordingFrame() before the client calls
- * disableMsgType(CAMERA_MSG_VIDEO_FRAME). After the client calls
- * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's
- * responsibility to manage the life-cycle of the video recording frames,
- * and the client must not modify/access any video recording frames.
- */
- int (*start_recording)(struct camera_device *);
-
- /**
- * Stop a previously started recording.
- */
- void (*stop_recording)(struct camera_device *);
-
- /**
- * Returns true if recording is enabled.
- */
- int (*recording_enabled)(struct camera_device *);
-
- /**
- * Release a record frame previously returned by CAMERA_MSG_VIDEO_FRAME.
- *
- * It is camera HAL client's responsibility to release video recording
- * frames sent out by the camera HAL before the camera HAL receives a call
- * to disableMsgType(CAMERA_MSG_VIDEO_FRAME). After it receives the call to
- * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's
- * responsibility to manage the life-cycle of the video recording frames.
- */
- void (*release_recording_frame)(struct camera_device *,
- const void *opaque);
-
- /**
- * Start auto focus, the notification callback routine is called with
- * CAMERA_MSG_FOCUS once when focusing is complete. autoFocus() will be
- * called again if another auto focus is needed.
- */
- int (*auto_focus)(struct camera_device *);
-
- /**
- * Cancels auto-focus function. If the auto-focus is still in progress,
- * this function will cancel it. Whether the auto-focus is in progress or
- * not, this function will return the focus position to the default. If
- * the camera does not support auto-focus, this is a no-op.
- */
- int (*cancel_auto_focus)(struct camera_device *);
-
- /**
- * Take a picture.
- */
- int (*take_picture)(struct camera_device *);
-
- /**
- * Cancel a picture that was started with takePicture. Calling this method
- * when no picture is being taken is a no-op.
- */
- int (*cancel_picture)(struct camera_device *);
-
- /**
- * Set the camera parameters. This returns BAD_VALUE if any parameter is
- * invalid or not supported.
- */
- int (*set_parameters)(struct camera_device *, const char *parms);
-
- /** Retrieve the camera parameters. The buffer returned by the camera HAL
- must be returned back to it with put_parameters, if put_parameters
- is not NULL.
- */
- char *(*get_parameters)(struct camera_device *);
-
- /** The camera HAL uses its own memory to pass us the parameters when we
- call get_parameters. Use this function to return the memory back to
- the camera HAL, if put_parameters is not NULL. If put_parameters
- is NULL, then you have to use free() to release the memory.
- */
- void (*put_parameters)(struct camera_device *, char *);
-
- /**
- * Send command to camera driver.
- */
- int (*send_command)(struct camera_device *,
- int32_t cmd, int32_t arg1, int32_t arg2);
-
- /**
- * Release the hardware resources owned by this object. Note that this is
- * *not* done in the destructor.
- */
- void (*release)(struct camera_device *);
-
- /**
- * Dump state of the camera hardware
- */
- int (*dump)(struct camera_device *, int fd);
-} camera_device_ops_t;
-
-#ifdef OMAP_ENHANCEMENT
-/**
- * camera_device_extended_ops_t struct is intended to be used as extension to
- * standard camera_device_ops_t. Adding new callbacks directly to
- * camera_device_ops_t breaks binary compatibility with HAL. Instead, enhanced
- * CameraService should call send_command(CAMERA_CMD_SETUP_EXTENDED_OPERATIONS)
- * passing the pointer to camera_device_extended_ops instance that HAL should
- * either populate or ignore.
- */
-typedef struct camera_device_extended_ops {
-#ifdef OMAP_ENHANCEMENT_CPCAM
- /**
- * Set the buffer sources for a pipeline that can have
- * either a tapin and/or tapout point.
- */
- int (*set_buffer_source)(struct camera_device *,
- struct preview_stream_ops *tapin,
- struct preview_stream_ops *tapout);
-
- /**
- * Take a picture with parameters.
- */
- int (*take_picture_with_parameters)(struct camera_device *,
- const char *parameters);
-
- /** Release buffer sources previously set by set_buffer_source */
- int (*release_buffer_source)(struct camera_device *,
- struct preview_stream_ops *tapin,
- struct preview_stream_ops *tapout);
-
- /** start a reprocessing operation */
- int (*reprocess)(struct camera_device *, const char *params);
-
- /** cancels current reprocessing operation */
- int (*cancel_reprocess)(struct camera_device *);
-#endif
-
- /** Set extended preview operations on window/surface texture */
- int (*set_extended_preview_ops)(struct camera_device *, preview_stream_extended_ops_t *ops);
-
-} camera_device_extended_ops_t;
-
-/**
- * Helpers to allow passing pointer to send_command callback by converting its
- * low and high parts into arg1 and arg2 ints.
- */
-inline void* camera_cmd_send_command_args_to_pointer(int32_t arg1, int32_t arg2)
-{
- return (void*)(((int64_t)arg2 << 32) | (int64_t)arg1);
-}
-
-inline void camera_cmd_send_command_pointer_to_args(const void* p, int32_t* arg1, int32_t* arg2)
-{
- *arg1 = (int32_t)((int64_t)p & 0xffffffff);
- *arg2 = (int32_t)((int64_t)p >> 32);
-}
-#endif
-
-typedef struct camera_device {
- /**
- * camera_device.common.version must be in the range
- * HARDWARE_DEVICE_API_VERSION(0,0)-(1,FF). CAMERA_DEVICE_API_VERSION_1_0 is
- * recommended.
- */
- hw_device_t common;
- camera_device_ops_t *ops;
- void *priv;
-} camera_device_t;
-
-__END_DECLS
-
-#endif /* #ifdef ANDROID_INCLUDE_CAMERA_H */
diff --git a/include/hardware/camera_common.h b/include/hardware/camera_common.h
deleted file mode 100644
index dadbc8f..0000000
--- a/include/hardware/camera_common.h
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-// FIXME: add well-defined names for cameras
-
-#ifndef ANDROID_INCLUDE_CAMERA_COMMON_H
-#define ANDROID_INCLUDE_CAMERA_COMMON_H
-
-#include <stdint.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <cutils/native_handle.h>
-#include <system/camera.h>
-#include <system/camera_vendor_tags.h>
-#include <hardware/hardware.h>
-#include <hardware/gralloc.h>
-
-__BEGIN_DECLS
-
-/**
- * The id of this module
- */
-#define CAMERA_HARDWARE_MODULE_ID "camera"
-
-/**
- * Module versioning information for the Camera hardware module, based on
- * camera_module_t.common.module_api_version. The two most significant hex
- * digits represent the major version, and the two least significant represent
- * the minor version.
- *
- *******************************************************************************
- * Versions: 0.X - 1.X [CAMERA_MODULE_API_VERSION_1_0]
- *
- * Camera modules that report these version numbers implement the initial
- * camera module HAL interface. All camera devices openable through this
- * module support only version 1 of the camera device HAL. The device_version
- * and static_camera_characteristics fields of camera_info are not valid. Only
- * the android.hardware.Camera API can be supported by this module and its
- * devices.
- *
- *******************************************************************************
- * Version: 2.0 [CAMERA_MODULE_API_VERSION_2_0]
- *
- * Camera modules that report this version number implement the second version
- * of the camera module HAL interface. Camera devices openable through this
- * module may support either version 1.0 or version 2.0 of the camera device
- * HAL interface. The device_version field of camera_info is always valid; the
- * static_camera_characteristics field of camera_info is valid if the
- * device_version field is 2.0 or higher.
- *
- *******************************************************************************
- * Version: 2.1 [CAMERA_MODULE_API_VERSION_2_1]
- *
- * This camera module version adds support for asynchronous callbacks to the
- * framework from the camera HAL module, which is used to notify the framework
- * about changes to the camera module state. Modules that provide a valid
- * set_callbacks() method must report at least this version number.
- *
- *******************************************************************************
- * Version: 2.2 [CAMERA_MODULE_API_VERSION_2_2]
- *
- * This camera module version adds vendor tag support from the module, and
- * deprecates the old vendor_tag_query_ops that were previously only
- * accessible with a device open.
- *
- *******************************************************************************
- * Version: 2.3 [CAMERA_MODULE_API_VERSION_2_3]
- *
- * This camera module version adds open legacy camera HAL device support.
- * Framework can use it to open the camera device as lower device HAL version
- * HAL device if the same device can support multiple device API versions.
- * The standard hardware module open call (common.methods->open) continues
- * to open the camera device with the latest supported version, which is
- * also the version listed in camera_info_t.device_version.
- */
-
-/**
- * Predefined macros for currently-defined version numbers
- */
-
-/**
- * All module versions <= HARDWARE_MODULE_API_VERSION(1, 0xFF) must be treated
- * as CAMERA_MODULE_API_VERSION_1_0
- */
-#define CAMERA_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0)
-#define CAMERA_MODULE_API_VERSION_2_0 HARDWARE_MODULE_API_VERSION(2, 0)
-#define CAMERA_MODULE_API_VERSION_2_1 HARDWARE_MODULE_API_VERSION(2, 1)
-#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_CURRENT CAMERA_MODULE_API_VERSION_2_3
-
-/**
- * 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_3_2 HARDWARE_DEVICE_API_VERSION(3, 2)
-
-// Device version 3.2 is current, older HAL camera device versions are not
-// recommended for new devices.
-#define CAMERA_DEVICE_API_VERSION_CURRENT CAMERA_DEVICE_API_VERSION_3_2
-
-/**
- * Defined in /system/media/camera/include/system/camera_metadata.h
- */
-typedef struct camera_metadata camera_metadata_t;
-
-typedef struct camera_info {
- /**
- * The direction that the camera faces to. It should be CAMERA_FACING_BACK
- * or CAMERA_FACING_FRONT.
- *
- * Version information:
- * Valid in all camera_module versions
- */
- int facing;
-
- /**
- * The orientation of the camera image. The value is the angle that the
- * camera image needs to be rotated clockwise so it shows correctly on the
- * display in its natural orientation. It should be 0, 90, 180, or 270.
- *
- * For example, suppose a device has a naturally tall screen. The
- * back-facing camera sensor is mounted in landscape. You are looking at the
- * screen. If the top side of the camera sensor is aligned with the right
- * edge of the screen in natural orientation, the value should be 90. If the
- * top side of a front-facing camera sensor is aligned with the right of the
- * screen, the value should be 270.
- *
- * Version information:
- * Valid in all camera_module versions
- */
- int orientation;
-
- /**
- * The value of camera_device_t.common.version.
- *
- * Version information (based on camera_module_t.common.module_api_version):
- *
- * CAMERA_MODULE_API_VERSION_1_0:
- *
- * Not valid. Can be assumed to be CAMERA_DEVICE_API_VERSION_1_0. Do
- * not read this field.
- *
- * CAMERA_MODULE_API_VERSION_2_0 or higher:
- *
- * Always valid
- *
- */
- uint32_t device_version;
-
- /**
- * The camera's fixed characteristics, which include all camera metadata in
- * the android.*.info.* sections. This should be a sorted metadata buffer,
- * and may not be modified or freed by the caller. The pointer should remain
- * valid for the lifetime of the camera module, and values in it may not
- * change after it is returned by get_camera_info().
- *
- * Version information (based on camera_module_t.common.module_api_version):
- *
- * CAMERA_MODULE_API_VERSION_1_0:
- *
- * Not valid. Extra characteristics are not available. Do not read this
- * field.
- *
- * CAMERA_MODULE_API_VERSION_2_0 or higher:
- *
- * Valid if device_version >= CAMERA_DEVICE_API_VERSION_2_0. Do not read
- * otherwise.
- *
- */
- const camera_metadata_t *static_camera_characteristics;
-} camera_info_t;
-
-/**
- * camera_device_status_t:
- *
- * The current status of the camera device, as provided by the HAL through the
- * camera_module_callbacks.camera_device_status_change() call.
- *
- * At module load time, the framework will assume all camera devices are in the
- * CAMERA_DEVICE_STATUS_PRESENT state. The HAL should invoke
- * camera_module_callbacks::camera_device_status_change to inform the framework
- * of any initially NOT_PRESENT devices.
- *
- * Allowed transitions:
- * PRESENT -> NOT_PRESENT
- * NOT_PRESENT -> ENUMERATING
- * NOT_PRESENT -> PRESENT
- * ENUMERATING -> PRESENT
- * ENUMERATING -> NOT_PRESENT
- */
-typedef enum camera_device_status {
- /**
- * The camera device is not currently connected, and opening it will return
- * failure. Calls to get_camera_info must still succeed, and provide the
- * same information it would if the camera were connected
- */
- CAMERA_DEVICE_STATUS_NOT_PRESENT = 0,
-
- /**
- * The camera device is connected, and opening it will succeed. The
- * information returned by get_camera_info cannot change due to this status
- * change. By default, the framework will assume all devices are in this
- * state.
- */
- CAMERA_DEVICE_STATUS_PRESENT = 1,
-
- /**
- * The camera device is connected, but it is undergoing an enumeration and
- * so opening the device will return -EBUSY. Calls to get_camera_info
- * must still succeed, as if the camera was in the PRESENT status.
- */
- CAMERA_DEVICE_STATUS_ENUMERATING = 2,
-
-} camera_device_status_t;
-
-/**
- * Callback functions for the camera HAL module to use to inform the framework
- * of changes to the camera subsystem. These are called only by HAL modules
- * implementing version CAMERA_MODULE_API_VERSION_2_1 or higher of the HAL
- * module API interface.
- */
-typedef struct camera_module_callbacks {
-
- /**
- * camera_device_status_change:
- *
- * Callback to the framework to indicate that the state of a specific camera
- * device has changed. At module load time, the framework will assume all
- * camera devices are in the CAMERA_DEVICE_STATUS_PRESENT state. The HAL
- * must call this method to inform the framework of any initially
- * NOT_PRESENT devices.
- *
- * camera_module_callbacks: The instance of camera_module_callbacks_t passed
- * to the module with set_callbacks.
- *
- * camera_id: The ID of the camera device that has a new status.
- *
- * new_status: The new status code, one of the camera_device_status_t enums,
- * or a platform-specific status.
- *
- */
- void (*camera_device_status_change)(const struct camera_module_callbacks*,
- int camera_id,
- int new_status);
-
-} camera_module_callbacks_t;
-
-typedef struct camera_module {
- /**
- * Common methods of the camera module. This *must* be the first member of
- * camera_module as users of this structure will cast a hw_module_t to
- * camera_module pointer in contexts where it's known the hw_module_t
- * references a camera_module.
- *
- * The return values for common.methods->open for camera_module are:
- *
- * 0: On a successful open of the camera device.
- *
- * -ENODEV: The camera device cannot be opened due to an internal
- * error.
- *
- * -EINVAL: The input arguments are invalid, i.e. the id is invalid,
- * and/or the module is invalid.
- *
- * -EBUSY: The camera device was already opened for this camera id
- * (by using this method or open_legacy),
- * regardless of the device HAL version it was opened as.
- *
- * -EUSERS: The maximal number of camera devices that can be
- * opened concurrently were opened already, either by
- * this method or the open_legacy method.
- *
- * All other return values from common.methods->open will be treated as
- * -ENODEV.
- */
- hw_module_t common;
-
- /**
- * get_number_of_cameras:
- *
- * Returns the number of camera devices accessible through the camera
- * module. The camera devices are numbered 0 through N-1, where N is the
- * value returned by this call. The name of the camera device for open() is
- * simply the number converted to a string. That is, "0" for camera ID 0,
- * "1" for camera ID 1.
- *
- * The value here must be static, and cannot change after the first call to
- * this method
- */
- int (*get_number_of_cameras)(void);
-
- /**
- * get_camera_info:
- *
- * Return the static camera information for a given camera device. This
- * information may not change for a camera device.
- *
- * 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.
- */
- int (*get_camera_info)(int camera_id, struct camera_info *info);
-
- /**
- * set_callbacks:
- *
- * Provide callback function pointers to the HAL module to inform framework
- * of asynchronous camera module events. The framework will call this
- * function once after initial camera HAL module load, after the
- * get_number_of_cameras() method is called for the first time, and before
- * any other calls to the module.
- *
- * Version information (based on camera_module_t.common.module_api_version):
- *
- * CAMERA_MODULE_API_VERSION_1_0, CAMERA_MODULE_API_VERSION_2_0:
- *
- * Not provided by HAL module. Framework may not call this function.
- *
- * CAMERA_MODULE_API_VERSION_2_1:
- *
- * Valid to be called by the framework.
- *
- * Return values:
- *
- * 0: On a successful operation
- *
- * -ENODEV: The operation cannot be completed due to an internal
- * error.
- *
- * -EINVAL: The input arguments are invalid, i.e. the callbacks are
- * null
- */
- int (*set_callbacks)(const camera_module_callbacks_t *callbacks);
-
- /**
- * get_vendor_tag_ops:
- *
- * Get methods to query for vendor extension metadata tag information. The
- * HAL should fill in all the vendor tag operation methods, or leave ops
- * unchanged if no vendor tags are defined.
- *
- * The vendor_tag_ops structure used here is defined in:
- * system/media/camera/include/system/vendor_tags.h
- *
- * Version information (based on camera_module_t.common.module_api_version):
- *
- * CAMERA_MODULE_API_VERSION_1_x/2_0/2_1:
- * Not provided by HAL module. Framework may not call this function.
- *
- * CAMERA_MODULE_API_VERSION_2_2:
- * Valid to be called by the framework.
- */
- void (*get_vendor_tag_ops)(vendor_tag_ops_t* ops);
-
- /**
- * open_legacy:
- *
- * Open a specific legacy camera HAL device if multiple device HAL API
- * versions are supported by this camera HAL module. For example, if the
- * camera module supports both CAMERA_DEVICE_API_VERSION_1_0 and
- * CAMERA_DEVICE_API_VERSION_3_2 device API for the same camera id,
- * framework can call this function to open the camera device as
- * CAMERA_DEVICE_API_VERSION_1_0 device.
- *
- * This is an optional method. A Camera HAL module does not need to support
- * more than one device HAL version per device, and such modules may return
- * -ENOSYS for all calls to this method. For all older HAL device API
- * versions that are not supported, it may return -EOPNOTSUPP. When above
- * cases occur, The normal open() method (common.methods->open) will be
- * used by the framework instead.
- *
- * Version information (based on camera_module_t.common.module_api_version):
- *
- * CAMERA_MODULE_API_VERSION_1_x/2_0/2_1/2_2:
- * Not provided by HAL module. Framework will not call this function.
- *
- * CAMERA_MODULE_API_VERSION_2_3:
- * Valid to be called by the framework.
- *
- * Return values:
- *
- * 0: On a successful open of the camera device.
- *
- * -ENOSYS This method is not supported.
- *
- * -EOPNOTSUPP: The requested HAL version is not supported by this method.
- *
- * -EINVAL: The input arguments are invalid, i.e. the id is invalid,
- * and/or the module is invalid.
- *
- * -EBUSY: The camera device was already opened for this camera id
- * (by using this method or common.methods->open method),
- * regardless of the device HAL version it was opened as.
- *
- * -EUSERS: The maximal number of camera devices that can be
- * opened concurrently were opened already, either by
- * this method or common.methods->open method.
- */
- int (*open_legacy)(const struct hw_module_t* module, const char* id,
- uint32_t halVersion, struct hw_device_t** device);
-
- /* reserved for future use */
- void* reserved[7];
-} camera_module_t;
-
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_CAMERA_COMMON_H */
diff --git a/include/hardware/hwcomposer.h b/include/hardware/hwcomposer.h
deleted file mode 100644
index 2483c18..0000000
--- a/include/hardware/hwcomposer.h
+++ /dev/null
@@ -1,900 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H
-#define ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H
-
-#include <stdint.h>
-#include <sys/cdefs.h>
-
-#include <hardware/gralloc.h>
-#include <hardware/hardware.h>
-#include <cutils/native_handle.h>
-
-#include <hardware/hwcomposer_defs.h>
-
-__BEGIN_DECLS
-
-/*****************************************************************************/
-
-/* for compatibility */
-#define HWC_MODULE_API_VERSION HWC_MODULE_API_VERSION_0_1
-#define HWC_DEVICE_API_VERSION HWC_DEVICE_API_VERSION_0_1
-#define HWC_API_VERSION HWC_DEVICE_API_VERSION
-
-/*****************************************************************************/
-
-/**
- * The id of this module
- */
-#define HWC_HARDWARE_MODULE_ID "hwcomposer"
-
-/**
- * Name of the sensors device to open
- */
-#define HWC_HARDWARE_COMPOSER "composer"
-
-typedef struct hwc_rect {
- int left;
- int top;
- int right;
- int bottom;
-} hwc_rect_t;
-
-typedef struct hwc_frect {
- float left;
- float top;
- float right;
- float bottom;
-} hwc_frect_t;
-
-typedef struct hwc_region {
- size_t numRects;
- hwc_rect_t const* rects;
-} hwc_region_t;
-
-typedef struct hwc_color {
- uint8_t r;
- uint8_t g;
- uint8_t b;
- uint8_t a;
-} hwc_color_t;
-
-typedef struct hwc_layer_1 {
- /*
- * compositionType is used to specify this layer's type and is set by either
- * the hardware composer implementation, or by the caller (see below).
- *
- * This field is always reset to HWC_BACKGROUND or HWC_FRAMEBUFFER
- * before (*prepare)() is called when the HWC_GEOMETRY_CHANGED flag is
- * also set, otherwise, this field is preserved between (*prepare)()
- * calls.
- *
- * HWC_BACKGROUND
- * Always set by the caller before calling (*prepare)(), this value
- * indicates this is a special "background" layer. The only valid field
- * is backgroundColor.
- * The HWC can toggle this value to HWC_FRAMEBUFFER to indicate it CANNOT
- * handle the background color.
- *
- *
- * HWC_FRAMEBUFFER_TARGET
- * Always set by the caller before calling (*prepare)(), this value
- * indicates this layer is the framebuffer surface used as the target of
- * OpenGL ES composition. If the HWC sets all other layers to HWC_OVERLAY
- * or HWC_BACKGROUND, then no OpenGL ES composition will be done, and
- * this layer should be ignored during set().
- *
- * This flag (and the framebuffer surface layer) will only be used if the
- * HWC version is HWC_DEVICE_API_VERSION_1_1 or higher. In older versions,
- * the OpenGL ES target surface is communicated by the (dpy, sur) fields
- * in hwc_compositor_device_1_t.
- *
- * This value cannot be set by the HWC implementation.
- *
- *
- * HWC_FRAMEBUFFER
- * Set by the caller before calling (*prepare)() ONLY when the
- * HWC_GEOMETRY_CHANGED flag is also set.
- *
- * Set by the HWC implementation during (*prepare)(), this indicates
- * that the layer will be drawn into the framebuffer using OpenGL ES.
- * The HWC can toggle this value to HWC_OVERLAY to indicate it will
- * handle the layer.
- *
- *
- * HWC_OVERLAY
- * Set by the HWC implementation during (*prepare)(), this indicates
- * that the layer will be handled by the HWC (ie: it must not be
- * composited with OpenGL ES).
- *
- *
- * HWC_SIDEBAND
- * Set by the caller before calling (*prepare)(), this value indicates
- * the contents of this layer come from a sideband video stream.
- *
- * The h/w composer is responsible for receiving new image buffers from
- * the stream at the appropriate time (e.g. synchronized to a separate
- * audio stream), compositing them with the current contents of other
- * layers, and displaying the resulting image. This happens
- * independently of the normal prepare/set cycle. The prepare/set calls
- * only happen when other layers change, or when properties of the
- * sideband layer such as position or size change.
- *
- * If the h/w composer can't handle the layer as a sideband stream for
- * some reason (e.g. unsupported scaling/blending/rotation, or too many
- * sideband layers) it can set compositionType to HWC_FRAMEBUFFER in
- * (*prepare)(). However, doing so will result in the layer being shown
- * as a solid color since the platform is not currently able to composite
- * sideband layers with the GPU. This may be improved in future
- * versions of the platform.
- *
- *
- * HWC_CURSOR_OVERLAY
- * Set by the HWC implementation during (*prepare)(), this value
- * indicates the layer's composition will now be handled by the HWC.
- * Additionally, the client can now asynchronously update the on-screen
- * position of this layer using the setCursorPositionAsync() api.
- */
- int32_t compositionType;
-
- /*
- * hints is bit mask set by the HWC implementation during (*prepare)().
- * It is preserved between (*prepare)() calls, unless the
- * HWC_GEOMETRY_CHANGED flag is set, in which case it is reset to 0.
- *
- * see hwc_layer_t::hints
- */
- uint32_t hints;
-
- /* see hwc_layer_t::flags */
- uint32_t flags;
-
- union {
- /* color of the background. hwc_color_t.a is ignored */
- hwc_color_t backgroundColor;
-
- struct {
- union {
- /* When compositionType is HWC_FRAMEBUFFER, HWC_OVERLAY,
- * HWC_FRAMEBUFFER_TARGET, this is the handle of the buffer to
- * compose. This handle is guaranteed to have been allocated
- * from gralloc using the GRALLOC_USAGE_HW_COMPOSER usage flag.
- * If the layer's handle is unchanged across two consecutive
- * prepare calls and the HWC_GEOMETRY_CHANGED flag is not set
- * for the second call then the HWComposer implementation may
- * assume that the contents of the buffer have not changed. */
- buffer_handle_t handle;
-
- /* When compositionType is HWC_SIDEBAND, this is the handle
- * of the sideband video stream to compose. */
- const native_handle_t* sidebandStream;
- };
-
- /* transformation to apply to the buffer during composition */
- uint32_t transform;
-
- /* blending to apply during composition */
- int32_t blending;
-
- /* area of the source to consider, the origin is the top-left corner of
- * the buffer. As of HWC_DEVICE_API_VERSION_1_3, sourceRect uses floats.
- * If the h/w can't support a non-integer source crop rectangle, it should
- * punt to OpenGL ES composition.
- */
- union {
- // crop rectangle in integer (pre HWC_DEVICE_API_VERSION_1_3)
- hwc_rect_t sourceCropi;
- hwc_rect_t sourceCrop; // just for source compatibility
- // crop rectangle in floats (as of HWC_DEVICE_API_VERSION_1_3)
- hwc_frect_t sourceCropf;
- };
-
- /* where to composite the sourceCrop onto the display. The sourceCrop
- * is scaled using linear filtering to the displayFrame. The origin is the
- * top-left corner of the screen.
- */
- hwc_rect_t displayFrame;
-
- /* visible region in screen space. The origin is the
- * top-left corner of the screen.
- * The visible region INCLUDES areas overlapped by a translucent layer.
- */
- hwc_region_t visibleRegionScreen;
-
- /* Sync fence object that will be signaled when the buffer's
- * contents are available. May be -1 if the contents are already
- * available. This field is only valid during set(), and should be
- * ignored during prepare(). The set() call must not wait for the
- * fence to be signaled before returning, but the HWC must wait for
- * all buffers to be signaled before reading from them.
- *
- * HWC_FRAMEBUFFER layers will never have an acquire fence, since
- * reads from them are complete before the framebuffer is ready for
- * display.
- *
- * HWC_SIDEBAND layers will never have an acquire fence, since
- * synchronization is handled through implementation-defined
- * sideband mechanisms.
- *
- * The HWC takes ownership of the acquireFenceFd and is responsible
- * for closing it when no longer needed.
- */
- int acquireFenceFd;
-
- /* During set() the HWC must set this field to a file descriptor for
- * a sync fence object that will signal after the HWC has finished
- * reading from the buffer. The field is ignored by prepare(). Each
- * layer should have a unique file descriptor, even if more than one
- * refer to the same underlying fence object; this allows each to be
- * closed independently.
- *
- * If buffer reads can complete at significantly different times,
- * then using independent fences is preferred. For example, if the
- * HWC handles some layers with a blit engine and others with
- * overlays, then the blit layers can be reused immediately after
- * the blit completes, but the overlay layers can't be reused until
- * a subsequent frame has been displayed.
- *
- * Since HWC doesn't read from HWC_FRAMEBUFFER layers, it shouldn't
- * produce a release fence for them. The releaseFenceFd will be -1
- * for these layers when set() is called.
- *
- * Since HWC_SIDEBAND buffers don't pass through the HWC client,
- * the HWC shouldn't produce a release fence for them. The
- * releaseFenceFd will be -1 for these layers when set() is called.
- *
- * The HWC client taks ownership of the releaseFenceFd and is
- * responsible for closing it when no longer needed.
- */
- int releaseFenceFd;
-
- /*
- * Availability: HWC_DEVICE_API_VERSION_1_2
- *
- * Alpha value applied to the whole layer. The effective
- * value of each pixel is computed as:
- *
- * if (blending == HWC_BLENDING_PREMULT)
- * pixel.rgb = pixel.rgb * planeAlpha / 255
- * pixel.a = pixel.a * planeAlpha / 255
- *
- * Then blending proceeds as usual according to the "blending"
- * field above.
- *
- * NOTE: planeAlpha applies to YUV layers as well:
- *
- * pixel.rgb = yuv_to_rgb(pixel.yuv)
- * if (blending == HWC_BLENDING_PREMULT)
- * pixel.rgb = pixel.rgb * planeAlpha / 255
- * pixel.a = planeAlpha
- *
- *
- * IMPLEMENTATION NOTE:
- *
- * If the source image doesn't have an alpha channel, then
- * the h/w can use the HWC_BLENDING_COVERAGE equations instead of
- * HWC_BLENDING_PREMULT and simply set the alpha channel to
- * planeAlpha.
- *
- * e.g.:
- *
- * if (blending == HWC_BLENDING_PREMULT)
- * blending = HWC_BLENDING_COVERAGE;
- * pixel.a = planeAlpha;
- *
- */
- uint8_t planeAlpha;
-
- /* reserved for future use */
- uint8_t _pad[3];
- };
- };
-
-#ifdef __LP64__
- /*
- * For 64-bit mode, this struct is 120 bytes (and 8-byte aligned), and needs
- * to be padded as such to maintain binary compatibility.
- */
- uint8_t reserved[120 - 96];
-#else
- /*
- * For 32-bit mode, this struct is 96 bytes, and needs to be padded as such
- * to maintain binary compatibility.
- */
- uint8_t reserved[96 - 76];
-#endif
-
-} hwc_layer_1_t;
-
-#if 1 /*def OMAP_ENHANCEMENT*/
-
-/*
- * HWC extension operations, see HWC_EXTENDED_API
- */
-enum {
- /*
- * Get extra layer data
- * @params
- * data: hwc_layer_extended_t
- */
- HWC_EXTENDED_OP_LAYERDATA = 1,
-
- /*
- * Returns layer stack identifier
- * @params
- * data: hwc_layer_stack_t
- */
- HWC_EXTENDED_OP_LAYERSTACK = 2,
-};
-
-typedef struct hwc_layer_extended {
- /*
- * Layer index (input)
- */
- uint32_t idx;
-
- /*
- * Display index (input)
- */
- int32_t dpy;
-
- /*
- * Provides a unique identity for this layer (output)
- */
- uint32_t identity;
-} hwc_layer_extended_t;
-
-typedef struct hwc_layer_stack {
- /*
- * Display index (input)
- */
- int32_t dpy;
-
- /*
- * Layer stack identifier for this display (output)
- */
- uint32_t stack;
-} hwc_layer_stack_t;
-
-typedef struct hwc_layer_list_extended {
- size_t numHwLayers;
- hwc_layer_extended_t hwLayers[0];
-} hwc_layer_list_extended_t;
-
-#endif
-
-/* This represents a display, typically an EGLDisplay object */
-typedef void* hwc_display_t;
-
-/* This represents a surface, typically an EGLSurface object */
-typedef void* hwc_surface_t;
-
-/*
- * hwc_display_contents_1_t::flags values
- */
-enum {
- /*
- * HWC_GEOMETRY_CHANGED is set by SurfaceFlinger to indicate that the list
- * passed to (*prepare)() has changed by more than just the buffer handles
- * and acquire fences.
- */
- HWC_GEOMETRY_CHANGED = 0x00000001,
-#if 1 /*def OMAP_ENHANCEMENT*/
- /*
- * HWC_EXTENDED_API is set by SurfaceFlinger to indicate that the h/w
- * composer HAL api has been extended and that the HAL implementation
- * can use functions in the extended ABI.
- */
- HWC_EXTENDED_API = 0x80000000,
-#endif
-};
-
-/*
- * Description of the contents to output on a display.
- *
- * This is the top-level structure passed to the prepare and set calls to
- * negotiate and commit the composition of a display image.
- */
-typedef struct hwc_display_contents_1 {
- /* File descriptor referring to a Sync HAL fence object which will signal
- * when this composition is retired. For a physical display, a composition
- * is retired when it has been replaced on-screen by a subsequent set. For
- * a virtual display, the composition is retired when the writes to
- * outputBuffer are complete and can be read. The fence object is created
- * and returned by the set call; this field will be -1 on entry to prepare
- * and set. SurfaceFlinger will close the returned file descriptor.
- */
- int retireFenceFd;
-
- union {
- /* Fields only relevant for HWC_DEVICE_VERSION_1_0. */
- struct {
- /* (dpy, sur) is the target of SurfaceFlinger's OpenGL ES
- * composition for HWC_DEVICE_VERSION_1_0. They aren't relevant to
- * prepare. The set call should commit this surface atomically to
- * the display along with any overlay layers.
- */
- hwc_display_t dpy;
- hwc_surface_t sur;
- };
-
- /* These fields are used for virtual displays when the h/w composer
- * version is at least HWC_DEVICE_VERSION_1_3. */
- struct {
- /* outbuf is the buffer that receives the composed image for
- * virtual displays. Writes to the outbuf must wait until
- * outbufAcquireFenceFd signals. A fence that will signal when
- * writes to outbuf are complete should be returned in
- * retireFenceFd.
- *
- * This field is set before prepare(), so properties of the buffer
- * can be used to decide which layers can be handled by h/w
- * composer.
- *
- * If prepare() sets all layers to FRAMEBUFFER, then GLES
- * composition will happen directly to the output buffer. In this
- * case, both outbuf and the FRAMEBUFFER_TARGET layer's buffer will
- * be the same, and set() has no work to do besides managing fences.
- *
- * If the TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS board config
- * variable is defined (not the default), then this behavior is
- * changed: if all layers are marked for FRAMEBUFFER, GLES
- * composition will take place to a scratch framebuffer, and
- * h/w composer must copy it to the output buffer. This allows the
- * h/w composer to do format conversion if there are cases where
- * that is more desirable than doing it in the GLES driver or at the
- * virtual display consumer.
- *
- * If some or all layers are marked OVERLAY, then the framebuffer
- * and output buffer will be different. As with physical displays,
- * the framebuffer handle will not change between frames if all
- * layers are marked for OVERLAY.
- */
- buffer_handle_t outbuf;
-
- /* File descriptor for a fence that will signal when outbuf is
- * ready to be written. The h/w composer is responsible for closing
- * this when no longer needed.
- *
- * Will be -1 whenever outbuf is NULL, or when the outbuf can be
- * written immediately.
- */
- int outbufAcquireFenceFd;
- };
- };
-
- /* List of layers that will be composed on the display. The buffer handles
- * in the list will be unique. If numHwLayers is 0, all composition will be
- * performed by SurfaceFlinger.
- */
- uint32_t flags;
- size_t numHwLayers;
- hwc_layer_1_t hwLayers[0];
-
-} hwc_display_contents_1_t;
-
-/* see hwc_composer_device::registerProcs()
- * All of the callbacks are required and non-NULL unless otherwise noted.
- */
-typedef struct hwc_procs {
- /*
- * (*invalidate)() triggers a screen refresh, in particular prepare and set
- * will be called shortly after this call is made. Note that there is
- * NO GUARANTEE that the screen refresh will happen after invalidate()
- * returns (in particular, it could happen before).
- * invalidate() is GUARANTEED TO NOT CALL BACK into the h/w composer HAL and
- * it is safe to call invalidate() from any of hwc_composer_device
- * hooks, unless noted otherwise.
- */
- void (*invalidate)(const struct hwc_procs* procs);
-
- /*
- * (*vsync)() is called by the h/w composer HAL when a vsync event is
- * received and HWC_EVENT_VSYNC is enabled on a display
- * (see: hwc_event_control).
- *
- * the "disp" parameter indicates which display the vsync event is for.
- * the "timestamp" parameter is the system monotonic clock timestamp in
- * nanosecond of when the vsync event happened.
- *
- * vsync() is GUARANTEED TO NOT CALL BACK into the h/w composer HAL.
- *
- * It is expected that vsync() is called from a thread of at least
- * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible,
- * typically less than 0.5 ms.
- *
- * It is a (silent) error to have HWC_EVENT_VSYNC enabled when calling
- * hwc_composer_device.set(..., 0, 0, 0) (screen off). The implementation
- * can either stop or continue to process VSYNC events, but must not
- * crash or cause other problems.
- */
- void (*vsync)(const struct hwc_procs* procs, int disp, int64_t timestamp);
-
- /*
- * (*hotplug)() is called by the h/w composer HAL when a display is
- * connected or disconnected. The PRIMARY display is always connected and
- * the hotplug callback should not be called for it.
- *
- * The disp parameter indicates which display type this event is for.
- * The connected parameter indicates whether the display has just been
- * connected (1) or disconnected (0).
- *
- * The hotplug() callback may call back into the h/w composer on the same
- * thread to query refresh rate and dpi for the display. Additionally,
- * other threads may be calling into the h/w composer while the callback
- * is in progress.
- *
- * The h/w composer must serialize calls to the hotplug callback; only
- * one thread may call it at a time.
- *
- * This callback will be NULL if the h/w composer is using
- * HWC_DEVICE_API_VERSION_1_0.
- */
- void (*hotplug)(const struct hwc_procs* procs, int disp, int connected);
-
-#if 1 /*def OMAP_ENHANCEMENT*/
- /*
- * (*extension_cb)() is called by the h/w composer HAL. Its purpose is
- * to extend the api from h/w composer to SurfaceFlinger.
- *
- * In order to handle mismatching build configuration between
- * SurfaceFlinger and the h/w composer HAL. The HAL will only call
- * this callback if HWC_EXTENDED_API is passed in hwc_layer_list_t
- * flags.
- *
- * The "operation" parameter specifies the specific extension required
- * the caller and callee should maintain the ABI between each other in
- * the same way as kernel ioctl calls do.
- *
- * If the "size" parameter is -1 a return value of zero indicates the
- * given operation is supported.
- */
- int (*extension_cb)(struct hwc_procs* procs,
- int operation,
- void** data,
- int size);
-
-#endif
-} hwc_procs_t;
-
-
-/*****************************************************************************/
-
-typedef struct hwc_module {
- /**
- * Common methods of the hardware composer module. This *must* be the first member of
- * hwc_module as users of this structure will cast a hw_module_t to
- * hwc_module pointer in contexts where it's known the hw_module_t references a
- * hwc_module.
- */
- struct hw_module_t common;
-} hwc_module_t;
-
-typedef struct hwc_composer_device_1 {
- /**
- * Common methods of the hardware composer device. This *must* be the first member of
- * hwc_composer_device_1 as users of this structure will cast a hw_device_t to
- * hwc_composer_device_1 pointer in contexts where it's known the hw_device_t references a
- * hwc_composer_device_1.
- */
- struct hw_device_t common;
-
- /*
- * (*prepare)() is called for each frame before composition and is used by
- * SurfaceFlinger to determine what composition steps the HWC can handle.
- *
- * (*prepare)() can be called more than once, the last call prevails.
- *
- * The HWC responds by setting the compositionType field in each layer to
- * either HWC_FRAMEBUFFER, HWC_OVERLAY, or HWC_CURSOR_OVERLAY. For the
- * HWC_FRAMEBUFFER type, composition for the layer is handled by
- * SurfaceFlinger with OpenGL ES. For the latter two overlay types,
- * the HWC will have to handle the layer's composition. compositionType
- * and hints are preserved between (*prepare)() calles unless the
- * HWC_GEOMETRY_CHANGED flag is set.
- *
- * (*prepare)() is called with HWC_GEOMETRY_CHANGED to indicate that the
- * list's geometry has changed, that is, when more than just the buffer's
- * handles have been updated. Typically this happens (but is not limited to)
- * when a window is added, removed, resized or moved. In this case
- * compositionType and hints are reset to their default value.
- *
- * For HWC 1.0, numDisplays will always be one, and displays[0] will be
- * non-NULL.
- *
- * For HWC 1.1, numDisplays will always be HWC_NUM_PHYSICAL_DISPLAY_TYPES.
- * Entries for unsupported or disabled/disconnected display types will be
- * NULL.
- *
- * In HWC 1.3, numDisplays may be up to HWC_NUM_DISPLAY_TYPES. The extra
- * entries correspond to enabled virtual displays, and will be non-NULL.
- *
- * returns: 0 on success. An negative error code on error. If an error is
- * returned, SurfaceFlinger will assume that none of the layer will be
- * handled by the HWC.
- */
- int (*prepare)(struct hwc_composer_device_1 *dev,
- size_t numDisplays, hwc_display_contents_1_t** displays);
-
- /*
- * (*set)() is used in place of eglSwapBuffers(), and assumes the same
- * functionality, except it also commits the work list atomically with
- * the actual eglSwapBuffers().
- *
- * The layer lists are guaranteed to be the same as the ones returned from
- * the last call to (*prepare)().
- *
- * When this call returns the caller assumes that the displays will be
- * updated in the near future with the content of their work lists, without
- * artifacts during the transition from the previous frame.
- *
- * A display with zero layers indicates that the entire composition has
- * been handled by SurfaceFlinger with OpenGL ES. In this case, (*set)()
- * behaves just like eglSwapBuffers().
- *
- * For HWC 1.0, numDisplays will always be one, and displays[0] will be
- * non-NULL.
- *
- * For HWC 1.1, numDisplays will always be HWC_NUM_PHYSICAL_DISPLAY_TYPES.
- * Entries for unsupported or disabled/disconnected display types will be
- * NULL.
- *
- * In HWC 1.3, numDisplays may be up to HWC_NUM_DISPLAY_TYPES. The extra
- * entries correspond to enabled virtual displays, and will be non-NULL.
- *
- * IMPORTANT NOTE: There is an implicit layer containing opaque black
- * pixels behind all the layers in the list. It is the responsibility of
- * the hwcomposer module to make sure black pixels are output (or blended
- * from).
- *
- * IMPORTANT NOTE: In the event of an error this call *MUST* still cause
- * any fences returned in the previous call to set to eventually become
- * signaled. The caller may have already issued wait commands on these
- * fences, and having set return without causing those fences to signal
- * will likely result in a deadlock.
- *
- * returns: 0 on success. A negative error code on error:
- * HWC_EGL_ERROR: eglGetError() will provide the proper error code (only
- * allowed prior to HWComposer 1.1)
- * Another code for non EGL errors.
- */
- int (*set)(struct hwc_composer_device_1 *dev,
- size_t numDisplays, hwc_display_contents_1_t** displays);
-
- /*
- * eventControl(..., event, enabled)
- * Enables or disables h/w composer events for a display.
- *
- * eventControl can be called from any thread and takes effect
- * immediately.
- *
- * Supported events are:
- * HWC_EVENT_VSYNC
- *
- * returns -EINVAL if the "event" parameter is not one of the value above
- * or if the "enabled" parameter is not 0 or 1.
- */
- int (*eventControl)(struct hwc_composer_device_1* dev, int disp,
- int event, int enabled);
-
- union {
- /*
- * For HWC 1.3 and earlier, the blank() interface is used.
- *
- * blank(..., blank)
- * Blanks or unblanks a display's screen.
- *
- * Turns the screen off when blank is nonzero, on when blank is zero.
- * Multiple sequential calls with the same blank value must be
- * supported.
- * The screen state transition must be be complete when the function
- * returns.
- *
- * returns 0 on success, negative on error.
- */
- int (*blank)(struct hwc_composer_device_1* dev, int disp, int blank);
-
- /*
- * For HWC 1.4 and above, setPowerMode() will be used in place of
- * blank().
- *
- * setPowerMode(..., mode)
- * Sets the display screen's power state.
- *
- * Refer to the documentation of the HWC_POWER_MODE_* constants
- * for information about each power mode.
- *
- * The functionality is similar to the blank() command in previous
- * versions of HWC, but with support for more power states.
- *
- * The display driver is expected to retain and restore the low power
- * state of the display while entering and exiting from suspend.
- *
- * Multiple sequential calls with the same mode value must be supported.
- *
- * The screen state transition must be be complete when the function
- * returns.
- *
- * returns 0 on success, negative on error.
- */
- int (*setPowerMode)(struct hwc_composer_device_1* dev, int disp,
- int mode);
- };
-
- /*
- * Used to retrieve information about the h/w composer
- *
- * Returns 0 on success or -errno on error.
- */
- int (*query)(struct hwc_composer_device_1* dev, int what, int* value);
-
- /*
- * (*registerProcs)() registers callbacks that the h/w composer HAL can
- * later use. It will be called immediately after the composer device is
- * opened with non-NULL procs. It is FORBIDDEN to call any of the callbacks
- * from within registerProcs(). registerProcs() must save the hwc_procs_t
- * pointer which is needed when calling a registered callback.
- */
- void (*registerProcs)(struct hwc_composer_device_1* dev,
- hwc_procs_t const* procs);
-
- /*
- * This field is OPTIONAL and can be NULL.
- *
- * If non NULL it will be called by SurfaceFlinger on dumpsys
- */
- void (*dump)(struct hwc_composer_device_1* dev, char *buff, int buff_len);
-
- /*
- * (*getDisplayConfigs)() returns handles for the configurations available
- * on the connected display. These handles must remain valid as long as the
- * display is connected.
- *
- * Configuration handles are written to configs. The number of entries
- * allocated by the caller is passed in *numConfigs; getDisplayConfigs must
- * not try to write more than this number of config handles. On return, the
- * total number of configurations available for the display is returned in
- * *numConfigs. If *numConfigs is zero on entry, then configs may be NULL.
- *
- * Hardware composers implementing HWC_DEVICE_API_VERSION_1_3 or prior
- * shall choose one configuration to activate and report it as the first
- * entry in the returned list. Reporting the inactive configurations is not
- * required.
- *
- * HWC_DEVICE_API_VERSION_1_4 and later provide configuration management
- * through SurfaceFlinger, and hardware composers implementing these APIs
- * must also provide getActiveConfig and setActiveConfig. Hardware composers
- * implementing these API versions may choose not to activate any
- * configuration, leaving configuration selection to higher levels of the
- * framework.
- *
- * Returns 0 on success or a negative error code on error. If disp is a
- * hotpluggable display type and no display is connected, an error shall be
- * returned.
- *
- * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later.
- * It shall be NULL for previous versions.
- */
- int (*getDisplayConfigs)(struct hwc_composer_device_1* dev, int disp,
- uint32_t* configs, size_t* numConfigs);
-
- /*
- * (*getDisplayAttributes)() returns attributes for a specific config of a
- * connected display. The config parameter is one of the config handles
- * returned by getDisplayConfigs.
- *
- * The list of attributes to return is provided in the attributes
- * parameter, terminated by HWC_DISPLAY_NO_ATTRIBUTE. The value for each
- * requested attribute is written in order to the values array. The
- * HWC_DISPLAY_NO_ATTRIBUTE attribute does not have a value, so the values
- * array will have one less value than the attributes array.
- *
- * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later.
- * It shall be NULL for previous versions.
- *
- * If disp is a hotpluggable display type and no display is connected,
- * or if config is not a valid configuration for the display, a negative
- * error code shall be returned.
- */
- int (*getDisplayAttributes)(struct hwc_composer_device_1* dev, int disp,
- uint32_t config, const uint32_t* attributes, int32_t* values);
-
- /*
- * (*getActiveConfig)() returns the index of the configuration that is
- * currently active on the connected display. The index is relative to
- * the list of configuration handles returned by getDisplayConfigs. If there
- * is no active configuration, -1 shall be returned.
- *
- * Returns the configuration index on success or -1 on error.
- *
- * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_4 and later.
- * It shall be NULL for previous versions.
- */
- int (*getActiveConfig)(struct hwc_composer_device_1* dev, int disp);
-
- /*
- * (*setActiveConfig)() instructs the hardware composer to switch to the
- * display configuration at the given index in the list of configuration
- * handles returned by getDisplayConfigs.
- *
- * If this function returns without error, any subsequent calls to
- * getActiveConfig shall return the index set by this function until one
- * of the following occurs:
- * 1) Another successful call of this function
- * 2) The display is disconnected
- *
- * Returns 0 on success or a negative error code on error. If disp is a
- * hotpluggable display type and no display is connected, or if index is
- * outside of the range of hardware configurations returned by
- * getDisplayConfigs, an error shall be returned.
- *
- * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_4 and later.
- * It shall be NULL for previous versions.
- */
- int (*setActiveConfig)(struct hwc_composer_device_1* dev, int disp,
- int index);
- /*
- * Asynchronously update the location of the cursor layer.
- *
- * Within the standard prepare()/set() composition loop, the client
- * (surfaceflinger) can request that a given layer uses dedicated cursor
- * composition hardware by specifiying the HWC_IS_CURSOR_LAYER flag. Only
- * one layer per display can have this flag set. If the layer is suitable
- * for the platform's cursor hardware, hwcomposer will return from prepare()
- * a composition type of HWC_CURSOR_OVERLAY for that layer. This indicates
- * not only that the client is not responsible for compositing that layer,
- * but also that the client can continue to update the position of that layer
- * after a call to set(). This can reduce the visible latency of mouse
- * movement to visible, on-screen cursor updates. Calls to
- * setCursorPositionAsync() may be made from a different thread doing the
- * prepare()/set() composition loop, but care must be taken to not interleave
- * calls of setCursorPositionAsync() between calls of set()/prepare().
- *
- * Notes:
- * - Only one layer per display can be specified as a cursor layer with
- * HWC_IS_CURSOR_LAYER.
- * - hwcomposer will only return one layer per display as HWC_CURSOR_OVERLAY
- * - This returns 0 on success or -errno on error.
- * - This field is optional for HWC_DEVICE_API_VERSION_1_4 and later. It
- * should be null for previous versions.
- */
- int (*setCursorPositionAsync)(struct hwc_composer_device_1 *dev, int disp, int x_pos, int y_pos);
-
- /*
- * Reserved for future use. Must be NULL.
- */
- void* reserved_proc[1];
-
-} hwc_composer_device_1_t;
-
-/** convenience API for opening and closing a device */
-
-static inline int hwc_open_1(const struct hw_module_t* module,
- hwc_composer_device_1_t** device) {
- return module->methods->open(module,
- HWC_HARDWARE_COMPOSER, (struct hw_device_t**)device);
-}
-
-static inline int hwc_close_1(hwc_composer_device_1_t* device) {
- return device->common.close(&device->common);
-}
-
-/*****************************************************************************/
-
-__END_DECLS
-
-#endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H */