Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbdcf1f4 authored by Kalle Raita's avatar Kalle Raita
Browse files

Remove GLES2Renderer dependency on config stores

Test: Builds, code search for RenderEngine::create
Change-Id: I7b5032f072d0fc468a8e0eba54035867c5bf74c4
parent 0929c097
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
@@ -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 @@ void writePPM(const char* basename, GLuint width, GLuint height) {
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 @@ GLES20RenderEngine::GLES20RenderEngine() :
    //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
+3 −2
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ class GLES20RenderEngine : public RenderEngine {
    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 @@ protected:
    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 @@ protected:
            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);
+2 −2
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ static bool findExtension(const char* exts, const char* name) {
    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 @@ RenderEngine* RenderEngine::create(EGLDisplay display, int hwcFormat) {
        break;
    case GLES_VERSION_2_0:
    case GLES_VERSION_3_0:
        engine = new GLES20RenderEngine();
        engine = new GLES20RenderEngine(featureFlags);
        break;
    }
    engine->setEGLHandles(config, ctxt);
+4 −1
Original line number Diff line number Diff line
@@ -59,7 +59,10 @@ protected:
    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);

+2 −1
Original line number Diff line number Diff line
@@ -560,7 +560,8 @@ void SurfaceFlinger::init() {

        // 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
Loading