Loading libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp +1 −16 Original line number Diff line number Diff line Loading @@ -157,21 +157,7 @@ void SkiaOpenGLPipeline::onStop() { } } static void setBufferCount(ANativeWindow* window, uint32_t extraBuffers) { int query_value; int err = window->query(window, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &query_value); if (err != 0 || query_value < 0) { ALOGE("window->query failed: %s (%d) value=%d", strerror(-err), err, query_value); return; } auto min_undequeued_buffers = static_cast<uint32_t>(query_value); int bufferCount = min_undequeued_buffers + 2 + extraBuffers; native_window_set_buffer_count(window, bufferCount); } bool SkiaOpenGLPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBehavior, uint32_t extraBuffers) { bool SkiaOpenGLPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBehavior) { if (mEglSurface != EGL_NO_SURFACE) { mEglManager.destroySurface(mEglSurface); mEglSurface = EGL_NO_SURFACE; Loading @@ -189,7 +175,6 @@ bool SkiaOpenGLPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBeh if (mEglSurface != EGL_NO_SURFACE) { const bool preserveBuffer = (swapBehavior != SwapBehavior::kSwap_discardBuffer); mBufferPreserved = mEglManager.setPreserveBuffer(mEglSurface, preserveBuffer); setBufferCount(surface, extraBuffers); return true; } Loading libs/hwui/pipeline/skia/SkiaOpenGLPipeline.h +1 −2 Original line number Diff line number Diff line Loading @@ -45,8 +45,7 @@ public: bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty, FrameInfo* currentFrameInfo, bool* requireSwap) override; DeferredLayerUpdater* createTextureLayer() override; bool setSurface(ANativeWindow* surface, renderthread::SwapBehavior swapBehavior, uint32_t extraBuffers) override; bool setSurface(ANativeWindow* surface, renderthread::SwapBehavior swapBehavior) override; void onStop() override; bool isSurfaceReady() override; bool isContextReady() override; Loading libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -116,8 +116,7 @@ DeferredLayerUpdater* SkiaVulkanPipeline::createTextureLayer() { void SkiaVulkanPipeline::onStop() {} bool SkiaVulkanPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBehavior, uint32_t extraBuffers) { bool SkiaVulkanPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBehavior) { if (mVkSurface) { mVkManager.destroySurface(mVkSurface); mVkSurface = nullptr; Loading @@ -127,7 +126,7 @@ bool SkiaVulkanPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBeh mRenderThread.requireVkContext(); mVkSurface = mVkManager.createSurface(surface, mColorMode, mSurfaceColorSpace, mSurfaceColorType, mRenderThread.getGrContext(), extraBuffers); mRenderThread.getGrContext(), 0); } return mVkSurface != nullptr; Loading libs/hwui/pipeline/skia/SkiaVulkanPipeline.h +1 −2 Original line number Diff line number Diff line Loading @@ -42,8 +42,7 @@ public: bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty, FrameInfo* currentFrameInfo, bool* requireSwap) override; DeferredLayerUpdater* createTextureLayer() override; bool setSurface(ANativeWindow* surface, renderthread::SwapBehavior swapBehavior, uint32_t extraBuffers) override; bool setSurface(ANativeWindow* surface, renderthread::SwapBehavior swapBehavior) override; void onStop() override; bool isSurfaceReady() override; bool isContextReady() override; Loading libs/hwui/renderthread/CanvasContext.cpp +27 −10 Original line number Diff line number Diff line Loading @@ -139,9 +139,30 @@ void CanvasContext::destroy() { mAnimationContext->destroy(); } static void setBufferCount(ANativeWindow* window, uint32_t extraBuffers) { int query_value; int err = window->query(window, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &query_value); if (err != 0 || query_value < 0) { ALOGE("window->query failed: %s (%d) value=%d", strerror(-err), err, query_value); return; } auto min_undequeued_buffers = static_cast<uint32_t>(query_value); int bufferCount = min_undequeued_buffers + 2 + extraBuffers; native_window_set_buffer_count(window, bufferCount); } void CanvasContext::setSurface(ANativeWindow* window, bool enableTimeout) { ATRACE_CALL(); if (mRenderAheadDepth == 0 && DeviceInfo::get()->getMaxRefreshRate() > 66.6f) { mFixedRenderAhead = false; mRenderAheadCapacity = 1; } else { mFixedRenderAhead = true; mRenderAheadCapacity = mRenderAheadDepth; } if (window) { mNativeSurface = std::make_unique<ReliableSurface>(window); mNativeSurface->init(); Loading @@ -149,21 +170,17 @@ void CanvasContext::setSurface(ANativeWindow* window, bool enableTimeout) { // TODO: Fix error handling & re-shorten timeout ANativeWindow_setDequeueTimeout(window, 4000_ms); } mNativeSurface->setExtraBufferCount(mRenderAheadCapacity); } else { mNativeSurface = nullptr; } if (mRenderAheadDepth == 0 && DeviceInfo::get()->getMaxRefreshRate() > 66.6f) { mFixedRenderAhead = false; mRenderAheadCapacity = 1; } else { mFixedRenderAhead = true; mRenderAheadCapacity = mRenderAheadDepth; } bool hasSurface = mRenderPipeline->setSurface( mNativeSurface ? mNativeSurface->getNativeWindow() : nullptr, mSwapBehavior, mRenderAheadCapacity); mNativeSurface ? mNativeSurface->getNativeWindow() : nullptr, mSwapBehavior); if (mNativeSurface && !mNativeSurface->didSetExtraBuffers()) { setBufferCount(mNativeSurface->getNativeWindow(), mRenderAheadCapacity); } mFrameNumber = -1; Loading Loading
libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp +1 −16 Original line number Diff line number Diff line Loading @@ -157,21 +157,7 @@ void SkiaOpenGLPipeline::onStop() { } } static void setBufferCount(ANativeWindow* window, uint32_t extraBuffers) { int query_value; int err = window->query(window, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &query_value); if (err != 0 || query_value < 0) { ALOGE("window->query failed: %s (%d) value=%d", strerror(-err), err, query_value); return; } auto min_undequeued_buffers = static_cast<uint32_t>(query_value); int bufferCount = min_undequeued_buffers + 2 + extraBuffers; native_window_set_buffer_count(window, bufferCount); } bool SkiaOpenGLPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBehavior, uint32_t extraBuffers) { bool SkiaOpenGLPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBehavior) { if (mEglSurface != EGL_NO_SURFACE) { mEglManager.destroySurface(mEglSurface); mEglSurface = EGL_NO_SURFACE; Loading @@ -189,7 +175,6 @@ bool SkiaOpenGLPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBeh if (mEglSurface != EGL_NO_SURFACE) { const bool preserveBuffer = (swapBehavior != SwapBehavior::kSwap_discardBuffer); mBufferPreserved = mEglManager.setPreserveBuffer(mEglSurface, preserveBuffer); setBufferCount(surface, extraBuffers); return true; } Loading
libs/hwui/pipeline/skia/SkiaOpenGLPipeline.h +1 −2 Original line number Diff line number Diff line Loading @@ -45,8 +45,7 @@ public: bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty, FrameInfo* currentFrameInfo, bool* requireSwap) override; DeferredLayerUpdater* createTextureLayer() override; bool setSurface(ANativeWindow* surface, renderthread::SwapBehavior swapBehavior, uint32_t extraBuffers) override; bool setSurface(ANativeWindow* surface, renderthread::SwapBehavior swapBehavior) override; void onStop() override; bool isSurfaceReady() override; bool isContextReady() override; Loading
libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -116,8 +116,7 @@ DeferredLayerUpdater* SkiaVulkanPipeline::createTextureLayer() { void SkiaVulkanPipeline::onStop() {} bool SkiaVulkanPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBehavior, uint32_t extraBuffers) { bool SkiaVulkanPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBehavior) { if (mVkSurface) { mVkManager.destroySurface(mVkSurface); mVkSurface = nullptr; Loading @@ -127,7 +126,7 @@ bool SkiaVulkanPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBeh mRenderThread.requireVkContext(); mVkSurface = mVkManager.createSurface(surface, mColorMode, mSurfaceColorSpace, mSurfaceColorType, mRenderThread.getGrContext(), extraBuffers); mRenderThread.getGrContext(), 0); } return mVkSurface != nullptr; Loading
libs/hwui/pipeline/skia/SkiaVulkanPipeline.h +1 −2 Original line number Diff line number Diff line Loading @@ -42,8 +42,7 @@ public: bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty, FrameInfo* currentFrameInfo, bool* requireSwap) override; DeferredLayerUpdater* createTextureLayer() override; bool setSurface(ANativeWindow* surface, renderthread::SwapBehavior swapBehavior, uint32_t extraBuffers) override; bool setSurface(ANativeWindow* surface, renderthread::SwapBehavior swapBehavior) override; void onStop() override; bool isSurfaceReady() override; bool isContextReady() override; Loading
libs/hwui/renderthread/CanvasContext.cpp +27 −10 Original line number Diff line number Diff line Loading @@ -139,9 +139,30 @@ void CanvasContext::destroy() { mAnimationContext->destroy(); } static void setBufferCount(ANativeWindow* window, uint32_t extraBuffers) { int query_value; int err = window->query(window, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &query_value); if (err != 0 || query_value < 0) { ALOGE("window->query failed: %s (%d) value=%d", strerror(-err), err, query_value); return; } auto min_undequeued_buffers = static_cast<uint32_t>(query_value); int bufferCount = min_undequeued_buffers + 2 + extraBuffers; native_window_set_buffer_count(window, bufferCount); } void CanvasContext::setSurface(ANativeWindow* window, bool enableTimeout) { ATRACE_CALL(); if (mRenderAheadDepth == 0 && DeviceInfo::get()->getMaxRefreshRate() > 66.6f) { mFixedRenderAhead = false; mRenderAheadCapacity = 1; } else { mFixedRenderAhead = true; mRenderAheadCapacity = mRenderAheadDepth; } if (window) { mNativeSurface = std::make_unique<ReliableSurface>(window); mNativeSurface->init(); Loading @@ -149,21 +170,17 @@ void CanvasContext::setSurface(ANativeWindow* window, bool enableTimeout) { // TODO: Fix error handling & re-shorten timeout ANativeWindow_setDequeueTimeout(window, 4000_ms); } mNativeSurface->setExtraBufferCount(mRenderAheadCapacity); } else { mNativeSurface = nullptr; } if (mRenderAheadDepth == 0 && DeviceInfo::get()->getMaxRefreshRate() > 66.6f) { mFixedRenderAhead = false; mRenderAheadCapacity = 1; } else { mFixedRenderAhead = true; mRenderAheadCapacity = mRenderAheadDepth; } bool hasSurface = mRenderPipeline->setSurface( mNativeSurface ? mNativeSurface->getNativeWindow() : nullptr, mSwapBehavior, mRenderAheadCapacity); mNativeSurface ? mNativeSurface->getNativeWindow() : nullptr, mSwapBehavior); if (mNativeSurface && !mNativeSurface->didSetExtraBuffers()) { setBufferCount(mNativeSurface->getNativeWindow(), mRenderAheadCapacity); } mFrameNumber = -1; Loading