Starting in Android 13, the Hardware Composer (HWC) HAL
is defined in AIDL. The HIDL versions ranging from
android.hardware.graphics.composer@2.1 to
android.hardware.graphics.composer@2.4 are deprecated.
This page describes the differences between the AIDL and HIDL HALs for the HWC, and how to implement and test the AIDL HAL.
Because AIDL offers advantages, vendors can implement the AIDL composer HAL starting in Android 13 instead of the HIDL version. For more information, see the Implementation section.
Differences between AIDL and HIDL HALs
The new AIDL composer HAL, named android.hardware.graphics.composer3, is
defined in IComposer.aidl. The API is similar to the HIDL HAL
android.hardware.graphics.composer@2.4, but includes the following changes:
Removal of the Fast Message Queue (FMQ) in favor of parcelable commands.
The AIDL HAL defines the command interface based on strongly typed parcelable types instead of the serialized commands over FMQ in HIDL. This provides a stable interface for commands and a more readable definition of how the system interprets the command payload.
The
executeCommands5 method is defined inIComposerClient.aidl:CommandResultPayload[] executeCommands(in DisplayCommand[] commands);Each command is a strongly typed parcelable type defined in
DisplayCommand.aidl. Command responses are strongly typed parcelables defined inCommandResultPayload.aidl.Removal of
IComposerClient.getClientTargetSupportbecause no active clients use this method.Representation of colors as floats instead of bytes to align with the upper graphics stack in Android, as defined by
ASurfaceTransaction_setColor.Addition of new fields for controlling HDR content.
In the AIDL HAL, mixed SDR/HDR layer stacks support the seamless dimming of SDR layers when an HDR layer is on screen at the same time.
The
brightnessfield inLayerCommandlets SurfaceFlinger specify a per-layer brightness. This enables the HWC to dim the layer's content in linear light space instead of gamma space.The
brightnessfield inClientTargetPropertyWithBrightnesslets the HWC specify the brightness space for client composition and instructsRenderEnginewhether to dim SDR layers in client composition.The
dimmingStagefield lets the HWC configure whenRenderEnginedims content. This accommodates vendor-definedColorModesthat might prefer to dim in gamma space to enable vendor-defined contrast enhancements in their color pipelines.Addition of a composition type,
DISPLAY_DECORATION, inComposition.aidlfor screen decorations.Some devices have dedicated hardware to optimize the drawing of the alpha mask that smooths rounded corners and cutouts on displays. Devices with such hardware must implement
IComposerClient.getDisplayDecorationSupportand return aDisplayDecorationSupportstructure as defined inDisplayDecorationSupport.aidl. This structure describes thePixelFormatandAlphaInterpretationenums required by the device. After this implementation, System UI marks the alpha mask layer asDISPLAY_DECORATION, a composition type that takes advantage of the dedicated hardware.Addition of an
expectedPresentTimefield toDisplayCommand.aidl.The
expectedPresentTimefield lets SurfaceFlinger set the expected present time for when the current content must be displayed on screen. With this feature, SurfaceFlinger sends a present command to the implementation ahead of time, which allows it to pipeline more of the composition work.Addition of new APIs to control boot display configuration.
Using
BOOT_DISPLAY_CONFIG, vendors can specify that the boot display configuration is supported. ThesetBootDisplayConfig,clearBootDisplayConfig, andgetPreferredBootDisplayConfigmethods useBOOT_DISPLAY_CONFIGas follows:Using
setBootDisplayConfig, the framework informs vendors of the boot time display configuration. Vendors must cache in the boot display configuration, and boot in this config on next reboot. If the device is unable to boot in this config, the vendor must find a config that matches the resolution and refresh rate of this config. If no such config exists, the vendor must use their preferred display config.Using
clearBootDisplayConfig, the framework informs the vendors to clear the boot display configuration, and boot in their preferred display config during the next reboot.Using
getPreferredBootDisplayConfig, the framework queries the vendor's preferred boot mode.
When the boot display configuration isn't supported, these methods return a value of
UNSUPPORTED.Addition of new APIs to control the display idle timer:
Using
DISPLAY_IDLE_TIMER, vendors can specify that an inactivity timer is implemented by the vendor for this display. When idle, this capability changes the refresh rate to a lower setting to preserve power. The platform usessetIdleTimerEnabledto control the timeout of the timer, and in some cases, to disable it in order to prevent undesired refresh rate switches when idle.Using the
IComposerCallback.onVsyncIdlecallback indicates to the platform that the display is idle and thevsynccadence has changed. The platform responds to this callback by resetting itsvsyncmodel. It forces avsyncresync on the next frame, and learns the newvsynccadence.
Implementation
Vendors aren't required to implement the AIDL HAL for Android 13. However, vendors are encouraged to implement the AIDL composer HAL instead of the HIDL version to use the functionality and APIs of the AIDL composer HAL.
Android emulators include a reference implementation for the AIDL HWC HAL.
Testing
To test your implementation, run VtsHalGraphicsComposer3_TargetTest.