Remove GLES2Renderer dependency on config stores
Test: Builds, code search for RenderEngine::create
Change-Id: I7b5032f072d0fc468a8e0eba54035867c5bf74c4
diff --git a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp
index 18b2e1b..a1ee294 100644
--- a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp
+++ b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp
@@ -40,9 +40,7 @@
#include "Mesh.h"
#include "Texture.h"
-#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
-#include <configstore/Utils.h>
-
+#include <sstream>
#include <fstream>
// ---------------------------------------------------------------------------
@@ -111,8 +109,10 @@
namespace android {
// ---------------------------------------------------------------------------
-GLES20RenderEngine::GLES20RenderEngine() :
- mVpWidth(0), mVpHeight(0) {
+GLES20RenderEngine::GLES20RenderEngine(uint32_t featureFlags) :
+ mVpWidth(0),
+ mVpHeight(0),
+ mPlatformHasWideColor((featureFlags & WIDE_COLOR_SUPPORT) != 0) {
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, mMaxViewportDims);
@@ -133,12 +133,6 @@
//mColorBlindnessCorrection = M;
#ifdef USE_HWC2
- // retrieve wide-color and hdr settings from configstore
- using namespace android::hardware::configstore;
- using namespace android::hardware::configstore::V1_0;
-
- mPlatformHasWideColor =
- getBool<ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::hasWideColorDisplay>(false);
if (mPlatformHasWideColor) {
// Compute sRGB to DisplayP3 color transform
// NOTE: For now, we are limiting wide-color support to
diff --git a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h
index 19cbb60..eaf94af 100644
--- a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h
+++ b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h
@@ -59,7 +59,7 @@
virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName);
public:
- GLES20RenderEngine();
+ GLES20RenderEngine(uint32_t featureFlags); // See RenderEngine::FeatureFlag
protected:
virtual ~GLES20RenderEngine();
@@ -86,7 +86,6 @@
android_dataspace mDataSpace = HAL_DATASPACE_V0_SRGB;
// Indicate if wide-color mode is needed or not
- bool mPlatformHasWideColor = false;
bool mDisplayHasWideColor = false;
bool mUseWideColor = false;
uint64_t mWideColorFrameCount = 0;
@@ -98,6 +97,8 @@
int alpha);
virtual void setupDimLayerBlending(int alpha);
#endif
+ bool mPlatformHasWideColor = false;
+
virtual void setupLayerTexturing(const Texture& texture);
virtual void setupLayerBlackedOut();
virtual void setupFillWithColor(float r, float g, float b, float a);
diff --git a/services/surfaceflinger/RenderEngine/RenderEngine.cpp b/services/surfaceflinger/RenderEngine/RenderEngine.cpp
index f8785db..ac2d8b2 100644
--- a/services/surfaceflinger/RenderEngine/RenderEngine.cpp
+++ b/services/surfaceflinger/RenderEngine/RenderEngine.cpp
@@ -47,7 +47,7 @@
return false;
}
-RenderEngine* RenderEngine::create(EGLDisplay display, int hwcFormat) {
+RenderEngine* RenderEngine::create(EGLDisplay display, int hwcFormat, uint32_t featureFlags) {
// EGL_ANDROIDX_no_config_context is an experimental extension with no
// written specification. It will be replaced by something more formal.
// SurfaceFlinger is using it to allow a single EGLContext to render to
@@ -135,7 +135,7 @@
break;
case GLES_VERSION_2_0:
case GLES_VERSION_3_0:
- engine = new GLES20RenderEngine();
+ engine = new GLES20RenderEngine(featureFlags);
break;
}
engine->setEGLHandles(config, ctxt);
diff --git a/services/surfaceflinger/RenderEngine/RenderEngine.h b/services/surfaceflinger/RenderEngine/RenderEngine.h
index 8b031bc..56f5827 100644
--- a/services/surfaceflinger/RenderEngine/RenderEngine.h
+++ b/services/surfaceflinger/RenderEngine/RenderEngine.h
@@ -59,7 +59,10 @@
virtual ~RenderEngine() = 0;
public:
- static RenderEngine* create(EGLDisplay display, int hwcFormat);
+ enum FeatureFlag {
+ WIDE_COLOR_SUPPORT = 1 << 0 // Platform has a wide color display
+ };
+ static RenderEngine* create(EGLDisplay display, int hwcFormat, uint32_t featureFlags);
static EGLConfig chooseEglConfig(EGLDisplay display, int format);
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 12afdf7..7392006 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -560,7 +560,8 @@
// Get a RenderEngine for the given display / config (can't fail)
mRenderEngine = RenderEngine::create(mEGLDisplay,
- HAL_PIXEL_FORMAT_RGBA_8888);
+ HAL_PIXEL_FORMAT_RGBA_8888,
+ hasWideColorDisplay ? RenderEngine::WIDE_COLOR_SUPPORT : 0);
}
// Drop the state lock while we initialize the hardware composer. We drop
diff --git a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
index f6ee660..0b3a0d0 100644
--- a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
+++ b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
@@ -536,7 +536,8 @@
*static_cast<HWComposer::EventHandler *>(this));
// get a RenderEngine for the given display / config (can't fail)
- mRenderEngine = RenderEngine::create(mEGLDisplay, mHwc->getVisualID());
+ mRenderEngine = RenderEngine::create(mEGLDisplay,
+ mHwc->getVisualID(), 0);
// retrieve the EGL context that was selected/created
mEGLContext = mRenderEngine->getEGLContext();