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

Commit bc566da9 authored by Alec Mouri's avatar Alec Mouri
Browse files

Respect crop scaling mode for texture transforms in BufferLayerConsumer

HWC is given the scaled down crop if
NATIVE_WINDOW_SCALING_MODE_SCALE_CROP is the current scaling mode. The
GL path should be given the same crop.

Bug: 122171389
Change-Id: I29932a2cf71bb31ee0f78452ca7b00d5b1834e0c
Merged-In: I0621f3fbd48a4e90e61154379478980f513d354f
Test: Repro steps in bug no longer repro
parent c1ad9fb6
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -435,7 +435,9 @@ void BufferLayerConsumer::computeCurrentTransformMatrixLocked() {
        BLC_LOGD("computeCurrentTransformMatrixLocked: "
        BLC_LOGD("computeCurrentTransformMatrixLocked: "
                 "mCurrentTextureImage is nullptr");
                 "mCurrentTextureImage is nullptr");
    }
    }
    const Rect& cropRect = canUseImageCrop(mCurrentCrop) ? Rect::EMPTY_RECT : mCurrentCrop;

    const Rect& currentCrop = getCurrentCropLocked();
    const Rect& cropRect = canUseImageCrop(currentCrop) ? Rect::EMPTY_RECT : currentCrop;
    GLConsumer::computeTransformMatrix(mCurrentTransformMatrix, buf, cropRect, mCurrentTransform,
    GLConsumer::computeTransformMatrix(mCurrentTransformMatrix, buf, cropRect, mCurrentTransform,
                                       mFilteringEnabled);
                                       mFilteringEnabled);
}
}
@@ -490,6 +492,10 @@ sp<GraphicBuffer> BufferLayerConsumer::getCurrentBuffer(int* outSlot) const {


Rect BufferLayerConsumer::getCurrentCrop() const {
Rect BufferLayerConsumer::getCurrentCrop() const {
    Mutex::Autolock lock(mMutex);
    Mutex::Autolock lock(mMutex);
    return getCurrentCropLocked();
}

Rect BufferLayerConsumer::getCurrentCropLocked() const {
    return (mCurrentScalingMode == NATIVE_WINDOW_SCALING_MODE_SCALE_CROP)
    return (mCurrentScalingMode == NATIVE_WINDOW_SCALING_MODE_SCALE_CROP)
            ? GLConsumer::scaleDownCrop(mCurrentCrop, mDefaultWidth, mDefaultHeight)
            ? GLConsumer::scaleDownCrop(mCurrentCrop, mDefaultWidth, mDefaultHeight)
            : mCurrentCrop;
            : mCurrentCrop;
+3 −0
Original line number Original line Diff line number Diff line
@@ -274,6 +274,9 @@ private:
    // mCurrentTextureImage must not be nullptr.
    // mCurrentTextureImage must not be nullptr.
    void computeCurrentTransformMatrixLocked();
    void computeCurrentTransformMatrixLocked();


    // See getCurrentCrop, but with mMutex already held.
    Rect getCurrentCropLocked() const;

    // doFenceWaitLocked inserts a wait command into the RenderEngine command
    // doFenceWaitLocked inserts a wait command into the RenderEngine command
    // stream to ensure that it is safe for future RenderEngine commands to
    // stream to ensure that it is safe for future RenderEngine commands to
    // access the current texture buffer.
    // access the current texture buffer.