Title: [227524] trunk/Source/WebCore
Revision
227524
Author
d...@apple.com
Date
2018-01-24 09:14:56 -0800 (Wed, 24 Jan 2018)

Log Message

REGRESSION (r222961?): sRGB images shown in WebGL are over-saturated on a wide gamut monitor
https://bugs.webkit.org/show_bug.cgi?id=182033
<rdar://problem/36377780>

Reviewed by Antoine Quint.

Source/WebCore:

My fix for YouTube360 changed the way we composite WebGL on macOS. Unfortunately it dropped
a flag telling the compositor the colorspace of the content should be sRGB. Reinstate this
by explicitly setting the colorspace on the IOSurface we use for WebGL back buffers.

This *should* be covered by the test in:
fast/canvas/webgl/match-page-color-space.html
... however, it shows a problem with our testing infrastructure. As long as it is not
testing on a Wide Gamut display, and explicitly setting the color profile, an automated
test won't pick up this regression. I could add an Internals helper to query the colorspace
of the WebGL content, but that doesn't actually verify the composited result, which is
all that matters.

* platform/graphics/cocoa/WebGLLayer.mm:
(-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):

Source/WebCore/PAL:

Expose an IOSurface colorspace property name, and a function to serialize a CGColorSpace.

* pal/spi/cg/CoreGraphicsSPI.h:
* pal/spi/cocoa/IOSurfaceSPI.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (227523 => 227524)


--- trunk/Source/WebCore/ChangeLog	2018-01-24 16:09:52 UTC (rev 227523)
+++ trunk/Source/WebCore/ChangeLog	2018-01-24 17:14:56 UTC (rev 227524)
@@ -1,3 +1,26 @@
+2018-01-23  Dean Jackson  <d...@apple.com>
+
+        REGRESSION (r222961?): sRGB images shown in WebGL are over-saturated on a wide gamut monitor
+        https://bugs.webkit.org/show_bug.cgi?id=182033
+        <rdar://problem/36377780>
+
+        Reviewed by Antoine Quint.
+
+        My fix for YouTube360 changed the way we composite WebGL on macOS. Unfortunately it dropped
+        a flag telling the compositor the colorspace of the content should be sRGB. Reinstate this
+        by explicitly setting the colorspace on the IOSurface we use for WebGL back buffers.
+
+        This *should* be covered by the test in:
+        fast/canvas/webgl/match-page-color-space.html
+        ... however, it shows a problem with our testing infrastructure. As long as it is not
+        testing on a Wide Gamut display, and explicitly setting the color profile, an automated
+        test won't pick up this regression. I could add an Internals helper to query the colorspace
+        of the WebGL content, but that doesn't actually verify the composited result, which is
+        all that matters.
+
+        * platform/graphics/cocoa/WebGLLayer.mm:
+        (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
+
 2018-01-24  Ms2ger  <ms2...@igalia.com>
 
         [GTK] Fix some test failures in ATK selection handling.

Modified: trunk/Source/WebCore/PAL/ChangeLog (227523 => 227524)


--- trunk/Source/WebCore/PAL/ChangeLog	2018-01-24 16:09:52 UTC (rev 227523)
+++ trunk/Source/WebCore/PAL/ChangeLog	2018-01-24 17:14:56 UTC (rev 227524)
@@ -1,3 +1,16 @@
+2018-01-23  Dean Jackson  <d...@apple.com>
+
+        REGRESSION (r222961?): sRGB images shown in WebGL are over-saturated on a wide gamut monitor
+        https://bugs.webkit.org/show_bug.cgi?id=182033
+        <rdar://problem/36377780>
+
+        Reviewed by Antoine Quint.
+
+        Expose an IOSurface colorspace property name, and a function to serialize a CGColorSpace.
+
+        * pal/spi/cg/CoreGraphicsSPI.h:
+        * pal/spi/cocoa/IOSurfaceSPI.h:
+
 2018-01-23  Michael Catanzaro  <mcatanz...@igalia.com>
 
         [WPE][GTK] Sleep inhibitors do not work under Flatpak

Modified: trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h (227523 => 227524)


--- trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h	2018-01-24 16:09:52 UTC (rev 227523)
+++ trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h	2018-01-24 17:14:56 UTC (rev 227524)
@@ -267,6 +267,7 @@
 
 #if PLATFORM(COCOA)
 CGColorSpaceRef CGContextCopyDeviceColorSpace(CGContextRef);
+CFPropertyListRef CGColorSpaceCopyPropertyList(CGColorSpaceRef);
 CGError CGSNewRegionWithRect(const CGRect*, CGRegionRef*);
 CGError CGSPackagesEnableConnectionOcclusionNotifications(CGSConnectionID, bool flag, bool* outCurrentVisibilityState);
 CGError CGSPackagesEnableConnectionWindowModificationNotifications(CGSConnectionID, bool flag, bool* outConnectionIsCurrentlyIdle);

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/IOSurfaceSPI.h (227523 => 227524)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/IOSurfaceSPI.h	2018-01-24 16:09:52 UTC (rev 227523)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/IOSurfaceSPI.h	2018-01-24 17:14:56 UTC (rev 227524)
@@ -54,6 +54,7 @@
 extern const CFStringRef kIOSurfaceBytesPerElement;
 extern const CFStringRef kIOSurfaceBytesPerRow;
 extern const CFStringRef kIOSurfaceCacheMode;
+extern const CFStringRef kIOSurfaceColorSpace;
 extern const CFStringRef kIOSurfaceHeight;
 extern const CFStringRef kIOSurfacePixelFormat;
 extern const CFStringRef kIOSurfaceWidth;

Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm (227523 => 227524)


--- trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm	2018-01-24 16:09:52 UTC (rev 227523)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm	2018-01-24 17:14:56 UTC (rev 227524)
@@ -154,9 +154,15 @@
     _contentsBuffer = WebCore::IOSurface::create(size, sRGBColorSpaceRef());
     _drawingBuffer = WebCore::IOSurface::create(size, sRGBColorSpaceRef());
     _spareBuffer = WebCore::IOSurface::create(size, sRGBColorSpaceRef());
+
     ASSERT(_contentsBuffer);
     ASSERT(_drawingBuffer);
     ASSERT(_spareBuffer);
+
+    auto sRGBDetails = adoptCF(CGColorSpaceCopyPropertyList(sRGBColorSpaceRef()));
+    IOSurfaceSetValue(_contentsBuffer->surface(), kIOSurfaceColorSpace, sRGBDetails.get());
+    IOSurfaceSetValue(_drawingBuffer->surface(), kIOSurfaceColorSpace, sRGBDetails.get());
+    IOSurfaceSetValue(_spareBuffer->surface(), kIOSurfaceColorSpace, sRGBDetails.get());
 }
 
 - (void)bindFramebufferToNextAvailableSurface
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to