From 6950e428feaccc8164b989ef64e771a99948797a Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 5 Oct 2009 17:07:12 -0700 Subject: fix [2167050] glTexImage2D code path buggy in SurfaceFlinger When EGLImage extension is not available, SurfaceFlinger will fallback to using glTexImage2D and glTexSubImage2D instead, which requires 50% more memory and an extra copy. However this code path has never been exercised and had some bugs which this patch fix. Mainly the scale factor wasn't computed right when falling back on glDrawElements. We also fallback to this mode of operation if a buffer doesn't have the adequate usage bits for EGLImage usage. This changes only code that is currently not executed. Some refactoring was needed to keep the change clean. This doesn't change anything functionaly. --- libs/surfaceflinger/SurfaceFlinger.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'libs/surfaceflinger/SurfaceFlinger.cpp') diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp index f2b918f..9694cf1 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/libs/surfaceflinger/SurfaceFlinger.cpp @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -44,8 +45,6 @@ #include #include "clz.h" -#include "Buffer.h" -#include "BufferAllocator.h" #include "Layer.h" #include "LayerBlur.h" #include "LayerBuffer.h" @@ -190,6 +189,7 @@ SurfaceFlinger::SurfaceFlinger() mLastSwapBufferTime(0), mDebugInTransaction(0), mLastTransactionTime(0), + mBootFinished(false), mConsoleSignals(0), mSecureFrameBuffer(0) { @@ -294,6 +294,7 @@ void SurfaceFlinger::bootFinished() const nsecs_t now = systemTime(); const nsecs_t duration = now - mBootTime; LOGI("Boot is finished (%ld ms)", long(ns2ms(duration)) ); + mBootFinished = true; property_set("ctl.stop", "bootanim"); } @@ -1521,8 +1522,8 @@ status_t SurfaceFlinger::dump(int fd, const Vector& args) if (l != 0) { SharedBufferStack::Statistics stats = l->lcblk->getStats(); result.append( l->lcblk->dump(" ") ); - sp buf0(l->getBuffer(0)); - sp buf1(l->getBuffer(1)); + sp buf0(l->getBuffer(0)); + sp buf1(l->getBuffer(1)); uint32_t w0=0, h0=0, s0=0; uint32_t w1=0, h1=0, s1=0; if (buf0 != 0) { @@ -1573,7 +1574,7 @@ status_t SurfaceFlinger::dump(int fd, const Vector& args) } snprintf(buffer, SIZE, " client count: %d\n", mClientsMap.size()); result.append(buffer); - const BufferAllocator& alloc(BufferAllocator::get()); + const GraphicBufferAllocator& alloc(GraphicBufferAllocator::get()); alloc.dump(result); if (locked) { -- cgit v1.1