Title: [110716] trunk/Source
Revision
110716
Author
[email protected]
Date
2012-03-14 11:12:29 -0700 (Wed, 14 Mar 2012)

Log Message

[chromium] Provide explicit polling API to check if the platform is capable of accelerated 2d canvas
https://bugs.webkit.org/show_bug.cgi?id=80667

Reviewed by Darin Fisher.

Source/WebCore:

Query the platform to see if we can instantiate a context suitable for accelerating 2d canvas. If we can't, for
instance if we're on a system that can't preserve a context when the screensaver comes up, then immediately fall
back to software.

Covered by canvas layout tests in the virtual-gpu mode.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::shouldAccelerate):
* platform/chromium/PlatformSupport.h:

Source/WebKit/chromium:

* public/platform/WebKitPlatformSupport.h:
(WebKit::WebKitPlatformSupport::canAccelerate2dCanvas):
(WebKitPlatformSupport):
* src/PlatformSupport.cpp:
(WebCore::PlatformSupport::canAccelerate2dCanvas):
(WebCore):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (110715 => 110716)


--- trunk/Source/WebCore/ChangeLog	2012-03-14 18:03:01 UTC (rev 110715)
+++ trunk/Source/WebCore/ChangeLog	2012-03-14 18:12:29 UTC (rev 110716)
@@ -1,3 +1,20 @@
+2012-03-14  James Robinson  <[email protected]>
+
+        [chromium] Provide explicit polling API to check if the platform is capable of accelerated 2d canvas
+        https://bugs.webkit.org/show_bug.cgi?id=80667
+
+        Reviewed by Darin Fisher.
+
+        Query the platform to see if we can instantiate a context suitable for accelerating 2d canvas. If we can't, for
+        instance if we're on a system that can't preserve a context when the screensaver comes up, then immediately fall
+        back to software.
+
+        Covered by canvas layout tests in the virtual-gpu mode.
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::shouldAccelerate):
+        * platform/chromium/PlatformSupport.h:
+
 2012-03-14  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Handle printing errors in WebKit2

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (110715 => 110716)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2012-03-14 18:03:01 UTC (rev 110715)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2012-03-14 18:12:29 UTC (rev 110716)
@@ -59,6 +59,10 @@
 #include "WebGLRenderingContext.h"
 #endif
 
+#if PLATFORM(CHROMIUM)
+#include "PlatformSupport.h"
+#endif
+
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -461,6 +465,11 @@
     if (size.width() * size.height() < settings->minimumAccelerated2dCanvasSize())
         return false;
 
+#if PLATFORM(CHROMIUM)
+    if (!PlatformSupport::canAccelerate2dCanvas())
+        return false;
+#endif
+
     return true;
 #else
     UNUSED_PARAM(size);

Modified: trunk/Source/WebCore/platform/chromium/PlatformSupport.h (110715 => 110716)


--- trunk/Source/WebCore/platform/chromium/PlatformSupport.h	2012-03-14 18:03:01 UTC (rev 110715)
+++ trunk/Source/WebCore/platform/chromium/PlatformSupport.h	2012-03-14 18:12:29 UTC (rev 110716)
@@ -435,6 +435,8 @@
 
     static void didStartWorkerRunLoop(WorkerRunLoop*);
     static void didStopWorkerRunLoop(WorkerRunLoop*);
+
+    static bool canAccelerate2dCanvas();
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebKit/chromium/ChangeLog (110715 => 110716)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-14 18:03:01 UTC (rev 110715)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-14 18:12:29 UTC (rev 110716)
@@ -1,3 +1,17 @@
+2012-03-14  James Robinson  <[email protected]>
+
+        [chromium] Provide explicit polling API to check if the platform is capable of accelerated 2d canvas
+        https://bugs.webkit.org/show_bug.cgi?id=80667
+
+        Reviewed by Darin Fisher.
+
+        * public/platform/WebKitPlatformSupport.h:
+        (WebKit::WebKitPlatformSupport::canAccelerate2dCanvas):
+        (WebKitPlatformSupport):
+        * src/PlatformSupport.cpp:
+        (WebCore::PlatformSupport::canAccelerate2dCanvas):
+        (WebCore):
+
 2012-03-14  Andrey Kosyakov  <[email protected]>
 
         Web Inspector: add didCancelFrame timeline event

Modified: trunk/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h (110715 => 110716)


--- trunk/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h	2012-03-14 18:03:01 UTC (rev 110715)
+++ trunk/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h	2012-03-14 18:12:29 UTC (rev 110716)
@@ -386,6 +386,8 @@
     // Returns newly allocated and initialized offscreen WebGraphicsContext3D instance.
     virtual WebGraphicsContext3D* createOffscreenGraphicsContext3D(const WebGraphicsContext3D::Attributes&) { return 0; }
 
+    virtual bool canAccelerate2dCanvas() { return false; }
+
     // Audio --------------------------------------------------------------
 
     virtual double audioHardwareSampleRate() { return 0; }

Modified: trunk/Source/WebKit/chromium/src/PlatformSupport.cpp (110715 => 110716)


--- trunk/Source/WebKit/chromium/src/PlatformSupport.cpp	2012-03-14 18:03:01 UTC (rev 110715)
+++ trunk/Source/WebKit/chromium/src/PlatformSupport.cpp	2012-03-14 18:12:29 UTC (rev 110716)
@@ -1136,4 +1136,9 @@
 }
 #endif
 
+bool PlatformSupport::canAccelerate2dCanvas()
+{
+    return webKitPlatformSupport()->canAccelerate2dCanvas();
+}
+
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to