Title: [211126] trunk/Source
Revision
211126
Author
[email protected]
Date
2017-01-24 17:44:09 -0800 (Tue, 24 Jan 2017)

Log Message

[iOS WK2] Avoid IOSurface readback for snapshot creation
https://bugs.webkit.org/show_bug.cgi?id=167397
rdar://problem/30174873

Reviewed by Tim Horton.

Source/WebCore:

Export sinkIntoImage().

* platform/graphics/cocoa/IOSurface.h:

Source/WebKit2:

Use IOSurface::sinkIntoImage() for snapshots, to avoid GPU readback.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (211125 => 211126)


--- trunk/Source/WebCore/ChangeLog	2017-01-25 01:43:21 UTC (rev 211125)
+++ trunk/Source/WebCore/ChangeLog	2017-01-25 01:44:09 UTC (rev 211126)
@@ -1,3 +1,15 @@
+2017-01-24  Simon Fraser  <[email protected]>
+
+        [iOS WK2] Avoid IOSurface readback for snapshot creation
+        https://bugs.webkit.org/show_bug.cgi?id=167397
+        rdar://problem/30174873
+
+        Reviewed by Tim Horton.
+
+        Export sinkIntoImage().
+
+        * platform/graphics/cocoa/IOSurface.h:
+
 2017-01-24  Brent Fulgham  <[email protected]>
 
         Bug 167392: REGRESSION(r210531): Relax same-volume display requirement for iOS

Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h (211125 => 211126)


--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h	2017-01-25 01:43:21 UTC (rev 211125)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h	2017-01-25 01:44:09 UTC (rev 211126)
@@ -62,7 +62,7 @@
     // Any images created from a surface need to be released before releasing
     // the surface, or an expensive GPU readback can result.
     WEBCORE_EXPORT RetainPtr<CGImageRef> createImage();
-    static RetainPtr<CGImageRef> sinkIntoImage(std::unique_ptr<IOSurface>);
+    WEBCORE_EXPORT static RetainPtr<CGImageRef> sinkIntoImage(std::unique_ptr<IOSurface>);
 
     id asLayerContents() const { return (id)(CFTypeRef)m_surface.get(); }
     IOSurfaceRef surface() const { return m_surface.get(); }

Modified: trunk/Source/WebKit2/ChangeLog (211125 => 211126)


--- trunk/Source/WebKit2/ChangeLog	2017-01-25 01:43:21 UTC (rev 211125)
+++ trunk/Source/WebKit2/ChangeLog	2017-01-25 01:44:09 UTC (rev 211126)
@@ -1,3 +1,16 @@
+2017-01-24  Simon Fraser  <[email protected]>
+
+        [iOS WK2] Avoid IOSurface readback for snapshot creation
+        https://bugs.webkit.org/show_bug.cgi?id=167397
+        rdar://problem/30174873
+
+        Reviewed by Tim Horton.
+
+        Use IOSurface::sinkIntoImage() for snapshots, to avoid GPU readback.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
+
 2017-01-24  Tim Horton  <[email protected]>
 
         Script gets touch events even after navigation swipe begins

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (211125 => 211126)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-01-25 01:43:21 UTC (rev 211125)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-01-25 01:44:09 UTC (rev 211126)
@@ -4419,7 +4419,7 @@
         CATransform3D transform = CATransform3DMakeScale(imageScaleInViewCoordinates, imageScaleInViewCoordinates, 1);
         transform = CATransform3DTranslate(transform, -rectInViewCoordinates.origin.x, -rectInViewCoordinates.origin.y, 0);
         CARenderServerRenderDisplayLayerWithTransformAndTimeOffset(MACH_PORT_NULL, (CFStringRef)display.name, self.layer.context.contextId, reinterpret_cast<uint64_t>(self.layer), surface->surface(), 0, 0, &transform, 0);
-        completionHandler(surface->createImage().get());
+        completionHandler(WebCore::IOSurface::sinkIntoImage(WTFMove(surface)).get());
         return;
     }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to