Loading libs/hwui/renderthread/CanvasContext.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -149,6 +149,8 @@ void CanvasContext::setStopped(bool stopped) { if (mEglManager.isCurrent(mEglSurface)) { if (mEglManager.isCurrent(mEglSurface)) { mEglManager.makeCurrent(EGL_NO_SURFACE); mEglManager.makeCurrent(EGL_NO_SURFACE); } } } else if (mIsDirty && hasSurface()) { mRenderThread.postFrameCallback(this); } } } } } } Loading Loading @@ -231,6 +233,8 @@ void CanvasContext::prepareTree(TreeInfo& info, int64_t* uiFrameInfo, freePrefetchedLayers(info.observer); freePrefetchedLayers(info.observer); GL_CHECKPOINT(MODERATE); GL_CHECKPOINT(MODERATE); mIsDirty = true; if (CC_UNLIKELY(!mNativeSurface.get())) { if (CC_UNLIKELY(!mNativeSurface.get())) { mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame); mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame); info.out.canDrawThisFrame = false; info.out.canDrawThisFrame = false; Loading Loading @@ -503,6 +507,7 @@ void CanvasContext::draw() { // Even if we decided to cancel the frame, from the perspective of jank // Even if we decided to cancel the frame, from the perspective of jank // metrics the frame was swapped at this point // metrics the frame was swapped at this point mCurrentFrameInfo->markSwapBuffers(); mCurrentFrameInfo->markSwapBuffers(); mIsDirty = false; if (drew || mEglManager.damageRequiresSwap()) { if (drew || mEglManager.damageRequiresSwap()) { if (CC_UNLIKELY(!mEglManager.swapBuffers(frame, screenDirty))) { if (CC_UNLIKELY(!mEglManager.swapBuffers(frame, screenDirty))) { Loading libs/hwui/renderthread/CanvasContext.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -187,7 +187,12 @@ private: EglManager& mEglManager; EglManager& mEglManager; sp<Surface> mNativeSurface; sp<Surface> mNativeSurface; EGLSurface mEglSurface = EGL_NO_SURFACE; EGLSurface mEglSurface = EGL_NO_SURFACE; // stopped indicates the CanvasContext will reject actual redraw operations, // and defer repaint until it is un-stopped bool mStopped = false; bool mStopped = false; // CanvasContext is dirty if it has received an update that it has not // painted onto its surface. bool mIsDirty = false; bool mBufferPreserved = false; bool mBufferPreserved = false; SwapBehavior mSwapBehavior = kSwap_default; SwapBehavior mSwapBehavior = kSwap_default; struct SwapHistory { struct SwapHistory { Loading Loading
libs/hwui/renderthread/CanvasContext.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -149,6 +149,8 @@ void CanvasContext::setStopped(bool stopped) { if (mEglManager.isCurrent(mEglSurface)) { if (mEglManager.isCurrent(mEglSurface)) { mEglManager.makeCurrent(EGL_NO_SURFACE); mEglManager.makeCurrent(EGL_NO_SURFACE); } } } else if (mIsDirty && hasSurface()) { mRenderThread.postFrameCallback(this); } } } } } } Loading Loading @@ -231,6 +233,8 @@ void CanvasContext::prepareTree(TreeInfo& info, int64_t* uiFrameInfo, freePrefetchedLayers(info.observer); freePrefetchedLayers(info.observer); GL_CHECKPOINT(MODERATE); GL_CHECKPOINT(MODERATE); mIsDirty = true; if (CC_UNLIKELY(!mNativeSurface.get())) { if (CC_UNLIKELY(!mNativeSurface.get())) { mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame); mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame); info.out.canDrawThisFrame = false; info.out.canDrawThisFrame = false; Loading Loading @@ -503,6 +507,7 @@ void CanvasContext::draw() { // Even if we decided to cancel the frame, from the perspective of jank // Even if we decided to cancel the frame, from the perspective of jank // metrics the frame was swapped at this point // metrics the frame was swapped at this point mCurrentFrameInfo->markSwapBuffers(); mCurrentFrameInfo->markSwapBuffers(); mIsDirty = false; if (drew || mEglManager.damageRequiresSwap()) { if (drew || mEglManager.damageRequiresSwap()) { if (CC_UNLIKELY(!mEglManager.swapBuffers(frame, screenDirty))) { if (CC_UNLIKELY(!mEglManager.swapBuffers(frame, screenDirty))) { Loading
libs/hwui/renderthread/CanvasContext.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -187,7 +187,12 @@ private: EglManager& mEglManager; EglManager& mEglManager; sp<Surface> mNativeSurface; sp<Surface> mNativeSurface; EGLSurface mEglSurface = EGL_NO_SURFACE; EGLSurface mEglSurface = EGL_NO_SURFACE; // stopped indicates the CanvasContext will reject actual redraw operations, // and defer repaint until it is un-stopped bool mStopped = false; bool mStopped = false; // CanvasContext is dirty if it has received an update that it has not // painted onto its surface. bool mIsDirty = false; bool mBufferPreserved = false; bool mBufferPreserved = false; SwapBehavior mSwapBehavior = kSwap_default; SwapBehavior mSwapBehavior = kSwap_default; struct SwapHistory { struct SwapHistory { Loading