Title: [124490] trunk/Source
Revision
124490
Author
[email protected]
Date
2012-08-02 13:33:42 -0700 (Thu, 02 Aug 2012)

Log Message

[chromium] Wrap shared context getters in WebKit API and avoid WebCore::GraphicsContext3D use in compositor internals
https://bugs.webkit.org/show_bug.cgi?id=92917

Reviewed by Adrienne Walker.

Source/Platform:

This adds Platform API for creating and accessing shared GraphicsContext3D and Ganesh contexts from the main or
compositor threads. These can be used for evaluating filters or doing accelerated painting. These contexts are
generally leaked until lost or process exit, the details are documented in WebSharedGraphicsContext3D.h

* Platform.gypi:
* chromium/public/WebSharedGraphicsContext3D.h: Added.
(WebKit):
(WebSharedGraphicsContext3D):

Source/WebCore:

This uses Platform API wrappers to access the shared WebGraphicsContext3D / Ganesh contexts from the compositor
to evaluate accelerated filters or do accelerated painting.

Filters changes covered by css3/filters/*-hw.html layout tests.

* WebCore.gypi:
* platform/chromium/support/WebSharedGraphicsContext3D.cpp:
(WebKit):
(WebKit::WebSharedGraphicsContext3D::mainThreadContext):
(WebKit::WebSharedGraphicsContext3D::mainThreadGrContext):
(WebKit::WebSharedGraphicsContext3D::compositorThreadContext):
(WebKit::WebSharedGraphicsContext3D::compositorThreadGrContext):
(WebKit::WebSharedGraphicsContext3D::haveCompositorThreadContext):
(WebKit::WebSharedGraphicsContext3D::createCompositorThreadContext):
* platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp:
(WebCore::createAcceleratedCanvas):
(WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect):
(WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect):
* platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h:
(WebKit):
(FrameBufferSkPictureCanvasLayerTextureUpdater):
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::applyFilters):
* platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp:
(WebCore::CCRenderSurfaceFilters::apply):
* platform/graphics/chromium/cc/CCRenderSurfaceFilters.h:
(WebKit):
(CCRenderSurfaceFilters):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (124489 => 124490)


--- trunk/Source/Platform/ChangeLog	2012-08-02 20:30:15 UTC (rev 124489)
+++ trunk/Source/Platform/ChangeLog	2012-08-02 20:33:42 UTC (rev 124490)
@@ -1,3 +1,19 @@
+2012-08-01  James Robinson  <[email protected]>
+
+        [chromium] Wrap shared context getters in WebKit API and avoid WebCore::GraphicsContext3D use in compositor internals
+        https://bugs.webkit.org/show_bug.cgi?id=92917
+
+        Reviewed by Adrienne Walker.
+
+        This adds Platform API for creating and accessing shared GraphicsContext3D and Ganesh contexts from the main or
+        compositor threads. These can be used for evaluating filters or doing accelerated painting. These contexts are
+        generally leaked until lost or process exit, the details are documented in WebSharedGraphicsContext3D.h
+
+        * Platform.gypi:
+        * chromium/public/WebSharedGraphicsContext3D.h: Added.
+        (WebKit):
+        (WebSharedGraphicsContext3D):
+
 2012-08-02  Peter Beverloo  <[email protected]>
 
         [Chromium] Add a stub for WebView::getTouchHighlightQuads()

Modified: trunk/Source/Platform/Platform.gypi (124489 => 124490)


--- trunk/Source/Platform/Platform.gypi	2012-08-02 20:30:15 UTC (rev 124489)
+++ trunk/Source/Platform/Platform.gypi	2012-08-02 20:33:42 UTC (rev 124490)
@@ -117,6 +117,7 @@
             'chromium/public/WebScrollbarThemeGeometry.h',
             'chromium/public/WebScrollbarThemePainter.h',
             'chromium/public/WebSessionDescriptionDescriptor.h',
+            'chromium/public/WebSharedGraphicsContext3D.h',
             'chromium/public/WebSize.h',
             'chromium/public/WebSocketStreamError.h',
             'chromium/public/WebSocketStreamHandle.h',

Added: trunk/Source/Platform/chromium/public/WebSharedGraphicsContext3D.h (0 => 124490)


--- trunk/Source/Platform/chromium/public/WebSharedGraphicsContext3D.h	                        (rev 0)
+++ trunk/Source/Platform/chromium/public/WebSharedGraphicsContext3D.h	2012-08-02 20:33:42 UTC (rev 124490)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebSharedGraphicsContext3D_h
+#define WebSharedGraphicsContext3D_h
+
+#include "WebCommon.h"
+
+class GrContext;
+
+namespace WebKit {
+
+class WebGraphicsContext3D;
+
+class WebSharedGraphicsContext3D {
+public:
+    // Returns a context usable from the main thread. If the context is lost or has never been created, this will attempt to create a new context.
+    // The returned pointer is only valid until the next call to mainThreadContext().
+    WEBKIT_EXPORT static WebGraphicsContext3D* mainThreadContext();
+
+    // Returns a ganesh context associated with the main thread shared context. The ganesh context has the same lifetime as the main thread shared
+    // WebGraphicsContext3D.
+    WEBKIT_EXPORT static GrContext* mainThreadGrContext();
+
+    // Attempts to create a context usable from the compositor thread. Must be called from the main (WebKit) thread. Returns false
+    // if a context could not be created.
+    WEBKIT_EXPORT static bool createCompositorThreadContext();
+
+    // Can be called from any thread.
+    WEBKIT_EXPORT static bool haveCompositorThreadContext();
+
+    // Returns a context usable from the compositor thread, if there is one. The context must be used only from the compositor thread.
+    // The returned context is valid until the next call to createCompositorThreadContext().
+    // If this context becomes lost or unusable, the caller should call createCompositorThreadContext() on the main thread and
+    // then use the newly created context from the compositor thread.
+    WEBKIT_EXPORT static WebGraphicsContext3D* compositorThreadContext();
+
+    // Returns a ganesh context associated with the compositor thread shared context. The ganesh context has the same lifetime as the compositor thread
+    // shared WebGraphicsContext3D.
+    WEBKIT_EXPORT static GrContext* compositorThreadGrContext();
+};
+
+}
+
+#endif // WebSharedGraphicsContext3D_h
Property changes on: trunk/Source/Platform/chromium/public/WebSharedGraphicsContext3D.h
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (124489 => 124490)


--- trunk/Source/WebCore/ChangeLog	2012-08-02 20:30:15 UTC (rev 124489)
+++ trunk/Source/WebCore/ChangeLog	2012-08-02 20:33:42 UTC (rev 124490)
@@ -1,3 +1,39 @@
+2012-08-01  James Robinson  <[email protected]>
+
+        [chromium] Wrap shared context getters in WebKit API and avoid WebCore::GraphicsContext3D use in compositor internals
+        https://bugs.webkit.org/show_bug.cgi?id=92917
+
+        Reviewed by Adrienne Walker.
+
+        This uses Platform API wrappers to access the shared WebGraphicsContext3D / Ganesh contexts from the compositor
+        to evaluate accelerated filters or do accelerated painting.
+
+        Filters changes covered by css3/filters/*-hw.html layout tests.
+
+        * WebCore.gypi:
+        * platform/chromium/support/WebSharedGraphicsContext3D.cpp:
+        (WebKit):
+        (WebKit::WebSharedGraphicsContext3D::mainThreadContext):
+        (WebKit::WebSharedGraphicsContext3D::mainThreadGrContext):
+        (WebKit::WebSharedGraphicsContext3D::compositorThreadContext):
+        (WebKit::WebSharedGraphicsContext3D::compositorThreadGrContext):
+        (WebKit::WebSharedGraphicsContext3D::haveCompositorThreadContext):
+        (WebKit::WebSharedGraphicsContext3D::createCompositorThreadContext):
+        * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp:
+        (WebCore::createAcceleratedCanvas):
+        (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect):
+        (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect):
+        * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h:
+        (WebKit):
+        (FrameBufferSkPictureCanvasLayerTextureUpdater):
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::applyFilters):
+        * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp:
+        (WebCore::CCRenderSurfaceFilters::apply):
+        * platform/graphics/chromium/cc/CCRenderSurfaceFilters.h:
+        (WebKit):
+        (CCRenderSurfaceFilters):
+
 2012-08-02  Beth Dakin  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=93020

Modified: trunk/Source/WebCore/WebCore.gypi (124489 => 124490)


--- trunk/Source/WebCore/WebCore.gypi	2012-08-02 20:30:15 UTC (rev 124489)
+++ trunk/Source/WebCore/WebCore.gypi	2012-08-02 20:33:42 UTC (rev 124490)
@@ -8234,9 +8234,10 @@
             'platform/chromium/support/WebMediaStreamSourcesRequest.cpp',
             'platform/chromium/support/WebPrerender.cpp',
             'platform/chromium/support/WebRTCConfiguration.cpp',
+            'platform/chromium/support/WebSharedGraphicsContext3D.cpp',
             'platform/chromium/support/WebThreadSafeData.cpp',
+            'platform/chromium/support/WebTransformOperations.cpp',
             'platform/chromium/support/WebTransformationMatrix.cpp',
-            'platform/chromium/support/WebTransformOperations.cpp',
             'platform/chromium/support/WebURL.cpp',
             'platform/chromium/support/WebURLError.cpp',
             'platform/chromium/support/WebURLRequest.cpp',

Copied: trunk/Source/WebCore/platform/chromium/support/WebSharedGraphicsContext3D.cpp (from rev 124489, trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.h) (0 => 124490)


--- trunk/Source/WebCore/platform/chromium/support/WebSharedGraphicsContext3D.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/chromium/support/WebSharedGraphicsContext3D.cpp	2012-08-02 20:33:42 UTC (rev 124490)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include <public/WebSharedGraphicsContext3D.h>
+
+#include "GraphicsContext3DPrivate.h"
+#include "SharedGraphicsContext3D.h"
+
+using WebCore::GraphicsContext3DPrivate;
+using WebCore::SharedGraphicsContext3D;
+
+namespace WebKit {
+
+WebGraphicsContext3D* WebSharedGraphicsContext3D::mainThreadContext()
+{
+    return GraphicsContext3DPrivate::extractWebGraphicsContext3D(SharedGraphicsContext3D::get().get());
+}
+
+GrContext* WebSharedGraphicsContext3D::mainThreadGrContext()
+{
+    return SharedGraphicsContext3D::get() ? SharedGraphicsContext3D::get()->grContext() : 0;
+}
+
+
+WebGraphicsContext3D* WebSharedGraphicsContext3D::compositorThreadContext()
+{
+    return GraphicsContext3DPrivate::extractWebGraphicsContext3D(SharedGraphicsContext3D::getForImplThread().get());
+}
+
+GrContext* WebSharedGraphicsContext3D::compositorThreadGrContext()
+{
+    return SharedGraphicsContext3D::getForImplThread() ? SharedGraphicsContext3D::getForImplThread()->grContext() : 0;
+}
+
+bool WebSharedGraphicsContext3D::haveCompositorThreadContext()
+{
+    return SharedGraphicsContext3D::haveForImplThread();
+}
+
+bool WebSharedGraphicsContext3D::createCompositorThreadContext()
+{
+    return SharedGraphicsContext3D::createForImplThread();
+}
+
+}
+

Modified: trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp (124489 => 124490)


--- trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp	2012-08-02 20:30:15 UTC (rev 124489)
+++ trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp	2012-08-02 20:33:42 UTC (rev 124490)
@@ -31,18 +31,21 @@
 #include "FrameBufferSkPictureCanvasLayerTextureUpdater.h"
 
 #include "LayerPainterChromium.h"
-#include "SharedGraphicsContext3D.h"
 #include "SkCanvas.h"
 #include "SkGpuDevice.h"
 #include "cc/CCProxy.h"
+#include <public/WebGraphicsContext3D.h>
+#include <public/WebSharedGraphicsContext3D.h>
 
+using WebKit::WebGraphicsContext3D;
+using WebKit::WebSharedGraphicsContext3D;
+
 namespace WebCore {
 
-static PassOwnPtr<SkCanvas> createAcceleratedCanvas(GraphicsContext3D* context,
+static PassOwnPtr<SkCanvas> createAcceleratedCanvas(GrContext* grContext,
                                                     IntSize canvasSize,
                                                     unsigned textureId)
 {
-    GrContext* grContext = context->grContext();
     GrPlatformTextureDesc textureDesc;
     textureDesc.fFlags = kRenderTarget_GrPlatformTextureFlag;
     textureDesc.fWidth = canvasSize.width();
@@ -66,10 +69,11 @@
 
 void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourceProvider, const IntRect& sourceRect, const IntRect& destRect)
 {
-    RefPtr<GraphicsContext3D> sharedContext = CCProxy::hasImplThread() ? SharedGraphicsContext3D::getForImplThread() : SharedGraphicsContext3D::get();
-    if (!sharedContext)
+    WebGraphicsContext3D* sharedContext = CCProxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadContext() : WebSharedGraphicsContext3D::mainThreadContext();
+    GrContext* sharedGrContext = CCProxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadGrContext() : WebSharedGraphicsContext3D::mainThreadGrContext();
+    if (!sharedContext || !sharedGrContext)
         return;
-    textureUpdater()->updateTextureRect(sharedContext.release(), resourceProvider, texture(), sourceRect, destRect);
+    textureUpdater()->updateTextureRect(sharedContext, sharedGrContext, resourceProvider, texture(), sourceRect, destRect);
 }
 
 PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> FrameBufferSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter)
@@ -97,17 +101,15 @@
     return LayerTextureUpdater::SampledTexelFormatRGBA;
 }
 
-void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(PassRefPtr<GraphicsContext3D> prpContext, CCResourceProvider* resourceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
+void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(WebGraphicsContext3D* context, GrContext* grContext, CCResourceProvider* resourceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
 {
-    RefPtr<GraphicsContext3D> context(prpContext);
-
     // Make sure ganesh uses the correct GL context.
     context->makeContextCurrent();
 
     texture->acquireBackingTexture(resourceProvider);
     CCScopedLockResourceForWrite lock(resourceProvider, texture->resourceId());
     // Create an accelerated canvas to draw on.
-    OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(context.get(), texture->size(), lock.textureId());
+    OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(grContext, texture->size(), lock.textureId());
 
     // The compositor expects the textures to be upside-down so it can flip
     // the final composited image. Ganesh renders the image upright so we
@@ -123,7 +125,7 @@
     drawPicture(canvas.get());
 
     // Flush ganesh context so that all the rendered stuff appears on the texture.
-    context->grContext()->flush();
+    grContext->flush();
 
     // Flush the GL context so rendering results from this context are visible in the compositor's context.
     context->flush();

Modified: trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h (124489 => 124490)


--- trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h	2012-08-02 20:30:15 UTC (rev 124489)
+++ trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h	2012-08-02 20:33:42 UTC (rev 124490)
@@ -31,6 +31,13 @@
 
 #include "SkPictureCanvasLayerTextureUpdater.h"
 
+class GrContext;
+
+namespace WebKit {
+class WebGraphicsContext3D;
+class WebSharedGraphicsContext3D;
+}
+
 namespace WebCore {
 
 // This class records the contentRect into an SkPicture, then uses accelerated
@@ -56,7 +63,7 @@
 
     virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE;
     virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE;
-    void updateTextureRect(PassRefPtr<GraphicsContext3D>, CCResourceProvider*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntRect& destRect);
+    void updateTextureRect(WebKit::WebGraphicsContext3D*, GrContext*, CCResourceProvider*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntRect& destRect);
 
 private:
     explicit FrameBufferSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (124489 => 124490)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2012-08-02 20:30:15 UTC (rev 124489)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2012-08-02 20:33:42 UTC (rev 124490)
@@ -40,7 +40,6 @@
 #include "GrTexture.h"
 #include "NotImplemented.h"
 #include "PlatformColor.h"
-#include "SharedGraphicsContext3D.h"
 #include "SkBitmap.h"
 #include "SkColor.h"
 #include "ThrottledTextureUploader.h"
@@ -56,6 +55,7 @@
 #include "cc/CCSingleThreadProxy.h"
 #include "cc/CCVideoLayerImpl.h"
 #include <public/WebGraphicsContext3D.h>
+#include <public/WebSharedGraphicsContext3D.h>
 #include <public/WebVideoFrame.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/MainThread.h>
@@ -64,6 +64,7 @@
 using namespace std;
 using WebKit::WebGraphicsContext3D;
 using WebKit::WebGraphicsMemoryAllocation;
+using WebKit::WebSharedGraphicsContext3D;
 using WebKit::WebTransformationMatrix;
 
 namespace WebCore {
@@ -529,14 +530,16 @@
     if (filters.isEmpty())
         return SkBitmap();
 
-    RefPtr<GraphicsContext3D> filterContext = CCProxy::hasImplThread() ? SharedGraphicsContext3D::getForImplThread() : SharedGraphicsContext3D::get();
-    if (!filterContext)
+    WebGraphicsContext3D* filterContext = CCProxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadContext() : WebSharedGraphicsContext3D::mainThreadContext();
+    GrContext* filterGrContext = CCProxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadGrContext() : WebSharedGraphicsContext3D::mainThreadGrContext();
+
+    if (!filterContext || !filterGrContext)
         return SkBitmap();
 
     layerRenderer->context()->flush();
 
     CCScopedLockResourceForWrite lock(layerRenderer->resourceProvider(), sourceTexture->id());
-    SkBitmap source = CCRenderSurfaceFilters::apply(filters, lock.textureId(), sourceTexture->size(), filterContext.get());
+    SkBitmap source = CCRenderSurfaceFilters::apply(filters, lock.textureId(), sourceTexture->size(), filterContext, filterGrContext);
     return source;
 }
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp (124489 => 124490)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp	2012-08-02 20:30:15 UTC (rev 124489)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp	2012-08-02 20:33:42 UTC (rev 124490)
@@ -30,7 +30,6 @@
 #include "cc/CCRenderSurfaceFilters.h"
 
 #include "FloatSize.h"
-#include "GraphicsContext3D.h"
 #include "SkBlurImageFilter.h"
 #include "SkCanvas.h"
 #include "SkColorMatrixFilter.h"
@@ -38,6 +37,7 @@
 #include "SkGrTexturePixelRef.h"
 #include <public/WebFilterOperation.h>
 #include <public/WebFilterOperations.h>
+#include <public/WebGraphicsContext3D.h>
 #include <wtf/MathExtras.h>
 
 namespace {
@@ -385,14 +385,11 @@
     return newList;
 }
 
-SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const FloatSize& size, GraphicsContext3D* context3D)
+SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const FloatSize& size, WebKit::WebGraphicsContext3D* context3D, GrContext* grContext)
 {
-    if (!context3D)
+    if (!context3D || !grContext)
         return SkBitmap();
 
-    GrContext* grContext = context3D->grContext();
-    if (!grContext)
-        return SkBitmap();
     WebKit::WebFilterOperations optimizedFilters = optimize(filters);
     FilterBufferState state(grContext, size, textureId);
     if (!state.init(optimizedFilters.size()))

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.h (124489 => 124490)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.h	2012-08-02 20:30:15 UTC (rev 124489)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.h	2012-08-02 20:33:42 UTC (rev 124490)
@@ -29,20 +29,22 @@
 
 #if USE(ACCELERATED_COMPOSITING)
 
+class GrContext;
 class SkBitmap;
 
 namespace WebKit {
 class WebFilterOperations;
+class WebGraphicsContext3D;
 }
 
 namespace WebCore {
 class FloatSize;
-class GraphicsContext3D;
 
 class CCRenderSurfaceFilters {
 public:
-    static SkBitmap apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const FloatSize&, GraphicsContext3D*);
+    static SkBitmap apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const FloatSize&, WebKit::WebGraphicsContext3D*, GrContext*);
     static WebKit::WebFilterOperations optimize(const WebKit::WebFilterOperations& filters);
+
 private:
     CCRenderSurfaceFilters();
 };

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (124489 => 124490)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-08-02 20:30:15 UTC (rev 124489)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-08-02 20:33:42 UTC (rev 124490)
@@ -26,7 +26,6 @@
 
 #include "cc/CCThreadProxy.h"
 
-#include "SharedGraphicsContext3D.h"
 #include "TraceEvent.h"
 #include "cc/CCDelayBasedTimeSource.h"
 #include "cc/CCDrawQuad.h"
@@ -38,11 +37,13 @@
 #include "cc/CCScopedThreadProxy.h"
 #include "cc/CCTextureUpdater.h"
 #include "cc/CCThreadTask.h"
+#include <public/WebSharedGraphicsContext3D.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/MainThread.h>
 
 using namespace WTF;
 
+using WebKit::WebSharedGraphicsContext3D;
 namespace {
 
 // Number of textures to update with each call to
@@ -241,7 +242,7 @@
     if (!context)
         return false;
     if (m_layerTreeHost->needsSharedContext() && !m_layerTreeHost->settings().forceSoftwareCompositing)
-        if (!SharedGraphicsContext3D::createForImplThread())
+        if (!WebSharedGraphicsContext3D::createCompositorThreadContext())
             return false;
 
     // Make a blocking call to recreateContextOnImplThread. The results of that
@@ -473,8 +474,8 @@
         return;
     }
 
-    if (m_layerTreeHost->needsSharedContext() && !m_layerTreeHost->settings().forceSoftwareCompositing && !SharedGraphicsContext3D::haveForImplThread())
-        SharedGraphicsContext3D::createForImplThread();
+    if (m_layerTreeHost->needsSharedContext() && !m_layerTreeHost->settings().forceSoftwareCompositing && !WebSharedGraphicsContext3D::haveCompositorThreadContext())
+        WebSharedGraphicsContext3D::createCompositorThreadContext();
 
     OwnPtr<BeginFrameAndCommitState> request(m_pendingBeginFrameRequest.release());
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to