am 13de3699
: Merge changes I47cd25c9,I7638ffe8 into jb-mr1-dev
* commit '13de3699807f3260cfbabd196a08191d6a80a99a': don't call eglMakeCurrent() before calling HWC commit() on HWC 1.1 handle EGL errors
This commit is contained in:
commit
e41c2e1714
@ -205,27 +205,34 @@ void DisplayDevice::flip(const Region& dirty) const
|
||||
}
|
||||
|
||||
void DisplayDevice::swapBuffers(HWComposer& hwc) const {
|
||||
EGLBoolean success = EGL_TRUE;
|
||||
if (hwc.initCheck() != NO_ERROR) {
|
||||
// no HWC, we call eglSwapBuffers()
|
||||
eglSwapBuffers(mDisplay, mSurface);
|
||||
success = eglSwapBuffers(mDisplay, mSurface);
|
||||
} else {
|
||||
// We have a valid HWC, but not all displays can use it, in particular
|
||||
// the virtual displays are on their own.
|
||||
// TODO: HWC 1.2 will allow virtual displays
|
||||
if (mType >= DisplayDevice::DISPLAY_VIRTUAL) {
|
||||
// always call eglSwapBuffers() for virtual displays
|
||||
eglSwapBuffers(mDisplay, mSurface);
|
||||
success = 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);
|
||||
success = eglSwapBuffers(mDisplay, mSurface);
|
||||
}
|
||||
} else {
|
||||
// HWC doesn't have the framebuffer target, we don't call
|
||||
// eglSwapBuffers(), since this is handled by HWComposer::commit().
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: we should at least handle EGL_CONTEXT_LOST, by recreating the
|
||||
// context and resetting our state.
|
||||
LOG_ALWAYS_FATAL_IF(!success,
|
||||
"eglSwapBuffers(%p, %p) failed with 0x%8x",
|
||||
mDisplay, mSurface, eglGetError());
|
||||
}
|
||||
|
||||
void DisplayDevice::onSwapBuffersCompleted(HWComposer& hwc) const {
|
||||
|
@ -927,10 +927,13 @@ void SurfaceFlinger::postFramebuffer()
|
||||
|
||||
HWComposer& hwc(getHwComposer());
|
||||
if (hwc.initCheck() == NO_ERROR) {
|
||||
// FIXME: EGL spec says:
|
||||
// "surface must be bound to the calling thread's current context,
|
||||
// for the current rendering API."
|
||||
DisplayDevice::makeCurrent(mEGLDisplay, getDefaultDisplayDevice(), mEGLContext);
|
||||
if (!hwc.supportsFramebufferTarget()) {
|
||||
// EGL spec says:
|
||||
// "surface must be bound to the calling thread's current context,
|
||||
// for the current rendering API."
|
||||
DisplayDevice::makeCurrent(mEGLDisplay,
|
||||
getDefaultDisplayDevice(), mEGLContext);
|
||||
}
|
||||
hwc.commit();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user