summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-08-20 15:59:53 -0700
committerMathias Agopian <mathias@google.com>2010-08-25 12:14:27 -0700
commitc817b22055f094e5fd640952e05821f288107eb3 (patch)
tree3f0b0c79b89b8eaeb74639da6ed2cf90fda6c81d /services
parent8395b4625b96f2133e2e4f595fdc69fbe222e4fc (diff)
downloadframeworks_base-c817b22055f094e5fd640952e05821f288107eb3.zip
frameworks_base-c817b22055f094e5fd640952e05821f288107eb3.tar.gz
frameworks_base-c817b22055f094e5fd640952e05821f288107eb3.tar.bz2
don't try to lock a buffer that wasn't allocated with SW usage bits
Change-Id: Iabbcec1bfa30dc47d45ece699dd178653f1b675b
Diffstat (limited to 'services')
-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
}
}
}