diff options
author | 2018-04-18 16:13:31 -0700 | |
---|---|---|
committer | 2018-04-18 16:18:17 -0700 | |
commit | 1a4a981199860f0f9c4738dc426d8349e16b0dd5 (patch) | |
tree | 3581ca62e7f6ad57d8728332b11937869c0f88fa | |
parent | d4e5725d457cf64efd06cfdae66c2ba68441fdac (diff) |
Revert "Add support for render-ahead"
This reverts commit ec100976e0655acaa204c8800dfb83dadae20cc8.
Reason for revert: b/77971494
Test: hwuiunit passes
Change-Id: I2e7dc719d2df1dd939b275496c0edc38e458c434
-rw-r--r-- | libs/hwui/Properties.cpp | 2 | ||||
-rw-r--r-- | libs/hwui/Properties.h | 7 | ||||
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 26 | ||||
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.h | 6 | ||||
-rw-r--r-- | libs/hwui/renderthread/DrawFrameTask.cpp | 5 | ||||
-rw-r--r-- | libs/hwui/renderthread/EglManager.cpp | 11 | ||||
-rw-r--r-- | libs/hwui/renderthread/Frame.h | 3 | ||||
-rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/renderthread/RenderProxy.h | 18 | ||||
-rw-r--r-- | libs/hwui/renderthread/RenderThread.cpp | 19 | ||||
-rw-r--r-- | libs/hwui/tests/common/TestScene.h | 1 | ||||
-rw-r--r-- | libs/hwui/tests/macrobench/TestSceneRunner.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/tests/macrobench/main.cpp | 13 |
13 files changed, 18 insertions, 105 deletions
diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp index 064763f65e09..d284269986d6 100644 --- a/libs/hwui/Properties.cpp +++ b/libs/hwui/Properties.cpp @@ -36,7 +36,6 @@ 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; @@ -136,7 +135,6 @@ 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); diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h index 5376bab50b58..657f9aa5466e 100644 --- a/libs/hwui/Properties.h +++ b/libs/hwui/Properties.h @@ -151,12 +151,6 @@ 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" /** @@ -226,7 +220,6 @@ public: static bool skipEmptyFrames; static bool useBufferAge; static bool enablePartialUpdates; - static bool usePresentTime; // TODO: Move somewhere else? static constexpr float textGamma = 1.45f; diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index 3deed6e0ba77..95ca8d9d2612 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -17,7 +17,6 @@ #include "CanvasContext.h" #include <GpuMemoryTracker.h> -#include "../Properties.h" #include "AnimationContext.h" #include "Caches.h" #include "EglManager.h" @@ -33,6 +32,7 @@ #include "renderstate/Stencil.h" #include "utils/GLUtils.h" #include "utils/TimeUtils.h" +#include "../Properties.h" #include <cutils/properties.h> #include <private/hwui/DrawGlInfo.h> @@ -159,7 +159,6 @@ void CanvasContext::setSurface(sp<Surface>&& surface) { if (hasSurface) { mHaveNewSurface = true; mSwapHistory.clear(); - updateBufferCount(); } else { mRenderThread.removeFrameCallback(this); } @@ -393,9 +392,6 @@ 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); @@ -619,26 +615,6 @@ 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 diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h index 930498af3da7..aaef85a5b1bc 100644 --- a/libs/hwui/renderthread/CanvasContext.h +++ b/libs/hwui/renderthread/CanvasContext.h @@ -78,7 +78,7 @@ public: bool createOrUpdateLayer(RenderNode* node, const DamageAccumulator& dmgAccumulator, ErrorHandler* errorHandler) { return mRenderPipeline->createOrUpdateLayer(node, dmgAccumulator, mWideColorGamut, - errorHandler); + errorHandler); } /** @@ -188,8 +188,6 @@ 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); @@ -202,7 +200,6 @@ private: void freePrefetchedLayers(); bool isSwapChainStuffed(); - void updateBufferCount(); SkRect computeDirtyRect(const Frame& frame, SkRect* dirty); @@ -228,7 +225,6 @@ 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; diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp index 5b0e28125502..778e7689d0f9 100644 --- a/libs/hwui/renderthread/DrawFrameTask.cpp +++ b/libs/hwui/renderthread/DrawFrameTask.cpp @@ -103,8 +103,9 @@ 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)) { diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp index 3a49bebe7936..6e239e357cf6 100644 --- a/libs/hwui/renderthread/EglManager.cpp +++ b/libs/hwui/renderthread/EglManager.cpp @@ -83,7 +83,6 @@ static struct { bool glColorSpace = false; bool scRGB = false; bool contextPriority = false; - bool presentTime = false; } EglExtensions; EglManager::EglManager(RenderThread& thread) @@ -171,7 +170,6 @@ void EglManager::initExtensions() { EglExtensions.scRGB = extensions.has("EGL_EXT_gl_colorspace_scrgb"); #endif EglExtensions.contextPriority = extensions.has("EGL_IMG_context_priority"); - EglExtensions.presentTime = extensions.has("EGL_ANDROID_presentation_time"); } bool EglManager::hasEglContext() { @@ -244,7 +242,7 @@ void EglManager::loadConfigs() { &numConfigs) || numConfigs != 1) { ALOGE("Device claims wide gamut support, cannot find matching config, error = %s", - eglErrorString()); + eglErrorString()); EglExtensions.pixelFormatFloat = false; } } @@ -439,13 +437,6 @@ bool EglManager::swapBuffers(const Frame& frame, const SkRect& screenDirty) { fence(); } - if (EglExtensions.presentTime && Properties::usePresentTime) { - if (!eglPresentationTimeANDROID(mEglDisplay, frame.mSurface, frame.mPresentTime)) { - LOG_ALWAYS_FATAL("Failed to set presentation time on surface %p, error=%s", - (void*)frame.mSurface, eglErrorString()); - } - } - EGLint rects[4]; frame.map(screenDirty, rects); eglSwapBuffersWithDamageKHR(mEglDisplay, frame.mSurface, rects, screenDirty.isEmpty() ? 0 : 1); diff --git a/libs/hwui/renderthread/Frame.h b/libs/hwui/renderthread/Frame.h index 03cf95d797d4..d266faa4f7c9 100644 --- a/libs/hwui/renderthread/Frame.h +++ b/libs/hwui/renderthread/Frame.h @@ -37,8 +37,6 @@ public: // for what this means int32_t bufferAge() const { return mBufferAge; } - void setPresentTime(int64_t presentTime) { mPresentTime = presentTime; } - private: Frame() {} friend class EglManager; @@ -46,7 +44,6 @@ private: int32_t mWidth; int32_t mHeight; int32_t mBufferAge; - int64_t mPresentTime; EGLSurface mSurface; diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index 653ea2808ae7..4b948f8c6b36 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -286,12 +286,6 @@ void RenderProxy::removeFrameMetricsObserver(FrameMetricsObserver* observerPtr) }); } -void RenderProxy::setRenderAheadDepth(int renderAhead) { - mRenderThread.queue().post([ context = mContext, renderAhead ]() { - context->setRenderAheadDepth(renderAhead); - }); -} - int RenderProxy::copySurfaceInto(sp<Surface>& surface, int left, int top, int right, int bottom, SkBitmap* bitmap) { auto& thread = RenderThread::getInstance(); diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h index ca20755711b2..433adeb5eb37 100644 --- a/libs/hwui/renderthread/RenderProxy.h +++ b/libs/hwui/renderthread/RenderProxy.h @@ -117,23 +117,7 @@ public: ANDROID_API void addFrameMetricsObserver(FrameMetricsObserver* observer); ANDROID_API void removeFrameMetricsObserver(FrameMetricsObserver* observer); - - /** - * Sets a render-ahead depth on the backing renderer. This will increase latency by - * <swapInterval> * renderAhead and increase memory usage by (3 + renderAhead) * <resolution>. - * In return the renderer will be less susceptible to jitter, resulting in a smoother animation. - * - * Not recommended to use in response to anything touch driven, but for canned animations - * where latency is not a concern careful use may be beneficial. - * - * Note that when increasing this there will be a frame gap of N frames where N is - * renderAhead - <current renderAhead>. When decreasing this if there are any pending - * frames they will retain their prior renderAhead value, so it will take a few frames - * for the decrease to flush through. - * - * @param renderAhead How far to render ahead, must be in the range [0..2] - */ - ANDROID_API void setRenderAheadDepth(int renderAhead); + ANDROID_API long getDroppedFrameReportCount(); ANDROID_API static int copySurfaceInto(sp<Surface>& surface, int left, int top, int right, int bottom, SkBitmap* bitmap); diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp index 84f43ec1a206..5e067dafed03 100644 --- a/libs/hwui/renderthread/RenderThread.cpp +++ b/libs/hwui/renderthread/RenderThread.cpp @@ -24,8 +24,8 @@ #include "hwui/Bitmap.h" #include "pipeline/skia/SkiaOpenGLPipeline.h" #include "pipeline/skia/SkiaOpenGLReadback.h" -#include "pipeline/skia/SkiaVulkanPipeline.h" #include "pipeline/skia/SkiaVulkanReadback.h" +#include "pipeline/skia/SkiaVulkanPipeline.h" #include "renderstate/RenderState.h" #include "utils/FatVector.h" #include "utils/TimeUtils.h" @@ -91,11 +91,14 @@ public: DummyVsyncSource(RenderThread* renderThread) : mRenderThread(renderThread) {} virtual void requestNextVsync() override { - mRenderThread->queue().postDelayed(16_ms, - [this]() { mRenderThread->drainDisplayEventQueue(); }); + mRenderThread->queue().postDelayed(16_ms, [this]() { + mRenderThread->drainDisplayEventQueue(); + }); } - virtual nsecs_t latestVsyncEvent() override { return systemTime(CLOCK_MONOTONIC); } + virtual nsecs_t latestVsyncEvent() override { + return systemTime(CLOCK_MONOTONIC); + } private: RenderThread* mRenderThread; @@ -142,13 +145,13 @@ void RenderThread::initializeDisplayEventReceiver() { auto receiver = std::make_unique<DisplayEventReceiver>(); status_t status = receiver->initCheck(); LOG_ALWAYS_FATAL_IF(status != NO_ERROR, - "Initialization of DisplayEventReceiver " - "failed with status: %d", - status); + "Initialization of DisplayEventReceiver " + "failed with status: %d", + status); // Register the FD mLooper->addFd(receiver->getFd(), 0, Looper::EVENT_INPUT, - RenderThread::displayEventReceiverCallback, this); + RenderThread::displayEventReceiverCallback, this); mVsyncSource = new DisplayEventReceiverWrapper(std::move(receiver)); } else { mVsyncSource = new DummyVsyncSource(this); diff --git a/libs/hwui/tests/common/TestScene.h b/libs/hwui/tests/common/TestScene.h index 74a039b3d090..91022cfe734b 100644 --- a/libs/hwui/tests/common/TestScene.h +++ b/libs/hwui/tests/common/TestScene.h @@ -38,7 +38,6 @@ public: int count = 0; int reportFrametimeWeight = 0; bool renderOffscreen = true; - int renderAhead = 0; }; template <class T> diff --git a/libs/hwui/tests/macrobench/TestSceneRunner.cpp b/libs/hwui/tests/macrobench/TestSceneRunner.cpp index 854a449c73a6..9428f532434a 100644 --- a/libs/hwui/tests/macrobench/TestSceneRunner.cpp +++ b/libs/hwui/tests/macrobench/TestSceneRunner.cpp @@ -153,12 +153,6 @@ void run(const TestScene::Info& info, const TestScene::Options& opts, proxy->resetProfileInfo(); proxy->fence(); - if (opts.renderAhead) { - // Need to let the queue drain to see render-ahead in action. - usleep(33000); - } - proxy->setRenderAheadDepth(opts.renderAhead); - ModifiedMovingAverage<double> avgMs(opts.reportFrametimeWeight); nsecs_t start = systemTime(CLOCK_MONOTONIC); diff --git a/libs/hwui/tests/macrobench/main.cpp b/libs/hwui/tests/macrobench/main.cpp index 6f3d9221f7e2..b74d3595e964 100644 --- a/libs/hwui/tests/macrobench/main.cpp +++ b/libs/hwui/tests/macrobench/main.cpp @@ -67,7 +67,6 @@ OPTIONS: are offscreen rendered --benchmark_format Set output format. Possible values are tabular, json, csv --renderer=TYPE Sets the render pipeline to use. May be skiagl or skiavk - --render-ahead=NUM Sets how far to render-ahead. Must be 0 (default), 1, or 2. )"); } @@ -171,7 +170,6 @@ enum { Onscreen, Offscreen, Renderer, - RenderAhead, }; } @@ -187,7 +185,6 @@ static const struct option LONG_OPTIONS[] = { {"onscreen", no_argument, nullptr, LongOpts::Onscreen}, {"offscreen", no_argument, nullptr, LongOpts::Offscreen}, {"renderer", required_argument, nullptr, LongOpts::Renderer}, - {"render-ahead", required_argument, nullptr, LongOpts::RenderAhead}, {0, 0, 0, 0}}; static const char* SHORT_OPTIONS = "c:r:h"; @@ -286,16 +283,6 @@ void parseOptions(int argc, char* argv[]) { gOpts.renderOffscreen = true; break; - case LongOpts::RenderAhead: - if (!optarg) { - error = true; - } - gOpts.renderAhead = atoi(optarg); - if (gOpts.renderAhead < 0 || gOpts.renderAhead > 2) { - error = true; - } - break; - case 'h': printHelp(); exit(EXIT_SUCCESS); |