summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-10-05 18:20:39 -0700
committerMathias Agopian <mathias@google.com>2009-10-06 17:24:26 -0700
commita4b740ed89074cda898a30eb1b029b0d3a5de1a5 (patch)
tree2c7f89741b0d58e569b1392372ac344b8023267e /libs/surfaceflinger/Layer.cpp
parentb26af23744fa73e8bc142b1eb98772fde5970c10 (diff)
downloadframeworks_native-a4b740ed89074cda898a30eb1b029b0d3a5de1a5.zip
frameworks_native-a4b740ed89074cda898a30eb1b029b0d3a5de1a5.tar.gz
frameworks_native-a4b740ed89074cda898a30eb1b029b0d3a5de1a5.tar.bz2
fix [2168528] enable glTexImage2D code path in SF for software-only buffers
Diffstat (limited to 'libs/surfaceflinger/Layer.cpp')
-rw-r--r--libs/surfaceflinger/Layer.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index c1f7f27..eb0614f 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -51,6 +51,7 @@ Layer::Layer(SurfaceFlinger* flinger, DisplayID display,
const sp<Client>& c, int32_t i)
: LayerBaseClient(flinger, display, c, i),
mSecure(false),
+ mNoEGLImageForSwBuffers(false),
mNeedsBlending(true),
mNeedsDithering(false)
{
@@ -108,13 +109,15 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h,
const DisplayHardware& hw(graphicPlane(0).displayHardware());
PixelFormatInfo displayInfo;
getPixelFormatInfo(hw.getFormat(), &displayInfo);
-
+ const uint32_t hwFlags = hw.getFlags();
+
mFormat = format;
mWidth = w;
mHeight = h;
mSecure = (flags & ISurfaceComposer::eSecure) ? true : false;
mNeedsBlending = (info.h_alpha - info.l_alpha) > 0;
-
+ mNoEGLImageForSwBuffers = !(hwFlags & DisplayHardware::CACHED_BUFFERS);
+
// we use the red index
int displayRedSize = displayInfo.getSize(PixelFormatInfo::INDEX_RED);
int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED);
@@ -331,7 +334,15 @@ uint32_t Layer::getEffectiveUsage(uint32_t usage) const
} else {
// it's allowed to modify the usage flags here, but generally
// the requested flags should be honored.
- usage |= GraphicBuffer::USAGE_HW_TEXTURE;
+ if (mNoEGLImageForSwBuffers) {
+ if (usage & GraphicBuffer::USAGE_HW_MASK) {
+ // request EGLImage for h/w buffers only
+ usage |= GraphicBuffer::USAGE_HW_TEXTURE;
+ }
+ } else {
+ // request EGLImage for all buffers
+ usage |= GraphicBuffer::USAGE_HW_TEXTURE;
+ }
}
return usage;
}