Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Issue 752213002: Revert of Use scratch keys for stencil buffers. (Closed)

Created:
6 years ago by Tom Hudson
Modified:
6 years ago
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Visibility:
Public.

Description

Revert of Use scratch keys for stencil buffers. (patchset #3 id:40001 of https://codereview.chromium.org/747043004/) Reason for revert: Bisecting points to this as the culprit in persistent DM crashes, e.g.: > 2033 tasks left 344M peak 843ms tabl-cuteoverload_skp > Signal 11: > _sigtramp (+0x1a) > create_surface(CanvasConfig const&, GrContext*) (+0x1b2) > test_WritePixels(skiatest::Reporter*, GrContextFactory*) (+0x8d4) > skiatest::WritePixelsClass::onRun(skiatest::Reporter*) (+0x21) > skiatest::Test::run() (+0x7c) > DM::GpuTestTask::draw(GrContextFactory*) (+0x8c) > DM::GpuTask::run(GrContextFactory*) (+0xa6) > DM::TaskRunner::wait() (+0x7f) > dm_main() (+0x33f) > main (+0x27) On all MacMini platforms (the following URL with -Mac{10.6,10.7,10.8}- and -{Debug,Release}): http://build.chromium.org/p/client.skia/builders/Test-Mac10.6-MacMini4.1-GeForce320M-x86_64-Debug Original issue's description: > Use scratch keys for stencil buffers. > > BUG=skia:2889 > > Committed: https://skia.googlesource.com/skia/+/91175f19664a62851da4ca4e0984a7c7c45b258f TBR=robertphillips@google.com,bsalomon@google.com NOTREECHECKS=true NOTRY=true BUG=skia:2889

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+74 lines, -44 lines) Patch
M bench/GrResourceCacheBench.cpp View 8 chunks +33 lines, -37 lines 0 comments Download
M include/gpu/GrContext.h View 2 chunks +8 lines, -0 lines 0 comments Download
M src/gpu/GrContext.cpp View 2 chunks +17 lines, -0 lines 0 comments Download
M src/gpu/GrGpu.cpp View 2 chunks +5 lines, -4 lines 0 comments Download
M src/gpu/GrStencilBuffer.h View 2 chunks +3 lines, -1 line 0 comments Download
M src/gpu/GrStencilBuffer.cpp View 1 chunk +5 lines, -1 line 0 comments Download
M src/gpu/gl/GrGpuGL.cpp View 2 chunks +3 lines, -1 line 0 comments Download

Messages

Total messages: 4 (1 generated)
Tom Hudson
Created Revert of Use scratch keys for stencil buffers.
6 years ago (2014-11-24 19:22:31 UTC) #1
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/752213002/1
6 years ago (2014-11-24 19:23:34 UTC) #2
commit-bot: I haz the power
6 years ago (2014-11-24 19:23:38 UTC) #4
Failed to apply patch for bench/GrResourceCacheBench.cpp:
While running git apply --index -3 -p1;
  error: patch failed: bench/GrResourceCacheBench.cpp:21
  Falling back to three-way merge...
  Applied patch to 'bench/GrResourceCacheBench.cpp' with conflicts.
  U bench/GrResourceCacheBench.cpp

Patch:       bench/GrResourceCacheBench.cpp
Index: bench/GrResourceCacheBench.cpp
diff --git a/bench/GrResourceCacheBench.cpp b/bench/GrResourceCacheBench.cpp
index
272e7bf01eec4a8cdff1738a3dcf20f8a759f7a5..e1ec90d51106ea31bddc4e50e61effc0976f8b05
100644
--- a/bench/GrResourceCacheBench.cpp
+++ b/bench/GrResourceCacheBench.cpp
@@ -14,6 +14,9 @@
 #include "GrContext.h"
 #include "GrGpu.h"
 #include "GrResourceCache2.h"
+#include "GrStencilBuffer.h"
+#include "GrTexture.h"
+#include "GrTexturePriv.h"
 #include "SkCanvas.h"
 
 enum {
@@ -21,24 +24,17 @@
     CACHE_SIZE_BYTES = 2 * 1024 * 1024,
 };
 
