android overlay 架构,Android Overlay HAL架构初探

0818b9ca8b590ca3270a3433284dd417.png

1 overlay可能支持的颜色格式

/* possible overlay formats可能支持的颜色格式 */

enum {

OVERLAY_FORMAT_RGBA_8888    = HAL_PIXEL_FORMAT_RGBA_8888,

OVERLAY_FORMAT_RGB_565      = HAL_PIXEL_FORMAT_RGB_565,

OVERLAY_FORMAT_BGRA_8888    = HAL_PIXEL_FORMAT_BGRA_8888,

OVERLAY_FORMAT_YCbCr_422_SP = HAL_PIXEL_FORMAT_YCbCr_422_SP,

OVERLAY_FORMAT_YCbCr_420_SP = HAL_PIXEL_FORMAT_YCbCr_420_SP,

OVERLAY_FORMAT_YCbYCr_422_I = HAL_PIXEL_FORMAT_YCbCr_422_I,

OVERLAY_FORMAT_YCbYCr_420_I = HAL_PIXEL_FORMAT_YCbCr_420_I,

OVERLAY_FORMAT_CbYCrY_422_I = HAL_PIXEL_FORMAT_CbYCrY_422_I,

OVERLAY_FORMAT_CbYCrY_420_I = HAL_PIXEL_FORMAT_CbYCrY_420_I,

OVERLAY_FORMAT_DEFAULT      = 99    // The actual color format is determined

// by the overlay

};

2 overlay_control_device_t结构的子函数

/* get static informations about the capabilities of the overlay engine 获取overlay引擎的固定信息*/

int (*get)(struct overlay_control_device_t *dev, int name);

/* creates an overlay matching the given parameters as closely as possible.根据所给的参数,尽可能得创建一个overlay。

* returns an error if no more overlays are available. The actual 如果没有更多的overlay可获取,返回错误。

* size and format is returned in overlay_t. 实际的尺寸和格式通过overlay_t结构返回*/

overlay_t* (*createOverlay)(struct overlay_control_device_t *dev,

uint32_t w, uint32_t h, int32_t format);

/* destroys an overlay. This call releases all 销毁一个overlay,释放所有资源

* resources associated with overlay_t and make it invalid */

void (*destroyOverlay)(struct overlay_control_device_t *dev,

overlay_t* overlay);

/* set position and scaling of the given overlay as closely as possible. 根据所给的参数,尽可能的设置坐标和缩放。

* if scaling cannot be performed, overlay must be centered. 如果无法执行尺寸变化,必须为中心覆盖*/

int (*setPosition)(struct overlay_control_device_t *dev,

overlay_t* overlay,

int x, int y, uint32_t w, uint32_t h);

/* returns the actual position and size of the overlay 获取overlay的实际位置*/

int (*getPosition)(struct overlay_control_device_t *dev,

overlay_t* overlay,

int* x, int* y, uint32_t* w, uint32_t* h);

/* sets configurable parameters for this overlay. returns an error if not设置配置参数,如果不支持返回错误

* supported. */

int (*setParameter)(struct overlay_control_device_t *dev,

overlay_t* overlay, int param, int value);

/*以下两个函数没有实现*/

int (*stage)(struct overlay_control_device_t *dev, overlay_t* overlay);

int (*commit)(struct overlay_control_device_t *dev, overlay_t* overlay);

3、 overlay_data_device_t结构体函数子函数

/* initialize the overlay from the given handle. this associates this通过传入的handle初始化overlay

* overlay data module to its control module将data模块附加到控制模块上 */

int (*initialize)(struct overlay_data_device_t *dev,

overlay_handle_t handle);

/* can be called to change the width and height of the overlay.改变overlay的宽度和高度 */

int (*resizeInput)(struct overlay_data_device_t *dev,

uint32_t w, uint32_t h);

/*以下三个函数没有实现*/

int (*setCrop)(struct overlay_data_device_t *dev,

uint32_t x, uint32_t y, uint32_t w, uint32_t h) ;

int (*getCrop)(struct overlay_data_device_t *dev,

uint32_t* x, uint32_t* y, uint32_t* w, uint32_t* h) ;

int (*setParameter)(struct overlay_data_device_t *dev,

int param, int value);

/* blocks until an overlay buffer is available and return that buffer.阻塞直到一个overlay释放buffer */

int (*dequeueBuffer)(struct overlay_data_device_t *dev,

overlay_buffer_t *buf);

/* release the overlay buffer and post it释放overlay buffer,post我理解是贴到screen上 */

int (*queueBuffer)(struct overlay_data_device_t *dev,

overlay_buffer_t buffer);

/* returns the address of a given buffer if supported, NULL otherwise.返回given buffer的地址 */

void* (*getBufferAddress)(struct overlay_data_device_t *dev,

overlay_buffer_t buffer);

/*暂未实现*/

int (*getBufferCount)(struct overlay_data_device_t *dev);

4、get()函数可以提供的种类

enum {

/* Maximum amount of minification supported by the hardware硬件支持的最大缩小倍数*/

OVERLAY_MINIFICATION_LIMIT      = 1,

/* Maximum amount of magnification supported by the hardware硬件支持的最大放大倍数 */

OVERLAY_MAGNIFICATION_LIMIT     = 2,

/* Number of fractional bits support by the overlay scaling engine 缩放引擎支持的小数位数 */

OVERLAY_SCALING_FRAC_BITS       = 3,

/* Supported rotation step in degrees. 旋转步进*/

OVERLAY_ROTATION_STEP_DEG       = 4,

/* horizontal alignment in pixels 像素中的水平对齐?*/

OVERLAY_HORIZONTAL_ALIGNMENT    = 5,

/* vertical alignment in pixels 像素中的垂直对齐*/

OVERLAY_VERTICAL_ALIGNMENT      = 6,

/* width alignment restrictions. negative number for max. power-of-two 宽度对齐限制。负数为最大值。双功率?*/

OVERLAY_WIDTH_ALIGNMENT         = 7,

/* height alignment restrictions. negative number for max. power-of-two 高度对齐限制。负数为最大值。双功率?*/

OVERLAY_HEIGHT_ALIGNMENT        = 8,

};

5、设置setParameter()函数可设置的种类 enum {     /* rotation of the source image in degrees (0 to 359)源图像旋转角度(0 到 359)6410好像还不支持任意角度旋转 */     OVERLAY_ROTATION_DEG = 1,     /* enable or disable dithering */     OVERLAY_DITHER        = 3,     /* transformation applied (this is a superset of COPYBIT_ROTATION_DEG) */     OVERLAY_TRANSFORM    = 4, };

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值