Loading libs/hwui/Properties.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ bool Properties::showDirtyRegions = false; bool Properties::skipEmptyFrames = true; bool Properties::useBufferAge = true; bool Properties::enablePartialUpdates = true; bool Properties::usePresentTime = true; DebugLevel Properties::debugLevel = kDebugDisabled; OverdrawColorSet Properties::overdrawColorSet = OverdrawColorSet::Default; Loading Loading @@ -135,6 +136,7 @@ bool Properties::load() { skipEmptyFrames = property_get_bool(PROPERTY_SKIP_EMPTY_DAMAGE, true); useBufferAge = property_get_bool(PROPERTY_USE_BUFFER_AGE, true); enablePartialUpdates = property_get_bool(PROPERTY_ENABLE_PARTIAL_UPDATES, true); usePresentTime = property_get_bool(PROPERTY_USE_PRESENT_TIME, true); filterOutTestOverhead = property_get_bool(PROPERTY_FILTER_TEST_OVERHEAD, false); Loading libs/hwui/Properties.h +7 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,12 @@ enum DebugLevel { */ #define PROPERTY_ENABLE_PARTIAL_UPDATES "debug.hwui.use_partial_updates" /** * Setting this to "false" will disable the use of the EGL_ANDROID_presentation_time extension * and prevents more precise control over swap behavior & timings. */ #define PROPERTY_USE_PRESENT_TIME "debug.hwui.use_present_time" #define PROPERTY_FILTER_TEST_OVERHEAD "debug.hwui.filter_test_overhead" /** Loading Loading @@ -220,6 +226,7 @@ public: static bool skipEmptyFrames; static bool useBufferAge; static bool enablePartialUpdates; static bool usePresentTime; // TODO: Move somewhere else? static constexpr float textGamma = 1.45f; Loading libs/hwui/renderthread/CanvasContext.cpp +25 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include "CanvasContext.h" #include <GpuMemoryTracker.h> #include "../Properties.h" #include "AnimationContext.h" #include "Caches.h" #include "EglManager.h" Loading @@ -34,7 +35,6 @@ #include "renderstate/Stencil.h" #include "utils/GLUtils.h" #include "utils/TimeUtils.h" #include "../Properties.h" #include <cutils/properties.h> #include <google/protobuf/io/zero_copy_stream_impl.h> Loading Loading @@ -194,6 +194,7 @@ void CanvasContext::setSurface(sp<Surface>&& surface) { if (hasSurface) { mHaveNewSurface = true; mSwapHistory.clear(); updateBufferCount(); } else { mRenderThread.removeFrameCallback(this); } Loading Loading @@ -427,6 +428,9 @@ void CanvasContext::draw() { waitOnFences(); frame.setPresentTime(mCurrentFrameInfo->get(FrameInfoIndex::Vsync) + (mRenderThread.timeLord().frameIntervalNanos() * (mRenderAheadDepth + 1))); bool requireSwap = false; bool didSwap = mRenderPipeline->swapBuffers(frame, drew, windowDirty, mCurrentFrameInfo, &requireSwap); Loading Loading @@ -705,6 +709,26 @@ int64_t CanvasContext::getFrameNumber() { return mFrameNumber; } void overrideBufferCount(const sp<Surface>& surface, int bufferCount) { struct SurfaceExposer : Surface { using Surface::setBufferCount; }; // Protected is just a sign, not a cop ((*surface.get()).*&SurfaceExposer::setBufferCount)(bufferCount); } void CanvasContext::updateBufferCount() { overrideBufferCount(mNativeSurface, 3 + mRenderAheadDepth); } void CanvasContext::setRenderAheadDepth(int renderAhead) { if (renderAhead < 0 || renderAhead > 2 || renderAhead == mRenderAheadDepth) { return; } mRenderAheadDepth = renderAhead; updateBufferCount(); } SkRect CanvasContext::computeDirtyRect(const Frame& frame, SkRect* dirty) { if (frame.width() != mLastFrameWidth || frame.height() != mLastFrameHeight) { // can't rely on prior content of window if viewport size changes Loading libs/hwui/renderthread/CanvasContext.h +5 −1 Original line number Diff line number Diff line Loading @@ -190,6 +190,8 @@ public: IRenderPipeline* getRenderPipeline() { return mRenderPipeline.get(); } void setRenderAheadDepth(int renderAhead); private: CanvasContext(RenderThread& thread, bool translucent, RenderNode* rootRenderNode, IContextFactory* contextFactory, std::unique_ptr<IRenderPipeline> renderPipeline); Loading @@ -202,6 +204,7 @@ private: void freePrefetchedLayers(); bool isSwapChainStuffed(); void updateBufferCount(); SkRect computeDirtyRect(const Frame& frame, SkRect* dirty); Loading @@ -227,6 +230,7 @@ private: RingBuffer<SwapHistory, 3> mSwapHistory; int64_t mFrameNumber = -1; int mRenderAheadDepth = 0; // last vsync for a dropped frame due to stuffed queue nsecs_t mLastDropVsync = 0; Loading libs/hwui/renderthread/DrawFrameTask.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -103,9 +103,8 @@ void DrawFrameTask::run() { // Even if we aren't drawing this vsync pulse the next frame number will still be accurate if (CC_UNLIKELY(callback)) { context->enqueueFrameWork([callback, frameNr = context->getFrameNumber()]() { callback(frameNr); }); context->enqueueFrameWork( [ callback, frameNr = context->getFrameNumber() ]() { callback(frameNr); }); } if (CC_LIKELY(canDrawThisFrame)) { Loading Loading
libs/hwui/Properties.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ bool Properties::showDirtyRegions = false; bool Properties::skipEmptyFrames = true; bool Properties::useBufferAge = true; bool Properties::enablePartialUpdates = true; bool Properties::usePresentTime = true; DebugLevel Properties::debugLevel = kDebugDisabled; OverdrawColorSet Properties::overdrawColorSet = OverdrawColorSet::Default; Loading Loading @@ -135,6 +136,7 @@ bool Properties::load() { skipEmptyFrames = property_get_bool(PROPERTY_SKIP_EMPTY_DAMAGE, true); useBufferAge = property_get_bool(PROPERTY_USE_BUFFER_AGE, true); enablePartialUpdates = property_get_bool(PROPERTY_ENABLE_PARTIAL_UPDATES, true); usePresentTime = property_get_bool(PROPERTY_USE_PRESENT_TIME, true); filterOutTestOverhead = property_get_bool(PROPERTY_FILTER_TEST_OVERHEAD, false); Loading
libs/hwui/Properties.h +7 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,12 @@ enum DebugLevel { */ #define PROPERTY_ENABLE_PARTIAL_UPDATES "debug.hwui.use_partial_updates" /** * Setting this to "false" will disable the use of the EGL_ANDROID_presentation_time extension * and prevents more precise control over swap behavior & timings. */ #define PROPERTY_USE_PRESENT_TIME "debug.hwui.use_present_time" #define PROPERTY_FILTER_TEST_OVERHEAD "debug.hwui.filter_test_overhead" /** Loading Loading @@ -220,6 +226,7 @@ public: static bool skipEmptyFrames; static bool useBufferAge; static bool enablePartialUpdates; static bool usePresentTime; // TODO: Move somewhere else? static constexpr float textGamma = 1.45f; Loading
libs/hwui/renderthread/CanvasContext.cpp +25 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include "CanvasContext.h" #include <GpuMemoryTracker.h> #include "../Properties.h" #include "AnimationContext.h" #include "Caches.h" #include "EglManager.h" Loading @@ -34,7 +35,6 @@ #include "renderstate/Stencil.h" #include "utils/GLUtils.h" #include "utils/TimeUtils.h" #include "../Properties.h" #include <cutils/properties.h> #include <google/protobuf/io/zero_copy_stream_impl.h> Loading Loading @@ -194,6 +194,7 @@ void CanvasContext::setSurface(sp<Surface>&& surface) { if (hasSurface) { mHaveNewSurface = true; mSwapHistory.clear(); updateBufferCount(); } else { mRenderThread.removeFrameCallback(this); } Loading Loading @@ -427,6 +428,9 @@ void CanvasContext::draw() { waitOnFences(); frame.setPresentTime(mCurrentFrameInfo->get(FrameInfoIndex::Vsync) + (mRenderThread.timeLord().frameIntervalNanos() * (mRenderAheadDepth + 1))); bool requireSwap = false; bool didSwap = mRenderPipeline->swapBuffers(frame, drew, windowDirty, mCurrentFrameInfo, &requireSwap); Loading Loading @@ -705,6 +709,26 @@ int64_t CanvasContext::getFrameNumber() { return mFrameNumber; } void overrideBufferCount(const sp<Surface>& surface, int bufferCount) { struct SurfaceExposer : Surface { using Surface::setBufferCount; }; // Protected is just a sign, not a cop ((*surface.get()).*&SurfaceExposer::setBufferCount)(bufferCount); } void CanvasContext::updateBufferCount() { overrideBufferCount(mNativeSurface, 3 + mRenderAheadDepth); } void CanvasContext::setRenderAheadDepth(int renderAhead) { if (renderAhead < 0 || renderAhead > 2 || renderAhead == mRenderAheadDepth) { return; } mRenderAheadDepth = renderAhead; updateBufferCount(); } SkRect CanvasContext::computeDirtyRect(const Frame& frame, SkRect* dirty) { if (frame.width() != mLastFrameWidth || frame.height() != mLastFrameHeight) { // can't rely on prior content of window if viewport size changes Loading
libs/hwui/renderthread/CanvasContext.h +5 −1 Original line number Diff line number Diff line Loading @@ -190,6 +190,8 @@ public: IRenderPipeline* getRenderPipeline() { return mRenderPipeline.get(); } void setRenderAheadDepth(int renderAhead); private: CanvasContext(RenderThread& thread, bool translucent, RenderNode* rootRenderNode, IContextFactory* contextFactory, std::unique_ptr<IRenderPipeline> renderPipeline); Loading @@ -202,6 +204,7 @@ private: void freePrefetchedLayers(); bool isSwapChainStuffed(); void updateBufferCount(); SkRect computeDirtyRect(const Frame& frame, SkRect* dirty); Loading @@ -227,6 +230,7 @@ private: RingBuffer<SwapHistory, 3> mSwapHistory; int64_t mFrameNumber = -1; int mRenderAheadDepth = 0; // last vsync for a dropped frame due to stuffed queue nsecs_t mLastDropVsync = 0; Loading
libs/hwui/renderthread/DrawFrameTask.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -103,9 +103,8 @@ void DrawFrameTask::run() { // Even if we aren't drawing this vsync pulse the next frame number will still be accurate if (CC_UNLIKELY(callback)) { context->enqueueFrameWork([callback, frameNr = context->getFrameNumber()]() { callback(frameNr); }); context->enqueueFrameWork( [ callback, frameNr = context->getFrameNumber() ]() { callback(frameNr); }); } if (CC_LIKELY(canDrawThisFrame)) { Loading