Bug 123600 - Remote Layer Tree: Vend layer contents via IOSurfaces
Summary: Remote Layer Tree: Vend layer contents via IOSurfaces
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-31 17:21 PDT by Tim Horton
Modified: 2013-11-01 12:45 PDT (History)
4 users (show)

See Also:


Attachments
patch (26.61 KB, patch)
2013-10-31 17:23 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
patch (26.60 KB, patch)
2013-10-31 17:27 PDT, Tim Horton
andersca: review-
Details | Formatted Diff | Diff
patch (26.10 KB, patch)
2013-10-31 18:06 PDT, Tim Horton
andersca: review+
Details | Formatted Diff | Diff
address darin's review comments (4.10 KB, patch)
2013-11-01 12:39 PDT, Tim Horton
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2013-10-31 17:21:29 PDT
Instead of ShareableBitmap.
Comment 1 Tim Horton 2013-10-31 17:23:32 PDT
Created attachment 215696 [details]
patch
Comment 2 WebKit Commit Bot 2013-10-31 17:25:53 PDT
Attachment 215696 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/WebCore.exp.in', u'Source/WebCore/WebCore.xcodeproj/project.pbxproj', u'Source/WebKit2/ChangeLog', u'Source/WebKit2/Configurations/WebKit2.xcconfig', u'Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm', u'Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm', u'Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp', u'Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h', u'Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.h', u'Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.mm']" exit_code: 1
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.h:43:  The parameter name "layer" adds no information, so it should be removed.  [readability/parameter_name] [5]
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.h:43:  The parameter name "size" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 2 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Tim Horton 2013-10-31 17:27:09 PDT
Created attachment 215697 [details]
patch
Comment 4 Anders Carlsson 2013-10-31 17:46:09 PDT
Comment on attachment 215697 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=215697&action=review

Looks like there’s a memory leak somewhere, so I’m going to r-.

> Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.mm:182
> +    const void* keys[6];
> +    const void* values[6];
> +    keys[0] = kIOSurfaceWidth;
> +    values[0] = CFNumberCreate(0, kCFNumberIntType, &width);
> +    keys[1] = kIOSurfaceHeight;
> +    values[1] = CFNumberCreate(0, kCFNumberIntType, &height);
> +    keys[2] = kIOSurfacePixelFormat;
> +    values[2] = CFNumberCreate(0, kCFNumberIntType, &pixelFormat);
> +    keys[3] = kIOSurfaceBytesPerElement;
> +    values[3] = CFNumberCreate(0, kCFNumberIntType, &bytesPerElement);
> +    keys[4] = kIOSurfaceBytesPerRow;
> +    values[4] = CFNumberCreate(0, kCFNumberLongType, &bytesPerRow);
> +    keys[5] = kIOSurfaceAllocSize;
> +    values[5] = CFNumberCreate(0, kCFNumberLongType, &allocSize);
> +
> +    RetainPtr<CFDictionaryRef> dict = adoptCF(CFDictionaryCreate(0, keys, values, 6, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
> +    for (unsigned i = 0; i < 6; i++)
> +        CFRelease(values[i]);

This should use the Objective-C literal syntax.

> Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.mm:207
> +        m_frontBuffer = 0;
> +        m_frontSurface = 0;

These should be nullptr.

> Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.mm:321
> +    frontImage = 0;
> +    frontContext = 0;

Should be nullptr.
Comment 5 Anders Carlsson 2013-10-31 17:48:20 PDT
Comment on attachment 215697 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=215697&action=review

> Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.mm:106
> +        result.m_frontSurface = IOSurfaceLookupFromMachPort(machPort.port());

I think the leak is here!
Comment 6 Tim Horton 2013-10-31 18:06:11 PDT
Created attachment 215707 [details]
patch
Comment 7 Anders Carlsson 2013-10-31 18:10:29 PDT
Comment on attachment 215707 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=215707&action=review

> Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.mm:171
> +        (id)kIOSurfaceAllocSize: @(allocSize) };

} should be on a separate line.
Comment 8 Tim Horton 2013-10-31 18:15:02 PDT
http://trac.webkit.org/changeset/158417
Comment 9 Tim Horton 2013-11-01 12:39:56 PDT
Created attachment 215749 [details]
address darin's review comments
Comment 10 Anders Carlsson 2013-11-01 12:41:07 PDT
Comment on attachment 215749 [details]
address darin's review comments

View in context: https://bugs.webkit.org/attachment.cgi?id=215749&action=review

> Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.mm:142
>      RetainPtr<CGContextRef> ctx = adoptCF(CGIOSurfaceContextCreate(surface, size.width(), size.height(), bitsPerComponent, bitsPerPixel, colorSpace, bitmapInfo));

Can’ probably jest return adoptCF directly here.
Comment 11 Tim Horton 2013-11-01 12:45:26 PDT
follow up in http://trac.webkit.org/changeset/158449