summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger/LayerBuffer.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-10-05 17:07:12 -0700
committerMathias Agopian <mathias@google.com>2009-10-06 17:00:25 -0700
commit3330b203039dea366d4981db1408a460134b2d2c (patch)
treef165f7801f2ee8034ad1edfd34e2b554fdaf662f /libs/surfaceflinger/LayerBuffer.cpp
parent0ad3f9f4009c76b56f41da5d26eb7712dee938f1 (diff)
downloadframeworks_native-3330b203039dea366d4981db1408a460134b2d2c.zip
frameworks_native-3330b203039dea366d4981db1408a460134b2d2c.tar.gz
frameworks_native-3330b203039dea366d4981db1408a460134b2d2c.tar.bz2
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.
Diffstat (limited to 'libs/surfaceflinger/LayerBuffer.cpp')
-rw-r--r--libs/surfaceflinger/LayerBuffer.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp
index 667571b..7e27a02 100644
--- a/libs/surfaceflinger/LayerBuffer.cpp
+++ b/libs/surfaceflinger/LayerBuffer.cpp
@@ -23,13 +23,12 @@
#include <utils/Log.h>
#include <utils/StopWatch.h>
+#include <ui/GraphicBuffer.h>
#include <ui/PixelFormat.h>
#include <ui/FramebufferNativeWindow.h>
#include <hardware/copybit.h>
-#include "Buffer.h"
-#include "BufferAllocator.h"
#include "LayerBuffer.h"
#include "SurfaceFlinger.h"
#include "DisplayHardware/DisplayHardware.h"
@@ -474,9 +473,9 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const
mTempBitmap->getWidth() < size_t(tmp_w) ||
mTempBitmap->getHeight() < size_t(tmp_h)) {
mTempBitmap.clear();
- mTempBitmap = new android::Buffer(
- tmp_w, tmp_h, src.img.format,
- BufferAllocator::USAGE_HW_2D);
+ mTempBitmap = new GraphicBuffer(
+ tmp_w, tmp_h, src.img.format,
+ GraphicBuffer::USAGE_HW_2D);
err = mTempBitmap->initCheck();
}
@@ -549,7 +548,7 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const
t.format = src.img.format;
t.data = (GGLubyte*)src.img.base;
const Region dirty(Rect(t.width, t.height));
- mLayer.loadTexture(&mTexture, mTexture.name, dirty, t);
+ mLayer.loadTexture(&mTexture, dirty, t);
mTexture.transform = mBufferHeap.transform;
mLayer.drawWithOpenGL(clip, mTexture);
}