Title: [188968] trunk/Source/WebCore
Revision
188968
Author
commit-qu...@webkit.org
Date
2015-08-26 09:44:43 -0700 (Wed, 26 Aug 2015)

Log Message

[Cairo] Accelerated canvas should fall back to non-accelerated canvas on creation failure
https://bugs.webkit.org/show_bug.cgi?id=148476

Patch by Jinyoung Hur <hur....@navercorp.com> on 2015-08-26
Reviewed by Brent Fulgham.

Cairo-gl backed surface might fail to be created with large dimensions, e.g., 50x32000, depending on
the gl implementations. In case of Mac port, ImageBufferCG falls back to a software surface when it fails to create
IOSurface, an accelerated surface. Though the unaccelerated surface could be slower, it would be better
to create a working surface than nothing.

Because the max dimensions of gl texture might vary among the OpenGL implementations, below test can't guarantee
the verification of behavior difference depending on the running platform.

Test: fast/canvas/canvas-large-dimensions.html

* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::ImageBuffer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (188967 => 188968)


--- trunk/Source/WebCore/ChangeLog	2015-08-26 16:06:21 UTC (rev 188967)
+++ trunk/Source/WebCore/ChangeLog	2015-08-26 16:44:43 UTC (rev 188968)
@@ -1,3 +1,23 @@
+2015-08-26  Jinyoung Hur  <hur....@navercorp.com>
+
+        [Cairo] Accelerated canvas should fall back to non-accelerated canvas on creation failure
+        https://bugs.webkit.org/show_bug.cgi?id=148476
+
+        Reviewed by Brent Fulgham.
+
+        Cairo-gl backed surface might fail to be created with large dimensions, e.g., 50x32000, depending on 
+        the gl implementations. In case of Mac port, ImageBufferCG falls back to a software surface when it fails to create
+        IOSurface, an accelerated surface. Though the unaccelerated surface could be slower, it would be better
+        to create a working surface than nothing.
+
+        Because the max dimensions of gl texture might vary among the OpenGL implementations, below test can't guarantee
+        the verification of behavior difference depending on the running platform.
+
+        Test: fast/canvas/canvas-large-dimensions.html
+
+        * platform/graphics/cairo/ImageBufferCairo.cpp:
+        (WebCore::ImageBuffer::ImageBuffer):
+
 2015-08-26  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r188960.

Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp (188967 => 188968)


--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp	2015-08-26 16:06:21 UTC (rev 188967)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp	2015-08-26 16:44:43 UTC (rev 188968)
@@ -117,9 +117,12 @@
         return;
 
 #if ENABLE(ACCELERATED_2D_CANVAS)
-    if (renderingMode == Accelerated)
+    if (renderingMode == Accelerated) {
         m_data.m_surface = createCairoGLSurface(size, m_data.m_texture);
-    else
+        if (!m_data.m_surface || cairo_surface_status(m_data.m_surface.get()) != CAIRO_STATUS_SUCCESS)
+            renderingMode = Unaccelerated; // If allocation fails, fall back to non-accelerated path.
+    }
+    if (renderingMode == Unaccelerated)
 #else
     ASSERT_UNUSED(renderingMode, renderingMode != Accelerated);
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to