add support for VSYNC events in h/w composer HAL
Change-Id: Ic19a41ae522a236f45957e50c792934d987b116a
This commit is contained in:
committed by
Erik Gilling
parent
0cacd8d44b
commit
b08d45dff6
@@ -28,9 +28,15 @@ __BEGIN_DECLS
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define HWC_DEVICE_API_VERSION HARDWARE_DEVICE_API_VERSION(0, 2)
|
#define HWC_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
|
||||||
#define HWC_MODULE_API_VERSION HARDWARE_MODULE_API_VERSION(0, 1)
|
|
||||||
|
#define HWC_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION(0, 1)
|
||||||
|
#define HWC_DEVICE_API_VERSION_0_2 HARDWARE_DEVICE_API_VERSION(0, 2)
|
||||||
|
#define HWC_DEVICE_API_VERSION_0_3 HARDWARE_DEVICE_API_VERSION(0, 3)
|
||||||
|
|
||||||
// for compatibility
|
// 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
|
#define HWC_API_VERSION HWC_DEVICE_API_VERSION
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,10 +138,58 @@ enum {
|
|||||||
|
|
||||||
/* attributes queriable with query() */
|
/* attributes queriable with query() */
|
||||||
enum {
|
enum {
|
||||||
/* must return 1 if the background layer is supported, 0 otherwise */
|
/*
|
||||||
|
* availability: HWC_DEVICE_API_VERSION_0_2
|
||||||
|
* must return 1 if the background layer is supported, 0 otherwise
|
||||||
|
*/
|
||||||
HWC_BACKGROUND_LAYER_SUPPORTED = 0,
|
HWC_BACKGROUND_LAYER_SUPPORTED = 0,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* availability: HWC_DEVICE_API_VERSION_0_3
|
||||||
|
* returns the vsync period in nanosecond
|
||||||
|
*/
|
||||||
|
HWC_VSYNC_PERIOD = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Allowed events for hwc_methods::eventControl() */
|
||||||
|
enum {
|
||||||
|
HWC_EVENT_VSYNC = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
struct hwc_composer_device;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* availability: HWC_DEVICE_API_VERSION_0_3
|
||||||
|
*
|
||||||
|
* struct hwc_methods cannot be embedded in other structures as
|
||||||
|
* sizeof(struct hwc_methods) cannot be relied upon.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct hwc_methods {
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* HWC_DEVICE_API_VERSION_0_3
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* eventControl(..., event, enabled)
|
||||||
|
* Enables or disables h/w composer events.
|
||||||
|
*
|
||||||
|
* 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* dev, int event, int enabled);
|
||||||
|
|
||||||
|
} hwc_methods_t;
|
||||||
|
|
||||||
typedef struct hwc_rect {
|
typedef struct hwc_rect {
|
||||||
int left;
|
int left;
|
||||||
int top;
|
int top;
|
||||||
@@ -185,7 +239,6 @@ typedef struct hwc_layer {
|
|||||||
hwc_color_t backgroundColor;
|
hwc_color_t backgroundColor;
|
||||||
|
|
||||||
struct {
|
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
|
||||||
@@ -263,6 +316,23 @@ typedef struct hwc_procs {
|
|||||||
* hooks, unless noted otherwise.
|
* hooks, unless noted otherwise.
|
||||||
*/
|
*/
|
||||||
void (*invalidate)(struct hwc_procs* procs);
|
void (*invalidate)(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 (see: hwc_event_control).
|
||||||
|
*
|
||||||
|
* the "zero" parameter must always be 0.
|
||||||
|
* the "timestamp" parameter is the 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
|
||||||
|
* ANDROID_URGENT_DISPLAY_PRIORITY with as little latency as possible,
|
||||||
|
* typically less than 0.5 ms.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void (*vsync)(struct hwc_procs* procs, int zero, int64_t timestamp);
|
||||||
} hwc_procs_t;
|
} hwc_procs_t;
|
||||||
|
|
||||||
|
|
||||||
@@ -349,14 +419,14 @@ typedef struct hwc_composer_device {
|
|||||||
hwc_surface_t sur,
|
hwc_surface_t sur,
|
||||||
hwc_layer_list_t* list);
|
hwc_layer_list_t* list);
|
||||||
/*
|
/*
|
||||||
* This hook is OPTIONAL.
|
* This field is OPTIONAL and can be NULL.
|
||||||
*
|
*
|
||||||
* If non NULL it will be called by SurfaceFlinger on dumpsys
|
* If non NULL it will be called by SurfaceFlinger on dumpsys
|
||||||
*/
|
*/
|
||||||
void (*dump)(struct hwc_composer_device* dev, char *buff, int buff_len);
|
void (*dump)(struct hwc_composer_device* dev, char *buff, int buff_len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This hook is OPTIONAL.
|
* This field is OPTIONAL and can be NULL.
|
||||||
*
|
*
|
||||||
* (*registerProcs)() registers a set of callbacks the h/w composer HAL
|
* (*registerProcs)() registers a set of callbacks the h/w composer HAL
|
||||||
* can later use. It is FORBIDDEN to call any of the callbacks from
|
* can later use. It is FORBIDDEN to call any of the callbacks from
|
||||||
@@ -372,7 +442,8 @@ typedef struct hwc_composer_device {
|
|||||||
hwc_procs_t const* procs);
|
hwc_procs_t const* procs);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This hook is OPTIONAL.
|
* This field is OPTIONAL and can be NULL.
|
||||||
|
* availability: HWC_DEVICE_API_VERSION_0_2
|
||||||
*
|
*
|
||||||
* Used to retrieve information about the h/w composer
|
* Used to retrieve information about the h/w composer
|
||||||
*
|
*
|
||||||
@@ -380,8 +451,16 @@ typedef struct hwc_composer_device {
|
|||||||
*/
|
*/
|
||||||
int (*query)(struct hwc_composer_device* dev, int what, int* value);
|
int (*query)(struct hwc_composer_device* dev, int what, int* value);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reserved for future use. Must be NULL.
|
||||||
|
*/
|
||||||
|
void* reserved_proc[4];
|
||||||
|
|
||||||
void* reserved_proc[5];
|
/*
|
||||||
|
* This field is OPTIONAL and can be NULL.
|
||||||
|
* availability: HWC_DEVICE_API_VERSION_0_3
|
||||||
|
*/
|
||||||
|
hwc_methods_t const *methods;
|
||||||
|
|
||||||
} hwc_composer_device_t;
|
} hwc_composer_device_t;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user