-class FooResource : public GrGpuResource {
-public:
-    SK_DECLARE_INST_COUNT(FooResource);
-    FooResource(GrGpu* gpu, int id)
+class StencilResource : public GrGpuResource {
+public:
+    SK_DECLARE_INST_COUNT(StencilResource);
+    StencilResource(GrGpu* gpu, int id)
         : INHERITED(gpu, false)
         , fID(id) {
         this->registerWithCache();
     }
 
     static GrResourceKey ComputeKey(int width, int height, int sampleCnt) {
-        GrCacheID::Key key;
-        memset(&key, 0, sizeof(key));
-        key.fData32[0] = width;
-        key.fData32[1] = height;
-        key.fData32[2] = sampleCnt;
-        static int gType = GrResourceKey::GenerateResourceType();
-        static int gDomain = GrCacheID::GenerateDomain();
-        return GrResourceKey(GrCacheID(gDomain, key), gType, 0);
+        return GrStencilBuffer::ComputeKey(width, height, sampleCnt);
     }
 
     int fID;
@@ -51,10 +47,10 @@
     typedef GrGpuResource INHERITED;
 };
 
-class BarResource : public GrGpuResource {
-public:
-    SK_DECLARE_INST_COUNT(BarResource);
-    BarResource(GrGpu* gpu, int id)
+class TextureResource : public GrGpuResource {
+public:
+    SK_DECLARE_INST_COUNT(TextureResource);
+    TextureResource(GrGpu* gpu, int id)
         : INHERITED(gpu, false)
         , fID(id) {
         this->registerWithCache();
@@ -81,13 +77,13 @@
     typedef GrGpuResource INHERITED;
 };
 
-static void get_foo_params(int i, int* w, int* h, int* s) {
+static void get_stencil(int i, int* w, int* h, int* s) {
     *w = i % 1024;
     *h = i * 2 % 1024;
-    *s = i % 2 == 0 ? 0 : 4;
-}
-
-static void get_bar_surf_desc(int i, GrSurfaceDesc* desc) {
+    *s = i % 1 == 0 ? 0 : 4;
+}
+
+static void get_texture_desc(int i, GrSurfaceDesc* desc) {
     desc->fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurfaceFlag;
     desc->fWidth  = i % 1024;
     desc->fHeight = i * 2 % 1024;
@@ -98,18 +94,18 @@
 static void populate_cache(GrGpu* gpu, int resourceCount) {
     for (int i = 0; i < resourceCount; ++i) {
         int w, h, s;
-        get_foo_params(i, &w, &h, &s);
-        GrResourceKey key = FooResource::ComputeKey(w, h, s);
-        GrGpuResource* resource = SkNEW_ARGS(FooResource, (gpu, i));
+        get_stencil(i, &w, &h, &s);
+        GrResourceKey key = GrStencilBuffer::ComputeKey(w, h, s);
+        GrGpuResource* resource = SkNEW_ARGS(StencilResource, (gpu, i));
         resource->cacheAccess().setContentKey(key);
         resource->unref();
     }
 
     for (int i = 0; i < resourceCount; ++i) {
         GrSurfaceDesc desc;
-        get_bar_surf_desc(i, &desc);
-        GrResourceKey key =  BarResource::ComputeKey(desc);
-        GrGpuResource* resource = SkNEW_ARGS(BarResource, (gpu, i));
+        get_texture_desc(i, &desc);
+        GrResourceKey key =  TextureResource::ComputeKey(desc);
+        GrGpuResource* resource = SkNEW_ARGS(TextureResource, (gpu, i));
         resource->cacheAccess().setContentKey(key);
         resource->unref();
     }
@@ -119,28 +115,28 @@
     // Benchmark find calls that succeed.
     {
         GrSurfaceDesc desc;
-        get_bar_surf_desc(k, &desc);
-        GrResourceKey key = BarResource::ComputeKey(desc);
+        get_texture_desc(k, &desc);
+        GrResourceKey key = TextureResource::ComputeKey(desc);
         SkAutoTUnref<GrGpuResource>
item(cache->findAndRefContentResource(key));
         if (!item) {
             SkFAIL("cache add does not work as expected");
             return;
         }
-        if (static_cast<BarResource*>(item.get())->fID != k) {
+        if (static_cast<TextureResource*>(item.get())->fID != k) {
             SkFAIL("cache add does not work as expected");
             return;
         }
     }
     {
         int w, h, s;
-        get_foo_params(k, &w, &h, &s);
-        GrResourceKey key = FooResource::ComputeKey(w, h, s);
+        get_stencil(k, &w, &h, &s);
+        GrResourceKey key = StencilResource::ComputeKey(w, h, s);
         SkAutoTUnref<GrGpuResource>
item(cache->findAndRefContentResource(key));
         if (!item) {
             SkFAIL("cache add does not work as expected");
             return;
         }
-        if (static_cast<FooResource*>(item.get())->fID != k) {
+        if (static_cast<TextureResource*>(item.get())->fID != k) {
             SkFAIL("cache add does not work as expected");
             return;
         }
@@ -149,9 +145,9 @@
     // Benchmark also find calls that always fail.
     {
         GrSurfaceDesc desc;
-        get_bar_surf_desc(k, &desc);
+        get_texture_desc(k, &desc);
         desc.fHeight |= 1;
-        GrResourceKey key = BarResource::ComputeKey(desc);
+        GrResourceKey key = TextureResource::ComputeKey(desc);
         SkAutoTUnref<GrGpuResource>
item(cache->findAndRefContentResource(key));
         if (item) {
             SkFAIL("cache add does not work as expected");
@@ -160,9 +156,9 @@
     }
     {
         int w, h, s;
-        get_foo_params(k, &w, &h, &s);
+        get_stencil(k, &w, &h, &s);
         h |= 1;
-        GrResourceKey key = FooResource::ComputeKey(w, h, s);
+        GrResourceKey key = StencilResource::ComputeKey(w, h, s);
         SkAutoTUnref<GrGpuResource>
item(cache->findAndRefContentResource(key));
         if (item) {
             SkFAIL("cache add does not work as expected");

Powered by Google App Engine
This is Rietveld 408576698