SurfaceFlinger: Change to support framebuffer flip for 2D blitters
- Surfaceflinger does not flip framebuffers when there are
no layers marked for HWC_FRAMEBUFFER
- This change checks for the HWC_BLIT flag and will request a flip
to a new FB_TARGET buffer even if there are no FRAMEBUFFER layers
Conflicts:
services/surfaceflinger/DisplayHardware/HWComposer.cpp
services/surfaceflinger/Layer.cpp
Change-Id: I1cb44389a05c9ec049d7f0d39c288feccb11a91c
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index d4843c6..80ccb99 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -690,6 +690,11 @@
if (l.compositionType == HWC_FRAMEBUFFER) {
disp.hasFbComp = true;
}
+ // If the composition type is BLIT, we set this to
+ // trigger a FLIP
+ if(l.compositionType == HWC_BLIT) {
+ disp.hasFbComp = true;
+ }
if (l.compositionType == HWC_OVERLAY) {
disp.hasOvComp = true;
}
@@ -1191,6 +1196,7 @@
"FB TARGET",
"SIDEBAND",
"HWC_CURSOR",
+ "FB_BLIT",
"UNKNOWN"};
if (type >= NELEM(compositionTypeName))
type = NELEM(compositionTypeName) - 1;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 03e1ea4..e1545b1 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -533,7 +533,8 @@
// TODO: there is a possible optimization here: we only need to set the
// acquire fence the first time a new buffer is acquired on EACH display.
- if (layer.getCompositionType() == HWC_OVERLAY || layer.getCompositionType() == HWC_CURSOR_OVERLAY) {
+ if (layer.getCompositionType() == HWC_OVERLAY || layer.getCompositionType() == HWC_CURSOR_OVERLAY ||
+ layer.getCompositionType() == HWC_BLIT) {
sp<Fence> fence = mSurfaceFlingerConsumer->getCurrentFence();
if (fence->isValid()) {
fenceFd = fence->dup();
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 0ff26be..c7567bd 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1902,6 +1902,9 @@
layer->draw(hw, clip);
break;
}
+ case HWC_BLIT:
+ //Do nothing
+ break;
case HWC_FRAMEBUFFER_TARGET: {
// this should not happen as the iterator shouldn't
// let us get there.