Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (192500 => 192501)
--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-11-17 01:21:06 UTC (rev 192500)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-11-17 01:56:31 UTC (rev 192501)
@@ -1,5 +1,25 @@
2015-11-16 Matthew Hanson <matthew_han...@apple.com>
+ Merge r192284. rdar://problem/22846841
+
+ 2015-11-10 Simon Fraser <simon.fra...@apple.com>
+
+ Use different pixel formats for displays that support them
+ https://bugs.webkit.org/show_bug.cgi?id=151122
+ rdar://problem/22846841
+
+ Reviewed by Tim Horton.
+
+ Add new IOSurface format enum values, and set up the appropriate IOSurfaceCreate()
+ property dictionaries for them.
+
+ * platform/graphics/cocoa/IOSurface.h:
+ * platform/graphics/cocoa/IOSurface.mm:
+ (IOSurface::IOSurface):
+ * platform/spi/cocoa/IOSurfaceSPI.h:
+
+2015-11-16 Matthew Hanson <matthew_han...@apple.com>
+
Merge r192138. rdar://problem/22846841
2015-11-07 Simon Fraser <simon.fra...@apple.com>
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h (192500 => 192501)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h 2015-11-17 01:21:06 UTC (rev 192500)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h 2015-11-17 01:56:31 UTC (rev 192501)
@@ -41,7 +41,9 @@
enum class Format {
RGBA,
#if PLATFORM(IOS)
- YUV422
+ YUV422,
+ RGB10,
+ RGB10A8,
#endif
};
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (192500 => 192501)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm 2015-11-17 01:21:06 UTC (rev 192500)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm 2015-11-17 01:56:31 UTC (rev 192501)
@@ -102,44 +102,115 @@
, m_size(size)
, m_contextSize(size)
{
- unsigned pixelFormat = 'BGRA';
- unsigned bytesPerPixel = 4;
- unsigned bytesPerElement = 4;
- unsigned elementWidth = 1;
-#if PLATFORM(IOS)
- if (format == Format::YUV422) {
- pixelFormat = 'yuvf';
- bytesPerPixel = 2;
- elementWidth = 2;
- bytesPerElement = 4;
- }
-#endif
+ unsigned pixelFormat;
+ unsigned bytesPerPixel;
+ unsigned bytesPerElement;
int width = size.width();
int height = size.height();
- size_t bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerPixel);
- ASSERT(bytesPerRow);
+ NSDictionary *options;
+
+ if (format == Format::RGB10A8) {
+ pixelFormat = 'b3a8';
+
+ // RGB plane (10-10-10)
+ bytesPerPixel = 4;
+ bytesPerElement = 4;
- m_totalBytes = IOSurfaceAlignProperty(kIOSurfaceAllocSize, height * bytesPerRow);
- ASSERT(m_totalBytes);
+ size_t rgbPlaneBytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerElement);
+ size_t rgbPlaneTotalBytes = IOSurfaceAlignProperty(kIOSurfaceAllocSize, height * rgbPlaneBytesPerRow);
- NSDictionary *options = @{
- (id)kIOSurfaceWidth: @(width),
- (id)kIOSurfaceHeight: @(height),
- (id)kIOSurfacePixelFormat: @(pixelFormat),
- (id)kIOSurfaceBytesPerElement: @(bytesPerElement),
- (id)kIOSurfaceBytesPerRow: @(bytesPerRow),
- (id)kIOSurfaceAllocSize: @(m_totalBytes),
+ // Alpha plane (8)
+ bytesPerElement = 1;
+ size_t alphaPlaneBytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerElement);
+ size_t alphaPlaneTotalBytes = IOSurfaceAlignProperty(kIOSurfaceAllocSize, height * alphaPlaneBytesPerRow);
+
+ m_totalBytes = rgbPlaneTotalBytes + alphaPlaneTotalBytes;
+
+ NSArray *planeInfo = @[
+ @{
+ (id)kIOSurfacePlaneWidth: @(width),
+ (id)kIOSurfacePlaneHeight: @(height),
+ (id)kIOSurfacePlaneBytesPerRow: @(rgbPlaneBytesPerRow),
+ (id)kIOSurfacePlaneOffset: @(0),
+ (id)kIOSurfacePlaneSize: @(rgbPlaneTotalBytes)
+ },
+ @{
+ (id)kIOSurfacePlaneWidth: @(width),
+ (id)kIOSurfacePlaneHeight: @(height),
+ (id)kIOSurfacePlaneBytesPerRow: @(alphaPlaneBytesPerRow),
+ (id)kIOSurfacePlaneOffset: @(rgbPlaneTotalBytes),
+ (id)kIOSurfacePlaneSize: @(alphaPlaneTotalBytes)
+ }
+ ];
+
+ options = @{
+ (id)kIOSurfaceWidth: @(width),
+ (id)kIOSurfaceHeight: @(height),
+ (id)kIOSurfacePixelFormat: @(pixelFormat),
+ (id)kIOSurfaceAllocSize: @(m_totalBytes),
#if PLATFORM(IOS)
- (id)kIOSurfaceCacheMode: @(kIOMapWriteCombineCache),
+ (id)kIOSurfaceCacheMode: @(kIOMapWriteCombineCache),
#endif
- (id)kIOSurfaceElementWidth: @(elementWidth),
- (id)kIOSurfaceElementHeight: @(1)
- };
+ (id)kIOSurfacePlaneInfo: planeInfo,
+ };
+ } else {
+ unsigned elementWidth;
+ switch (format) {
+ case Format::RGBA:
+ pixelFormat = 'BGRA';
+ bytesPerPixel = 4;
+ bytesPerElement = 4;
+ elementWidth = 1;
+ break;
+ case Format::YUV422:
+ pixelFormat = 'yuvf';
+ bytesPerPixel = 2;
+ bytesPerElement = 4;
+ elementWidth = 2;
+ break;
+ case Format::RGB10:
+ pixelFormat = 'w30r';
+ bytesPerPixel = 4;
+ bytesPerElement = 4;
+ elementWidth = 1;
+ break;
+ case Format::RGB10A8:
+ ASSERT_NOT_REACHED();
+ pixelFormat = 'b3a8';
+ bytesPerPixel = 1;
+ bytesPerElement = 1;
+ elementWidth = 1;
+ break;
+ }
+
+ size_t bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerPixel);
+ ASSERT(bytesPerRow);
+
+ m_totalBytes = IOSurfaceAlignProperty(kIOSurfaceAllocSize, height * bytesPerRow);
+ ASSERT(m_totalBytes);
+
+ options = @{
+ (id)kIOSurfaceWidth: @(width),
+ (id)kIOSurfaceHeight: @(height),
+ (id)kIOSurfacePixelFormat: @(pixelFormat),
+ (id)kIOSurfaceBytesPerElement: @(bytesPerElement),
+ (id)kIOSurfaceBytesPerRow: @(bytesPerRow),
+ (id)kIOSurfaceAllocSize: @(m_totalBytes),
+#if PLATFORM(IOS)
+ (id)kIOSurfaceCacheMode: @(kIOMapWriteCombineCache),
+#endif
+ (id)kIOSurfaceElementWidth: @(elementWidth),
+ (id)kIOSurfaceElementHeight: @(1)
+ };
+ }
+
m_surface = adoptCF(IOSurfaceCreate((CFDictionaryRef)options));
+ if (!m_surface)
+ NSLog(@"Surface creation failed for options %@", options);
}
IOSurface::IOSurface(IntSize size, IntSize contextSize, ColorSpace colorSpace)
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h (192500 => 192501)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h 2015-11-17 01:21:06 UTC (rev 192500)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h 2015-11-17 01:56:31 UTC (rev 192501)
@@ -56,6 +56,12 @@
extern const CFStringRef kIOSurfaceHeight;
extern const CFStringRef kIOSurfacePixelFormat;
extern const CFStringRef kIOSurfaceWidth;
+extern const CFStringRef kIOSurfacePlaneWidth;
+extern const CFStringRef kIOSurfacePlaneHeight;
+extern const CFStringRef kIOSurfacePlaneBytesPerRow;
+extern const CFStringRef kIOSurfacePlaneOffset;
+extern const CFStringRef kIOSurfacePlaneSize;
+extern const CFStringRef kIOSurfacePlaneInfo;
size_t IOSurfaceAlignProperty(CFStringRef property, size_t value);
IOSurfaceRef IOSurfaceCreate(CFDictionaryRef properties);
Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (192500 => 192501)
--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog 2015-11-17 01:21:06 UTC (rev 192500)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog 2015-11-17 01:56:31 UTC (rev 192501)
@@ -1,5 +1,24 @@
2015-11-16 Matthew Hanson <matthew_han...@apple.com>
+ Merge r192284. rdar://problem/22846841
+
+ 2015-11-10 Simon Fraser <simon.fra...@apple.com>
+
+ Use different pixel formats for displays that support them
+ https://bugs.webkit.org/show_bug.cgi?id=151122
+ rdar://problem/22846841
+
+ Reviewed by Tim Horton.
+
+ New the new IOSurface formats when appropriate for the properties of the
+ display.
+
+ * Shared/mac/RemoteLayerBackingStore.mm:
+ (WebKit::bufferFormat):
+ (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
+
+2015-11-16 Matthew Hanson <matthew_han...@apple.com>
+
Merge r191895. rdar://problem/23501902
2015-11-02 Yongjun Zhang <yongjun_zh...@apple.com>
Modified: branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (192500 => 192501)
--- branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm 2015-11-17 01:21:06 UTC (rev 192500)
+++ branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm 2015-11-17 01:56:31 UTC (rev 192501)
@@ -45,6 +45,23 @@
#import <mach/mach_port.h>
#endif
+#if __has_include(<WebKitAdditions/RemoteLayerBackingStoreAdditions.mm>)
+#import <WebKitAdditions/RemoteLayerBackingStoreAdditions.mm>
+#else
+
+namespace WebKit {
+
+#if USE(IOSURFACE)
+static WebCore::IOSurface::Format bufferFormat(bool)
+{
+ return WebCore::IOSurface::Format::RGBA;
+}
+#endif // USE(IOSURFACE)
+
+} // namespace WebKit
+
+#endif
+
using namespace WebCore;
namespace WebKit {
@@ -186,10 +203,9 @@
std::swap(m_frontBuffer, m_backBuffer);
if (!m_frontBuffer.surface)
- m_frontBuffer.surface = IOSurface::create(expandedScaledSize, ColorSpaceSRGB);
+ m_frontBuffer.surface = IOSurface::create(expandedScaledSize, ColorSpaceSRGB, bufferFormat(m_isOpaque));
setBufferVolatility(BufferType::Front, false);
-
return;
}
#endif