diff options
Diffstat (limited to 'include/android/hardware/libhardware')
5 files changed, 275 insertions, 61 deletions
diff --git a/include/android/hardware/libhardware/include/hardware/camera3.h b/include/android/hardware/libhardware/include/hardware/camera3.h index d89bc930..fd1e2072 100644 --- a/include/android/hardware/libhardware/include/hardware/camera3.h +++ b/include/android/hardware/libhardware/include/hardware/camera3.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* - * Copyright (C) 2013 The Android Open Source Project + * Copyright (C) 2013-2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,21 +22,21 @@ #include "camera_common.h" /** - * Camera device HAL 3.3 [ CAMERA_DEVICE_API_VERSION_3_3 ] + * Camera device HAL 3.5[ CAMERA_DEVICE_API_VERSION_3_5 ] * * This is the current recommended version of the camera device HAL. * * Supports the android.hardware.Camera API, and as of v3.2, the - * android.hardware.camera2 API in LIMITED or FULL modes. + * android.hardware.camera2 API as LIMITED or above hardware level. * * Camera devices that support this version of the HAL must return - * CAMERA_DEVICE_API_VERSION_3_3 in camera_device_t.common.version and in + * CAMERA_DEVICE_API_VERSION_3_5 in camera_device_t.common.version and in * camera_info_t.device_version (from camera_module_t.get_camera_info). * - * CAMERA_DEVICE_API_VERSION_3_3: - * Camera modules that may contain version 3.3 devices must implement at - * least version 2.2 of the camera module interface (as defined by - * camera_module_t.common.module_api_version). + * CAMERA_DEVICE_API_VERSION_3_3 and above: + * Camera modules that may contain version 3.3 or above devices must + * implement at least version 2.2 of the camera module interface (as defined + * by camera_module_t.common.module_api_version). * * CAMERA_DEVICE_API_VERSION_3_2: * Camera modules that may contain version 3.2 devices must implement at @@ -138,6 +138,52 @@ * * - Addition of camera3 stream configuration operation mode to camera3_stream_configuration_t * + * 3.4: Minor additions to supported metadata and changes to data_space support + * + * - Add ANDROID_SENSOR_OPAQUE_RAW_SIZE static metadata as mandatory if + * RAW_OPAQUE format is supported. + * + * - Add ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE static metadata as + * mandatory if any RAW format is supported + * + * - Switch camera3_stream_t data_space field to a more flexible definition, + * using the version 0 definition of dataspace encoding. + * + * - General metadata additions which are available to use for HALv3.2 or + * newer: + * - ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_3 + * - ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST + * - ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE + * - ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL + * - ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL + * - ANDROID_SENSOR_OPAQUE_RAW_SIZE + * - ANDROID_SENSOR_OPTICAL_BLACK_REGIONS + * + * 3.5: Minor revisions to support session parameters and logical multi camera: + * + * - Add ANDROID_REQUEST_AVAILABLE_SESSION_KEYS static metadata, which is + * optional for implementations that want to support session parameters. If support is + * needed, then Hal should populate the list with all available capture request keys + * that can cause severe processing delays when modified by client. Typical examples + * include parameters that require time-consuming HW re-configuration or internal camera + * pipeline update. + * + * - Add a session parameter field to camera3_stream_configuration which can be populated + * by clients with initial values for the keys found in ANDROID_REQUEST_AVAILABLE_SESSION_KEYS. + * + * - Metadata additions for logical multi camera capability: + * - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA + * - ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS + * - ANDROID_LOGICAL_MULTI_CAMERA_SYNC_TYPE + * + * - Add physical camera id field in camera3_stream, so that for a logical + * multi camera, the application has the option to specify which physical camera + * a particular stream is configured on. + * + * - Add physical camera id and settings field in camera3_capture_request, so that + * for a logical multi camera, the application has the option to specify individual + * settings for a particular physical device. + * */ /** @@ -1460,6 +1506,13 @@ typedef enum camera3_stream_configuration_mode { * android.lens.opticalStabilizationMode (if it is supported) * android.scaler.cropRegion * android.statistics.faceDetectMode (if it is supported) + * 6. To reduce the amount of data passed across process boundaries at + * high frame rate, within one batch, camera framework only propagates + * the last shutter notify and the last capture results (including partial + * results and final result) to the app. The shutter notifies and capture + * results for the other requests in the batch are derived by + * the camera framework. As a result, the HAL can return empty metadata + * except for the last result in the batch. * * For more details about high speed stream requirements, see * android.control.availableHighSpeedVideoConfigurations and CONSTRAINED_HIGH_SPEED_VIDEO @@ -1578,6 +1631,13 @@ typedef struct camera3_stream { * value of this is 0. * For all streams passed via configure_streams(), the HAL must write * over this field with its usage flags. + * + * From Android O, the usage flag for an output stream may be bitwise + * combination of usage flags for multiple consumers, for the purpose of + * sharing one camera stream between those consumers. The HAL must fail + * configure_streams call with -EINVAL if the combined flags cannot be + * supported due to imcompatible buffer format, dataSpace, or other hardware + * limitations. */ uint32_t usage; @@ -1612,11 +1672,19 @@ typedef struct camera3_stream { * be HAL_DATASPACE_UNKNOWN, and the appropriate color space, etc, should * be determined from the usage flags and the format. * - * >= CAMERA_DEVICE_API_VERSION_3_3: + * = CAMERA_DEVICE_API_VERSION_3_3: * * Always set by the camera service. HAL must use this dataSpace to * configure the stream to the correct colorspace, or to select between - * color and depth outputs if supported. + * color and depth outputs if supported. The dataspace values are the + * legacy definitions in graphics.h + * + * >= CAMERA_DEVICE_API_VERSION_3_4: + * + * Always set by the camera service. HAL must use this dataSpace to + * configure the stream to the correct colorspace, or to select between + * color and depth outputs if supported. The dataspace values are set + * using the V0 dataspace definitions in graphics.h */ android_dataspace_t data_space; @@ -1647,6 +1715,29 @@ typedef struct camera3_stream { int rotation; /** + * The physical camera id this stream belongs to. + * + * <= CAMERA_DEVICE_API_VERISON_3_4: + * + * Not defined and must not be accessed. + * + * >= CAMERA_DEVICE_API_VERISON_3_5: + * + * Always set by camera service. If the camera device is not a logical + * multi camera, or if the camera is a logical multi camera but the stream + * is not a physical output stream, this field will point to a 0-length + * string. + * + * A logical multi camera is a camera device backed by multiple physical + * cameras that are also exposed to the application. And for a logical + * multi camera, a physical output stream is an output stream specifically + * requested on an underlying physical camera. + * + * For an input stream, this field is guaranteed to be a 0-length string. + */ + const char* physical_camera_id; + + /** * This should be one of the camera3_stream_rotation_t values except for * CAMERA3_STREAM_ROTATION_180. * When setting to CAMERA3_STREAM_ROTATION_90 or CAMERA3_STREAM_ROTATION_270, HAL would crop, @@ -1663,7 +1754,7 @@ typedef struct camera3_stream { int crop_rotate_scale_degrees; /* reserved for future use */ - void *reserved[6]; + void *reserved[5]; } camera3_stream_t; @@ -1697,16 +1788,30 @@ typedef struct camera3_stream_configuration { /** * >= CAMERA_DEVICE_API_VERSION_3_3: * - * The operation mode of streams in this configuration, one of the value defined in - * camera3_stream_configuration_mode_t. - * The HAL can use this mode as an indicator to set the stream property (e.g., - * camera3_stream->max_buffers) appropriately. For example, if the configuration is - * CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE, the HAL may want to set aside more - * buffers for batch mode operation (see android.control.availableHighSpeedVideoConfigurations - * for batch mode definition). + * The operation mode of streams in this configuration, one of the value + * defined in camera3_stream_configuration_mode_t. The HAL can use this + * mode as an indicator to set the stream property (e.g., + * camera3_stream->max_buffers) appropriately. For example, if the + * configuration is + * CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE, the HAL may + * want to set aside more buffers for batch mode operation (see + * android.control.availableHighSpeedVideoConfigurations for batch mode + * definition). * */ uint32_t operation_mode; + + /** + * >= CAMERA_DEVICE_API_VERSION_3_5: + * + * The session metadata buffer contains the initial values of + * ANDROID_REQUEST_AVAILABLE_SESSION_KEYS. This field is optional + * and camera clients can choose to ignore it, in which case it will + * be set to NULL. If parameters are present, then Hal should examine + * the parameter values and configure its internal camera pipeline + * accordingly. + */ + const camera_metadata_t *session_parameters; } camera3_stream_configuration_t; /** @@ -1950,7 +2055,7 @@ typedef enum camera3_error_msg_code { * available. Subsequent requests are unaffected, and the device remains * operational. The frame_number field specifies the request for which the * buffer was dropped, and error_stream contains a pointer to the stream - * that dropped the frame.u + * that dropped the frame. */ CAMERA3_MSG_ERROR_BUFFER = 4, @@ -2190,6 +2295,44 @@ typedef struct camera3_capture_request { */ const camera3_stream_buffer_t *output_buffers; + /** + * <= CAMERA_DEVICE_API_VERISON_3_4: + * + * Not defined and must not be accessed. + * + * >= CAMERA_DEVICE_API_VERSION_3_5: + * The number of physical camera settings to be applied. If 'num_physcam_settings' + * equals 0 or a physical device is not included, then Hal must decide the + * specific physical device settings based on the default 'settings'. + */ + uint32_t num_physcam_settings; + + /** + * <= CAMERA_DEVICE_API_VERISON_3_4: + * + * Not defined and must not be accessed. + * + * >= CAMERA_DEVICE_API_VERSION_3_5: + * The physical camera ids. The array will contain 'num_physcam_settings' + * camera id strings for all physical devices that have specific settings. + * In case some id is invalid, the process capture request must fail and return + * -EINVAL. + */ + const char **physcam_id; + + /** + * <= CAMERA_DEVICE_API_VERISON_3_4: + * + * Not defined and must not be accessed. + * + * >= CAMERA_DEVICE_API_VERSION_3_5: + * The capture settings for the physical cameras. The array will contain + * 'num_physcam_settings' settings for invididual physical devices. In + * case the settings at some particular index are empty, the process capture + * request must fail and return -EINVAL. + */ + const camera_metadata_t **physcam_settings; + } camera3_capture_request_t; /** @@ -2367,6 +2510,37 @@ typedef struct camera3_capture_result { */ uint32_t partial_result; + /** + * >= CAMERA_DEVICE_API_VERSION_3_5: + * + * Specifies the number of physical camera metadata this capture result + * contains. It must be equal to the number of physical cameras being + * requested from. + * + * If the current camera device is not a logical multi-camera, or the + * corresponding capture_request doesn't request on any physical camera, + * this field must be 0. + */ + uint32_t num_physcam_metadata; + + /** + * >= CAMERA_DEVICE_API_VERSION_3_5: + * + * An array of strings containing the physical camera ids for the returned + * physical camera metadata. The length of the array is + * num_physcam_metadata. + */ + const char **physcam_ids; + + /** + * >= CAMERA_DEVICE_API_VERSION_3_5: + * + * The array of physical camera metadata for the physical cameras being + * requested upon. This array should have a 1-to-1 mapping with the + * physcam_ids. The length of the array is num_physcam_metadata. + */ + const camera_metadata_t **physcam_metadata; + } camera3_capture_result_t; /********************************************************************** @@ -2899,7 +3073,8 @@ typedef struct camera3_device_ops { * 0: On a successful start to processing the capture request * * -EINVAL: If the input is malformed (the settings are NULL when not - * allowed, there are 0 output buffers, etc) and capture processing + * allowed, invalid physical camera settings, + * there are 0 output buffers, etc) and capture processing * cannot start. Failures during request processing should be * handled by calling camera3_callback_ops_t.notify(). In case of * this error, the framework will retain responsibility for the diff --git a/include/android/hardware/libhardware/include/hardware/camera_common.h b/include/android/hardware/libhardware/include/hardware/camera_common.h index 26df0698..5c9bc06f 100644 --- a/include/android/hardware/libhardware/include/hardware/camera_common.h +++ b/include/android/hardware/libhardware/include/hardware/camera_common.h @@ -141,17 +141,19 @@ __BEGIN_DECLS * All device versions <= HARDWARE_DEVICE_API_VERSION(1, 0xFF) must be treated * as CAMERA_DEVICE_API_VERSION_1_0 */ -#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) -#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) -#define CAMERA_DEVICE_API_VERSION_2_1 HARDWARE_DEVICE_API_VERSION(2, 1) -#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0) -#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1) +#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) // DEPRECATED +#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) // NO LONGER SUPPORTED +#define CAMERA_DEVICE_API_VERSION_2_1 HARDWARE_DEVICE_API_VERSION(2, 1) // NO LONGER SUPPORTED +#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0) // NO LONGER SUPPORTED +#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1) // NO LONGER SUPPORTED #define CAMERA_DEVICE_API_VERSION_3_2 HARDWARE_DEVICE_API_VERSION(3, 2) #define CAMERA_DEVICE_API_VERSION_3_3 HARDWARE_DEVICE_API_VERSION(3, 3) +#define CAMERA_DEVICE_API_VERSION_3_4 HARDWARE_DEVICE_API_VERSION(3, 4) +#define CAMERA_DEVICE_API_VERSION_3_5 HARDWARE_DEVICE_API_VERSION(3, 5) -// Device version 3.3 is current, older HAL camera device versions are not +// Device version 3.5 is current, older HAL camera device versions are not // recommended for new devices. -#define CAMERA_DEVICE_API_VERSION_CURRENT CAMERA_DEVICE_API_VERSION_3_3 +#define CAMERA_DEVICE_API_VERSION_CURRENT CAMERA_DEVICE_API_VERSION_3_5 /** * Defined in /system/media/camera/include/system/camera_metadata.h diff --git a/include/android/hardware/libhardware/include/hardware/fb.h b/include/android/hardware/libhardware/include/hardware/fb.h index 9ea9a6e6..2d9153ae 100644 --- a/include/android/hardware/libhardware/include/hardware/fb.h +++ b/include/android/hardware/libhardware/include/hardware/fb.h @@ -161,7 +161,7 @@ typedef struct framebuffer_device_t { static inline int framebuffer_open(const struct hw_module_t* module, struct framebuffer_device_t** device) { return module->methods->open(module, - GRALLOC_HARDWARE_FB0, (struct hw_device_t**)device); + GRALLOC_HARDWARE_FB0, TO_HW_DEVICE_T_OPEN(device)); } static inline int framebuffer_close(struct framebuffer_device_t* device) { diff --git a/include/android/hardware/libhardware/include/hardware/gralloc.h b/include/android/hardware/libhardware/include/hardware/gralloc.h index 80da4cb8..01a76727 100644 --- a/include/android/hardware/libhardware/include/hardware/gralloc.h +++ b/include/android/hardware/libhardware/include/hardware/gralloc.h @@ -19,9 +19,8 @@ #ifndef ANDROID_GRALLOC_INTERFACE_H #define ANDROID_GRALLOC_INTERFACE_H -#include <system/window.h> -#include <system/graphics.h> #include <hardware/hardware.h> +#include <system/graphics.h> #include <stdint.h> #include <sys/cdefs.h> @@ -29,8 +28,8 @@ #include <cutils/native_handle.h> -#include <hardware/hardware.h> #include <hardware/fb.h> +#include <hardware/hardware.h> __BEGIN_DECLS @@ -69,69 +68,69 @@ __BEGIN_DECLS enum { /* buffer is never read in software */ - GRALLOC_USAGE_SW_READ_NEVER = 0x00000000, + GRALLOC_USAGE_SW_READ_NEVER = 0x00000000U, /* buffer is rarely read in software */ - GRALLOC_USAGE_SW_READ_RARELY = 0x00000002, + GRALLOC_USAGE_SW_READ_RARELY = 0x00000002U, /* buffer is often read in software */ - GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003, + GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003U, /* mask for the software read values */ - GRALLOC_USAGE_SW_READ_MASK = 0x0000000F, + GRALLOC_USAGE_SW_READ_MASK = 0x0000000FU, /* buffer is never written in software */ - GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000, + GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000U, /* buffer is rarely written in software */ - GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020, + GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020U, /* buffer is often written in software */ - GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030, + GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030U, /* mask for the software write values */ - GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0, + GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0U, /* buffer will be used as an OpenGL ES texture */ - GRALLOC_USAGE_HW_TEXTURE = 0x00000100, + GRALLOC_USAGE_HW_TEXTURE = 0x00000100U, /* buffer will be used as an OpenGL ES render target */ - GRALLOC_USAGE_HW_RENDER = 0x00000200, + GRALLOC_USAGE_HW_RENDER = 0x00000200U, /* buffer will be used by the 2D hardware blitter */ - GRALLOC_USAGE_HW_2D = 0x00000400, + GRALLOC_USAGE_HW_2D = 0x00000400U, /* buffer will be used by the HWComposer HAL module */ - GRALLOC_USAGE_HW_COMPOSER = 0x00000800, + GRALLOC_USAGE_HW_COMPOSER = 0x00000800U, /* buffer will be used with the framebuffer device */ - GRALLOC_USAGE_HW_FB = 0x00001000, + GRALLOC_USAGE_HW_FB = 0x00001000U, /* buffer should be displayed full-screen on an external display when * possible */ - GRALLOC_USAGE_EXTERNAL_DISP = 0x00002000, + GRALLOC_USAGE_EXTERNAL_DISP = 0x00002000U, /* Must have a hardware-protected path to external display sink for * this buffer. If a hardware-protected path is not available, then * either don't composite only this buffer (preferred) to the * external sink, or (less desirable) do not route the entire * composition to the external sink. */ - GRALLOC_USAGE_PROTECTED = 0x00004000, + GRALLOC_USAGE_PROTECTED = 0x00004000U, /* buffer may be used as a cursor */ - GRALLOC_USAGE_CURSOR = 0x00008000, + GRALLOC_USAGE_CURSOR = 0x00008000U, /* buffer will be used with the HW video encoder */ - GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000, + GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000U, /* buffer will be written by the HW camera pipeline */ - GRALLOC_USAGE_HW_CAMERA_WRITE = 0x00020000, + GRALLOC_USAGE_HW_CAMERA_WRITE = 0x00020000U, /* buffer will be read by the HW camera pipeline */ - GRALLOC_USAGE_HW_CAMERA_READ = 0x00040000, + GRALLOC_USAGE_HW_CAMERA_READ = 0x00040000U, /* buffer will be used as part of zero-shutter-lag queue */ - GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00060000, + GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00060000U, /* mask for the camera access values */ - GRALLOC_USAGE_HW_CAMERA_MASK = 0x00060000, + GRALLOC_USAGE_HW_CAMERA_MASK = 0x00060000U, /* mask for the software usage bit-mask */ - GRALLOC_USAGE_HW_MASK = 0x00071F00, + GRALLOC_USAGE_HW_MASK = 0x00071F00U, /* buffer will be used as a RenderScript Allocation */ - GRALLOC_USAGE_RENDERSCRIPT = 0x00100000, + GRALLOC_USAGE_RENDERSCRIPT = 0x00100000U, /* Set by the consumer to indicate to the producer that they may attach a * buffer that they did not detach from the BufferQueue. Will be filtered * out by GRALLOC_USAGE_ALLOC_MASK, so gralloc modules will not need to * handle this flag. */ - GRALLOC_USAGE_FOREIGN_BUFFERS = 0x00200000, + GRALLOC_USAGE_FOREIGN_BUFFERS = 0x00200000U, /* Mask of all flags which could be passed to a gralloc module for buffer * allocation. Any flags not in this mask do not need to be handled by @@ -139,11 +138,11 @@ enum { GRALLOC_USAGE_ALLOC_MASK = ~(GRALLOC_USAGE_FOREIGN_BUFFERS), /* implementation-specific private usage flags */ - GRALLOC_USAGE_PRIVATE_0 = 0x10000000, - GRALLOC_USAGE_PRIVATE_1 = 0x20000000, - GRALLOC_USAGE_PRIVATE_2 = 0x40000000, - GRALLOC_USAGE_PRIVATE_3 = 0x80000000, - GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000, + GRALLOC_USAGE_PRIVATE_0 = 0x10000000U, + GRALLOC_USAGE_PRIVATE_1 = 0x20000000U, + GRALLOC_USAGE_PRIVATE_2 = 0x40000000U, + GRALLOC_USAGE_PRIVATE_3 = 0x80000000U, + GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000U, }; /*****************************************************************************/ @@ -373,13 +372,45 @@ typedef struct alloc_device_t { static inline int gralloc_open(const struct hw_module_t* module, struct alloc_device_t** device) { return module->methods->open(module, - GRALLOC_HARDWARE_GPU0, (struct hw_device_t**)device); + GRALLOC_HARDWARE_GPU0, TO_HW_DEVICE_T_OPEN(device)); } static inline int gralloc_close(struct alloc_device_t* device) { return device->common.close(&device->common); } +/** + * map_usage_to_memtrack should be called after allocating a gralloc buffer. + * + * @param usage - it is the flag used when alloc function is called. + * + * This function maps the gralloc usage flags to appropriate memtrack bucket. + * GrallocHAL implementers and users should make an additional ION_IOCTL_TAG + * call using the memtrack tag returned by this function. This will help the + * in-kernel memtack to categorize the memory allocated by different processes + * according to their usage. + * + */ +static inline const char* map_usage_to_memtrack(uint32_t usage) { + usage &= GRALLOC_USAGE_ALLOC_MASK; + + if ((usage & GRALLOC_USAGE_HW_CAMERA_WRITE) != 0) { + return "camera"; + } else if ((usage & GRALLOC_USAGE_HW_VIDEO_ENCODER) != 0 || + (usage & GRALLOC_USAGE_EXTERNAL_DISP) != 0) { + return "video"; + } else if ((usage & GRALLOC_USAGE_HW_RENDER) != 0 || + (usage & GRALLOC_USAGE_HW_TEXTURE) != 0) { + return "gl"; + } else if ((usage & GRALLOC_USAGE_HW_CAMERA_READ) != 0) { + return "camera"; + } else if ((usage & GRALLOC_USAGE_SW_READ_MASK) != 0 || + (usage & GRALLOC_USAGE_SW_WRITE_MASK) != 0) { + return "cpu"; + } + return "graphics"; +} + __END_DECLS #endif // ANDROID_GRALLOC_INTERFACE_H diff --git a/include/android/hardware/libhardware/include/hardware/hardware.h b/include/android/hardware/libhardware/include/hardware/hardware.h index 10b73df7..8919f120 100644 --- a/include/android/hardware/libhardware/include/hardware/hardware.h +++ b/include/android/hardware/libhardware/include/hardware/hardware.h @@ -202,6 +202,12 @@ typedef struct hw_device_t { } hw_device_t; +#ifdef __cplusplus +#define TO_HW_DEVICE_T_OPEN(x) reinterpret_cast<struct hw_device_t**>(x) +#else +#define TO_HW_DEVICE_T_OPEN(x) (struct hw_device_t**)(x) +#endif + /** * Name of the hal_module_info */ |