[HWUI] Remove hardcoding around wide color gamut.
Previously we hardcode wide color gamut in HWUI as scRGB color space with FP16
pixel format. However, the hardware composer doesn't support this combination.
This patch plumbs wide color gamut composition preference from composer API to
HWUI such that HWUI can now pick the combination of color space and pixel
format for the surface.
BUG: 111436479
Test: Build, flash and boot, verify with a demo app.
Change-Id: I7a8b4d8deca72ef40069dba9d23a3f5e90dbfe5a
diff --git a/libs/hwui/renderthread/EglManager.h b/libs/hwui/renderthread/EglManager.h
index 2a44f7e..4dd9096 100644
--- a/libs/hwui/renderthread/EglManager.h
+++ b/libs/hwui/renderthread/EglManager.h
@@ -48,7 +48,8 @@
bool hasEglContext();
- Result<EGLSurface, EGLint> createSurface(EGLNativeWindowType window, ColorMode colorMode);
+ Result<EGLSurface, EGLint> createSurface(EGLNativeWindowType window, ColorMode colorMode,
+ SkColorSpace::Gamut colorGamut);
void destroySurface(EGLSurface surface);
void destroy();
@@ -80,6 +81,14 @@
status_t createReleaseFence(bool useFenceSync, EGLSyncKHR* eglFence, sp<Fence>& nativeFence);
private:
+ enum class SwapBehavior {
+ Discard,
+ Preserved,
+ BufferAge,
+ };
+
+ static EGLConfig load8BitsConfig(EGLDisplay display, SwapBehavior swapBehavior);
+ static EGLConfig loadFP16Config(EGLDisplay display, SwapBehavior swapBehavior);
void initExtensions();
void createPBufferSurface();
@@ -93,12 +102,7 @@
EGLContext mEglContext;
EGLSurface mPBufferSurface;
EGLSurface mCurrentSurface;
-
- enum class SwapBehavior {
- Discard,
- Preserved,
- BufferAge,
- };
+ bool mHasWideColorGamutSupport;
SwapBehavior mSwapBehavior = SwapBehavior::Discard;
};