Changeset 192552 in webkit
- Timestamp:
- Nov 17, 2015 4:26:54 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
r192501 r192552 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: 1 2015-11-13 Matthew Hanson <matthew_hanson@apple.com> 2 3 Rollout r192501. rdar://problem/22846841 20 4 21 5 2015-11-16 Matthew Hanson <matthew_hanson@apple.com> -
branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h
r192501 r192552 42 42 RGBA, 43 43 #if PLATFORM(IOS) 44 YUV422, 45 RGB10, 46 RGB10A8, 44 YUV422 47 45 #endif 48 46 }; -
branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm
r192501 r192552 103 103 , m_contextSize(size) 104 104 { 105 106 unsigned pixelFormat; 107 unsigned bytesPerPixel; 108 unsigned bytesPerElement; 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 109 118 110 119 int width = size.width(); 111 120 int height = size.height(); 112 121 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), 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), 154 135 #if PLATFORM(IOS) 155 136 (id)kIOSurfaceCacheMode: @(kIOMapWriteCombineCache), 156 137 #endif 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 138 (id)kIOSurfaceElementWidth: @(elementWidth), 139 (id)kIOSurfaceElementHeight: @(1) 140 }; 141 211 142 m_surface = adoptCF(IOSurfaceCreate((CFDictionaryRef)options)); 212 if (!m_surface)213 NSLog(@"Surface creation failed for options %@", options);214 143 } 215 144 -
branches/safari-601.1.46-branch/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h
r192501 r192552 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;65 59 66 60 size_t IOSurfaceAlignProperty(CFStringRef property, size_t value); -
branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog
r192501 r192552 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): 1 2015-11-13 Matthew Hanson <matthew_hanson@apple.com> 2 3 Rollout r192501. rdar://problem/22846841 19 4 20 5 2015-11-16 Matthew Hanson <matthew_hanson@apple.com> -
branches/safari-601.1.46-branch/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm
r192501 r192552 46 46 #endif 47 47 48 #if __has_include(<WebKitAdditions/RemoteLayerBackingStoreAdditions.mm>)49 #import <WebKitAdditions/RemoteLayerBackingStoreAdditions.mm>50 #else51 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 WebKit62 63 #endif64 65 48 using namespace WebCore; 66 49 … … 204 187 205 188 if (!m_frontBuffer.surface) 206 m_frontBuffer.surface = IOSurface::create(expandedScaledSize, ColorSpaceSRGB , bufferFormat(m_isOpaque));189 m_frontBuffer.surface = IOSurface::create(expandedScaledSize, ColorSpaceSRGB); 207 190 208 191 setBufferVolatility(BufferType::Front, false); 192 209 193 return; 210 194 }
Note: See TracChangeset
for help on using the changeset viewer.