diff options
author | Mathias Agopian <mathias@google.com> | 2011-01-19 15:24:23 -0800 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-01-19 15:24:23 -0800 |
commit | 45491690d8f21d2648cad9247115720fa90046b4 (patch) | |
tree | 7cfc78b00c20fc46fde954a5b57e3d64ab5176a0 /services | |
parent | 7a97ad421b50208dc2f484cc23fa3bb29331a713 (diff) | |
download | frameworks_base-45491690d8f21d2648cad9247115720fa90046b4.zip frameworks_base-45491690d8f21d2648cad9247115720fa90046b4.tar.gz frameworks_base-45491690d8f21d2648cad9247115720fa90046b4.tar.bz2 |
fix [3369743] SurfaceFlinger reads hardware composer hints before calling hwc.prepare()
Change-Id: If3277c7b9d4cb8ef20d1706155fac7b87e64fb20
Diffstat (limited to 'services')
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 65ad956..f5835c9 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -872,30 +872,36 @@ void SurfaceFlinger::composeSurfaces(const Region& dirty) for (size_t i=0 ; i<count ; i++) { const sp<LayerBase>& layer(layers[i]); layer->setPerFrameData(&cur[i]); - if (cur[i].hints & HWC_HINT_CLEAR_FB) { - if (!(layer->needsBlending())) { - transparent.orSelf(layer->visibleRegionScreen); - } - } } err = hwc.prepare(); LOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err)); - } - /* - * clear the area of the FB that need to be transparent - */ - transparent.andSelf(dirty); - if (!transparent.isEmpty()) { - glClearColor(0,0,0,0); - Region::const_iterator it = transparent.begin(); - Region::const_iterator const end = transparent.end(); - const int32_t height = hw.getHeight(); - while (it != end) { - const Rect& r(*it++); - const GLint sy = height - (r.top + r.height()); - glScissor(r.left, sy, r.width(), r.height()); - glClear(GL_COLOR_BUFFER_BIT); + if (err == NO_ERROR) { + for (size_t i=0 ; i<count ; i++) { + if (cur[i].hints & HWC_HINT_CLEAR_FB) { + const sp<LayerBase>& layer(layers[i]); + if (!(layer->needsBlending())) { + transparent.orSelf(layer->visibleRegionScreen); + } + } + } + + /* + * clear the area of the FB that need to be transparent + */ + transparent.andSelf(dirty); + if (!transparent.isEmpty()) { + glClearColor(0,0,0,0); + Region::const_iterator it = transparent.begin(); + Region::const_iterator const end = transparent.end(); + const int32_t height = hw.getHeight(); + while (it != end) { + const Rect& r(*it++); + const GLint sy = height - (r.top + r.height()); + glScissor(r.left, sy, r.width(), r.height()); + glClear(GL_COLOR_BUFFER_BIT); + } + } } } |