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

Commit dd6b8c19 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove GLES2Renderer dependency on config stores"

parents eae2febc bbdcf1f4
Loading
Loading
Loading
Loading
+5 −11
Original line number Original line Diff line number Diff line
@@ -40,9 +40,7 @@
#include "Mesh.h"
#include "Mesh.h"
#include "Texture.h"
#include "Texture.h"


#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
#include <sstream>
#include <configstore/Utils.h>

#include <fstream>
#include <fstream>


// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
@@ -111,8 +109,10 @@ void writePPM(const char* basename, GLuint width, GLuint height) {
namespace android {
namespace android {
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------


GLES20RenderEngine::GLES20RenderEngine() :
GLES20RenderEngine::GLES20RenderEngine(uint32_t featureFlags) :
        mVpWidth(0), mVpHeight(0) {
         mVpWidth(0),
         mVpHeight(0),
         mPlatformHasWideColor((featureFlags & WIDE_COLOR_SUPPORT) != 0) {


    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
    glGetIntegerv(GL_MAX_VIEWPORT_DIMS, mMaxViewportDims);
    glGetIntegerv(GL_MAX_VIEWPORT_DIMS, mMaxViewportDims);
@@ -133,12 +133,6 @@ GLES20RenderEngine::GLES20RenderEngine() :
    //mColorBlindnessCorrection = M;
    //mColorBlindnessCorrection = M;


#ifdef USE_HWC2
#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) {
    if (mPlatformHasWideColor) {
        // Compute sRGB to DisplayP3 color transform
        // Compute sRGB to DisplayP3 color transform
        // NOTE: For now, we are limiting wide-color support to
        // NOTE: For now, we are limiting wide-color support to
+3 −2
Original line number Original line Diff line number Diff line
@@ -59,7 +59,7 @@ class GLES20RenderEngine : public RenderEngine {
    virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName);
    virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName);


public:
public:
    GLES20RenderEngine();
    GLES20RenderEngine(uint32_t featureFlags); // See RenderEngine::FeatureFlag


protected:
protected:
    virtual ~GLES20RenderEngine();
    virtual ~GLES20RenderEngine();
@@ -86,7 +86,6 @@ protected:
    android_dataspace mDataSpace = HAL_DATASPACE_V0_SRGB;
    android_dataspace mDataSpace = HAL_DATASPACE_V0_SRGB;


    // Indicate if wide-color mode is needed or not
    // Indicate if wide-color mode is needed or not
    bool mPlatformHasWideColor = false;
    bool mDisplayHasWideColor = false;
    bool mDisplayHasWideColor = false;
    bool mUseWideColor = false;
    bool mUseWideColor = false;
    uint64_t mWideColorFrameCount = 0;
    uint64_t mWideColorFrameCount = 0;
@@ -98,6 +97,8 @@ protected:
            int alpha);
            int alpha);
    virtual void setupDimLayerBlending(int alpha);
    virtual void setupDimLayerBlending(int alpha);
#endif
#endif
    bool mPlatformHasWideColor = false;

    virtual void setupLayerTexturing(const Texture& texture);
    virtual void setupLayerTexturing(const Texture& texture);
    virtual void setupLayerBlackedOut();
    virtual void setupLayerBlackedOut();
    virtual void setupFillWithColor(float r, float g, float b, float a);
    virtual void setupFillWithColor(float r, float g, float b, float a);
+2 −2
Original line number Original line Diff line number Diff line
@@ -47,7 +47,7 @@ static bool findExtension(const char* exts, const char* name) {
    return false;
    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
    // EGL_ANDROIDX_no_config_context is an experimental extension with no
    // written specification. It will be replaced by something more formal.
    // written specification. It will be replaced by something more formal.
    // SurfaceFlinger is using it to allow a single EGLContext to render to
    // SurfaceFlinger is using it to allow a single EGLContext to render to
@@ -135,7 +135,7 @@ RenderEngine* RenderEngine::create(EGLDisplay display, int hwcFormat) {
        break;
        break;
    case GLES_VERSION_2_0:
    case GLES_VERSION_2_0:
    case GLES_VERSION_3_0:
    case GLES_VERSION_3_0:
        engine = new GLES20RenderEngine();
        engine = new GLES20RenderEngine(featureFlags);
        break;
        break;
    }
    }
    engine->setEGLHandles(config, ctxt);
    engine->setEGLHandles(config, ctxt);
+4 −1
Original line number Original line Diff line number Diff line
@@ -59,7 +59,10 @@ protected:
    virtual ~RenderEngine() = 0;
    virtual ~RenderEngine() = 0;


public:
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);
    static EGLConfig chooseEglConfig(EGLDisplay display, int format);


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


        // Get a RenderEngine for the given display / config (can't fail)
        // Get a RenderEngine for the given display / config (can't fail)
        mRenderEngine = RenderEngine::create(mEGLDisplay,
        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
    // Drop the state lock while we initialize the hardware composer. We drop
Loading