X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=services%2Fsurfaceflinger%2FDisplayDevice.cpp;h=0e3c7c650212d418371524fc42ec304bb4c0957e;hb=f460f55c84b0a75de749b8a784059f5ff423ed93;hp=c67f4d8f83d72629bc29c7ea54d315009a64f646;hpb=687821c05b5a85db1b172e7599861c803d268a8d;p=android-x86%2Fframeworks-native.git diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp index c67f4d8f83..0e3c7c6502 100644 --- a/services/surfaceflinger/DisplayDevice.cpp +++ b/services/surfaceflinger/DisplayDevice.cpp @@ -63,7 +63,6 @@ DisplayDevice::DisplayDevice( mDisplaySurface(displaySurface), mDisplay(EGL_NO_DISPLAY), mSurface(EGL_NO_SURFACE), - mContext(EGL_NO_CONTEXT), mDisplayWidth(), mDisplayHeight(), mFormat(), mFlags(), mPageFlipCount(), @@ -79,6 +78,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 */ @@ -253,6 +262,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(); } }