From 18e9484ad5b5755757dc6badb986017a088a9c6b Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Mon, 15 May 2017 13:06:44 -0400 Subject: [PATCH] Rename finishOpList to finishFlush and call it less frequently It is expected that this will fix the Vulkan perf regression associated with splitting up the opLists Change-Id: I1bbb6f71745bb08d4a8c2f7810e5ab84cca75e84 Reviewed-on: https://skia-review.googlesource.com/16901 Commit-Queue: Robert Phillips Reviewed-by: Greg Daniel --- src/gpu/GrDrawingManager.cpp | 11 ++++------- src/gpu/GrGpu.h | 4 ++-- src/gpu/GrRenderTargetOpList.cpp | 1 - src/gpu/GrTextureOpList.cpp | 7 ++----- src/gpu/GrTextureOpList.h | 3 +-- src/gpu/vk/GrVkGpu.cpp | 2 +- src/gpu/vk/GrVkGpu.h | 2 +- 7 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp index 0dc78ecb1e..9c49ab88de 100644 --- a/src/gpu/GrDrawingManager.cpp +++ b/src/gpu/GrDrawingManager.cpp @@ -155,15 +155,13 @@ void GrDrawingManager::internalFlush(GrSurfaceProxy*, GrResourceCache::FlushType if (fOpLists[i]->executeOps(&fFlushState)) { flushed = true; } + fOpLists[i]->reset(); } + fOpLists.reset(); SkASSERT(fFlushState.nextDrawToken() == fFlushState.nextTokenToFlush()); - for (int i = 0; i < fOpLists.count(); ++i) { - fOpLists[i]->reset(); - } - - fOpLists.reset(); + fContext->getGpu()->finishFlush(); fFlushState.reset(); // We always have to notify the cache when it requested a flush so it can reset its state. @@ -230,8 +228,7 @@ sk_sp GrDrawingManager::newTextureOpList(GrTextureProxy* textur fOpLists.back()->makeClosed(*fContext->caps()); } - sk_sp opList(new GrTextureOpList(textureProxy, fContext->getGpu(), - fContext->getAuditTrail())); + sk_sp opList(new GrTextureOpList(textureProxy, fContext->getAuditTrail())); SkASSERT(textureProxy->getLastOpList() == opList.get()); diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index f1efadb659..abaf684a1e 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -376,9 +376,9 @@ public: const GrGpuCommandBuffer::LoadAndStoreInfo& colorInfo, const GrGpuCommandBuffer::LoadAndStoreInfo& stencilInfo) = 0; - // Called by GrOpList when flushing. + // Called by GrDrawingManager when flushing. // Provides a hook for post-flush actions (e.g. Vulkan command buffer submits). - virtual void finishOpList() {} + virtual void finishFlush() {} virtual GrFence SK_WARN_UNUSED_RESULT insertFence() = 0; virtual bool waitFence(GrFence, uint64_t timeout = 1000) = 0; diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp index 4a6590687d..fe87bdeef0 100644 --- a/src/gpu/GrRenderTargetOpList.cpp +++ b/src/gpu/GrRenderTargetOpList.cpp @@ -178,7 +178,6 @@ bool GrRenderTargetOpList::executeOps(GrOpFlushState* flushState) { finish_command_buffer(commandBuffer.get()); flushState->setCommandBuffer(nullptr); - flushState->gpu()->finishOpList(); return true; } diff --git a/src/gpu/GrTextureOpList.cpp b/src/gpu/GrTextureOpList.cpp index 24bea3331c..dd1c8403b0 100644 --- a/src/gpu/GrTextureOpList.cpp +++ b/src/gpu/GrTextureOpList.cpp @@ -15,13 +15,11 @@ //////////////////////////////////////////////////////////////////////////////// -GrTextureOpList::GrTextureOpList(GrTextureProxy* proxy, GrGpu* gpu, GrAuditTrail* auditTrail) - : INHERITED(proxy, auditTrail) - , fGpu(SkRef(gpu)) { +GrTextureOpList::GrTextureOpList(GrTextureProxy* proxy, GrAuditTrail* auditTrail) + : INHERITED(proxy, auditTrail) { } GrTextureOpList::~GrTextureOpList() { - fGpu->unref(); } //////////////////////////////////////////////////////////////////////////////// @@ -71,7 +69,6 @@ bool GrTextureOpList::executeOps(GrOpFlushState* flushState) { fRecordedOps[i]->execute(flushState); } - fGpu->finishOpList(); return true; } diff --git a/src/gpu/GrTextureOpList.h b/src/gpu/GrTextureOpList.h index 984762c8ae..163c05c919 100644 --- a/src/gpu/GrTextureOpList.h +++ b/src/gpu/GrTextureOpList.h @@ -23,7 +23,7 @@ struct SkIRect; class GrTextureOpList final : public GrOpList { public: - GrTextureOpList(GrTextureProxy*, GrGpu*, GrAuditTrail*); + GrTextureOpList(GrTextureProxy*, GrAuditTrail*); ~GrTextureOpList() override; @@ -74,7 +74,6 @@ private: GrSurfaceProxy::UniqueID proxyUniqueID); SkSTArray<2, std::unique_ptr, true> fRecordedOps; - GrGpu* fGpu; typedef GrOpList INHERITED; }; diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index 107e46ae40..48e2e694fe 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -1417,7 +1417,7 @@ void GrVkGpu::addImageMemoryBarrier(VkPipelineStageFlags srcStageMask, barrier); } -void GrVkGpu::finishOpList() { +void GrVkGpu::finishFlush() { // Submit the current command buffer to the Queue this->submitCommandBuffer(kSkip_SyncQueue); } diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h index 3bedfd2ce6..9442d3f979 100644 --- a/src/gpu/vk/GrVkGpu.h +++ b/src/gpu/vk/GrVkGpu.h @@ -127,7 +127,7 @@ public: GrVkRenderTarget*, const SkIRect& bounds); - void finishOpList() override; + void finishFlush() override; GrFence SK_WARN_UNUSED_RESULT insertFence() override; bool waitFence(GrFence, uint64_t timeout) override; -- 2.34.1