summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-08-25 12:15:38 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-08-25 12:15:38 -0700
commit8eb16af29303cda190133a1d220b9ecd9341e261 (patch)
treec699895bb4b05087b2f9d8684673a9fb9240d42e
parent4d672988fed7fbdd887fe78603fa2eaf713031ad (diff)
parentc817b22055f094e5fd640952e05821f288107eb3 (diff)
downloadframeworks_base-8eb16af29303cda190133a1d220b9ecd9341e261.zip
frameworks_base-8eb16af29303cda190133a1d220b9ecd9341e261.tar.gz
frameworks_base-8eb16af29303cda190133a1d220b9ecd9341e261.tar.bz2
Merge "don't try to lock a buffer that wasn't allocated with SW usage bits" into gingerbread
-rw-r--r--services/surfaceflinger/Layer.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 6f3c66d..03d7a02 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -196,12 +196,16 @@ void Layer::reloadTexture(const Region& dirty)
} else {
slowpath:
GGLSurface t;
- status_t res = buffer->lock(&t, GRALLOC_USAGE_SW_READ_OFTEN);
- LOGE_IF(res, "error %d (%s) locking buffer %p",
- res, strerror(res), buffer.get());
- if (res == NO_ERROR) {
- mBufferManager.loadTexture(dirty, t);
- buffer->unlock();
+ if (buffer->usage & GRALLOC_USAGE_SW_READ_MASK) {
+ status_t res = buffer->lock(&t, GRALLOC_USAGE_SW_READ_OFTEN);
+ LOGE_IF(res, "error %d (%s) locking buffer %p",
+ res, strerror(res), buffer.get());
+ if (res == NO_ERROR) {
+ mBufferManager.loadTexture(dirty, t);
+ buffer->unlock();
+ }
+ } else {
+ // we can't do anything
}
}
}