Android 8.1 adds support for color management that can be used to provide a
consistent experience across display technologies. Applications running on
Android 8.1 can access the full capabilities of a wide gamut display to get the
most out of a display device.
Previous Android releases did not include color management support and
instead relied on content and displays being compatible (a goal often aided by
the TV industry). However, recent display technologies allow for much larger
gamut displays that do not display existing content as expected. With Android
8.1, devices that use a wide-gamut display (e.g. active-matrix organic
light-emitting diode or AMOLED, some LCDs) will be able to see wide-gamut
content from applications.
Determining device support
Devices with wide-color displays running Android 8.1 should support color
management (wide-color). Before enabling this feature, ensure the device meets
the following requirements:
Device display meets the hardware requirements, which include a
well-characterized display that supports the Display-P3 colorspace. If the
display does not meet this requirement, do not enable color management. To
reduce CPU and GPU impact, support for extended sRGB and HDR10 in the display
pipeline is desirable.
Device supports a factory calibration process that generates calibration
data (stored on the device) to adjust for manufacturing variance in display
behavior. At a minimum, calibration data should allow the display to accurately
display sRGB content and D65 and D73 white points (future versions of Android
may support full ICC profiles for each device).
If the above requirements are met, you can enable the color management
feature for the device.
Implementing color management
To implement color management, you must first update the
Hardware Composer 2 (HWC2) driver
to understand color modes and to apply those modes to the hardware.
Specifically, the HWC2 composer must report the Display-P3 and sRGB
color modes using HWCDisplay::GetColorModes.
Next, enable the necessary OpenGL extensions and library support to
translate OpenGL color spaces to HAL data spaces. Required OpenGL extensions
include:
EGL_EXT_pixel_format_float.
Allows applications to create presentable EGLSurface(s) with 16-bit float color
components. Priority: high (expect this is the default pixel format for
wide-color aware applications). Requires driver support.
EGL_KHR_gl_colorspace.
For applications that want to use sRGB format default framebuffers to more
easily achieve sRGB rendering to display devices, this extension allows creating
EGLSurfaces that will be rendered to in sRGB by OpenGL contexts supporting that
capability. Requires driver support for sRGB behavior.
Android also provides the following optional extensions:
EGL_EXT_colorspace_scrgb_linear.
This extension provides a new color space option, scRGB, for applications to
choose when creating an EGLSurface. The scRGB color space defines a linear
display referred space with the same white point and color primaries as sRGB
(and thus is backward-compatible with sRGB). This should not require driver
support and can be implemented in the Android EGL wrapper. To be useful, this
extension requires support for 16-bit floating point (FP16).
EGL_KHR_gl_colorspace_display_p3
and EGL_EXT_gl_colorspace_display_p3_linear. For applications that want
to use Display-P3 format default framebuffers to more easily achieve sRGB
rendering to display devices, this extension allows creating EGLSurfaces that
will be rendered to in Display-P3 by OpenGL contexts supporting that capability.
This can be implemented in EGL driver wrapper.
VK_EXT_swapchain_colorspace
(Vulkan). Enables applications to tag swap chains with the color space they are
using. Includes a number of common color spaces such as DCI-P3, Display-P3,
AdobeRGB, BT2020, etc.
Customizing
You can customize the color management feature by including support for a
variety of color standards such as DCI-P3, AdobeRGB, Rec709, Rec2020. Other
customizations include:
Hardware support for color conversion in the display
pipeline. Enables support for multiple color transforms in hardware.
Support for independent color transform on multiple layers
(e.g. some layers could be sRGB and others extended-sRGB, each with their own
color pipeline). When there is more than one color space visible, some color
spaces will need to be converted to the color space of the display. Ideally,
this transform is best provided by the display engine (otherwise Android must
perform GPU composition).
Testing
To test color management, use the following resources in
opengl/tests:
gl2_basic. Simple OpenGL demo that requests a Display-P3
colorspace.
EGL_test.
Tests for necessary extension and config support (10:10:10:2 and FP16).
test_wide_color. Creates surface in same manner as
SurfaceFlinger (e.g. config, color space, pixel format).
Reference implementation
For a reference implementation, refer to frameworks/native. For
headers, refer to: