summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/DisplayDevice.cpp
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2013-04-06 23:12:29 -0700
committerJesse Hall <jessehall@google.com>2013-07-15 13:59:41 -0700
commit38efe86d9459cf5c96a24a34cc5cbf31fdba7e19 (patch)
tree9fc8074b1c3fd31515d0396df9e7f917380529cb /services/surfaceflinger/DisplayDevice.cpp
parent5cd46aa3399ddeaf12a211390dfde66c796ab299 (diff)
downloadframeworks_native-38efe86d9459cf5c96a24a34cc5cbf31fdba7e19.zip
frameworks_native-38efe86d9459cf5c96a24a34cc5cbf31fdba7e19.tar.gz
frameworks_native-38efe86d9459cf5c96a24a34cc5cbf31fdba7e19.tar.bz2
Rewrite VirtualDisplaySurface
The previous implementation assumed that the HWC could read and write the same buffer on frames that involved both GLES and HWC composition. It turns out some hardware can't do this. The new implementation maintains a scratch buffer pool to use on these mixed frames, but on GLES-only or HWC-only frames still does composition directly into the output buffer. Bug: 8384764 Change-Id: I7a3addb34fad9bfcbdabbb8b635083e10223df69
Diffstat (limited to 'services/surfaceflinger/DisplayDevice.cpp')
-rw-r--r--services/surfaceflinger/DisplayDevice.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 2eae9c2..c67f4d8 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -188,6 +188,25 @@ void DisplayDevice::flip(const Region& dirty) const
mPageFlipCount++;
}
+status_t DisplayDevice::prepareFrame(const HWComposer& hwc) const {
+ DisplaySurface::CompositionType compositionType;
+ bool haveGles = hwc.hasGlesComposition(mHwcDisplayId);
+ bool haveHwc = hwc.hasHwcComposition(mHwcDisplayId);
+ if (haveGles && haveHwc) {
+ compositionType = DisplaySurface::COMPOSITION_MIXED;
+ } else if (haveGles) {
+ compositionType = DisplaySurface::COMPOSITION_GLES;
+ } else if (haveHwc) {
+ compositionType = DisplaySurface::COMPOSITION_HWC;
+ } else {
+ // Nothing to do -- when turning the screen off we get a frame like
+ // this. Call it a HWC frame since we won't be doing any GLES work but
+ // will do a prepare/set cycle.
+ compositionType = DisplaySurface::COMPOSITION_HWC;
+ }
+ return mDisplaySurface->prepareFrame(compositionType);
+}
+
void DisplayDevice::swapBuffers(HWComposer& hwc) const {
// We need to call eglSwapBuffers() unless:
// (a) there was no GLES composition this frame, or