Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9707f4df authored by Riley Andrews's avatar Riley Andrews
Browse files

Add glFlush in surfaceflinger screenshot code.

After creating a syncKHR object with type EGL_SYNC_NATIVE_FENCE_ANDROID,
glFlush must be called before the EGL_SYNC_NATIVE_FENCE_FD_ANDROID attribute
is populated with a sync fd. We currently call eglDupNativeFenceFDANDROID
before issuing the flush.

Bug 18052459
Taken verbatim from matthew.k.gumbel@intel.com.

Change-Id: I3781d14f92862076e2bca7d27341a6dc6e7e3775
parent afe2b1fa
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -219,6 +219,10 @@ void RenderEngine::fillRegionWithColor(const Region& region, uint32_t height,
    drawMesh(mesh);
}

void RenderEngine::flush() {
    glFlush();
}

void RenderEngine::clearWithColor(float red, float green, float blue, float alpha) {
    glClearColor(red, green, blue, alpha);
    glClear(GL_COLOR_BUFFER_BIT);
+1 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ public:
    virtual void dump(String8& result);

    // helpers
    void flush();
    void clearWithColor(float red, float green, float blue, float alpha);
    void fillRegionWithColor(const Region& region, uint32_t height,
            float red, float green, float blue, float alpha);
+2 −0
Original line number Diff line number Diff line
@@ -3201,6 +3201,8 @@ status_t SurfaceFlinger::captureScreenImplLocked(
                        EGLSyncKHR sync;
                        if (!DEBUG_SCREENSHOTS) {
                           sync = eglCreateSyncKHR(mEGLDisplay, EGL_SYNC_NATIVE_FENCE_ANDROID, NULL);
                           // native fence fd will not be populated until flush() is done.
                           getRenderEngine().flush();
                        } else {
                            sync = EGL_NO_SYNC_KHR;
                        }