From: joshualitt Date: Tue, 1 Sep 2015 15:19:46 +0000 (-0700) Subject: Remove GrGpuTraceMarker hooks until we rethink the design X-Git-Tag: submit/tizen/20180928.044319~1028 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dac7005b877c7c1c6f36b6e298133dfc7b85b9c0;p=platform%2Fupstream%2FlibSkiaSharp.git Remove GrGpuTraceMarker hooks until we rethink the design TBR=bsalomon@google.com BUG=526308 Review URL: https://codereview.chromium.org/1323823003 --- diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index cb5eb761ed..7f1e4109fa 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -26,7 +26,6 @@ class GrDrawContext; class GrDrawTarget; class GrFragmentProcessor; class GrGpu; -class GrGpuTraceMarker; class GrIndexBuffer; class GrLayerCache; class GrOvalRenderer; @@ -332,9 +331,6 @@ public: // Called by tests that draw directly to the context via GrDrawTarget void getTestTarget(GrTestTarget*); - void addGpuTraceMarker(const GrGpuTraceMarker* marker); - void removeGpuTraceMarker(const GrGpuTraceMarker* marker); - GrPathRenderer* getPathRenderer( const GrDrawTarget* target, const GrPipelineBuilder*, diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index a934501a6c..6dae8c7083 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -33,7 +33,6 @@ #include "GrSurfacePriv.h" #include "GrTextBlobCache.h" #include "GrTexturePriv.h" -#include "GrTraceMarker.h" #include "GrTracing.h" #include "GrVertices.h" #include "SkDashPathPriv.h" @@ -751,13 +750,3 @@ void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes) fResourceCache->setLimits(maxTextures, maxTextureBytes); } -////////////////////////////////////////////////////////////////////////////// - -void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { - fGpu->addGpuTraceMarker(marker); -} - -void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { - fGpu->removeGpuTraceMarker(marker); -} - diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index f3dd2db0bb..3f472d0948 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -36,7 +36,6 @@ GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider) : fGpu(SkRef(gpu)) , fCaps(SkRef(gpu->caps())) , fResourceProvider(resourceProvider) - , fGpuTraceMarkerCount(0) , fFlushing(false) { } @@ -120,12 +119,8 @@ void GrDrawTarget::flush() { } fFlushing = true; - this->getGpu()->saveActiveTraceMarkers(); - this->onFlush(); - this->getGpu()->restoreActiveTraceMarkers(); - fFlushing = false; this->reset(); } @@ -394,45 +389,6 @@ void GrDrawTarget::discard(GrRenderTarget* renderTarget) { } } -typedef GrTraceMarkerSet::Iter TMIter; -void GrDrawTarget::saveActiveTraceMarkers() { - if (this->caps()->gpuTracingSupport()) { - SkASSERT(0 == fStoredTraceMarkers.count()); - fStoredTraceMarkers.addSet(fActiveTraceMarkers); - for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMarkers.end(); ++iter) { - this->removeGpuTraceMarker(&(*iter)); - } - } -} - -void GrDrawTarget::restoreActiveTraceMarkers() { - if (this->caps()->gpuTracingSupport()) { - SkASSERT(0 == fActiveTraceMarkers.count()); - for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMarkers.end(); ++iter) { - this->addGpuTraceMarker(&(*iter)); - } - for (TMIter iter = fActiveTraceMarkers.begin(); iter != fActiveTraceMarkers.end(); ++iter) { - this->fStoredTraceMarkers.remove(*iter); - } - } -} - -void GrDrawTarget::addGpuTraceMarker(const GrGpuTraceMarker* marker) { - if (this->caps()->gpuTracingSupport()) { - SkASSERT(fGpuTraceMarkerCount >= 0); - this->fActiveTraceMarkers.add(*marker); - ++fGpuTraceMarkerCount; - } -} - -void GrDrawTarget::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { - if (this->caps()->gpuTracingSupport()) { - SkASSERT(fGpuTraceMarkerCount >= 1); - this->fActiveTraceMarkers.remove(*marker); - --fGpuTraceMarkerCount; - } -} - //////////////////////////////////////////////////////////////////////////////// void GrDrawTarget::copySurface(GrSurface* dst, diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h index 13cf990aed..572e4cbf3b 100644 --- a/src/gpu/GrDrawTarget.h +++ b/src/gpu/GrDrawTarget.h @@ -17,7 +17,6 @@ #include "GrPathRendering.h" #include "GrPipelineBuilder.h" #include "GrPipeline.h" -#include "GrTraceMarker.h" #include "GrVertexBuffer.h" #include "GrXferProcessor.h" @@ -164,25 +163,6 @@ public: /** Discards the contents render target. */ void discard(GrRenderTarget*); - /** - * Called at start and end of gpu trace marking - * GR_CREATE_GPU_TRACE_MARKER(marker_str, target) will automatically call these at the start - * and end of a code block respectively - */ - void addGpuTraceMarker(const GrGpuTraceMarker* marker); - void removeGpuTraceMarker(const GrGpuTraceMarker* marker); - - /** - * Takes the current active set of markers and stores them for later use. Any current marker - * in the active set is removed from the active set and the targets remove function is called. - * These functions do not work as a stack so you cannot call save a second time before calling - * restore. Also, it is assumed that when restore is called the current active set of markers - * is empty. When the stored markers are added back into the active set, the targets add marker - * is called. - */ - void saveActiveTraceMarkers(); - void restoreActiveTraceMarkers(); - /** * Copies a pixel rectangle from one surface to another. This call may finalize * reserved vertex/index data (as though a draw call was made). The src pixels @@ -226,12 +206,9 @@ public: }; protected: - GrGpu* getGpu() { return fGpu; } const GrGpu* getGpu() const { return fGpu; } - const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers; } - // Makes a copy of the dst if it is necessary for the draw. Returns false if a copy is required // but couldn't be made. Otherwise, returns true. This method needs to be protected because it // needs to be accessed by GLPrograms to setup a correct drawstate @@ -273,10 +250,6 @@ private: GrGpu* fGpu; const GrCaps* fCaps; GrResourceProvider* fResourceProvider; - // To keep track that we always have at least as many debug marker adds as removes - int fGpuTraceMarkerCount; - GrTraceMarkerSet fActiveTraceMarkers; - GrTraceMarkerSet fStoredTraceMarkers; bool fFlushing; typedef SkRefCnt INHERITED; diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 9f8e5e6e0e..b8cc788ca2 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -45,7 +45,6 @@ GrVertices& GrVertices::operator =(const GrVertices& di) { GrGpu::GrGpu(GrContext* context) : fResetTimestamp(kExpiredTimestamp+1) , fResetBits(kAll_GrBackendState) - , fGpuTraceMarkerCount(0) , fContext(context) { } @@ -355,47 +354,6 @@ void GrGpu::resolveRenderTarget(GrRenderTarget* target) { this->onResolveRenderTarget(target); } -typedef GrTraceMarkerSet::Iter TMIter; -void GrGpu::saveActiveTraceMarkers() { - if (this->caps()->gpuTracingSupport()) { - SkASSERT(0 == fStoredTraceMarkers.count()); - fStoredTraceMarkers.addSet(fActiveTraceMarkers); - for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMarkers.end(); ++iter) { - this->removeGpuTraceMarker(&(*iter)); - } - } -} - -void GrGpu::restoreActiveTraceMarkers() { - if (this->caps()->gpuTracingSupport()) { - SkASSERT(0 == fActiveTraceMarkers.count()); - for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMarkers.end(); ++iter) { - this->addGpuTraceMarker(&(*iter)); - } - for (TMIter iter = fActiveTraceMarkers.begin(); iter != fActiveTraceMarkers.end(); ++iter) { - this->fStoredTraceMarkers.remove(*iter); - } - } -} - -void GrGpu::addGpuTraceMarker(const GrGpuTraceMarker* marker) { - if (this->caps()->gpuTracingSupport()) { - SkASSERT(fGpuTraceMarkerCount >= 0); - this->fActiveTraceMarkers.add(*marker); - this->didAddGpuTraceMarker(); - ++fGpuTraceMarkerCount; - } -} - -void GrGpu::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { - if (this->caps()->gpuTracingSupport()) { - SkASSERT(fGpuTraceMarkerCount >= 1); - this->fActiveTraceMarkers.remove(*marker); - this->didRemoveGpuTraceMarker(); - --fGpuTraceMarkerCount; - } -} - //////////////////////////////////////////////////////////////////////////////// void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) { diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index 290e981dc3..08837ccde8 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -11,7 +11,6 @@ #include "GrPipelineBuilder.h" #include "GrProgramDesc.h" #include "GrStencil.h" -#include "GrTraceMarker.h" #include "GrXferProcessor.h" #include "SkPath.h" @@ -363,25 +362,6 @@ public: Stats* stats() { return &fStats; } - /** - * Called at start and end of gpu trace marking - * GR_CREATE_GPU_TRACE_MARKER(marker_str, target) will automatically call these at the start - * and end of a code block respectively - */ - void addGpuTraceMarker(const GrGpuTraceMarker* marker); - void removeGpuTraceMarker(const GrGpuTraceMarker* marker); - - /** - * Takes the current active set of markers and stores them for later use. Any current marker - * in the active set is removed from the active set and the targets remove function is called. - * These functions do not work as a stack so you cannot call save a second time before calling - * restore. Also, it is assumed that when restore is called the current active set of markers - * is empty. When the stored markers are added back into the active set, the targets add marker - * is called. - */ - void saveActiveTraceMarkers(); - void restoreActiveTraceMarkers(); - // creation and deletion of raw texture for testing // only to be used in GPU-specific tests virtual GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h, @@ -417,8 +397,6 @@ protected: *preference = SkTMax(*preference, elevation); } - const GrTraceMarkerSet& getActiveTraceMarkers() const { return fActiveTraceMarkers; } - Stats fStats; SkAutoTDelete fPathRendering; // Subclass must initialize this in its constructor. @@ -499,9 +477,6 @@ private: // clears target's entire stencil buffer to 0 virtual void clearStencil(GrRenderTarget* target) = 0; - virtual void didAddGpuTraceMarker() = 0; - virtual void didRemoveGpuTraceMarker() = 0; - void resetContext() { this->onResetContext(fResetBits); fResetBits = 0; @@ -516,10 +491,6 @@ private: ResetTimestamp fResetTimestamp; uint32_t fResetBits; - // To keep track that we always have at least as many debug marker adds as removes - int fGpuTraceMarkerCount; - GrTraceMarkerSet fActiveTraceMarkers; - GrTraceMarkerSet fStoredTraceMarkers; // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. GrContext* fContext; diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp index 566ae54459..a111ee5185 100644 --- a/src/gpu/GrTest.cpp +++ b/src/gpu/GrTest.cpp @@ -266,10 +266,6 @@ private: void clearStencil(GrRenderTarget* target) override {} - void didAddGpuTraceMarker() override {} - - void didRemoveGpuTraceMarker() override {} - GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h, GrPixelConfig config) const override { return 0; diff --git a/src/gpu/GrTracing.h b/src/gpu/GrTracing.h index 3851a95195..0eb203fbc4 100644 --- a/src/gpu/GrTracing.h +++ b/src/gpu/GrTracing.h @@ -20,41 +20,39 @@ */ class GrGpuTraceMarkerGenerator : public ::SkNoncopyable { public: - GrGpuTraceMarkerGenerator(GrDrawTarget* target) : fTarget(target) {} + GrGpuTraceMarkerGenerator(GrDrawTarget* target) {} ~GrGpuTraceMarkerGenerator() { if (fTraceMarker.isValid()) { - fTarget->removeGpuTraceMarker(fTraceMarker.get()); + // TODO remove trace marker } } void initialize(const char* marker_str, int* marker_counter) { - GrGpuTraceMarker* traceMarker = fTraceMarker.init(marker_str, *marker_counter); - fTarget->addGpuTraceMarker(traceMarker); + // GrGpuTraceMarker* traceMarker = fTraceMarker.init(marker_str, *marker_counter); + // TODO add trace marker } private: - GrDrawTarget* fTarget; SkTLazy fTraceMarker; }; class GrGpuTraceMarkerGeneratorContext : public ::SkNoncopyable { public: - GrGpuTraceMarkerGeneratorContext(GrContext* context) : fContext(context) {} + GrGpuTraceMarkerGeneratorContext(GrContext* context) {} ~GrGpuTraceMarkerGeneratorContext() { if (fTraceMarker.isValid()) { - fContext->removeGpuTraceMarker(fTraceMarker.get()); + // TODO remove trace marker } } void initialize(const char* marker_str, int* marker_counter) { - GrGpuTraceMarker* traceMarker = fTraceMarker.init(marker_str, *marker_counter); - fContext->addGpuTraceMarker(traceMarker); + // GrGpuTraceMarker* traceMarker = fTraceMarker.init(marker_str, *marker_counter); + // TODO add trace marker } private: - GrContext* fContext; SkTLazy fTraceMarker; }; diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 44b75059da..602eeca56d 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -3076,28 +3076,6 @@ void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) { } } -void GrGLGpu::didAddGpuTraceMarker() { - if (this->caps()->gpuTracingSupport()) { - const GrTraceMarkerSet& markerArray = this->getActiveTraceMarkers(); - SkString markerString = markerArray.toStringLast(); -#if GR_FORCE_GPU_TRACE_DEBUGGING - SkDebugf("%s\n", markerString.c_str()); -#else - GL_CALL(PushGroupMarker(0, markerString.c_str())); -#endif - } -} - -void GrGLGpu::didRemoveGpuTraceMarker() { - if (this->caps()->gpuTracingSupport()) { -#if GR_FORCE_GPU_TRACE_DEBUGGING - SkDebugf("Pop trace marker.\n"); -#else - GL_CALL(PopGroupMarker()); -#endif - } -} - GrBackendObject GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, int h, GrPixelConfig config) const { GrGLuint texID; diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h index f6d6a471e9..8a04467391 100644 --- a/src/gpu/gl/GrGLGpu.h +++ b/src/gpu/gl/GrGLGpu.h @@ -154,10 +154,6 @@ private: void clearStencil(GrRenderTarget*) override; - // GrDrawTarget overrides - void didAddGpuTraceMarker() override; - void didRemoveGpuTraceMarker() override; - // binds texture unit in GL void setTextureUnit(int unitIdx);