summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2015-04-22 00:07:51 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-22 00:07:52 +0000
commite647dddebb11a383c0d95b6dfd0cbe0998d9b644 (patch)
tree5209ecbf7d22fe30e209eccec8631e98dfebea6f
parentff5c1a6b677d8d25630ffc3d1a868eb98a38ceab (diff)
parentc62acbd12711ee6cff1ef94c146316dfe5169045 (diff)
downloadnative-e647dddebb11a383c0d95b6dfd0cbe0998d9b644.tar.gz
Merge "libgui: Fix CPU rendering on Surface"
-rw-r--r--include/gui/Surface.h10
-rw-r--r--libs/gui/Surface.cpp10
2 files changed, 11 insertions, 9 deletions
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index 8217652c3c..a9f78cf029 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -298,12 +298,12 @@ private:
sp<GraphicBuffer> mPostedBuffer;
bool mConnectedToCpu;
- // In the lock/unlock context, this reflects the region that the producer
- // wished to update and whether the Surface was able to copy the previous
- // buffer back to allow a partial update.
+ // When a CPU producer is attached, this reflects the region that the
+ // producer wished to update as well as whether the Surface was able to copy
+ // the previous buffer back to allow a partial update.
//
- // In the dequeue/queue context, this reflects the surface damage (the
- // damage since the last frame) passed in by the producer.
+ // When a non-CPU producer is attached, this reflects the surface damage
+ // (the change since the previous frame) passed in by the producer.
Region mDirtyRegion;
};
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 245f7a3745..b8acad2a85 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -322,7 +322,7 @@ int Surface::queueBuffer(android_native_buffer_t* buffer, int fenceFd) {
mDataSpace, crop, mScalingMode, mTransform ^ mStickyTransform,
mSwapIntervalZero, fence, mStickyTransform);
- if (mDirtyRegion.bounds() == Rect::INVALID_RECT) {
+ if (mConnectedToCpu || mDirtyRegion.bounds() == Rect::INVALID_RECT) {
input.setSurfaceDamage(Region::INVALID_REGION);
} else {
// The surface damage was specified using the OpenGL ES convention of
@@ -356,8 +356,10 @@ int Surface::queueBuffer(android_native_buffer_t* buffer, int fenceFd) {
mConsumerRunningBehind = (numPendingBuffers >= 2);
- // Clear surface damage back to full-buffer
- mDirtyRegion = Region::INVALID_REGION;
+ if (!mConnectedToCpu) {
+ // Clear surface damage back to full-buffer
+ mDirtyRegion = Region::INVALID_REGION;
+ }
return err;
}
@@ -844,7 +846,7 @@ void Surface::setSurfaceDamage(android_native_rect_t* rects, size_t numRects) {
ALOGV("Surface::setSurfaceDamage");
Mutex::Autolock lock(mMutex);
- if (numRects == 0) {
+ if (mConnectedToCpu || numRects == 0) {
mDirtyRegion = Region::INVALID_REGION;
return;
}