diff options
author | Peiyong Lin <lpy@google.com> | 2018-09-10 16:28:08 -0700 |
---|---|---|
committer | Peiyong Lin <lpy@google.com> | 2018-09-13 13:50:27 -0700 |
commit | 1f6aa122a59a1de79531da045cbc6d517255623d (patch) | |
tree | bd8129b0c9c8d119b2ffea265a3042b3e7cef4a4 /libs/hwui/DeviceInfo.cpp | |
parent | 7ee06167def672bf961d023fc281878400bf8806 (diff) |
[HWUI] Implement legacy color mode.
Previously, HWUI always produces SRGB buffers. We introduced new APIs for
SurfaceFlinger, a.k.a. the composer service to return to composition preference
for data space, and pixel format. This patch makes HWUI query composition
preference from composer service, and creates the corresponding EGL surface
with the correct attributes.
In legacy mode, HWUI will take the pixel value from source color space, and
interpret it as pixel value in destination color space.
BUG: 111436479
BUG: 113530681
Test: Build, flash, boot and check dumpsys SurfaceFlinger
Change-Id: I64562d5ea6f653076c8b448feb56b5e0624bc81c
Diffstat (limited to 'libs/hwui/DeviceInfo.cpp')
-rw-r--r-- | libs/hwui/DeviceInfo.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/hwui/DeviceInfo.cpp b/libs/hwui/DeviceInfo.cpp index a43f58cd1e56..b5b87d516ff7 100644 --- a/libs/hwui/DeviceInfo.cpp +++ b/libs/hwui/DeviceInfo.cpp @@ -66,12 +66,16 @@ void DeviceInfo::initialize(int maxTextureSize) { sDeviceInfo = new DeviceInfo(); sDeviceInfo->mDisplayInfo = DeviceInfo::queryDisplayInfo(); sDeviceInfo->mMaxTextureSize = maxTextureSize; + sDeviceInfo->queryCompositionPreference(&sDeviceInfo->mTargetDataSpace, + &sDeviceInfo->mTargetPixelFormat); }); } void DeviceInfo::load() { mDisplayInfo = queryDisplayInfo(); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); + sDeviceInfo->queryCompositionPreference(&sDeviceInfo->mTargetDataSpace, + &sDeviceInfo->mTargetPixelFormat); } DisplayInfo DeviceInfo::queryDisplayInfo() { @@ -86,5 +90,17 @@ DisplayInfo DeviceInfo::queryDisplayInfo() { return displayInfo; } +void DeviceInfo::queryCompositionPreference(ui::Dataspace* dataSpace, + ui::PixelFormat* pixelFormat) { + if (Properties::isolatedProcess) { + *dataSpace = ui::Dataspace::V0_SRGB; + *pixelFormat = ui::PixelFormat::RGBA_8888; + } + + status_t status = + SurfaceComposerClient::getCompositionPreference(dataSpace, pixelFormat); + LOG_ALWAYS_FATAL_IF(status, "Failed to get composition preference, error %d", status); +} + } /* namespace uirenderer */ } /* namespace android */ |