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

Commit 5a2dcde9 authored by Francis Hart's avatar Francis Hart Committed by android-build-merger
Browse files

Merge "Surface: Ensure synchronisation of copyBlt"

am: 88f77814

Change-Id: If8fe2dde08a1a850029e1d9ca6a7ae965f2aa8ab
parents 3ee6686f 88f77814
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -20,6 +20,13 @@

#include <android/native_window.h>

// We would eliminate the non-conforming zero-length array, but we can't since
// this is effectively included from the Linux kernel
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wzero-length-array"
#include <sync/sync.h>
#pragma clang diagnostic pop

#include <binder/Parcel.h>

#include <utils/Log.h>
@@ -1269,8 +1276,14 @@ status_t Surface::lock(
        if (canCopyBack) {
            // copy the area that is invalid and not repainted this round
            const Region copyback(mDirtyRegion.subtract(newDirtyRegion));
            if (!copyback.isEmpty())
            if (!copyback.isEmpty()) {
                if (fenceFd >= 0) {
                    sync_wait(fenceFd, -1);
                    close(fenceFd);
                    fenceFd = -1;
                }
                copyBlt(backBuffer, frontBuffer, copyback);
            }
        } else {
            // if we can't copy-back anything, modify the user's dirty
            // region to make sure they redraw the whole buffer