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

Commit 2ee0dda9 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: I0621f3fbd48a4e90e61154379478980f513d354f
Test: Repro steps in bug no longer repro.
Test: go/wm-smoke
parent 5e1371af
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -323,7 +323,8 @@ void BufferLayerConsumer::computeCurrentTransformMatrixLocked() {
                                       mCurrentTextureBuffer == nullptr
                                       mCurrentTextureBuffer == nullptr
                                               ? nullptr
                                               ? nullptr
                                               : mCurrentTextureBuffer->graphicBuffer(),
                                               : mCurrentTextureBuffer->graphicBuffer(),
                                       mCurrentCrop, mCurrentTransform, mFilteringEnabled);
                                       getCurrentCropLocked(), mCurrentTransform,
                                       mFilteringEnabled);
}
}


nsecs_t BufferLayerConsumer::getTimestamp() {
nsecs_t BufferLayerConsumer::getTimestamp() {
@@ -380,6 +381,10 @@ sp<GraphicBuffer> BufferLayerConsumer::getCurrentBuffer(int* outSlot, sp<Fence>*


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
@@ -253,6 +253,9 @@ private:
    // access the current texture buffer.
    // access the current texture buffer.
    status_t doFenceWaitLocked() const;
    status_t doFenceWaitLocked() const;


    // getCurrentCropLocked returns the cropping rectangle of the current buffer.
    Rect getCurrentCropLocked() const;

    // The default consumer usage flags that BufferLayerConsumer always sets on its
    // The default consumer usage flags that BufferLayerConsumer always sets on its
    // BufferQueue instance; these will be OR:d with any additional flags passed
    // BufferQueue instance; these will be OR:d with any additional flags passed
    // from the BufferLayerConsumer user. In particular, BufferLayerConsumer will always
    // from the BufferLayerConsumer user. In particular, BufferLayerConsumer will always