summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2012-09-25 20:26:00 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-27 17:27:20 -0700
commita4310c8be2dc3406a668ee99020d52187173232f (patch)
treeaaa94ea8636c97a54932929113a27c8004644457 /services/surfaceflinger
parentcb094a783f14daae3378ac8aa7dc509980f037b2 (diff)
downloadframeworks_native-a4310c8be2dc3406a668ee99020d52187173232f.zip
frameworks_native-a4310c8be2dc3406a668ee99020d52187173232f.tar.gz
frameworks_native-a4310c8be2dc3406a668ee99020d52187173232f.tar.bz2
SurfaceFlinger: don't always set HWC_GEOM_CHGD
This change fixes a bug in SurfaceFlinger that caused the HWC_GEOMETRY_CHANGED flag to be set every flip. Change-Id: I4f395a2883bcbb53b23b3d14941aff108739c9f0 Bug: 7234237
Diffstat (limited to 'services/surfaceflinger')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp56
1 files changed, 35 insertions, 21 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 521e14a..5f06105 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -940,8 +940,31 @@ void SurfaceFlinger::setUpHWComposer() {
HWComposer& hwc(getHwComposer());
if (hwc.initCheck() == NO_ERROR) {
// build the h/w work list
- const bool workListsDirty = mHwWorkListDirty;
- mHwWorkListDirty = false;
+ if (CC_UNLIKELY(mHwWorkListDirty)) {
+ mHwWorkListDirty = false;
+ for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) {
+ sp<const DisplayDevice> hw(mDisplays[dpy]);
+ const int32_t id = hw->getHwcDisplayId();
+ if (id >= 0) {
+ const Vector< sp<LayerBase> >& currentLayers(
+ hw->getVisibleLayersSortedByZ());
+ const size_t count = currentLayers.size();
+ if (hwc.createWorkList(id, count) == NO_ERROR) {
+ HWComposer::LayerListIterator cur = hwc.begin(id);
+ const HWComposer::LayerListIterator end = hwc.end(id);
+ for (size_t i=0 ; cur!=end && i<count ; ++i, ++cur) {
+ const sp<LayerBase>& layer(currentLayers[i]);
+ layer->setGeometry(hw, *cur);
+ if (mDebugDisableHWC || mDebugRegion) {
+ cur->setSkip(true);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // set the per-frame data
for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) {
sp<const DisplayDevice> hw(mDisplays[dpy]);
const int32_t id = hw->getHwcDisplayId();
@@ -949,28 +972,19 @@ void SurfaceFlinger::setUpHWComposer() {
const Vector< sp<LayerBase> >& currentLayers(
hw->getVisibleLayersSortedByZ());
const size_t count = currentLayers.size();
- if (hwc.createWorkList(id, count) >= 0) {
- HWComposer::LayerListIterator cur = hwc.begin(id);
- const HWComposer::LayerListIterator end = hwc.end(id);
- for (size_t i=0 ; cur!=end && i<count ; ++i, ++cur) {
- const sp<LayerBase>& layer(currentLayers[i]);
-
- if (CC_UNLIKELY(workListsDirty)) {
- layer->setGeometry(hw, *cur);
- if (mDebugDisableHWC || mDebugRegion) {
- cur->setSkip(true);
- }
- }
-
- /*
- * update the per-frame h/w composer data for each layer
- * and build the transparent region of the FB
- */
- layer->setPerFrameData(hw, *cur);
- }
+ HWComposer::LayerListIterator cur = hwc.begin(id);
+ const HWComposer::LayerListIterator end = hwc.end(id);
+ for (size_t i=0 ; cur!=end && i<count ; ++i, ++cur) {
+ /*
+ * update the per-frame h/w composer data for each layer
+ * and build the transparent region of the FB
+ */
+ const sp<LayerBase>& layer(currentLayers[i]);
+ layer->setPerFrameData(hw, *cur);
}
}
}
+
status_t err = hwc.prepare();
ALOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err));
}