OSDN Git Service

SF: Call makeCurrent after presenting each display
authorSeason Li <seasonl@nvidia.com>
Thu, 4 Aug 2016 21:32:44 +0000 (14:32 -0700)
committerGlenn Kasten <gkasten@google.com>
Wed, 24 May 2017 17:27:38 +0000 (10:27 -0700)
HWC can change EGLContext in each present. Restore to
default EGLContext after commiting each display.

Test: see https://android-review.googlesource.com/#/c/372703/
Change-Id: I4abc84fb3d4b74964fabcad5a2568ff01a6c5dbb

services/surfaceflinger/SurfaceFlinger.cpp

index deeb456..617aec3 100644 (file)
@@ -1405,13 +1405,7 @@ void SurfaceFlinger::postFramebuffer()
             mHwc->commit(hwcId);
         }
         displayDevice->onSwapBuffersCompleted();
-        if (displayId == 0) {
-            // Make the default display current because the VirtualDisplayDevice
-            // code cannot deal with dequeueBuffer() being called outside of the
-            // composition loop; however the code below can call glFlush() which
-            // is allowed to (and does in some case) call dequeueBuffer().
-            displayDevice->makeCurrent(mEGLDisplay, mEGLContext);
-        }
+        displayDevice->makeCurrent(mEGLDisplay, mEGLContext);
         for (auto& layer : displayDevice->getVisibleLayersSortedByZ()) {
             sp<Fence> releaseFence = Fence::NO_FENCE;
             if (layer->getCompositionType(hwcId) == HWC2::Composition::Client) {