Changeset 192689 in webkit
- Timestamp:
- Nov 20, 2015, 12:05:05 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r192688 r192689 1 2015-11-19 Simon Fraser <simon.fraser@apple.com> 2 3 Back-buffer to front-buffer copy fails for some buffer formats 4 https://bugs.webkit.org/show_bug.cgi?id=151475 5 rdar://problem/23617899 6 7 Reviewed by Tim Horton. 8 9 Fix some fo the bitsPerComponent/bitsPerPixel options in IOSurface::ensurePlatformContext() 10 for RGB10 buffers. Fix IOSurface::format() to return the new formats. 11 12 Implement IOSurface::copyToSurface(), which does a synchronous copy between 13 surfaces. 14 15 * platform/graphics/cocoa/IOSurface.h: 16 * platform/graphics/cocoa/IOSurface.mm: 17 (IOSurface::create): 18 (IOSurface::ensurePlatformContext): 19 (IOSurface::format): 20 (IOSurface::copyToSurface): 21 1 22 2015-11-20 Zalan Bujtas <zalan@apple.com> 2 23 -
trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h
r192284 r192689 81 81 size_t totalBytes() const { return m_totalBytes; } 82 82 ColorSpace colorSpace() const { return m_colorSpace; } 83 Format format() const;83 WEBCORE_EXPORT Format format() const; 84 84 85 85 WEBCORE_EXPORT bool isInUse() const; … … 90 90 91 91 #if PLATFORM(IOS) 92 WEBCORE_EXPORT void copyToSurface(IOSurface&); 92 93 WEBCORE_EXPORT static void convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format, std::function<void(std::unique_ptr<WebCore::IOSurface>)>); 93 94 #endif -
trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm
r192284 r192689 55 55 { 56 56 // YUV422 IOSurfaces do not go in the pool. 57 // FIXME: Want pooling of RGB10, RGB10A8. 57 58 if (pixelFormat == Format::RGBA) { 58 59 if (auto cachedSurface = surfaceFromPool(size, size, colorSpace)) … … 260 261 261 262 CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host; 263 262 264 size_t bitsPerComponent = 8; 263 265 size_t bitsPerPixel = 32; 266 267 switch (format()) { 268 case Format::RGBA: 269 break; 270 case Format::RGB10: 271 bitsPerComponent = 10; 272 bitsPerPixel = 32; 273 break; 274 case Format::RGB10A8: 275 // FIXME: This doesn't take the two-plane format into account. 276 bitsPerComponent = 10; 277 bitsPerPixel = 32; 278 break; 279 case Format::YUV422: 280 ASSERT_NOT_REACHED(); 281 break; 282 } 283 264 284 m_cgContext = adoptCF(CGIOSurfaceContextCreate(m_surface.get(), m_contextSize.width(), m_contextSize.height(), bitsPerComponent, bitsPerPixel, cachedCGColorSpace(m_colorSpace), bitmapInfo)); 265 285 … … 311 331 if (pixelFormat == 'BGRA') 312 332 return Format::RGBA; 333 334 if (pixelFormat == 'w30r') 335 return Format::RGB10; 336 337 if (pixelFormat == 'b3a8') 338 return Format::RGB10A8; 339 313 340 if (pixelFormat == 'yuvf') 314 341 return Format::YUV422; … … 330 357 331 358 #if PLATFORM(IOS) 359 WEBCORE_EXPORT void IOSurface::copyToSurface(IOSurface& destSurface) 360 { 361 if (destSurface.format() != format()) { 362 WTFLogAlways("Trying to copy IOSurface to another surface with a different format"); 363 return; 364 } 365 366 if (destSurface.size() != size()) { 367 WTFLogAlways("Trying to copy IOSurface to another surface with a different size"); 368 return; 369 } 370 371 static IOSurfaceAcceleratorRef accelerator; 372 if (!accelerator) 373 IOSurfaceAcceleratorCreate(nullptr, nullptr, &accelerator); 374 375 IOReturn ret = IOSurfaceAcceleratorTransformSurface(accelerator, m_surface.get(), destSurface.surface(), nullptr, nullptr, nullptr, nullptr, nullptr); 376 if (ret) 377 WTFLogAlways("IOSurfaceAcceleratorTransformSurface %p to %p failed with error %d", m_surface.get(), destSurface.surface(), ret); 378 } 379 332 380 void IOSurface::convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format format, std::function<void(std::unique_ptr<WebCore::IOSurface>)> callback) 333 381 { -
trunk/Source/WebKit2/ChangeLog
r192673 r192689 1 2015-11-19 Simon Fraser <simon.fraser@apple.com> 2 3 Back-buffer to front-buffer copy fails for some buffer formats 4 https://bugs.webkit.org/show_bug.cgi?id=151475 5 rdar://problem/23617899 6 7 Reviewed by Tim Horton. 8 9 When displaying RemoteLayerBackingStore, we copy the back buffer to the front 10 buffer before painting the updated regions. For buffers using Format::RGB10A8, 11 the CGImage-based copy fails, so in this case, use IOSurface::copyToSurface(). 12 13 Reorganized RemoteLayerBackingStore::drawInContext() to make this a bit easier 14 to understand. First, we either copy the entire surface over, or paint the backImage. 15 Then we clip to the dirty rects, and clear them, then paint the layer contents. 16 17 * Shared/mac/RemoteLayerBackingStore.mm: 18 (WebKit::RemoteLayerBackingStore::display): 19 (WebKit::RemoteLayerBackingStore::drawInContext): 20 1 21 2015-11-19 Commit Queue <commit-queue@webkit.org> 2 22 -
trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm
r192284 r192689 253 253 if (m_acceleratesDrawing) { 254 254 RetainPtr<CGImageRef> backImage; 255 if (m_backBuffer.surface && !willPaintEntireBackingStore) 256 backImage = m_backBuffer.surface->createImage(); 255 if (m_backBuffer.surface && !willPaintEntireBackingStore) { 256 #if PLATFORM(IOS) 257 if (m_backBuffer.surface->format() == WebCore::IOSurface::Format::RGB10A8) { 258 // FIXME: remove this when rdar://problem/23623670 is fixed. 259 m_backBuffer.surface->copyToSurface(*m_frontBuffer.surface); 260 } else 261 #endif 262 backImage = m_backBuffer.surface->createImage(); 263 } 257 264 258 265 GraphicsContext& context = m_frontBuffer.surface->ensureGraphicsContext(); … … 286 293 scaledSize.scale(m_scale); 287 294 IntRect scaledLayerBounds(IntPoint(), roundedIntSize(scaledSize)); 288 289 if (!m_isOpaque)290 context.clearRect(scaledLayerBounds);291 292 #ifndef NDEBUG293 if (m_isOpaque)294 context.fillRect(scaledLayerBounds, Color(255, 0, 0));295 #endif296 297 CGContextRef cgContext = context.platformContext();298 295 299 296 // If we have less than webLayerMaxRectsToPaint rects to paint and they cover less … … 324 321 } 325 322 323 CGContextRef cgContext = context.platformContext(); 324 326 325 if (backImage) { 327 CGContextS aveGState(cgContext);326 CGContextStateSaver stateSaver(cgContext); 328 327 CGContextSetBlendMode(cgContext, kCGBlendModeCopy); 329 330 CGContextAddRect(cgContext, CGRectInfinite);331 CGContextAddRects(cgContext, cgPaintingRects, m_paintingRects.size());332 CGContextEOClip(cgContext);333 334 328 CGContextTranslateCTM(cgContext, 0, scaledLayerBounds.height()); 335 329 CGContextScaleCTM(cgContext, 1, -1); 336 330 CGContextDrawImage(cgContext, scaledLayerBounds, backImage); 337 CGContextRestoreGState(cgContext);338 331 } 339 332 340 333 CGContextClipToRects(cgContext, cgPaintingRects, m_paintingRects.size()); 334 335 if (!m_isOpaque) 336 context.clearRect(scaledLayerBounds); 337 338 #ifndef NDEBUG 339 if (m_isOpaque) 340 context.fillRect(scaledLayerBounds, Color(255, 0, 0)); 341 #endif 341 342 342 343 context.scale(FloatSize(m_scale, m_scale));
Note:
See TracChangeset
for help on using the changeset viewer.