hwcomposer: Allow display configuration selection

Adds two functions to the HWC interface: one for querying the current
display configuration, and one for setting a new configuration. This
will enable DisplayManager to change the mode on demand.

Bug: 14320401
Change-Id: I556c509192b877b38b2103a78f937b3687f35546
This commit is contained in:
Dan Stoza
2014-05-06 15:56:59 -07:00
committed by Michael Lentine
parent 549e6be33d
commit e83d10c1fc
2 changed files with 56 additions and 11 deletions

View File

@@ -678,16 +678,24 @@ typedef struct hwc_composer_device_1 {
* total number of configurations available for the display is returned in * total number of configurations available for the display is returned in
* *numConfigs. If *numConfigs is zero on entry, then configs may be NULL. * *numConfigs. If *numConfigs is zero on entry, then configs may be NULL.
* *
* HWC_DEVICE_API_VERSION_1_1 does not provide a way to choose a config. * Hardware composers implementing HWC_DEVICE_API_VERSION_1_3 or prior
* For displays that support multiple configurations, the h/w composer * shall choose one configuration to activate and report it as the first
* implementation should choose one and report it as the first config in * entry in the returned list. Reporting the inactive configurations is not
* the list. Reporting the not-chosen configs is not required. * required.
* *
* Returns 0 on success or -errno on error. If disp is a hotpluggable * HWC_DEVICE_API_VERSION_1_4 and later provide configuration management
* display type and no display is connected, an error should be returned. * through SurfaceFlinger, and hardware composers implementing these APIs
* must also provide getActiveConfig and setActiveConfig. Hardware composers
* implementing these API versions may choose not to activate any
* configuration, leaving configuration selection to higher levels of the
* framework.
*
* Returns 0 on success or a negative error code on error. If disp is a
* hotpluggable display type and no display is connected, an error shall be
* returned.
* *
* This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later. * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later.
* It should be NULL for previous versions. * It shall be NULL for previous versions.
*/ */
int (*getDisplayConfigs)(struct hwc_composer_device_1* dev, int disp, int (*getDisplayConfigs)(struct hwc_composer_device_1* dev, int disp,
uint32_t* configs, size_t* numConfigs); uint32_t* configs, size_t* numConfigs);
@@ -704,19 +712,54 @@ typedef struct hwc_composer_device_1 {
* array will have one less value than the attributes array. * array will have one less value than the attributes array.
* *
* This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later. * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later.
* It should be NULL for previous versions. * It shall be NULL for previous versions.
* *
* If disp is a hotpluggable display type and no display is connected, * If disp is a hotpluggable display type and no display is connected,
* or if config is not a valid configuration for the display, a negative * or if config is not a valid configuration for the display, a negative
* value should be returned. * error code shall be returned.
*/ */
int (*getDisplayAttributes)(struct hwc_composer_device_1* dev, int disp, int (*getDisplayAttributes)(struct hwc_composer_device_1* dev, int disp,
uint32_t config, const uint32_t* attributes, int32_t* values); uint32_t config, const uint32_t* attributes, int32_t* values);
/*
* (*getActiveConfig)() returns the index of the configuration that is
* currently active on the connected display. The index is relative to
* the list of configuration handles returned by getDisplayConfigs. If there
* is no active configuration, -1 shall be returned.
*
* Returns the configuration index on success or -1 on error.
*
* This field is REQUIRED for HWC_DEVICE_API_VERSION_1_4 and later.
* It shall be NULL for previous versions.
*/
int (*getActiveConfig)(struct hwc_composer_device_1* dev, int disp);
/*
* (*setActiveConfig)() instructs the hardware composer to switch to the
* display configuration at the given index in the list of configuration
* handles returned by getDisplayConfigs.
*
* If this function returns without error, any subsequent calls to
* getActiveConfig shall return the index set by this function until one
* of the following occurs:
* 1) Another successful call of this function
* 2) The display is disconnected
*
* Returns 0 on success or a negative error code on error. If disp is a
* hotpluggable display type and no display is connected, or if index is
* outside of the range of hardware configurations returned by
* getDisplayConfigs, an error shall be returned.
*
* This field is REQUIRED for HWC_DEVICE_API_VERSION_1_4 and later.
* It shall be NULL for previous versions.
*/
int (*setActiveConfig)(struct hwc_composer_device_1* dev, int disp,
int index);
/* /*
* Reserved for future use. Must be NULL. * Reserved for future use. Must be NULL.
*/ */
void* reserved_proc[4]; void* reserved_proc[2];
} hwc_composer_device_1_t; } hwc_composer_device_1_t;

View File

@@ -167,7 +167,9 @@ void CheckOffsets(void) {
CHECK_MEMBER_AT(hwc_composer_device_1_t, dump, 88, 168); CHECK_MEMBER_AT(hwc_composer_device_1_t, dump, 88, 168);
CHECK_MEMBER_AT(hwc_composer_device_1_t, getDisplayConfigs, 92, 176); CHECK_MEMBER_AT(hwc_composer_device_1_t, getDisplayConfigs, 92, 176);
CHECK_MEMBER_AT(hwc_composer_device_1_t, getDisplayAttributes, 96, 184); CHECK_MEMBER_AT(hwc_composer_device_1_t, getDisplayAttributes, 96, 184);
CHECK_MEMBER_AT(hwc_composer_device_1_t, reserved_proc, 100, 192); CHECK_MEMBER_AT(hwc_composer_device_1_t, getActiveConfig, 100, 192);
CHECK_MEMBER_AT(hwc_composer_device_1_t, setActiveConfig, 104, 200);
CHECK_MEMBER_AT(hwc_composer_device_1_t, reserved_proc, 108, 208);
//Types defined in gralloc.h //Types defined in gralloc.h
CHECK_MEMBER_AT(gralloc_module_t, common, 0, 0); CHECK_MEMBER_AT(gralloc_module_t, common, 0, 0);