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 <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 0dc78ec..9c49ab8 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -155,15 +155,13 @@
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 @@
fOpLists.back()->makeClosed(*fContext->caps());
}
- sk_sp<GrTextureOpList> opList(new GrTextureOpList(textureProxy, fContext->getGpu(),
- fContext->getAuditTrail()));
+ sk_sp<GrTextureOpList> opList(new GrTextureOpList(textureProxy, fContext->getAuditTrail()));
SkASSERT(textureProxy->getLastOpList() == opList.get());
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index f1efadb..abaf684 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -376,9 +376,9 @@
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 4a65906..fe87bde 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -178,7 +178,6 @@
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 24bea33..dd1c840 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 @@
fRecordedOps[i]->execute(flushState);
}
- fGpu->finishOpList();
return true;
}
diff --git a/src/gpu/GrTextureOpList.h b/src/gpu/GrTextureOpList.h
index 984762c..163c05c 100644
--- a/src/gpu/GrTextureOpList.h
+++ b/src/gpu/GrTextureOpList.h
@@ -23,7 +23,7 @@
class GrTextureOpList final : public GrOpList {
public:
- GrTextureOpList(GrTextureProxy*, GrGpu*, GrAuditTrail*);
+ GrTextureOpList(GrTextureProxy*, GrAuditTrail*);
~GrTextureOpList() override;
@@ -74,7 +74,6 @@
GrSurfaceProxy::UniqueID proxyUniqueID);
SkSTArray<2, std::unique_ptr<GrOp>, true> fRecordedOps;
- GrGpu* fGpu;
typedef GrOpList INHERITED;
};
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 107e46a..48e2e69 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1417,7 +1417,7 @@
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 3bedfd2..9442d3f 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -127,7 +127,7 @@
GrVkRenderTarget*,
const SkIRect& bounds);
- void finishOpList() override;
+ void finishFlush() override;
GrFence SK_WARN_UNUSED_RESULT insertFence() override;
bool waitFence(GrFence, uint64_t timeout) override;