Title: [123260] trunk/Source/WebCore
- Revision
- 123260
- Author
- [email protected]
- Date
- 2012-07-20 14:24:05 -0700 (Fri, 20 Jul 2012)
Log Message
[chromium] Clean up scratch texture usage in Chromium's implementation
of GPU-accelerated filters.
https://bugs.webkit.org/show_bug.cgi?id=83370
Reviewed by Adrienne Walker.
There didn't used to be a safe way to allocate a scratch texture, and
hold into it beyond the lifetime of GrAutoScratchTexture. Now there is:
detach().
Covered by existing tests in css3/filters.
* platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp:
(WebCore::CCRenderSurfaceFilters::apply):
Use a GrAutoScratchTexture to allocate the destination texture, and
detach() to detach it from the cache before placing it in an
SkGrTexturePixelRef. This means we no longer need to do any lock/
unlock trickery with the TextureCacheEntry, since the refcount is
enough to keep the texture away from the cache's prying hands.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (123259 => 123260)
--- trunk/Source/WebCore/ChangeLog 2012-07-20 21:12:02 UTC (rev 123259)
+++ trunk/Source/WebCore/ChangeLog 2012-07-20 21:24:05 UTC (rev 123260)
@@ -1,3 +1,25 @@
+2012-07-20 Stephen White <[email protected]>
+
+ [chromium] Clean up scratch texture usage in Chromium's implementation
+ of GPU-accelerated filters.
+ https://bugs.webkit.org/show_bug.cgi?id=83370
+
+ Reviewed by Adrienne Walker.
+
+ There didn't used to be a safe way to allocate a scratch texture, and
+ hold into it beyond the lifetime of GrAutoScratchTexture. Now there is:
+ detach().
+
+ Covered by existing tests in css3/filters.
+
+ * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp:
+ (WebCore::CCRenderSurfaceFilters::apply):
+ Use a GrAutoScratchTexture to allocate the destination texture, and
+ detach() to detach it from the cache before placing it in an
+ SkGrTexturePixelRef. This means we no longer need to do any lock/
+ unlock trickery with the TextureCacheEntry, since the refcount is
+ enough to keep the texture away from the cache's prying hands.
+
2012-07-19 Andrew Scherkus <[email protected]>
[chromium] CSS tweaks to media controls to prevent styles from being overridden
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp (123259 => 123260)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp 2012-07-20 21:12:02 UTC (rev 123259)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp 2012-07-20 21:24:05 UTC (rev 123260)
@@ -193,12 +193,7 @@
source.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height());
source.setPixelRef(new SkGrTexturePixelRef(texture.get()))->unref();
- GrContext::TextureCacheEntry dest;
-
for (unsigned i = 0; i < filters.size(); ++i) {
- // Save the previous texture cache destination (if any), and keep it
- // locked during draw to prevent it be re-used as destination.
- GrContext::TextureCacheEntry sourceEntry = dest;
const WebKit::WebFilterOperation& op = filters.at(i);
// Allocate a destination texture.
GrTextureDesc desc;
@@ -208,10 +203,11 @@
desc.fHeight = size.height();
desc.fConfig = kSkia8888_PM_GrPixelConfig;
// FIXME: could we use approximate match, and fix texcoords on draw
- dest = gr->lockScratchTexture(desc, GrContext::kExact_ScratchTexMatch);
- if (!dest.texture())
+ GrAutoScratchTexture scratchTexture(gr, desc, GrContext::kExact_ScratchTexMatch);
+ SkAutoTUnref<GrTexture> destination(scratchTexture.detach());
+ if (!destination.get())
return SkBitmap();
- SkGpuDevice device(gr, dest.texture());
+ SkGpuDevice device(gr, destination.get());
SkCanvas canvas(&device);
canvas.clear(0x0);
switch (op.type()) {
@@ -289,13 +285,8 @@
break;
}
// Dest texture from this filter becomes source bitmap for next filter.
- source.setPixelRef(new SkGrTexturePixelRef(dest.texture()))->unref();
- // Unlock the previous texture cache entry.
- if (sourceEntry.texture())
- gr->unlockTexture(sourceEntry);
+ source.setPixelRef(new SkGrTexturePixelRef(destination.get()))->unref();
}
- if (dest.texture())
- gr->unlockTexture(dest);
context3D->flush();
return source;
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes