add support for setting the background color

this is a revision of the h/w composer API. This change
is binary backward compatible.

Change-Id: Id4cf43447594db9049f7e2c44ea08157ca725129
This commit is contained in:
Mathias Agopian
2012-02-03 15:54:11 -08:00
parent caf62bd7fb
commit eb8fb50814

View File

@@ -28,7 +28,7 @@ __BEGIN_DECLS
/*****************************************************************************/ /*****************************************************************************/
#define HWC_API_VERSION 1 #define HWC_API_VERSION HARDWARE_DEVICE_API_VERSION(0,2)
/** /**
* The id of this module * The id of this module
@@ -91,6 +91,10 @@ enum {
/* this layer will be handled in the HWC */ /* this layer will be handled in the HWC */
HWC_OVERLAY = 1, HWC_OVERLAY = 1,
/* this is the background layer. it's used to set the background color.
* there is only a single background layer */
HWC_BACKGROUND = 2,
}; };
/* /*
@@ -123,6 +127,12 @@ enum {
HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270, HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
}; };
/* attributes queriable with query() */
enum {
/* must return 1 if the background layer is supported, 0 otherwise */
HWC_BACKGROUND_LAYER_SUPPORTED = 0,
};
typedef struct hwc_rect { typedef struct hwc_rect {
int left; int left;
int top; int top;
@@ -135,12 +145,29 @@ typedef struct hwc_region {
hwc_rect_t const* rects; hwc_rect_t const* rects;
} hwc_region_t; } 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 { typedef struct hwc_layer {
/* /*
* initially set to HWC_FRAMEBUFFER, indicates the layer will * initially set to HWC_FRAMEBUFFER or HWC_BACKGROUND.
* be drawn into the framebuffer using OpenGL ES. * HWC_FRAMEBUFFER
* indicates the layer will be drawn into the framebuffer
* using OpenGL ES.
* The HWC can toggle this value to HWC_OVERLAY, to indicate * The HWC can toggle this value to HWC_OVERLAY, to indicate
* it will handle the layer. * it will handle the layer.
*
* HWC_BACKGROUND
* indicates this is a special "background" layer. The only valid
* field is backgroundColor. HWC_BACKGROUND can only be used with
* HWC_API_VERSION >= 0.2
* The HWC can toggle this value to HWC_FRAMEBUFFER, to indicate
* it CANNOT handle the background color
*
*/ */
int32_t compositionType; int32_t compositionType;
@@ -150,6 +177,12 @@ typedef struct hwc_layer {
/* see hwc_layer_t::flags above */ /* see hwc_layer_t::flags above */
uint32_t flags; uint32_t flags;
union {
/* color of the background. hwc_color_t.a is ignored */
hwc_color_t backgroundColor;
struct {
/* handle of buffer to compose. This handle is guaranteed to have been /* handle of buffer to compose. This handle is guaranteed to have been
* allocated from gralloc using the GRALLOC_USAGE_HW_COMPOSER usage flag. If * 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 layer's handle is unchanged across two consecutive prepare calls and
@@ -179,6 +212,8 @@ typedef struct hwc_layer {
* The visible region INCLUDES areas overlapped by a translucent layer. * The visible region INCLUDES areas overlapped by a translucent layer.
*/ */
hwc_region_t visibleRegionScreen; hwc_region_t visibleRegionScreen;
};
};
} hwc_layer_t; } hwc_layer_t;
@@ -333,7 +368,17 @@ typedef struct hwc_composer_device {
void (*registerProcs)(struct hwc_composer_device* dev, void (*registerProcs)(struct hwc_composer_device* dev,
hwc_procs_t const* procs); hwc_procs_t const* procs);
void* reserved_proc[6]; /*
* This hook is OPTIONAL.
*
* Used to retrieve information about the h/w composer
*
* Returns 0 on success or -errno on error.
*/
int (*query)(struct hwc_composer_device* dev, int what, int* value);
void* reserved_proc[5];
} hwc_composer_device_t; } hwc_composer_device_t;