fix external displays

we were not calling eglSwapBuffers() on external displays
because they can't use HWC which caused us to think they
didn't have GLES composition.

Change-Id: I6cef4ae40b138412d2e6f2acda33c9d222b03a83
This commit is contained in:
Mathias Agopian 2012-09-18 01:21:55 -07:00
parent 41cb1b5f67
commit d870703d55

View File

@ -179,7 +179,7 @@ void DisplayDevice::flip(const Region& dirty) const
b.left, b.top, b.width(), b.height()); b.left, b.top, b.width(), b.height());
} }
#endif #endif
mPageFlipCount++; mPageFlipCount++;
} }
@ -188,14 +188,21 @@ void DisplayDevice::swapBuffers(HWComposer& hwc) const {
// no HWC, we call eglSwapBuffers() // no HWC, we call eglSwapBuffers()
eglSwapBuffers(mDisplay, mSurface); eglSwapBuffers(mDisplay, mSurface);
} else { } else {
if (hwc.hasGlesComposition(mType)) { // We have a valid HWC, but not all displays can use it, in particular
if (hwc.supportsFramebufferTarget() || // the virtual displays are on their own.
mType >= DisplayDevice::DISPLAY_VIRTUAL) { // TODO: HWC 1.2 will allow virtual displays
// as of hwc 1.1 we always call eglSwapBuffers, however, if (mType >= DisplayDevice::DISPLAY_VIRTUAL) {
// on older versions of HWC, we need to call it only on // always call eglSwapBuffers() for virtual displays
// virtual displays eglSwapBuffers(mDisplay, mSurface);
} else if (hwc.supportsFramebufferTarget()) {
// as of hwc 1.1 we always call eglSwapBuffers if we have some
// GLES layers
if (hwc.hasGlesComposition(mType)) {
eglSwapBuffers(mDisplay, mSurface); eglSwapBuffers(mDisplay, mSurface);
} }
} else {
// HWC doesn't have the framebuffer target, we don't call
// eglSwapBuffers(), since this is handled by HWComposer::commit().
} }
} }
} }