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

Commit 57c41405 authored by Jeykumar Sankaran's avatar Jeykumar Sankaran Committed by Steve Kondik
Browse files

frameworks/native: Propagate dirty region in hwc_layer

This change propagates dirty rect value of each layer down to HWC
in hwc_layer structure.

Change-Id: I91d87facf4a321b92539de5353faf09b553d4919
parent 2aa1da58
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -172,6 +172,11 @@ public:
    // getCurrentCrop returns the cropping rectangle of the current buffer.
    Rect getCurrentCrop() const;

#ifdef QCOM_BSP
    // getDirtyRegion returns the dirty rect associated with the current buffer.
    Rect getCurrentDirtyRect() const;
#endif

    // getCurrentTransform returns the transform of the current buffer.
    uint32_t getCurrentTransform() const;

@@ -324,6 +329,12 @@ private:
    // It gets set each time updateTexImage is called.
    Rect mCurrentCrop;

#ifdef QCOM_BSP
    //mCurrentDirtyRect is the dirty rectangle associated with the current
    //buffer.
    Rect mCurrentDirtyRect;
#endif

    // mCurrentTransform is the transform identifier for the current texture. It
    // gets set each time updateTexImage is called.
    uint32_t mCurrentTransform;
+5 −0
Original line number Diff line number Diff line
@@ -62,6 +62,11 @@ public:
        // mCrop is the current crop rectangle for this buffer slot.
        Rect mCrop;

#ifdef QCOM_BSP
        // mDirtyRect is the dirty rectangle for this buffer slot.
        Rect mDirtyRect;
#endif

        // mTransform is the current transform flags for this buffer slot.
        uint32_t mTransform;

+37 −4
Original line number Diff line number Diff line
@@ -112,14 +112,44 @@ public:
                const Rect& crop, int scalingMode, uint32_t transform, bool async,
                const sp<Fence>& fence)
        : timestamp(timestamp), isAutoTimestamp(isAutoTimestamp), crop(crop),
          scalingMode(scalingMode), transform(transform), async(async),
          fence(fence) { }
#ifdef QCOM_BSP
        dirtyRect(crop),
#endif
        scalingMode(scalingMode), transform(transform),
        async(async), fence(fence) { }
#ifdef QCOM_BSP
        inline QueueBufferInput(int64_t timestamp, bool isAutoTimestamp,
                const Rect& crop, const Rect& dirtyRect, int scalingMode,
                uint32_t transform, bool async, const sp<Fence>& fence)
        : timestamp(timestamp), isAutoTimestamp(isAutoTimestamp), crop(crop),
        dirtyRect(dirtyRect), scalingMode(scalingMode), transform(transform),
        async(async), fence(fence) { }
        inline void deflate(int64_t* outTimestamp, bool* outIsAutoTimestamp,
                            Rect* outCrop, int* outScalingMode,
                            uint32_t* outTransform,  bool* outAsync,
                            sp<Fence>* outFence) const {
            *outTimestamp = timestamp;
            *outIsAutoTimestamp = bool(isAutoTimestamp);
            *outCrop = crop;
            *outScalingMode = scalingMode;
            *outTransform = transform;
            *outAsync = bool(async);
            *outFence = fence;
        }
#endif
        inline void deflate(int64_t* outTimestamp, bool* outIsAutoTimestamp,
                Rect* outCrop, int* outScalingMode, uint32_t* outTransform,
                            Rect* outCrop,
#ifdef QCOM_BSP
                            Rect* outDirtyRect,
#endif
                            int* outScalingMode, uint32_t* outTransform,
                            bool* outAsync, sp<Fence>* outFence) const {
            *outTimestamp = timestamp;
            *outIsAutoTimestamp = bool(isAutoTimestamp);
            *outCrop = crop;
#ifdef QCOM_BSP
            *outDirtyRect = dirtyRect;
#endif
            *outScalingMode = scalingMode;
            *outTransform = transform;
            *outAsync = bool(async);
@@ -136,6 +166,9 @@ public:
        int64_t timestamp;
        int isAutoTimestamp;
        Rect crop;
#ifdef QCOM_BSP
        Rect dirtyRect;
#endif
        int scalingMode;
        uint32_t transform;
        int async;
+12 −0
Original line number Diff line number Diff line
@@ -78,6 +78,12 @@ public:
        return surface != NULL && surface->getIGraphicBufferProducer() != NULL;
    }

#ifdef QCOM_BSP
    /* sets dirty rectangle of the buffer that gets queued next for the
     * Surface */
    status_t setDirtyRect(const Rect* dirtyRect);
#endif

protected:
    virtual ~Surface();

@@ -206,6 +212,12 @@ private:
    // that gets queued. It is set by calling setCrop.
    Rect mCrop;

#ifdef QCOM_BSP
    // mDirtyRect is the dirty rectangle set for the next buffer that gets
    // queued. It is set by calling setDirtyRect.
    Rect mDirtyRect;
#endif

    // mScalingMode is the scaling mode that will be used for the next
    // buffers that get queued. It is set by calling setScalingMode.
    int mScalingMode;
+11 −2
Original line number Diff line number Diff line
@@ -479,6 +479,9 @@ status_t BufferQueue::queueBuffer(int buf,
    ATRACE_BUFFER_INDEX(buf);

    Rect crop;
#ifdef QCOM_BSP
    Rect dirtyRect;
#endif
    uint32_t transform;
    int scalingMode;
    int64_t timestamp;
@@ -486,8 +489,11 @@ status_t BufferQueue::queueBuffer(int buf,
    bool async;
    sp<Fence> fence;

    input.deflate(&timestamp, &isAutoTimestamp, &crop, &scalingMode, &transform,
            &async, &fence);
    input.deflate(&timestamp, &isAutoTimestamp, &crop,
#ifdef QCOM_BSP
            &dirtyRect,
#endif
            &scalingMode, &transform, &async, &fence);

    if (fence == NULL) {
        ST_LOGE("queueBuffer: fence is NULL");
@@ -564,6 +570,9 @@ status_t BufferQueue::queueBuffer(int buf,
        item.mAcquireCalled = mSlots[buf].mAcquireCalled;
        item.mGraphicBuffer = mSlots[buf].mGraphicBuffer;
        item.mCrop = crop;
#ifdef QCOM_BSP
        item.mDirtyRect = dirtyRect;
#endif
        item.mTransform = transform & ~NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY;
        item.mTransformToDisplayInverse = bool(transform & NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY);
        item.mScalingMode = scalingMode;
Loading