summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@collabora.com>2017-07-18 13:49:41 +0200
committerRobert Foss <robert.foss@collabora.com>2017-07-18 13:49:41 +0200
commit2fbdea60c2948ba23047fa94ad0431723030e357 (patch)
treeb02fe01dd0e3ee364a3704fdf010c32150dd8744
parent541b1ebe0955ef40693b0746be2cd4f527feb7c2 (diff)
downloadandroid-frameworks-native-android-etnaviv-locking.tar.gz
android-frameworks-native-android-etnaviv-locking.tar.xz
HACK: Change locking orderandroid-etnaviv-locking
-rw-r--r--libs/gui/Surface.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 0838290..e88a884 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -1266,11 +1266,21 @@ status_t Surface::lock(
backBuffer->height == frontBuffer->height &&
backBuffer->format == frontBuffer->format);
+ status_t res;
+ void* vaddr = nullptr;
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()) {
+ res = backBuffer->lockAsync(
+ GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
+ newDirtyRegion.bounds(), &vaddr, fenceFd);
copyBlt(backBuffer, frontBuffer, copyback);
+ } else {
+ res = backBuffer->lockAsync(
+ GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
+ newDirtyRegion.bounds(), &vaddr, fenceFd);
+ }
} else {
// if we can't copy-back anything, modify the user's dirty
// region to make sure they redraw the whole buffer
@@ -1280,6 +1290,9 @@ status_t Surface::lock(
for (size_t i=0 ; i<NUM_BUFFER_SLOTS ; i++) {
mSlots[i].dirtyRegion.clear();
}
+ res = backBuffer->lockAsync(
+ GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
+ newDirtyRegion.bounds(), &vaddr, fenceFd);
}
@@ -1293,16 +1306,12 @@ status_t Surface::lock(
}
}
+
mDirtyRegion.orSelf(newDirtyRegion);
if (inOutDirtyBounds) {
*inOutDirtyBounds = newDirtyRegion.getBounds();
}
- void* vaddr;
- status_t res = backBuffer->lockAsync(
- GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
- newDirtyRegion.bounds(), &vaddr, fenceFd);
-
ALOGW_IF(res, "failed locking buffer (handle = %p)",
backBuffer->handle);