summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-05-04 14:17:04 -0700
committerMathias Agopian <mathias@google.com>2009-05-04 14:17:04 -0700
commitdff8e58d47ede6e748c0b02e128ca33b42a4f362 (patch)
tree716d70cda74aa625d6e67c4debc2eb7c6b81bfc9 /libs/surfaceflinger/Layer.cpp
parentfa6eda01a9f3df0102ce6a65302c8674cc9c7e50 (diff)
downloadframeworks_base-dff8e58d47ede6e748c0b02e128ca33b42a4f362.zip
frameworks_base-dff8e58d47ede6e748c0b02e128ca33b42a4f362.tar.gz
frameworks_base-dff8e58d47ede6e748c0b02e128ca33b42a4f362.tar.bz2
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
Diffstat (limited to 'libs/surfaceflinger/Layer.cpp')
-rw-r--r--libs/surfaceflinger/Layer.cpp15
1 files changed, 8 insertions, 7 deletions
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 @@ void Layer::destroy()
{
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 @@ status_t Layer::setBuffers( Client* client,
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 @@ void Layer::reloadTexture(const Region& dirty)
}
} 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 @@ void Layer::onDraw(const Region& clip) const
GGLSurface t;
sp<const Buffer> buffer(frontBuffer().getBuffer());
- buffer->getBitmapSurface(&t);
- drawWithOpenGL(clip, textureName, t);
+ drawWithOpenGL(clip, textureName, buffer);
}
sp<SurfaceBuffer> Layer::peekBuffer()