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

Commit eaa60d31 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge "Make sure to use filtering while in fixed-size mode" into kraken

parents 5260f23b a7f66925
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -209,6 +209,19 @@ void Layer::onDraw(const Region& clip) const
    drawWithOpenGL(clip, tex);
    drawWithOpenGL(clip, tex);
}
}


bool Layer::needsFiltering() const
{
    if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
        // NOTE: there is a race here, because mFixedSize is updated in a
        // binder transaction. however, it doesn't really matter since it is
        // evaluated each time we draw. To be perfectly correct, this flag
        // would have to be associated with a buffer.
        if (mFixedSize)
            return true;
    }
    return LayerBase::needsFiltering();
}



status_t Layer::setBufferCount(int bufferCount)
status_t Layer::setBufferCount(int bufferCount)
{
{
+1 −0
Original line number Original line Diff line number Diff line
@@ -67,6 +67,7 @@ public:
    virtual void finishPageFlip();
    virtual void finishPageFlip();
    virtual bool needsBlending() const      { return mNeedsBlending; }
    virtual bool needsBlending() const      { return mNeedsBlending; }
    virtual bool needsDithering() const     { return mNeedsDithering; }
    virtual bool needsDithering() const     { return mNeedsDithering; }
    virtual bool needsFiltering() const;
    virtual bool isSecure() const           { return mSecure; }
    virtual bool isSecure() const           { return mSecure; }
    virtual sp<Surface> createSurface() const;
    virtual sp<Surface> createSurface() const;
    virtual status_t ditch();
    virtual status_t ditch();
+4 −5
Original line number Original line Diff line number Diff line
@@ -43,7 +43,7 @@ LayerBase::LayerBase(SurfaceFlinger* flinger, DisplayID display)
    : dpy(display), contentDirty(false),
    : dpy(display), contentDirty(false),
      mFlinger(flinger),
      mFlinger(flinger),
      mTransformed(false),
      mTransformed(false),
      mUseLinearFiltering(false),
      mNeedsFiltering(false),
      mOrientation(0),
      mOrientation(0),
      mLeft(0), mTop(0),
      mLeft(0), mTop(0),
      mTransactionFlags(0),
      mTransactionFlags(0),
@@ -214,13 +214,12 @@ uint32_t LayerBase::doTransaction(uint32_t flags)
        flags |= eVisibleRegion;
        flags |= eVisibleRegion;
        this->contentDirty = true;
        this->contentDirty = true;


        const bool linearFiltering = mUseLinearFiltering;
        mNeedsFiltering = false;
        mUseLinearFiltering = false;
        if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
        if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
            // we may use linear filtering, if the matrix scales us
            // we may use linear filtering, if the matrix scales us
            const uint8_t type = temp.transform.getType();
            const uint8_t type = temp.transform.getType();
            if (!temp.transform.preserveRects() || (type >= Transform::SCALE)) {
            if (!temp.transform.preserveRects() || (type >= Transform::SCALE)) {
                mUseLinearFiltering = true;
                mNeedsFiltering = true;
            }
            }
        }
        }
    }
    }
@@ -466,7 +465,7 @@ void LayerBase::validateTexture(GLint textureName) const
    glBindTexture(GL_TEXTURE_2D, textureName);
    glBindTexture(GL_TEXTURE_2D, textureName);
    // TODO: reload the texture if needed
    // TODO: reload the texture if needed
    // this is currently done in loadTexture() below
    // this is currently done in loadTexture() below
    if (mUseLinearFiltering) {
    if (needsFiltering()) {
        glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    } else {
    } else {
+6 −1
Original line number Original line Diff line number Diff line
@@ -176,6 +176,11 @@ public:
     */
     */
    virtual bool needsDithering() const { return false; }
    virtual bool needsDithering() const { return false; }


    /**
     * needsLinearFiltering - true if this surface needs filtering
     */
    virtual bool needsFiltering() const { return mNeedsFiltering; }

    /**
    /**
     * transformed -- true is this surface needs a to be transformed
     * transformed -- true is this surface needs a to be transformed
     */
     */
@@ -232,7 +237,7 @@ protected:


                // cached during validateVisibility()
                // cached during validateVisibility()
                bool            mTransformed;
                bool            mTransformed;
                bool            mUseLinearFiltering;
                bool            mNeedsFiltering;
                int32_t         mOrientation;
                int32_t         mOrientation;
                GLfloat         mVertices[4][2];
                GLfloat         mVertices[4][2];
                Rect            mTransformedBounds;
                Rect            mTransformedBounds;
+2 −2
Original line number Original line Diff line number Diff line
@@ -118,7 +118,7 @@ uint32_t LayerBuffer::doTransaction(uint32_t flags)
        source->onTransaction(flags);
        source->onTransaction(flags);
    uint32_t res = LayerBase::doTransaction(flags);
    uint32_t res = LayerBase::doTransaction(flags);
    // we always want filtering for these surfaces
    // we always want filtering for these surfaces
    mUseLinearFiltering = !(mFlags & DisplayHardware::SLOW_CONFIG);
    mNeedsFiltering = !(mFlags & DisplayHardware::SLOW_CONFIG);
    return res;
    return res;
}
}


@@ -542,7 +542,7 @@ status_t LayerBuffer::BufferSource::initTempBuffer() const
    // figure out if we need linear filtering
    // figure out if we need linear filtering
    if (buffers.w * h == buffers.h * w) {
    if (buffers.w * h == buffers.h * w) {
        // same pixel area, don't use filtering
        // same pixel area, don't use filtering
        mLayer.mUseLinearFiltering = false;
        mLayer.mNeedsFiltering = false;
    }
    }


    // Allocate a temporary buffer and create the corresponding EGLImageKHR
    // Allocate a temporary buffer and create the corresponding EGLImageKHR