diff options
author | Mathias Agopian <mathias@google.com> | 2012-08-29 17:24:53 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-08-29 17:24:54 -0700 |
commit | c9ea4c8b580e73a89984641ed37a3eb417cc86c5 (patch) | |
tree | 7d02571da609764e677a102b1a5aa8c237e55a46 | |
parent | c1396dd14506d29e92fc047141d62b3d9246a72d (diff) | |
parent | 85d751cba5d4386c739dbf9dd8f7bbf8c493ade9 (diff) | |
download | frameworks_native-c9ea4c8b580e73a89984641ed37a3eb417cc86c5.zip frameworks_native-c9ea4c8b580e73a89984641ed37a3eb417cc86c5.tar.gz frameworks_native-c9ea4c8b580e73a89984641ed37a3eb417cc86c5.tar.bz2 |
Merge "we were sometimes not setting fences properly" into jb-mr1-dev
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 1162432..2576d87 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1264,15 +1264,13 @@ void SurfaceFlinger::doDisplayComposition(const sp<const DisplayDevice>& hw, void SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& hw, const Region& dirty) { + const int32_t id = hw->getHwcDisplayId(); HWComposer& hwc(getHwComposer()); - int32_t id = hw->getHwcDisplayId(); HWComposer::LayerListIterator cur = hwc.begin(id); const HWComposer::LayerListIterator end = hwc.end(id); - const bool hasGlesComposition = hwc.hasGlesComposition(id); - const bool hasHwcComposition = hwc.hasHwcComposition(id); - if (cur==end || hasGlesComposition) { - + const bool hasGlesComposition = hwc.hasGlesComposition(id) || (cur==end); + if (hasGlesComposition) { DisplayDevice::makeCurrent(hw, mEGLContext); // set the frame buffer @@ -1280,6 +1278,7 @@ void SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& hw, const glLoadIdentity(); // Never touch the framebuffer if we don't have any framebuffer layers + const bool hasHwcComposition = hwc.hasHwcComposition(id); if (hasHwcComposition) { // when using overlays, we assume a fully transparent framebuffer // NOTE: we could reduce how much we need to clear, for instance @@ -1296,39 +1295,50 @@ void SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& hw, const drawWormhole(hw, region); } } + } - /* - * and then, render the layers targeted at the framebuffer - */ + /* + * and then, render the layers targeted at the framebuffer + */ - const Vector< sp<LayerBase> >& layers(hw->getVisibleLayersSortedByZ()); - const size_t count = layers.size(); - const Transform& tr = hw->getTransform(); - for (size_t i=0 ; i<count ; ++i) { + const Vector< sp<LayerBase> >& layers(hw->getVisibleLayersSortedByZ()); + const size_t count = layers.size(); + const Transform& tr = hw->getTransform(); + if (cur != end) { + // we're using h/w composer + for (size_t i=0 ; i<count && cur!=end ; ++i, ++cur) { const sp<LayerBase>& layer(layers[i]); const Region clip(dirty.intersect(tr.transform(layer->visibleRegion))); - if (cur != end) { - // we're using h/w composer - if (!clip.isEmpty()) { - if (cur->getCompositionType() == HWC_OVERLAY) { - if (i && (cur->getHints() & HWC_HINT_CLEAR_FB) - && layer->isOpaque()) { + if (!clip.isEmpty()) { + switch (cur->getCompositionType()) { + case HWC_OVERLAY: { + if ((cur->getHints() & HWC_HINT_CLEAR_FB) + && i + && layer->isOpaque() + && hasGlesComposition) { // never clear the very first layer since we're // guaranteed the FB is already cleared layer->clearWithOpenGL(hw, clip); } - } else { + break; + } + case HWC_FRAMEBUFFER: { layer->draw(hw, clip); + break; } - layer->setAcquireFence(hw, *cur); - } - ++cur; - } else { - // we're not using h/w composer - if (!clip.isEmpty()) { - layer->draw(hw, clip); } } + layer->setAcquireFence(hw, *cur); + } + } else { + // we're not using h/w composer + for (size_t i=0 ; i<count ; ++i) { + const sp<LayerBase>& layer(layers[i]); + const Region clip(dirty.intersect( + tr.transform(layer->visibleRegion))); + if (!clip.isEmpty()) { + layer->draw(hw, clip); + } } } } |