summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/EglManager.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2017-07-11 09:48:28 -0700
committerRomain Guy <romainguy@google.com>2017-07-11 09:48:28 -0700
commit26b6a64953f29bbe6b10a5e948d11f47bd0611d6 (patch)
treea502383400a6035a38ae2321e9e65e448459e049 /libs/hwui/renderthread/EglManager.cpp
parent4e77ab6aad0cfc5c4ea57eca9c657557378aec38 (diff)
Use EGL_EXT_gl_colorspace_scrgb instead of *_linear
Since hwui output non-linear scRGB data in wide-gamut, use the scRGB-nl extension instead of scRGB. Bug: 62951776 Test: Manual, CtsGraphicsTestCases Change-Id: Ifdb288e777d12b790b93624ccea9b4f1f6966e52
Diffstat (limited to 'libs/hwui/renderthread/EglManager.cpp')
-rw-r--r--libs/hwui/renderthread/EglManager.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp
index cc791f6171a9..16d77364942e 100644
--- a/libs/hwui/renderthread/EglManager.cpp
+++ b/libs/hwui/renderthread/EglManager.cpp
@@ -79,6 +79,7 @@ static struct {
bool noConfigContext = false;
bool pixelFormatFloat = false;
bool glColorSpace = false;
+ bool scRGB = false;
} EglExtensions;
EglManager::EglManager(RenderThread& thread)
@@ -161,6 +162,11 @@ void EglManager::initExtensions() {
EglExtensions.glColorSpace = extensions.has("EGL_KHR_gl_colorspace");
EglExtensions.noConfigContext = extensions.has("EGL_KHR_no_config_context");
EglExtensions.pixelFormatFloat = extensions.has("EGL_EXT_pixel_format_float");
+#ifdef ANDROID_ENABLE_LINEAR_BLENDING
+ EglExtensions.scRGB = extensions.has("EGL_EXT_gl_colorspace_scrgb_linear");
+#else
+ EglExtensions.scRGB = extensions.has("EGL_EXT_gl_colorspace_scrgb");
+#endif
}
bool EglManager::hasEglContext() {
@@ -249,7 +255,7 @@ void EglManager::createPBufferSurface() {
EGLSurface EglManager::createSurface(EGLNativeWindowType window, bool wideColorGamut) {
initialize();
- wideColorGamut = wideColorGamut && EglExtensions.glColorSpace
+ wideColorGamut = wideColorGamut && EglExtensions.glColorSpace && EglExtensions.scRGB
&& EglExtensions.pixelFormatFloat && EglExtensions.noConfigContext;
// The color space we want to use depends on whether linear blending is turned
@@ -289,9 +295,7 @@ EGLSurface EglManager::createSurface(EGLNativeWindowType window, bool wideColorG
}
#else
if (wideColorGamut) {
- // TODO: this should be using scRGB-nl, not scRGB, we need an extension for this
- // TODO: in the meantime SurfaceFlinger just assumes that scRGB is scRGB-nl
- attribs[1] = EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT;
+ attribs[1] = EGL_GL_COLORSPACE_SCRGB_EXT;
} else {
attribs[1] = EGL_GL_COLORSPACE_LINEAR_KHR;
}