Make GrAuditTrail V1-only
This CL has some rough edges since some classes that use it (e.g., GrOpsTask) aren't yet V1-only. That said, the big CL has to be broken up somehow.
Bug: skia:11837
Change-Id: I41ed9982ca4664f893e447ba23c7aec59f42c964
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426416
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrAuditTrail.h b/src/gpu/GrAuditTrail.h
index a6eb8d3..f2d78dc 100644
--- a/src/gpu/GrAuditTrail.h
+++ b/src/gpu/GrAuditTrail.h
@@ -8,6 +8,10 @@
#ifndef GrAuditTrail_DEFINED
#define GrAuditTrail_DEFINED
+#include "include/gpu/GrTypes.h"
+
+#if SK_GPU_V1
+
#include "include/core/SkRect.h"
#include "include/core/SkString.h"
#include "include/gpu/GrConfig.h"
@@ -172,4 +176,14 @@
#define GR_AUDIT_TRAIL_OPS_RESULT_COMBINED(audit_trail, combineWith, op) \
GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, opsCombined, combineWith, op)
-#endif
+#else // SK_GPU_V1
+
+class GrAuditTrail {
+};
+
+#define GR_AUDIT_TRAIL_AUTO_FRAME(audit_trail, framename)
+#define GR_AUDIT_TRAIL_ADD_OP(audit_trail, op, proxy_id)
+#define GR_AUDIT_TRAIL_OPS_RESULT_COMBINED(audit_trail, combineWith, op)
+
+#endif // SK_GPU_V1
+#endif // GrAuditTrail_DEFINED
diff --git a/src/gpu/GrDirectContextPriv.cpp b/src/gpu/GrDirectContextPriv.cpp
index 15de5ce..e8a39d5 100644
--- a/src/gpu/GrDirectContextPriv.cpp
+++ b/src/gpu/GrDirectContextPriv.cpp
@@ -10,7 +10,6 @@
#include "include/gpu/GrContextThreadSafeProxy.h"
#include "include/gpu/GrDirectContext.h"
#include "src/core/SkRuntimeEffectPriv.h"
-#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrContextThreadSafeProxyPriv.h"
#include "src/gpu/GrDrawingManager.h"
#include "src/gpu/GrGpu.h"
diff --git a/src/gpu/GrDirectContextPriv.h b/src/gpu/GrDirectContextPriv.h
index ac65748..c25fd4f 100644
--- a/src/gpu/GrDirectContextPriv.h
+++ b/src/gpu/GrDirectContextPriv.h
@@ -70,7 +70,7 @@
*/
void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
- GrAuditTrail* auditTrail() { return fContext->auditTrail(); }
+ GrAuditTrail* auditTrail() { return fContext->fAuditTrail.get(); }
/**
* Finalizes all pending reads and writes to the surfaces and also performs an MSAA resolves
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index d9a3e9d..77e754b 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -16,7 +16,6 @@
#include "include/gpu/GrRecordingContext.h"
#include "src/core/SkDeferredDisplayListPriv.h"
#include "src/core/SkTInternalLList.h"
-#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrClientMappedBufferManager.h"
#include "src/gpu/GrCopyRenderTask.h"
#include "src/gpu/GrDDLTask.h"
@@ -703,6 +702,7 @@
std::move(surfaceView),
fContext->priv().auditTrail(),
std::move(arenas)));
+
SkASSERT(this->getLastRenderTask(opsTask->target(0)) == opsTask.get());
if (flushTimeOpsTask) {
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 3022526..e8f33ae 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -15,7 +15,6 @@
#include "src/core/SkMathPriv.h"
#include "src/core/SkMipmap.h"
#include "src/gpu/GrAttachment.h"
-#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrBackendUtils.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrDataUtils.h"
diff --git a/src/gpu/GrRecordingContextPriv.h b/src/gpu/GrRecordingContextPriv.h
index 21f5467..8edd06e6 100644
--- a/src/gpu/GrRecordingContextPriv.h
+++ b/src/gpu/GrRecordingContextPriv.h
@@ -73,7 +73,7 @@
*/
void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
- GrAuditTrail* auditTrail() { return fContext->auditTrail(); }
+ GrAuditTrail* auditTrail() { return fContext->fAuditTrail.get(); }
#if GR_TEST_UTILS
// Used by tests that intentionally exercise codepaths that print warning messages, in order to
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 0fe5979..885f377 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -225,8 +225,9 @@
////////////////////////////////////////////////////////////////////////////////
// return true on success; false on failure
bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
"GrSoftwarePathRenderer::onDrawPath");
+
if (!fProxyProvider) {
return false;
}
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index 44e25db..33cdd68 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -14,7 +14,6 @@
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkMipmap.h"
#include "src/core/SkYUVMath.h"
-#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrClientMappedBufferManager.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrDataUtils.h"
@@ -147,10 +146,6 @@
const GrCaps* GrSurfaceContext::caps() const { return fContext->priv().caps(); }
-GrAuditTrail* GrSurfaceContext::auditTrail() {
- return fContext->priv().auditTrail();
-}
-
GrDrawingManager* GrSurfaceContext::drawingManager() {
return fContext->priv().drawingManager();
}
@@ -172,7 +167,8 @@
ASSERT_SINGLE_OWNER
RETURN_FALSE_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrSurfaceContext::readPixels");
+ GR_CREATE_TRACE_MARKER_CONTEXT("GrSurfaceContext", "readPixels", fContext);
+
if (!fContext->priv().matches(dContext)) {
return false;
}
@@ -421,7 +417,7 @@
const GrCPixmap src[],
int numLevels,
SkIPoint pt) {
- GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrSurfaceContext::internalWritePixels");
+ GR_CREATE_TRACE_MARKER_CONTEXT("GrSurfaceContext", "internalWritePixels", fContext);
SkASSERT(numLevels >= 1);
SkASSERT(src);
@@ -1132,7 +1128,7 @@
ASSERT_SINGLE_OWNER
RETURN_NULLPTR_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrSurfaceContextPriv::copy");
+ GR_CREATE_TRACE_MARKER_CONTEXT("GrSurfaceContext", "copy", fContext);
const GrCaps* caps = fContext->priv().caps();
diff --git a/src/gpu/GrSurfaceContext.h b/src/gpu/GrSurfaceContext.h
index 77bd090..d9946e0 100644
--- a/src/gpu/GrSurfaceContext.h
+++ b/src/gpu/GrSurfaceContext.h
@@ -21,7 +21,6 @@
#include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/GrSurfaceProxyView.h"
-class GrAuditTrail;
class GrDrawingManager;
class GrRecordingContext;
class GrRenderTargetProxy;
@@ -191,8 +190,6 @@
SkImage::RescaleGamma,
SkImage::RescaleMode);
- GrAuditTrail* auditTrail();
-
#if GR_TEST_UTILS
bool testCopy(sk_sp<GrSurfaceProxy> src, const SkIRect& srcRect, const SkIPoint& dstPoint) {
return this->copy(std::move(src), srcRect, dstPoint) != nullptr;
diff --git a/src/gpu/GrSurfaceDrawContext.cpp b/src/gpu/GrSurfaceDrawContext.cpp
index 50ce321..bfcc88c 100644
--- a/src/gpu/GrSurfaceDrawContext.cpp
+++ b/src/gpu/GrSurfaceDrawContext.cpp
@@ -28,7 +28,6 @@
#include "src/core/SkSurfacePriv.h"
#include "src/gpu/GrAppliedClip.h"
#include "src/gpu/GrAttachment.h"
-#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrBlurUtils.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
diff --git a/src/gpu/GrTracing.h b/src/gpu/GrTracing.h
index 9e0559b..8b5dbf1 100644
--- a/src/gpu/GrTracing.h
+++ b/src/gpu/GrTracing.h
@@ -18,4 +18,5 @@
#define GR_CREATE_TRACE_MARKER_CONTEXT(classname, op, context) \
GR_AUDIT_TRAIL_AUTO_FRAME(context->priv().auditTrail(), classname "::" op); \
TRACE_EVENT0("skia.gpu", classname "::" op)
+
#endif
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index 660bcc0..e75dfcb 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -920,7 +920,7 @@
} // anonymous namespace
bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
"GrAAConvexPathRenderer::onDrawPath");
SkASSERT(args.fSurfaceDrawContext->numSamples() <= 1);
SkASSERT(!args.fShape->isEmpty());
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index 6c10f27..6715c54 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -1310,7 +1310,7 @@
}
bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
"GrAAHairlinePathRenderer::onDrawPath");
SkASSERT(args.fSurfaceDrawContext->numSamples() <= 1);
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index e19b57e..8057528 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -388,7 +388,7 @@
} // anonymous namespace
bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
"GrAALinearizingConvexPathRenderer::onDrawPath");
SkASSERT(args.fSurfaceDrawContext->numSamples() <= 1);
SkASSERT(!args.fShape->isEmpty());
diff --git a/src/gpu/ops/GrDashLinePathRenderer.cpp b/src/gpu/ops/GrDashLinePathRenderer.cpp
index d880283..1580ab7 100644
--- a/src/gpu/ops/GrDashLinePathRenderer.cpp
+++ b/src/gpu/ops/GrDashLinePathRenderer.cpp
@@ -29,7 +29,7 @@
}
bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
"GrDashLinePathRenderer::onDrawPath");
GrDashOp::AAMode aaMode;
switch (args.fAAType) {
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index 73568c4..c706a94 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -757,7 +757,7 @@
}
bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
"GrDefaultPathRenderer::onDrawPath");
GrAAType aaType = (GrAAType::kNone != args.fAAType) ? GrAAType::kMSAA : GrAAType::kNone;
@@ -767,7 +767,7 @@
}
void GrDefaultPathRenderer::onStencilPath(const StencilPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
"GrDefaultPathRenderer::onStencilPath");
SkASSERT(!args.fShape->inverseFilled());
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index c2eee7d..9ddbc6a 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -694,7 +694,7 @@
};
bool GrSmallPathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
"GrSmallPathRenderer::onDrawPath");
// we've already bailed on inverse filled paths, so this is safe
diff --git a/src/gpu/ops/GrTriangulatingPathRenderer.cpp b/src/gpu/ops/GrTriangulatingPathRenderer.cpp
index b924238..aada2b0 100644
--- a/src/gpu/ops/GrTriangulatingPathRenderer.cpp
+++ b/src/gpu/ops/GrTriangulatingPathRenderer.cpp
@@ -583,7 +583,7 @@
} // anonymous namespace
bool GrTriangulatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
"GrTriangulatingPathRenderer::onDrawPath");
GrOp::Owner op = TriangulatingPathOp::Make(
diff --git a/src/gpu/tessellate/GrAtlasRenderTask.cpp b/src/gpu/tessellate/GrAtlasRenderTask.cpp
index 79c0b8b..3defd36 100644
--- a/src/gpu/tessellate/GrAtlasRenderTask.cpp
+++ b/src/gpu/tessellate/GrAtlasRenderTask.cpp
@@ -14,11 +14,12 @@
#include "src/gpu/ops/GrFillRectOp.h"
#include "src/gpu/tessellate/GrPathStencilCoverOp.h"
-GrAtlasRenderTask::GrAtlasRenderTask(GrRecordingContext* rContext, GrAuditTrail* auditTrail,
+GrAtlasRenderTask::GrAtlasRenderTask(GrRecordingContext* rContext,
sk_sp<GrArenas> arenas,
std::unique_ptr<GrDynamicAtlas> dynamicAtlas)
: GrOpsTask(rContext->priv().drawingManager(),
- dynamicAtlas->writeView(*rContext->priv().caps()), auditTrail,
+ dynamicAtlas->writeView(*rContext->priv().caps()),
+ rContext->priv().auditTrail(),
std::move(arenas))
, fDynamicAtlas(std::move(dynamicAtlas)) {
}
diff --git a/src/gpu/tessellate/GrAtlasRenderTask.h b/src/gpu/tessellate/GrAtlasRenderTask.h
index 8215ec4..4834ea4 100644
--- a/src/gpu/tessellate/GrAtlasRenderTask.h
+++ b/src/gpu/tessellate/GrAtlasRenderTask.h
@@ -22,7 +22,8 @@
// call instantiate() at flush time.
class GrAtlasRenderTask : public GrOpsTask {
public:
- GrAtlasRenderTask(GrRecordingContext*, GrAuditTrail*, sk_sp<GrArenas>,
+ GrAtlasRenderTask(GrRecordingContext*,
+ sk_sp<GrArenas>,
std::unique_ptr<GrDynamicAtlas>);
const GrTextureProxy* atlasProxy() const { return fDynamicAtlas->textureProxy(); }
diff --git a/src/gpu/tessellate/GrTessellationPathRenderer.cpp b/src/gpu/tessellate/GrTessellationPathRenderer.cpp
index 21d48b8..397bc70 100644
--- a/src/gpu/tessellate/GrTessellationPathRenderer.cpp
+++ b/src/gpu/tessellate/GrTessellationPathRenderer.cpp
@@ -403,7 +403,7 @@
kAtlasAlpha8Type, GrDynamicAtlas::InternalMultisample::kYes,
SkISize{fAtlasInitialSize, fAtlasInitialSize}, fAtlasMaxSize,
*rContext->priv().caps(), kAtlasAlgorithm);
- auto newAtlasTask = sk_make_sp<GrAtlasRenderTask>(rContext, rContext->priv().auditTrail(),
+ auto newAtlasTask = sk_make_sp<GrAtlasRenderTask>(rContext,
sk_make_sp<GrArenas>(),
std::move(dynamicAtlas));
rContext->priv().drawingManager()->addAtlasTask(newAtlasTask, currentAtlasTask);