summaryrefslogtreecommitdiffstats
path: root/libs/ui/Surface.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-05-05 00:37:46 -0700
committerMathias Agopian <mathias@google.com>2009-05-05 00:37:46 -0700
commite71212ba5397387100a578d23b15862518a7a859 (patch)
tree3bbcd9e77ec897c785781aacc35a5498fe2a0edc /libs/ui/Surface.cpp
parentb2dd686d06a608ee40285b93bc0217cf26c2b035 (diff)
downloadframeworks_native-e71212ba5397387100a578d23b15862518a7a859.zip
frameworks_native-e71212ba5397387100a578d23b15862518a7a859.tar.gz
frameworks_native-e71212ba5397387100a578d23b15862518a7a859.tar.bz2
removed the "bits" attribute from android_native_buffer_t.
"bits" can never be trusted now that we need to call lock() on the handle to get the virtual address of the buffer.
Diffstat (limited to 'libs/ui/Surface.cpp')
-rw-r--r--libs/ui/Surface.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/libs/ui/Surface.cpp b/libs/ui/Surface.cpp
index 68fd963..5f2138e 100644
--- a/libs/ui/Surface.cpp
+++ b/libs/ui/Surface.cpp
@@ -90,23 +90,22 @@ int SurfaceBuffer::getHandle(android_native_buffer_t const * base,
return 0;
}
-status_t SurfaceBuffer::lock(uint32_t usage)
+status_t SurfaceBuffer::lock(uint32_t usage, void** vaddr)
{
const Rect lockBounds(width, height);
- status_t res = lock(usage, lockBounds);
+ status_t res = lock(usage, lockBounds, vaddr);
return res;
}
-status_t SurfaceBuffer::lock(uint32_t usage, const Rect& rect)
+status_t SurfaceBuffer::lock(uint32_t usage, const Rect& rect, void** vaddr)
{
- status_t res = getBufferMapper().lock(handle, usage, rect, &bits);
+ status_t res = getBufferMapper().lock(handle, usage, rect, vaddr);
return res;
}
status_t SurfaceBuffer::unlock()
{
status_t res = getBufferMapper().unlock(handle);
- bits = NULL;
return res;
}
@@ -134,11 +133,11 @@ static void copyBlt(
const sp<SurfaceBuffer>& src,
const Region& reg)
{
- src->lock(GRALLOC_USAGE_SW_READ_OFTEN, reg.bounds());
- uint8_t const * const src_bits = (uint8_t const *)src->bits;
+ uint8_t const * src_bits;
+ src->lock(GRALLOC_USAGE_SW_READ_OFTEN, reg.bounds(), (void**)&src_bits);
- dst->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, reg.bounds());
- uint8_t* const dst_bits = (uint8_t*)dst->bits;
+ uint8_t* dst_bits;
+ dst->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, reg.bounds(), (void**)&dst_bits);
Region::iterator iterator(reg);
if (iterator) {
@@ -629,9 +628,10 @@ status_t Surface::lock(SurfaceInfo* other, Region* dirtyIn, bool blocking)
mDirtyRegion = newDirtyRegion;
mOldDirtyRegion = newDirtyRegion;
+ void* vaddr;
status_t res = backBuffer->lock(
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
- newDirtyRegion.bounds());
+ newDirtyRegion.bounds(), &vaddr);
LOGW_IF(res, "failed locking buffer %d (%p)",
mBackbufferIndex, backBuffer->handle);
@@ -642,7 +642,7 @@ status_t Surface::lock(SurfaceInfo* other, Region* dirtyIn, bool blocking)
other->s = backBuffer->stride;
other->usage = backBuffer->usage;
other->format = backBuffer->format;
- other->bits = backBuffer->bits;
+ other->bits = vaddr;
}
}
return err;
@@ -660,7 +660,6 @@ status_t Surface::unlockAndPost()
mBackbufferIndex, mLockedBuffer->handle);
status_t err = queueBuffer(mLockedBuffer);
- mLockedBuffer->bits = NULL;
mLockedBuffer = 0;
return err;
}