Changeset 192501 in webkit
- Timestamp:
- Nov 16, 2015 5:56:31 PM (8 years ago)
- Location:
- branches/safari-601.1.46-branch/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-601.1.46-branch/Source/WebCore/ChangeLog
r192479 r192501 1 2015-11-16 Matthew Hanson <matthew_hanson@apple.com> 2 3 Merge r192284. rdar://problem/22846841 4 5 2015-11-10 Simon Fraser <simon.fraser@apple.com> 6 7 Use different pixel formats for displays that support them 8 https://bugs.webkit.org/show_bug.cgi?id=151122 9 rdar://problem/22846841 10 11 Reviewed by Tim Horton. 12 13 Add new IOSurface format enum values, and set up the appropriate IOSurfaceCreate() 14 property dictionaries for them. 15 16 * platform/graphics/cocoa/IOSurface.h: 17 * platform/graphics/cocoa/IOSurface.mm: 18 (IOSurface::IOSurface): 19 * platform/spi/cocoa/IOSurfaceSPI.h: 20 1 21 2015-11-16 Matthew Hanson <matthew_hanson@apple.com> 2 22 -
branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h
r192419 r192501 42 42 RGBA, 43 43 #if PLATFORM(IOS) 44 YUV422 44 YUV422, 45 RGB10, 46 RGB10A8, 45 47 #endif 46 48 }; -
branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm
r192479 r192501 103 103 , m_contextSize(size) 104 104 { 105 unsigned pixelFormat = 'BGRA'; 106 unsigned bytesPerPixel = 4; 107 unsigned bytesPerElement = 4; 108 unsigned elementWidth = 1; 109 110 #if PLATFORM(IOS) 111 if (format == Format::YUV422) { 112 pixelFormat = 'yuvf'; 113 bytesPerPixel = 2; 114 elementWidth = 2; 115 bytesPerElement = 4; 116 } 117 #endif 105 106 unsigned pixelFormat; 107 unsigned bytesPerPixel; 108 unsigned bytesPerElement; 118 109 119 110 int width = size.width(); 120 111 int height = size.height(); 121 112 122 size_t bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerPixel); 123 ASSERT(bytesPerRow); 124 125 m_totalBytes = IOSurfaceAlignProperty(kIOSurfaceAllocSize, height * bytesPerRow); 126 ASSERT(m_totalBytes); 127 128 NSDictionary *options = @{ 129 (id)kIOSurfaceWidth: @(width), 130 (id)kIOSurfaceHeight: @(height), 131 (id)kIOSurfacePixelFormat: @(pixelFormat), 132 (id)kIOSurfaceBytesPerElement: @(bytesPerElement), 133 (id)kIOSurfaceBytesPerRow: @(bytesPerRow), 134 (id)kIOSurfaceAllocSize: @(m_totalBytes), 113 NSDictionary *options; 114 115 if (format == Format::RGB10A8) { 116 pixelFormat = 'b3a8'; 117 118 // RGB plane (10-10-10) 119 bytesPerPixel = 4; 120 bytesPerElement = 4; 121 122 size_t rgbPlaneBytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerElement); 123 size_t rgbPlaneTotalBytes = IOSurfaceAlignProperty(kIOSurfaceAllocSize, height * rgbPlaneBytesPerRow); 124 125 // Alpha plane (8) 126 bytesPerElement = 1; 127 size_t alphaPlaneBytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerElement); 128 size_t alphaPlaneTotalBytes = IOSurfaceAlignProperty(kIOSurfaceAllocSize, height * alphaPlaneBytesPerRow); 129 130 m_totalBytes = rgbPlaneTotalBytes + alphaPlaneTotalBytes; 131 132 NSArray *planeInfo = @[ 133 @{ 134 (id)kIOSurfacePlaneWidth: @(width), 135 (id)kIOSurfacePlaneHeight: @(height), 136 (id)kIOSurfacePlaneBytesPerRow: @(rgbPlaneBytesPerRow), 137 (id)kIOSurfacePlaneOffset: @(0), 138 (id)kIOSurfacePlaneSize: @(rgbPlaneTotalBytes) 139 }, 140 @{ 141 (id)kIOSurfacePlaneWidth: @(width), 142 (id)kIOSurfacePlaneHeight: @(height), 143 (id)kIOSurfacePlaneBytesPerRow: @(alphaPlaneBytesPerRow), 144 (id)kIOSurfacePlaneOffset: @(rgbPlaneTotalBytes), 145 (id)kIOSurfacePlaneSize: @(alphaPlaneTotalBytes) 146 } 147 ]; 148 149 options = @{ 150 (id)kIOSurfaceWidth: @(width), 151 (id)kIOSurfaceHeight: @(height), 152 (id)kIOSurfacePixelFormat: @(pixelFormat), 153 (id)kIOSurfaceAllocSize: @(m_totalBytes), 135 154 #if PLATFORM(IOS) 136 (id)kIOSurfaceCacheMode: @(kIOMapWriteCombineCache),155 (id)kIOSurfaceCacheMode: @(kIOMapWriteCombineCache), 137 156 #endif 138 (id)kIOSurfaceElementWidth: @(elementWidth), 139 (id)kIOSurfaceElementHeight: @(1) 140 }; 141 157 (id)kIOSurfacePlaneInfo: planeInfo, 158 }; 159 } else { 160 unsigned elementWidth; 161 162 switch (format) { 163 case Format::RGBA: 164 pixelFormat = 'BGRA'; 165 bytesPerPixel = 4; 166 bytesPerElement = 4; 167 elementWidth = 1; 168 break; 169 case Format::YUV422: 170 pixelFormat = 'yuvf'; 171 bytesPerPixel = 2; 172 bytesPerElement = 4; 173 elementWidth = 2; 174 break; 175 case Format::RGB10: 176 pixelFormat = 'w30r'; 177 bytesPerPixel = 4; 178 bytesPerElement = 4; 179 elementWidth = 1; 180 break; 181 case Format::RGB10A8: 182 ASSERT_NOT_REACHED(); 183 pixelFormat = 'b3a8'; 184 bytesPerPixel = 1; 185 bytesPerElement = 1; 186 elementWidth = 1; 187 break; 188 } 189 190 size_t bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerPixel); 191 ASSERT(bytesPerRow); 192 193 m_totalBytes = IOSurfaceAlignProperty(kIOSurfaceAllocSize, height * bytesPerRow); 194 ASSERT(m_totalBytes); 195 196 options = @{ 197 (id)kIOSurfaceWidth: @(width), 198 (id)kIOSurfaceHeight: @(height), 199 (id)kIOSurfacePixelFormat: @(pixelFormat), 200 (id)kIOSurfaceBytesPerElement: @(bytesPerElement), 201 (id)kIOSurfaceBytesPerRow: @(bytesPerRow), 202 (id)kIOSurfaceAllocSize: @(m_totalBytes), 203 #if PLATFORM(IOS) 204 (id)kIOSurfaceCacheMode: @(kIOMapWriteCombineCache), 205 #endif 206 (id)kIOSurfaceElementWidth: @(elementWidth), 207 (id)kIOSurfaceElementHeight: @(1) 208 }; 209 } 210 142 211 m_surface = adoptCF(IOSurfaceCreate((CFDictionaryRef)options)); 212 if (!m_surface) 213 NSLog(@"Surface creation failed for options %@", options); 143 214 } 144 215 -
branches/safari-601.1.46-branch/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h
r192419 r192501 57 57 extern const CFStringRef kIOSurfacePixelFormat; 58 58 extern const CFStringRef kIOSurfaceWidth; 59 extern const CFStringRef kIOSurfacePlaneWidth; 60 extern const CFStringRef kIOSurfacePlaneHeight; 61 extern const CFStringRef kIOSurfacePlaneBytesPerRow; 62 extern const CFStringRef kIOSurfacePlaneOffset; 63 extern const CFStringRef kIOSurfacePlaneSize; 64 extern const CFStringRef kIOSurfacePlaneInfo; 59 65 60 66 size_t IOSurfaceAlignProperty(CFStringRef property, size_t value); -
branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog
r192488 r192501 1 2015-11-16 Matthew Hanson <matthew_hanson@apple.com> 2 3 Merge r192284. rdar://problem/22846841 4 5 2015-11-10 Simon Fraser <simon.fraser@apple.com> 6 7 Use different pixel formats for displays that support them 8 https://bugs.webkit.org/show_bug.cgi?id=151122 9 rdar://problem/22846841 10 11 Reviewed by Tim Horton. 12 13 New the new IOSurface formats when appropriate for the properties of the 14 display. 15 16 * Shared/mac/RemoteLayerBackingStore.mm: 17 (WebKit::bufferFormat): 18 (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): 19 1 20 2015-11-16 Matthew Hanson <matthew_hanson@apple.com> 2 21 -
branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm
r192479 r192501 46 46 #endif 47 47 48 #if __has_include(<WebKitAdditions/RemoteLayerBackingStoreAdditions.mm>) 49 #import <WebKitAdditions/RemoteLayerBackingStoreAdditions.mm> 50 #else 51 52 namespace WebKit { 53 54 #if USE(IOSURFACE) 55 static WebCore::IOSurface::Format bufferFormat(bool) 56 { 57 return WebCore::IOSurface::Format::RGBA; 58 } 59 #endif // USE(IOSURFACE) 60 61 } // namespace WebKit 62 63 #endif 64 48 65 using namespace WebCore; 49 66 … … 187 204 188 205 if (!m_frontBuffer.surface) 189 m_frontBuffer.surface = IOSurface::create(expandedScaledSize, ColorSpaceSRGB );206 m_frontBuffer.surface = IOSurface::create(expandedScaledSize, ColorSpaceSRGB, bufferFormat(m_isOpaque)); 190 207 191 208 setBufferVolatility(BufferType::Front, false); 192 193 209 return; 194 210 }
Note: See TracChangeset
for help on using the changeset viewer.