summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/DisplayDevice.cpp
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2013-08-07 15:23:00 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-08-07 15:23:00 +0000
commitff866e7642033d8f68c11eaa16d0afcecf0bab5b (patch)
tree1d3ff194dfa1205ccd36211fc279a2a85b3836e3 /services/surfaceflinger/DisplayDevice.cpp
parent5f51ed9499508ecda2d44c794a258fe6f5e22149 (diff)
parentf460f55c84b0a75de749b8a784059f5ff423ed93 (diff)
downloadframeworks_native-ff866e7642033d8f68c11eaa16d0afcecf0bab5b.zip
frameworks_native-ff866e7642033d8f68c11eaa16d0afcecf0bab5b.tar.gz
frameworks_native-ff866e7642033d8f68c11eaa16d0afcecf0bab5b.tar.bz2
Merge "Set the swap interval of virtual display surfaces to 0"
Diffstat (limited to 'services/surfaceflinger/DisplayDevice.cpp')
-rw-r--r--services/surfaceflinger/DisplayDevice.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 391131d..8143227 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -64,7 +64,6 @@ DisplayDevice::DisplayDevice(
mDisplaySurface(displaySurface),
mDisplay(EGL_NO_DISPLAY),
mSurface(EGL_NO_SURFACE),
- mContext(EGL_NO_CONTEXT),
mDisplayWidth(), mDisplayHeight(), mFormat(),
mFlags(),
mPageFlipCount(),
@@ -80,6 +79,16 @@ DisplayDevice::DisplayDevice(
int format;
window->query(window, NATIVE_WINDOW_FORMAT, &format);
+ // Make sure that composition can never be stalled by a virtual display
+ // consumer that isn't processing buffers fast enough. We have to do this
+ // in two places:
+ // * Here, in case the display is composed entirely by HWC.
+ // * In makeCurrent(), using eglSwapInterval. Some EGL drivers set the
+ // window's swap interval in eglMakeCurrent, so they'll override the
+ // interval we set here.
+ if (mType >= DisplayDevice::DISPLAY_VIRTUAL)
+ window->setSwapInterval(window, 0);
+
/*
* Create our display's surface
*/
@@ -254,6 +263,8 @@ EGLBoolean DisplayDevice::makeCurrent(EGLDisplay dpy, EGLContext ctx) const {
if (sur != mSurface) {
result = eglMakeCurrent(dpy, mSurface, mSurface, ctx);
if (result == EGL_TRUE) {
+ if (mType >= DisplayDevice::DISPLAY_VIRTUAL)
+ eglSwapInterval(dpy, 0);
setViewportAndProjection();
}
}