sf: Enable GPU Tiled DR optimization for overlap and mixed mode use cases
Extend the GPU Tiled DR optimization to Overlapping layers use cases
and mixed mode composition
Change-Id: Iaba496be21d5c4ceeedfe3405cf26b36677cd14b
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index fc8b125..d6140dd 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2085,6 +2085,7 @@
Region clearRegion;
bool hasGlesComposition = hwc.hasGlesComposition(id);
+ const bool hasHwcComposition = hwc.hasHwcComposition(id);
if (hasGlesComposition) {
if (!hw->makeCurrent(mEGLDisplay, mEGLContext)) {
ALOGW("DisplayDevice::makeCurrent failed. Aborting surface composition for display %s",
@@ -2097,14 +2098,14 @@
}
// 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
// remove where there are opaque FB layers. however, on some
// GPUs doing a "clean slate" clear might be more efficient.
// We'll revisit later if needed.
- engine.clearWithColor(0, 0, 0, 0);
+ if(!(mGpuTileRenderEnable && (mDisplays.size()==1)))
+ engine.clearWithColor(0, 0, 0, 0);
} else {
// we start with the whole screen area
const Region bounds(hw->getBounds());
@@ -2195,9 +2196,21 @@
hw->eglSwapPreserved(false);
}
// DrawWormHole/Any Draw has to be within startTile & EndTile
- if (cur->getCompositionType() != HWC_BLIT &&
- !clearRegion.isEmpty()){
- drawWormhole(hw, clearRegion);
+ if (hasHwcComposition) {
+ if(mCanUseGpuTileRender && !mUnionDirtyRect.isEmpty()) {
+ const Rect& scissor(mUnionDirtyRect);
+ engine.setScissor(scissor.left, hw->getHeight()- scissor.bottom,
+ scissor.getWidth(), scissor.getHeight());
+ engine.clearWithColor(0, 0, 0, 0);
+ engine.disableScissor();
+ } else {
+ engine.clearWithColor(0, 0, 0, 0);
+ }
+ } else {
+ if (cur->getCompositionType() != HWC_BLIT &&
+ !clearRegion.isEmpty()){
+ drawWormhole(hw, clearRegion);
+ }
}
}
#endif