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/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index 8a7d467..7625931 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -69,8 +69,6 @@
{
for (int i=0 ; i<NUM_BUFFERS ; i++) {
if (mTextures[i].name != -1U) {
- // FIXME: this was originally to work-around a bug in the
- // adreno driver. this should be fixed now.
glDeleteTextures(1, &mTextures[i].name);
mTextures[i].name = -1U;
}
@@ -142,8 +140,8 @@
void Layer::reloadTexture(const Region& dirty)
{
- const sp<const Buffer>& buffer(frontBuffer().getBuffer());
- if (LIKELY(mFlags & DisplayHardware::DIRECT_TEXTURE)) {
+ const sp<Buffer>& buffer(frontBuffer().getBuffer());
+ if (LIKELY(mFlags & DisplayHardware::DIRECT_TEXTURE)) {
int index = mFrontBufferIndex;
if (LIKELY(!mTextures[index].dirty)) {
glBindTexture(GL_TEXTURE_2D, mTextures[index].name);
@@ -197,12 +195,16 @@
}
} else {
GGLSurface t;
- if (LIKELY(buffer->getBitmapSurface(&t) == NO_ERROR)) {
+ status_t res = buffer->lock(&t, GRALLOC_USAGE_SW_READ_RARELY);
+ LOGE_IF(res, "error %d (%s) locking buffer %p",
+ res, strerror(res), buffer.get());
+ if (res == NO_ERROR) {
if (UNLIKELY(mTextures[0].name == -1U)) {
mTextures[0].name = createTexture();
}
loadTexture(dirty, mTextures[0].name, t,
mTextures[0].width, mTextures[0].height);
+ buffer->unlock();
}
}
}
@@ -225,8 +227,7 @@
GGLSurface t;
sp<const Buffer> buffer(frontBuffer().getBuffer());
- buffer->getBitmapSurface(&t);
- drawWithOpenGL(clip, textureName, t);
+ drawWithOpenGL(clip, textureName, buffer);
}
sp<SurfaceBuffer> Layer::peekBuffer()