don't try to lock a buffer that wasn't allocated with SW usage bits

Change-Id: Iabbcec1bfa30dc47d45ece699dd178653f1b675b
This commit is contained in:
Mathias Agopian
2010-08-20 15:59:53 -07:00
parent 8395b4625b
commit c817b22055

View File

@@ -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
}
}
}