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

Commit ef7855c5 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "surfaceflinger: Enable dithering if persist.sys.use_dithering=1" into ics

parents f1dc3c9d 7b3c3b4a
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -182,10 +182,14 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h,
    mSurfaceTexture->setDefaultBufferSize(w, h);
    mSurfaceTexture->setDefaultBufferSize(w, h);
    mSurfaceTexture->setDefaultBufferFormat(format);
    mSurfaceTexture->setDefaultBufferFormat(format);


    if (mFlinger->getUseDithering()) {
        // we use the red index
        // we use the red index
        int displayRedSize = displayInfo.getSize(PixelFormatInfo::INDEX_RED);
        int displayRedSize = displayInfo.getSize(PixelFormatInfo::INDEX_RED);
        int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED);
        int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED);
        mNeedsDithering = layerRedsize > displayRedSize;
        mNeedsDithering = layerRedsize > displayRedSize;
    } else {
        mNeedsDithering = false;
    }


    return NO_ERROR;
    return NO_ERROR;
}
}
+13 −0
Original line number Original line Diff line number Diff line
@@ -406,6 +406,7 @@ void LayerBase::clearWithOpenGL(const Region& clip, GLclampf red,
    glDisable(GL_TEXTURE_EXTERNAL_OES);
    glDisable(GL_TEXTURE_EXTERNAL_OES);
    glDisable(GL_TEXTURE_2D);
    glDisable(GL_TEXTURE_2D);
    glDisable(GL_BLEND);
    glDisable(GL_BLEND);
    glDisable(GL_DITHER);


    Region::const_iterator it = clip.begin();
    Region::const_iterator it = clip.begin();
    Region::const_iterator const end = clip.end();
    Region::const_iterator const end = clip.end();
@@ -467,6 +468,12 @@ void LayerBase::drawWithOpenGL(const Region& clip) const
    texCoords[3].u = 1;
    texCoords[3].u = 1;
    texCoords[3].v = 1;
    texCoords[3].v = 1;


    if (needsDithering()) {
        glEnable(GL_DITHER);
    } else {
        glDisable(GL_DITHER);
    }

    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glVertexPointer(2, GL_FLOAT, 0, mVertices);
    glVertexPointer(2, GL_FLOAT, 0, mVertices);
    glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
    glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
@@ -530,6 +537,12 @@ void LayerBase::drawS3DUIWithOpenGL(const Region& clip) const
    texCoords[3].u = 1;
    texCoords[3].u = 1;
    texCoords[3].v = 1;
    texCoords[3].v = 1;


    if (needsDithering()) {
        glEnable(GL_DITHER);
    } else {
        glDisable(GL_DITHER);
    }

    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);


    Region::const_iterator it = clip.begin();
    Region::const_iterator it = clip.begin();
+7 −1
Original line number Original line Diff line number Diff line
@@ -112,7 +112,8 @@ SurfaceFlinger::SurfaceFlinger()
        mCanSkipComposition(false),
        mCanSkipComposition(false),
#endif
#endif
        mConsoleSignals(0),
        mConsoleSignals(0),
        mSecureFrameBuffer(0)
        mSecureFrameBuffer(0),
        mUseDithering(false)
{
{
    init();
    init();
}
}
@@ -132,6 +133,10 @@ void SurfaceFlinger::init()


    property_get("debug.sf.ddms", value, "0");
    property_get("debug.sf.ddms", value, "0");
    mDebugDDMS = atoi(value);
    mDebugDDMS = atoi(value);

    property_get("persist.sys.use_dithering", value, "0");
    mUseDithering = atoi(value) == 1;

    if (mDebugDDMS) {
    if (mDebugDDMS) {
        DdmConnection::start(getServiceName());
        DdmConnection::start(getServiceName());
    }
    }
@@ -139,6 +144,7 @@ void SurfaceFlinger::init()
    LOGI_IF(mDebugRegion,       "showupdates enabled");
    LOGI_IF(mDebugRegion,       "showupdates enabled");
    LOGI_IF(mDebugBackground,   "showbackground enabled");
    LOGI_IF(mDebugBackground,   "showbackground enabled");
    LOGI_IF(mDebugDDMS,         "DDMS debugging enabled");
    LOGI_IF(mDebugDDMS,         "DDMS debugging enabled");
    LOGI_IF(mUseDithering,      "use dithering");
}
}


SurfaceFlinger::~SurfaceFlinger()
SurfaceFlinger::~SurfaceFlinger()
+4 −0
Original line number Original line Diff line number Diff line
@@ -221,6 +221,8 @@ public:


    GLuint getProtectedTexName() const { return mProtectedTexName; }
    GLuint getProtectedTexName() const { return mProtectedTexName; }


    inline int  getUseDithering() const { return mUseDithering; }



    class MessageDestroyGLTexture : public MessageBase {
    class MessageDestroyGLTexture : public MessageBase {
        GLuint texture;
        GLuint texture;
@@ -442,6 +444,8 @@ private:


   // only written in the main thread, only read in other threads
   // only written in the main thread, only read in other threads
   volatile     int32_t                     mSecureFrameBuffer;
   volatile     int32_t                     mSecureFrameBuffer;

                bool                        mUseDithering;
};
};


// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------