Title: [225260] trunk
- Revision
- 225260
- Author
- [email protected]
- Date
- 2017-11-28 23:07:35 -0800 (Tue, 28 Nov 2017)
Log Message
[Cairo] Limit the number of active contexts in GraphicsContext3DCairo
https://bugs.webkit.org/show_bug.cgi?id=166968
Reviewed by Alex Christensen.
Source/WebCore:
Cairo's implementation of GraphicsContext3D should follow the Mac's
and limit the number of active GraphicsContext3D objects.
The active contexts are listed in a global Deque, with the first
among them being recycled when the GraphicsContext3D::create()
function sees that the limit has been reached. That function still
returns null if even after recycling the number of contexts didn't
decrease.
Finally, in the GraphicsContext3D destructor, the context being
destroyed is removed from the list of active contexts.
No new tests -- relevant tests are now passing.
* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::activeContexts):
(WebCore::GraphicsContext3D::create):
(WebCore::GraphicsContext3D::~GraphicsContext3D):
LayoutTests:
* platform/gtk/TestExpectations: Unskip WebGL tests that were failing
due to missing active context limit management.
* platform/wpe/TestExpectations: Ditto.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (225259 => 225260)
--- trunk/LayoutTests/ChangeLog 2017-11-29 06:16:54 UTC (rev 225259)
+++ trunk/LayoutTests/ChangeLog 2017-11-29 07:07:35 UTC (rev 225260)
@@ -1,3 +1,14 @@
+2017-11-28 Zan Dobersek <[email protected]>
+
+ [Cairo] Limit the number of active contexts in GraphicsContext3DCairo
+ https://bugs.webkit.org/show_bug.cgi?id=166968
+
+ Reviewed by Alex Christensen.
+
+ * platform/gtk/TestExpectations: Unskip WebGL tests that were failing
+ due to missing active context limit management.
+ * platform/wpe/TestExpectations: Ditto.
+
2017-11-28 Joseph Pecoraro <[email protected]>
Web Inspector: Write script syntax tree tests for template literals and default parameter values
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (225259 => 225260)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2017-11-29 06:16:54 UTC (rev 225259)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2017-11-29 07:07:35 UTC (rev 225260)
@@ -489,11 +489,6 @@
webkit.org/b/169917 webgl/1.0.3/conformance/renderbuffers/feedback-loop.html [ Failure ]
webkit.org/b/169917 webgl/1.0.3/conformance/rendering/point-no-attributes.html [ Failure ]
webkit.org/b/169917 webgl/1.0.3/conformance/textures/texture-copying-feedback-loops.html [ Failure ]
-webkit.org/b/169917 webgl/many-contexts-access-after-loss.html [ Failure ]
-webkit.org/b/169917 webgl/many-contexts.html [ Failure ]
-webkit.org/b/169917 webgl/max-active-contexts-console-warning.html [ Failure ]
-webkit.org/b/169917 webgl/max-active-contexts-gc.html [ Failure ]
-webkit.org/b/169917 webgl/max-active-contexts-oldest-context-lost.html [ Failure ]
webkit.org/b/169917 webgl/webgl-vertex-array-object-defined.html [ Failure ]
webkit.org/b/169917 webgl/webgl-border.html [ ImageOnlyFailure ]
webkit.org/b/169917 webgl/webgl-box-shadow.html [ ImageOnlyFailure ]
@@ -533,7 +528,6 @@
webkit.org/b/169917 webgl/1.0.3/conformance/uniforms/uniform-values-per-program.html [ Slow ]
webkit.org/b/169917 webgl/1.0.3/conformance/context/context-eviction-with-garbage-collection.html [ Slow ]
webkit.org/b/169917 webgl/1.0.3/conformance/glsl/misc/struct-nesting-of-variable-names.html [ Slow ]
-webkit.org/b/169917 webgl/max-active-contexts-webglcontextlost-prevent-default.html [ Timeout ]
# WebGL crashes
webkit.org/b/169917 fast/canvas/webgl/webgl-draw-buffers.html [ Failure Crash ]
webkit.org/b/169917 webgl/1.0.3/conformance/extensions/webgl-draw-buffers.html [ Failure Crash ]
Modified: trunk/LayoutTests/platform/wpe/TestExpectations (225259 => 225260)
--- trunk/LayoutTests/platform/wpe/TestExpectations 2017-11-29 06:16:54 UTC (rev 225259)
+++ trunk/LayoutTests/platform/wpe/TestExpectations 2017-11-29 07:07:35 UTC (rev 225260)
@@ -144,13 +144,6 @@
# Pixel test result oddities
Bug(WPE) webgl/webgl-border.html [ ImageOnlyFailure ]
Bug(WPE) webgl/webgl-box-shadow.html [ ImageOnlyFailure ]
-# Unknown
-Bug(WPE) webgl/many-contexts-access-after-loss.html [ Failure ]
-Bug(WPE) webgl/many-contexts.html [ Failure ]
-Bug(WPE) webgl/max-active-contexts-console-warning.html [ Failure ]
-Bug(WPE) webgl/max-active-contexts-gc.html [ Failure ]
-Bug(WPE) webgl/max-active-contexts-oldest-context-lost.html [ Failure ]
-webkit.org/b/169917 webgl/max-active-contexts-webglcontextlost-prevent-default.html [ Timeout ]
# Slow
webkit.org/b/169917 webgl/1.0.2/conformance/glsl/misc/shader-uniform-packing-restrictions.html [ Slow ]
webkit.org/b/169917 webgl/1.0.2/conformance/glsl/misc/shader-with-non-reserved-words.html [ Slow ]
Modified: trunk/Source/WebCore/ChangeLog (225259 => 225260)
--- trunk/Source/WebCore/ChangeLog 2017-11-29 06:16:54 UTC (rev 225259)
+++ trunk/Source/WebCore/ChangeLog 2017-11-29 07:07:35 UTC (rev 225260)
@@ -1,3 +1,29 @@
+2017-11-28 Zan Dobersek <[email protected]>
+
+ [Cairo] Limit the number of active contexts in GraphicsContext3DCairo
+ https://bugs.webkit.org/show_bug.cgi?id=166968
+
+ Reviewed by Alex Christensen.
+
+ Cairo's implementation of GraphicsContext3D should follow the Mac's
+ and limit the number of active GraphicsContext3D objects.
+
+ The active contexts are listed in a global Deque, with the first
+ among them being recycled when the GraphicsContext3D::create()
+ function sees that the limit has been reached. That function still
+ returns null if even after recycling the number of contexts didn't
+ decrease.
+
+ Finally, in the GraphicsContext3D destructor, the context being
+ destroyed is removed from the list of active contexts.
+
+ No new tests -- relevant tests are now passing.
+
+ * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
+ (WebCore::activeContexts):
+ (WebCore::GraphicsContext3D::create):
+ (WebCore::GraphicsContext3D::~GraphicsContext3D):
+
2017-11-28 Zalan Bujtas <[email protected]>
Clean up spanners before creating nested column context
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp (225259 => 225260)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp 2017-11-29 06:16:54 UTC (rev 225259)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp 2017-11-29 07:07:35 UTC (rev 225260)
@@ -40,6 +40,8 @@
#include "PlatformContextCairo.h"
#include "RefPtrCairo.h"
#include <cairo.h>
+#include <wtf/Deque.h>
+#include <wtf/NeverDestroyed.h>
#if PLATFORM(WIN)
#include <GLSLANG/ShaderLang.h>
@@ -65,6 +67,13 @@
namespace WebCore {
+static const size_t MaxActiveContexts = 16;
+static Deque<GraphicsContext3D*, MaxActiveContexts>& activeContexts()
+{
+ static NeverDestroyed<Deque<GraphicsContext3D*, MaxActiveContexts>> s_activeContexts;
+ return s_activeContexts;
+}
+
RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3DAttributes attributes, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
{
// This implementation doesn't currently support rendering directly to the HostWindow.
@@ -82,6 +91,15 @@
if (!success)
return nullptr;
+ auto& contexts = activeContexts();
+ if (contexts.size() >= MaxActiveContexts)
+ contexts.first()->recycleContext();
+
+ // Calling recycleContext() above should have lead to the graphics context being
+ // destroyed and thus removed from the active contexts list.
+ if (contexts.size() >= MaxActiveContexts)
+ return nullptr;
+
// Create the GraphicsContext3D object first in order to establist a current context on this thread.
auto context = adoptRef(new GraphicsContext3D(attributes, hostWindow, renderStyle));
@@ -91,6 +109,7 @@
return nullptr;
#endif
+ contexts.append(context.get());
return context;
}
@@ -251,6 +270,9 @@
if (m_vao)
deleteVertexArray(m_vao);
+
+ auto* activeContext = activeContexts().takeLast([this](auto* it) { return it == this; });
+ ASSERT_UNUSED(activeContext, !!activeContext);
}
GraphicsContext3D::ImageExtractor::~ImageExtractor()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes