OSDN Git Service

Always enable vsync thread when requested by surfaceflinger
authorMichael Goffioul <michael.goffioul@lincor.com>
Wed, 9 Oct 2019 15:58:16 +0000 (11:58 -0400)
committerMichael Goffioul <michael.goffioul@lincor.com>
Wed, 9 Oct 2019 15:58:16 +0000 (11:58 -0400)
There is an issue with surfaceflinger at startup whereby it needs at
least 2 vsync events in order to compute the vsync period. If these
events do not come after 1s timeout, it'll fake a vsync event, leading
to a crash (mod-by-0 exception due to vsync period being 0).

DrmDisplay.cpp

index 528341e..6274f94 100644 (file)
@@ -281,9 +281,7 @@ void DrmDisplay::disable() {
 
 void DrmDisplay::enableVsync() {
     mVsyncEnabled = true;
-    if (mModeSet) {
-        mVsyncThread.enable();
-    }
+    mVsyncThread.enable();
 }
 
 void DrmDisplay::disableVsync() {
@@ -316,8 +314,6 @@ void DrmDisplay::present(buffer_handle_t buffer) {
                 << " for display " << *this;
         } else {
             mModeSet = true;
-            if (mVsyncEnabled)
-                mVsyncThread.enable();
         }
     }
 }