aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2015-11-13 13:42:55 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-13 13:42:55 -0800
commit1d5127327111e00d0e4530adae73b11ad2ee3f42 (patch)
treeb98ac08dc426005596238185dc150fec01dfdfc8 /src/gpu
parentfa7e1a02a5104ea44dd823e4b998ac854e08cd9e (diff)
Revert of Update testing frameworks/tests for MDB (patchset #4 id:60001 of https://codereview.chromium.org/1441533003/ )
Reason for revert: Speculative revert for leaks based on ASAN bot (and some local valgrind testing) Original issue's description: > Update testing frameworks/tests for MDB > > This CL: > > Fixes an ordering problem w.r.t. drawTarget clean up in GrContext::abandonContext (for text test that abandons context) > Fixes when the lastDrawTarget field is set on a RenderTarget (now in GrDrawTarget ctor) due to GrTestTarget use case > Updates the ProgramUnitTest to use multiple drawTargets > Adds renderTarget creation to GrTestTargets (in MDB drawTargets require them) > > BUG=skia:4094 > > Committed: https://skia.googlesource.com/skia/+/9c8605144a0f15e3e69a4e1dcd5d3e63f339380e TBR=joshualitt@chromium.org,joshualitt@google.com,robertphillips@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4094 Review URL: https://codereview.chromium.org/1450513002
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrContext.cpp7
-rw-r--r--src/gpu/GrDrawContext.cpp1
-rw-r--r--src/gpu/GrDrawTarget.cpp2
-rw-r--r--src/gpu/GrDrawingManager.cpp21
-rw-r--r--src/gpu/GrDrawingManager.h2
-rw-r--r--src/gpu/GrTest.cpp21
-rw-r--r--src/gpu/GrTest.h5
7 files changed, 13 insertions, 46 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 348cdbaaca..bd4ca40a34 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -118,17 +118,14 @@ GrContext::~GrContext() {
void GrContext::abandonContext() {
fResourceProvider->abandon();
-
- // Need to abandon the drawing manager first so all the render targets
- // will be released/forgotten before they too are abandoned.
- fDrawingManager->abandon();
-
// abandon first to so destructors
// don't try to free the resources in the API.
fResourceCache->abandonAll();
fGpu->contextAbandoned();
+ fDrawingManager->abandon();
+
fBatchFontCache->freeAll();
fLayerCache->freeAll();
fTextBlobCache->freeAll();
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 2613407417..bac3a169f5 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -75,6 +75,7 @@ GrDrawTarget* GrDrawContext::getDrawTarget() {
if (!fDrawTarget || fDrawTarget->isClosed()) {
fDrawTarget = fDrawingManager->newDrawTarget(fRenderTarget);
+ fRenderTarget->setLastDrawTarget(fDrawTarget);
}
return fDrawTarget;
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index a7f4d92854..3f898ab26a 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -42,8 +42,6 @@ GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* r
fContext = fGpu->getContext();
fClipMaskManager.reset(new GrClipMaskManager(this));
- rt->setLastDrawTarget(this);
-
#ifdef SK_DEBUG
static int debugID = 0;
fDebugID = debugID++;
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 73b7d1695e..74459daa48 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -14,12 +14,10 @@
#include "GrStencilAndCoverTextContext.h"
#include "SkTTopoSort.h"
+//#define ENABLE_MDB 1
void GrDrawingManager::cleanup() {
for (int i = 0; i < fDrawTargets.count(); ++i) {
- fDrawTargets[i]->makeClosed(); // no drawTarget should receive a new command after this
- fDrawTargets[i]->clearRT();
-
fDrawTargets[i]->unref();
}
@@ -87,25 +85,17 @@ void GrDrawingManager::flush() {
SkASSERT(fFlushState.lastFlushedToken() == fFlushState.currentToken());
- for (int i = 0; i < fDrawTargets.count(); ++i) {
- fDrawTargets[i]->reset();
-#ifdef ENABLE_MDB
- fDrawTargets[i]->unref();
-#endif
- }
-
#ifndef ENABLE_MDB
// When MDB is disabled we keep reusing the same drawTarget
if (fDrawTargets.count()) {
SkASSERT(fDrawTargets.count() == 1);
- // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnmarked check
- // won't bark
fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag);
}
-#else
- fDrawTargets.reset();
#endif
+ for (int i = 0; i < fDrawTargets.count(); ++i) {
+ fDrawTargets[i]->reset();
+ }
fFlushState.reset();
}
@@ -144,9 +134,6 @@ GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) {
// When MDB is disabled we always just return the single drawTarget
if (fDrawTargets.count()) {
SkASSERT(fDrawTargets.count() == 1);
- // In the non-MDB-world the same drawTarget gets reused for multiple render targets.
- // Update this pointer so all the asserts are happy
- rt->setLastDrawTarget(fDrawTargets[0]);
// DrawingManager gets the creation ref - this ref is for the caller
return SkRef(fDrawTargets[0]);
}
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index 41d8ab5904..da7c999cc8 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -50,7 +50,7 @@ public:
GrPathRendererChain::DrawType drawType,
GrPathRenderer::StencilSupport* stencilSupport = NULL);
- static bool ProgramUnitTest(GrContext* context, int maxStages);
+ static bool ProgramUnitTest(GrContext* context, GrDrawTarget* drawTarget, int maxStages);
private:
GrDrawingManager(GrContext* context)
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index 24042ee31d..6e9df211fa 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -44,12 +44,11 @@ void SetupAlwaysEvictAtlas(GrContext* context) {
}
};
-void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, GrRenderTarget* rt) {
+void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) {
SkASSERT(!fContext);
fContext.reset(SkRef(ctx));
fDrawTarget.reset(SkRef(target));
- fRenderTarget.reset(SkRef(rt));
}
void GrContext::getTestTarget(GrTestTarget* tar) {
@@ -58,22 +57,8 @@ void GrContext::getTestTarget(GrTestTarget* tar) {
// then disconnects. This would help prevent test writers from mixing using the returned
// GrDrawTarget and regular drawing. We could also assert or fail in GrContext drawing methods
// until ~GrTestTarget().
- GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = 32;
- desc.fHeight = 32;
- desc.fConfig = kRGBA_8888_GrPixelConfig;
- desc.fSampleCnt = 0;
-
- GrTexture* texture = this->textureProvider()->createTexture(desc, false, nullptr, 0);
- if (nullptr == texture) {
- return;
- }
- SkASSERT(nullptr != texture->asRenderTarget());
- GrRenderTarget* rt = texture->asRenderTarget();
-
- SkAutoTUnref<GrDrawTarget> dt(fDrawingManager->newDrawTarget(rt));
- tar->init(this, dt, rt);
+ SkAutoTUnref<GrDrawTarget> dt(fDrawingManager->newDrawTarget(nullptr));
+ tar->init(this, dt);
}
void GrContext::setTextBlobCacheLimit_ForTesting(size_t bytes) {
diff --git a/src/gpu/GrTest.h b/src/gpu/GrTest.h
index 297f51c113..92bfb13750 100644
--- a/src/gpu/GrTest.h
+++ b/src/gpu/GrTest.h
@@ -28,15 +28,14 @@ class GrTestTarget {
public:
GrTestTarget() {};
- void init(GrContext*, GrDrawTarget*, GrRenderTarget*);
+ void init(GrContext*, GrDrawTarget*);
GrDrawTarget* target() { return fDrawTarget.get(); }
GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); }
private:
- SkAutoTUnref<GrContext> fContext;
SkAutoTUnref<GrDrawTarget> fDrawTarget;
- SkAutoTUnref<GrRenderTarget> fRenderTarget;
+ SkAutoTUnref<GrContext> fContext;
};
#endif