#include "Mesh.h"
#include "Texture.h"
-#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
-#include <configstore/Utils.h>
-
+#include <sstream>
#include <fstream>
// ---------------------------------------------------------------------------
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);
//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
virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName);
public:
- GLES20RenderEngine();
+ GLES20RenderEngine(uint32_t featureFlags); // See RenderEngine::FeatureFlag
protected:
virtual ~GLES20RenderEngine();
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;
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);
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
break;
case GLES_VERSION_2_0:
case GLES_VERSION_3_0:
- engine = new GLES20RenderEngine();
+ engine = new GLES20RenderEngine(featureFlags);
break;
}
engine->setEGLHandles(config, ctxt);
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);
// 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
*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();