2009-03-04 04:32:14 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2008 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_HARDWARE_H
|
|
|
|
#define ANDROID_INCLUDE_HARDWARE_HARDWARE_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
2009-04-10 23:24:31 +02:00
|
|
|
#include <cutils/native_handle.h>
|
|
|
|
|
2009-03-04 04:32:14 +01:00
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Value for the hw_module_t.tag field
|
|
|
|
*/
|
2009-04-10 23:24:31 +02:00
|
|
|
|
|
|
|
#define MAKE_TAG_CONSTANT(A,B,C,D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
|
|
|
|
|
|
|
|
#define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')
|
|
|
|
#define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')
|
2009-03-04 04:32:14 +01:00
|
|
|
|
|
|
|
struct hw_module_t;
|
|
|
|
struct hw_module_methods_t;
|
|
|
|
struct hw_device_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
|
|
|
|
* and the fields of this data structure must begin with hw_module_t
|
|
|
|
* followed by module specific information.
|
|
|
|
*/
|
2009-08-19 20:20:55 +02:00
|
|
|
typedef struct hw_module_t {
|
2009-03-04 04:32:14 +01:00
|
|
|
/** tag must be initialized to HARDWARE_MODULE_TAG */
|
|
|
|
uint32_t tag;
|
|
|
|
|
|
|
|
/** major version number for the module */
|
|
|
|
uint16_t version_major;
|
|
|
|
|
|
|
|
/** minor version number of the module */
|
|
|
|
uint16_t version_minor;
|
|
|
|
|
|
|
|
/** Identifier of module */
|
|
|
|
const char *id;
|
|
|
|
|
|
|
|
/** Name of this module */
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
/** Author/owner/implementor of the module */
|
|
|
|
const char *author;
|
|
|
|
|
|
|
|
/** Modules methods */
|
|
|
|
struct hw_module_methods_t* methods;
|
2009-04-10 23:24:31 +02:00
|
|
|
|
|
|
|
/** module's dso */
|
|
|
|
void* dso;
|
|
|
|
|
2009-03-04 04:32:14 +01:00
|
|
|
/** padding to 128 bytes, reserved for future use */
|
2009-04-10 23:24:31 +02:00
|
|
|
uint32_t reserved[32-7];
|
2009-03-04 04:32:14 +01:00
|
|
|
|
2009-08-19 20:20:55 +02:00
|
|
|
} hw_module_t;
|
|
|
|
|
|
|
|
typedef struct hw_module_methods_t {
|
2009-03-04 04:32:14 +01:00
|
|
|
/** Open a specific device */
|
|
|
|
int (*open)(const struct hw_module_t* module, const char* id,
|
|
|
|
struct hw_device_t** device);
|
2009-08-19 20:20:55 +02:00
|
|
|
|
|
|
|
} hw_module_methods_t;
|
2009-03-04 04:32:14 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Every device data structure must begin with hw_device_t
|
|
|
|
* followed by module specific public methods and attributes.
|
|
|
|
*/
|
2009-08-19 20:20:55 +02:00
|
|
|
typedef struct hw_device_t {
|
2009-03-04 04:32:14 +01:00
|
|
|
/** tag must be initialized to HARDWARE_DEVICE_TAG */
|
|
|
|
uint32_t tag;
|
|
|
|
|
|
|
|
/** version number for hw_device_t */
|
|
|
|
uint32_t version;
|
|
|
|
|
|
|
|
/** reference to the module this device belongs to */
|
|
|
|
struct hw_module_t* module;
|
|
|
|
|
|
|
|
/** padding reserved for future use */
|
|
|
|
uint32_t reserved[12];
|
|
|
|
|
|
|
|
/** Close this device */
|
|
|
|
int (*close)(struct hw_device_t* device);
|
2009-08-19 20:20:55 +02:00
|
|
|
|
|
|
|
} hw_device_t;
|
2009-03-04 04:32:14 +01:00
|
|
|
|
|
|
|
/**
|
2009-04-10 23:24:31 +02:00
|
|
|
* Name of the hal_module_info
|
2009-03-04 04:32:14 +01:00
|
|
|
*/
|
|
|
|
#define HAL_MODULE_INFO_SYM HMI
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Name of the hal_module_info as a string
|
|
|
|
*/
|
|
|
|
#define HAL_MODULE_INFO_SYM_AS_STR "HMI"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the module info associated with a module by id.
|
|
|
|
* @return: 0 == success, <0 == error and *pHmi == NULL
|
|
|
|
*/
|
|
|
|
int hw_get_module(const char *id, const struct hw_module_t **module);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pixel format definitions
|
|
|
|
*/
|
|
|
|
|
|
|
|
enum {
|
2010-06-15 06:08:00 +02:00
|
|
|
HAL_PIXEL_FORMAT_RGBA_8888 = 1,
|
|
|
|
HAL_PIXEL_FORMAT_RGBX_8888 = 2,
|
|
|
|
HAL_PIXEL_FORMAT_RGB_888 = 3,
|
|
|
|
HAL_PIXEL_FORMAT_RGB_565 = 4,
|
|
|
|
HAL_PIXEL_FORMAT_BGRA_8888 = 5,
|
|
|
|
HAL_PIXEL_FORMAT_RGBA_5551 = 6,
|
|
|
|
HAL_PIXEL_FORMAT_RGBA_4444 = 7,
|
2009-03-04 04:32:14 +01:00
|
|
|
|
2010-07-02 05:36:08 +02:00
|
|
|
/* 0x8 - 0xFF range unavailable */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 0x100 - 0x1FF
|
|
|
|
*
|
|
|
|
* This range is reserved for HAL implementations. OEMs can use
|
|
|
|
* any value in this range to communicate formats between their HAL
|
|
|
|
* modules
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2010-07-07 23:54:14 +02:00
|
|
|
* Android YUV format:
|
2010-07-02 05:36:08 +02:00
|
|
|
*
|
2010-07-07 23:54:14 +02:00
|
|
|
* This format is exposed outside of the HAL to software
|
2010-07-02 05:36:08 +02:00
|
|
|
* decoders and applications.
|
2010-07-07 23:54:14 +02:00
|
|
|
* EGLImageKHR must support it in conjunction with the
|
2010-07-02 05:36:08 +02:00
|
|
|
* OES_EGL_image_external extension.
|
|
|
|
*
|
2010-07-07 23:54:14 +02:00
|
|
|
* YV12 is 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
|
2010-07-02 05:36:08 +02:00
|
|
|
* by (W/2) x (H/2) Cr and Cb planes.
|
|
|
|
*
|
2010-07-07 23:54:14 +02:00
|
|
|
* This format assumes an horizontal stride of 16 pixels for all planes
|
|
|
|
* and an implicit vertical stride of the image height's next multiple
|
|
|
|
* of two:
|
|
|
|
* y_size = stride * ALIGN(height, 2)
|
|
|
|
* c_size = ALIGN(stride/2, 16) * height
|
|
|
|
* size = y_size + c_size * 2
|
|
|
|
* cr_offset = y_size
|
|
|
|
* cb_offset = y_size + c_size
|
2010-07-02 05:36:08 +02:00
|
|
|
*
|
|
|
|
*/
|
2010-07-07 23:54:14 +02:00
|
|
|
HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar
|
|
|
|
|
2010-07-02 05:36:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* Legacy formats (deprecated), used by ImageFormat.java */
|
|
|
|
HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16
|
|
|
|
HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21
|
|
|
|
HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2
|
2010-06-15 06:08:00 +02:00
|
|
|
};
|
2009-03-04 04:32:14 +01:00
|
|
|
|
2010-07-02 05:36:08 +02:00
|
|
|
|
2009-03-04 04:32:14 +01:00
|
|
|
/**
|
|
|
|
* Transformation definitions
|
|
|
|
*/
|
|
|
|
|
|
|
|
enum {
|
|
|
|
/* flip source image horizontally */
|
|
|
|
HAL_TRANSFORM_FLIP_H = 0x01,
|
|
|
|
/* flip source image vertically */
|
|
|
|
HAL_TRANSFORM_FLIP_V = 0x02,
|
2010-02-18 06:27:20 +01:00
|
|
|
/* rotate source image 90 degrees */
|
2009-03-04 04:32:14 +01:00
|
|
|
HAL_TRANSFORM_ROT_90 = 0x04,
|
2010-02-18 06:27:20 +01:00
|
|
|
/* rotate source image 180 degrees */
|
2009-03-04 04:32:14 +01:00
|
|
|
HAL_TRANSFORM_ROT_180 = 0x03,
|
2010-02-18 06:27:20 +01:00
|
|
|
/* rotate source image 270 degrees */
|
2009-03-04 04:32:14 +01:00
|
|
|
HAL_TRANSFORM_ROT_270 = 0x07,
|
|
|
|
};
|
|
|
|
|
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif /* ANDROID_INCLUDE_HARDWARE_HARDWARE_H */
|