Diff
Modified: trunk/ChangeLog (204663 => 204664)
--- trunk/ChangeLog 2016-08-19 22:49:26 UTC (rev 204663)
+++ trunk/ChangeLog 2016-08-19 22:52:24 UTC (rev 204664)
@@ -1,3 +1,18 @@
+2016-08-19 Dean Jackson <[email protected]>
+
+ Implement preferLowPowerToHighPerformance for WebGL
+ https://bugs.webkit.org/show_bug.cgi?id=161017
+ <rdar://problem/26819135>
+
+ Reviewed by Myles Maxfield.
+
+ A manual test that creates contexts with and without preferLowPowerToHighPerformance
+ to see what is used. This has to be manual because it depends on the hardware
+ configuration, and we don't have a way to detect it up-front. Also, if the
+ code was failing, it would be the same result as on a single GPU system.
+
+ * ManualTests/webgl-preferLowPowerToHighPerformance.html: Added.
+
2016-08-19 Per Arne Vollan <[email protected]>
[Win] Warning fix.
Modified: trunk/LayoutTests/ChangeLog (204663 => 204664)
--- trunk/LayoutTests/ChangeLog 2016-08-19 22:49:26 UTC (rev 204663)
+++ trunk/LayoutTests/ChangeLog 2016-08-19 22:52:24 UTC (rev 204664)
@@ -1,3 +1,16 @@
+2016-08-19 Dean Jackson <[email protected]>
+
+ Implement preferLowPowerToHighPerformance for WebGL
+ https://bugs.webkit.org/show_bug.cgi?id=161017
+ <rdar://problem/26819135>
+
+ Reviewed by Myles Maxfield.
+
+ Now that we implement preferLowPowerToHighPerformance we can
+ retain its value in the context creation attributes object.
+
+ * fast/canvas/webgl/context-creation-attributes-expected.txt:
+
2016-08-19 Ryan Haddad <[email protected]>
Rebaseline imported/w3c/web-platform-tests/html/semantics/interfaces.html for ios-simulator after r204647.
Modified: trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt (204663 => 204664)
--- trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt 2016-08-19 22:49:26 UTC (rev 204663)
+++ trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt 2016-08-19 22:52:24 UTC (rev 204664)
@@ -2,5 +2,5 @@
{"alpha":true,"depth":true,"stencil":false,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":false,"failIfMajorPerformanceCaveat":false}
{"alpha":true,"depth":true,"stencil":true,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":false,"failIfMajorPerformanceCaveat":false}
+{"alpha":true,"depth":true,"stencil":false,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":true,"failIfMajorPerformanceCaveat":false}
{"alpha":true,"depth":true,"stencil":false,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":false,"failIfMajorPerformanceCaveat":false}
-{"alpha":true,"depth":true,"stencil":false,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":false,"failIfMajorPerformanceCaveat":false}
Added: trunk/ManualTests/webgl-preferLowPowerToHighPerformance.html (0 => 204664)
--- trunk/ManualTests/webgl-preferLowPowerToHighPerformance.html (rev 0)
+++ trunk/ManualTests/webgl-preferLowPowerToHighPerformance.html 2016-08-19 22:52:24 UTC (rev 204664)
@@ -0,0 +1,38 @@
+<script>
+function createAndDescribeContext(msg, parameters)
+{
+ var canvas = document.createElement("canvas");
+ var gl = canvas.getContext("webgl", parameters);
+ var ext = gl.getExtension("WEBGL_debug_renderer_info");
+
+ var header = document.createElement("p");
+ header.textContent = msg;
+ document.body.appendChild(header);
+
+ var result = document.createElement("pre");
+ result.textContent = "UNMASKED_VENDOR_WEBGL is " + gl.getParameter(ext.UNMASKED_VENDOR_WEBGL) + "\n";
+ result.textContent += "UNMASKED_RENDERER_WEBGL is " + gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);
+ document.body.appendChild(result);
+}
+
+function run()
+{
+ createAndDescribeContext("With preferLowPowerToHighPerformance", {preferLowPowerToHighPerformance: true});
+ createAndDescribeContext("Without preferLowPowerToHighPerformance", {});
+}
+
+window.addEventListener("load", run, false);
+</script>
+<p>
+ This is a manual test, since it relies on hardware configurations. It creates two
+ WebGL contexts. It first asks for a context with preferLowPowerToHighPerformance
+ set to true, and then for a context with the default value (false).
+</p>
+<p>
+ Unfortunately there isn't a completely reliable way to know if this test passed.
+ On a system with both an integrated and discrete GPU, assuming that the system
+ is configured to prefer the integrated GPU, and no other apps are running
+ that might cause the discrete GPU to be active, the two renderers should be different.
+ Also, if they are different, then the first one should be the lower power model
+ (i.e. the integrated card).
+</p>
\ No newline at end of file
Property changes on: trunk/ManualTests/webgl-preferLowPowerToHighPerformance.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Modified: trunk/Source/WebCore/ChangeLog (204663 => 204664)
--- trunk/Source/WebCore/ChangeLog 2016-08-19 22:49:26 UTC (rev 204663)
+++ trunk/Source/WebCore/ChangeLog 2016-08-19 22:52:24 UTC (rev 204664)
@@ -1,3 +1,21 @@
+2016-08-19 Dean Jackson <[email protected]>
+
+ Implement preferLowPowerToHighPerformance for WebGL
+ https://bugs.webkit.org/show_bug.cgi?id=161017
+ <rdar://problem/26819135>
+
+ Reviewed by Myles Maxfield.
+
+ Implement preferLowPowerToHighPerformance on macOS by
+ passing the correct CGL attribute when creating the
+ pixel format.
+
+ * bindings/js/JSHTMLCanvasElementCustom.cpp:
+ (WebCore::get3DContextAttributes):
+ * platform/graphics/mac/GraphicsContext3DMac.mm:
+ (WebCore::setPixelFormat):
+ (WebCore::GraphicsContext3D::GraphicsContext3D):
+
2016-08-19 Joseph Pecoraro <[email protected]>
Remove empty files and empty namespace blocks
Modified: trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp (204663 => 204664)
--- trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp 2016-08-19 22:49:26 UTC (rev 204663)
+++ trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp 2016-08-19 22:52:24 UTC (rev 204664)
@@ -62,7 +62,8 @@
dictionary.tryGetProperty("antialias", graphicsAttrs.antialias);
dictionary.tryGetProperty("premultipliedAlpha", graphicsAttrs.premultipliedAlpha);
dictionary.tryGetProperty("preserveDrawingBuffer", graphicsAttrs.preserveDrawingBuffer);
-
+ dictionary.tryGetProperty("preferLowPowerToHighPerformance", graphicsAttrs.preferLowPowerToHighPerformance);
+
attrs = WebGLContextAttributes::create(graphicsAttrs);
}
#endif
Modified: trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm (204663 => 204664)
--- trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm 2016-08-19 22:49:26 UTC (rev 204663)
+++ trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm 2016-08-19 22:52:24 UTC (rev 204664)
@@ -84,7 +84,7 @@
};
#if !PLATFORM(IOS)
-static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBits, int depthBits, bool accelerated, bool supersample, bool closest, bool antialias)
+static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBits, int depthBits, bool accelerated, bool supersample, bool closest, bool antialias, bool allowOffline)
{
attribs.clear();
@@ -92,7 +92,14 @@
attribs.append(static_cast<CGLPixelFormatAttribute>(colorBits));
attribs.append(kCGLPFADepthSize);
attribs.append(static_cast<CGLPixelFormatAttribute>(depthBits));
-
+
+ // This attribute, while mentioning offline renderers, is actually
+ // allowing us to request the integrated graphics on a dual GPU
+ // system, and not force the discrete GPU.
+ // See https://developer.apple.com/library/mac/technotes/tn2229/_index.html
+ if (allowOffline)
+ attribs.append(kCGLPFAAllowOfflineRenderers);
+
if (accelerated)
attribs.append(kCGLPFAAccelerated);
else {
@@ -191,22 +198,22 @@
// If none of that works, we simply fail and set m_contextObj to 0.
bool useMultisampling = m_attrs.antialias;
-
- setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, true, false, useMultisampling);
+
+ setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, true, false, useMultisampling, attrs.preferLowPowerToHighPerformance);
CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
- if (numPixelFormats == 0) {
- setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, false, false, useMultisampling);
+ if (!numPixelFormats) {
+ setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.preferLowPowerToHighPerformance);
CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
- if (numPixelFormats == 0) {
- setPixelFormat(attribs, 32, 16, !attrs.forceSoftwareRenderer, false, false, useMultisampling);
+ if (!numPixelFormats) {
+ setPixelFormat(attribs, 32, 16, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.preferLowPowerToHighPerformance);
CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
- if (!attrs.forceSoftwareRenderer && numPixelFormats == 0) {
- setPixelFormat(attribs, 32, 16, false, false, true, false);
- CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
- useMultisampling = false;
+ if (!attrs.forceSoftwareRenderer && !numPixelFormats) {
+ setPixelFormat(attribs, 32, 16, false, false, true, false, false);
+ CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
+ useMultisampling = false;
}
}
}