update surfaceflinger, libui and libagl to the new gralloc api
- Currently the lock/unlock path is naive and is done for each drawing operation (glDrawElements and glDrawArrays). this should be improved eventually.
- factor all the lock/unlock code in SurfaceBuffer.
- fixed "showupdate" so it works even when we don't have preserving eglSwapBuffers().
- improved the situation with the dirty-region and fixed a problem that caused GL apps to not update.
- make use of LightRefBase() where needed, instead of duplicating its implementation
- add LightRefBase::getStrongCount()
- renamed EGLNativeWindowSurface.cpp to FramebufferNativeWindow.cpp
- disabled copybits test, since it clashes with the new gralloc api
- Camera/Video will be fixed later when we rework the overlay apis
diff --git a/libs/surfaceflinger/BufferAllocator.cpp b/libs/surfaceflinger/BufferAllocator.cpp
index fec7c87..cee8b64 100644
--- a/libs/surfaceflinger/BufferAllocator.cpp
+++ b/libs/surfaceflinger/BufferAllocator.cpp
@@ -16,20 +16,14 @@
*/
#include <sys/mman.h>
-#include <utils/CallStack.h>
#include <cutils/ashmem.h>
#include <cutils/log.h>
#include <utils/Singleton.h>
#include <utils/String8.h>
-#include <ui/BufferMapper.h>
-
#include "BufferAllocator.h"
-// FIXME: ANDROID_GRALLOC_DEBUG must only be used with *our* gralloc
-#define ANDROID_GRALLOC_DEBUG 1
-
namespace android {
// ---------------------------------------------------------------------------
@@ -67,8 +61,8 @@
const size_t c = list.size();
for (size_t i=0 ; i<c ; i++) {
const alloc_rec_t& rec(list.valueAt(i));
- snprintf(buffer, SIZE, "%10p: %10p | %7.2f KB | %4u x %4u | %2d | 0x%08x\n",
- list.keyAt(i), rec.vaddr, rec.size/1024.0f,
+ snprintf(buffer, SIZE, "%10p: %7.2f KiB | %4u x %4u | %2d | 0x%08x\n",
+ list.keyAt(i), rec.size/1024.0f,
rec.w, rec.h, rec.format, rec.usage);
result.append(buffer);
total += rec.size;
@@ -108,23 +102,9 @@
{
Mutex::Autolock _l(mLock);
-#if ANDROID_GRALLOC_DEBUG
- void* base = (void*)(handle->data[2]);
-#endif
-
status_t err = mAllocDev->free(mAllocDev, handle);
LOGW_IF(err, "free(...) failed %d (%s)", err, strerror(-err));
-#if ANDROID_GRALLOC_DEBUG
- if (base) {
- LOGD("freeing mapped handle %p from:", handle);
- CallStack s;
- s.update();
- s.dump("");
- BufferMapper::get().dump(handle);
- }
-#endif
-
if (err == NO_ERROR) {
Mutex::Autolock _l(sLock);
KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList);
@@ -134,37 +114,5 @@
return err;
}
-status_t BufferAllocator::map(buffer_handle_t handle, void** addr)
-{
- Mutex::Autolock _l(mLock);
- status_t err = BufferMapper::get().map(handle, addr, this);
- if (err == NO_ERROR) {
- Mutex::Autolock _l(sLock);
- KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList);
- ssize_t idx = list.indexOfKey(handle);
- if (idx >= 0)
- list.editValueAt(idx).vaddr = addr;
- }
-
- return err;
-}
-
-status_t BufferAllocator::unmap(buffer_handle_t handle)
-{
- Mutex::Autolock _l(mLock);
- gralloc_module_t* mod = (gralloc_module_t*)mAllocDev->common.module;
- status_t err = BufferMapper::get().unmap(handle, this);
- if (err == NO_ERROR) {
- Mutex::Autolock _l(sLock);
- KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList);
- ssize_t idx = list.indexOfKey(handle);
- if (idx >= 0)
- list.editValueAt(idx).vaddr = 0;
- }
-
- return err;
-}
-
-
// ---------------------------------------------------------------------------
}; // namespace android