Bug 218928

Summary: Initial implementation of DOM rendering via the GPU process
Product: WebKit Reporter: Tim Horton <thorton>
Component: New BugsAssignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: sabouhallawa, sam, simon.fraser, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Tim Horton 2020-11-13 16:30:55 PST
Initial implementation of DOM rendering via the GPU process
Comment 1 Tim Horton 2020-11-13 16:34:12 PST
Created attachment 414106 [details]
Patch
Comment 2 Simon Fraser (smfr) 2020-11-13 16:53:04 PST
Comment on attachment 414106 [details]
Patch

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

> Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:183
> +        m_frontBuffer.imageBuffer = m_layer->context()->ensureRemoteRenderingBackendProxy().createImageBuffer(backingStoreSize(), m_acceleratesDrawing ? WebCore::RenderingMode::Accelerated : WebCore::RenderingMode::Unaccelerated, 1, WebCore::ColorSpace::SRGB, pixelFormat());

This feels a bit weird. Maybe RemoteLayerBackingStore needs a delegate.

> Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:321
> +    // FIXME: This method has a weird name. This is "submit work".
> +    m_frontBuffer.imageBuffer->flushDrawingContextAndCommit();

Yes

> Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:362
> +    auto bitmap = ShareableBitmap::create(WTF::get<ShareableBitmap::Handle>(*m_bufferHandle));
> +    layer.contents = (__bridge id)bitmap->makeCGImageCopy().get();

Hmm, could someone write into the sharable bitmap while the layer owns it? Or is the "copy" really a copy?
Comment 3 Tim Horton 2020-11-14 22:35:13 PST
Created attachment 414155 [details]
Patch
Comment 4 Tim Horton 2020-11-14 23:16:22 PST
(In reply to Simon Fraser (smfr) from comment #2)
> Comment on attachment 414106 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=414106&action=review
> 
> > Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:183
> > +        m_frontBuffer.imageBuffer = m_layer->context()->ensureRemoteRenderingBackendProxy().createImageBuffer(backingStoreSize(), m_acceleratesDrawing ? WebCore::RenderingMode::Accelerated : WebCore::RenderingMode::Unaccelerated, 1, WebCore::ColorSpace::SRGB, pixelFormat());
> 
> This feels a bit weird. Maybe RemoteLayerBackingStore needs a delegate.

A little weird, but RemoteLayerTreeContext is kind of RLBS's "delegate", in a sense. (Other things that it uses RemoteLayerTreeContext for include "hey I was created", and "I'm about to paint", both of which are veryyyy delegatey.

> > Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:321
> > +    // FIXME: This method has a weird name. This is "submit work".
> > +    m_frontBuffer.imageBuffer->flushDrawingContextAndCommit();
> 
> Yes
> 
> > Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:362
> > +    auto bitmap = ShareableBitmap::create(WTF::get<ShareableBitmap::Handle>(*m_bufferHandle));
> > +    layer.contents = (__bridge id)bitmap->makeCGImageCopy().get();
> 
> Hmm, could someone write into the sharable bitmap while the layer owns it?
> Or is the "copy" really a copy?

It's not a real copy (I have no idea why it's called that). "Someone" could, for sure, but we won't. The same is true of the IOSurfaces, though??
Comment 5 EWS 2020-11-15 01:31:18 PST
Committed r269824: <https://trac.webkit.org/changeset/269824>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 414155 [details].
Comment 6 Radar WebKit Bug Importer 2020-11-15 01:32:25 PST
<rdar://problem/71410310>
Comment 7 Sam Weinig 2020-11-15 10:21:11 PST
Comment on attachment 414155 [details]
Patch

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

> Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h:43
> +class ThreadSafeRemoteImageBufferFlusher : public WebCore::ThreadSafeImageBufferFlusher {

Can this be final?