Bug 236685 - [GPU Process] Implement RemoteImageBufferProxy::drawConsuming()
Summary: [GPU Process] Implement RemoteImageBufferProxy::drawConsuming()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks: 236508
  Show dependency treegraph
 
Reported: 2022-02-15 18:38 PST by Said Abou-Hallawa
Modified: 2022-03-01 16:41 PST (History)
5 users (show)

See Also:


Attachments
Patch (42.41 KB, patch)
2022-02-15 22:08 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (4.56 KB, patch)
2022-02-25 15:15 PST, Said Abou-Hallawa
simon.fraser: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (4.58 KB, patch)
2022-02-25 17:48 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2022-02-15 18:38:35 PST
The current implementation calls the virtual method ImageBufferBackend::drawConsuming(). But this is wrong if GPU Process rendering is enabled because the following assertion will fire:

SHOULD NEVER BE REACHED
/Volumes/Data/WebKit/OpenSource/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp(103) : virtual void WebKit::ImageBufferRemoteIOSurfaceBackend::draw(WebCore::GraphicsContext &, const WebCore::FloatRect &, const WebCore::FloatRect &, const WebCore::ImagePaintingOptions &)
1   0x3393baad9 WTFCrash
2   0x31d12db8b WTFCrashWithInfo(int, char const*, char const*, int)
3   0x31f1aae9f WebKit::ImageBufferRemoteIOSurfaceBackend::draw(WebCore::GraphicsContext&, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&)
4   0x361738c46 WebCore::ImageBufferBackend::drawConsuming(WebCore::GraphicsContext&, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&)
5   0x31f198b58 WebCore::ConcreteImageBuffer<WebKit::ImageBufferRemoteIOSurfaceBackend>::drawConsuming(WebCore::GraphicsContext&, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&)
6   0x361738929 WebCore::ImageBuffer::drawConsuming(WTF::RefPtr<WebCore::ImageBuffer, WTF::RawPtrTraits<WebCore::ImageBuffer>, WTF::DefaultRefDerefTraits<WebCore::ImageBuffer> >, WebCore::GraphicsContext&, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&)
7   0x36170cf3d WebCore::GraphicsContext::drawConsumingImageBuffer(WTF::RefPtr<WebCore::ImageBuffer, WTF::RawPtrTraits<WebCore::ImageBuffer>, WTF::DefaultRefDerefTraits<WebCore::ImageBuffer> >, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&)
8   0x36170ce98 WebCore::GraphicsContext::drawConsumingImageBuffer(WTF::RefPtr<WebCore::ImageBuffer, WTF::RawPtrTraits<WebCore::ImageBuffer>, WTF::DefaultRefDerefTraits<WebCore::ImageBuffer> >, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&)
9   0x361c6dcea WebCore::RenderBoxModelObject::paintFillLayerExtended(WebCore::PaintInfo const&, WebCore::Color const&, WebCore::FillLayer const&, WebCore::LayoutRect const&, WebCore::BackgroundBleedAvoidance, WebCore::InlineIterator::InlineBoxIterator const&, WebCore::LayoutRect const&, WebCore::CompositeOperator, WebCore::RenderElement*, WebCore::BaseBackgroundColorUsage)
10  0x361c6bdfd WebCore::RenderBox::paintFillLayer(WebCore::PaintInfo const&, WebCore::Color const&, WebCore::FillLayer const&, WebCore::LayoutRect const&, WebCore::BackgroundBleedAvoidance, WebCore::CompositeOperator, WebCore::RenderElement*, WebCore::BaseBackgroundColorUsage)
11  0x361c653f1 WebCore::RenderBox::paintFillLayers(WebCore::PaintInfo const&, WebCore::Color const&, WebCore::FillLayer const&, WebCore::LayoutRect const&, WebCore::BackgroundBleedAvoidance, WebCore::CompositeOperator, WebCore::RenderElement*)
12  0x361c686d5 WebCore::RenderBox::paintBackground(WebCore::PaintInfo const&, WebCore::LayoutRect const&, WebCore::BackgroundBleedAvoidance)
13  0x361c65e2f WebCore::RenderBox::paintBoxDecorations(WebCore::PaintInfo&, WebCore::LayoutPoint const&)
14  0x361c33c74 WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&)
15  0x361c32983 WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&)
16  0x361d60a54 WebCore::RenderLayer::paintBackgroundForFragments(WTF::Vector<WebCore::LayerFragment, 1ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc> const&, WebCore::GraphicsContext&, WebCore::GraphicsContext&, WebCore::LayoutRect const&, bool, WebCore::RenderLayer::LayerPaintingInfo const&, WTF::OptionSet<WebCore::PaintBehavior>, WebCore::RenderObject*)
17  0x361d5c997 WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, WTF::OptionSet<WebCore::RenderLayer::PaintLayerFlag>)
18  0x361d80b12 WebCore::RenderLayerBacking::paintIntoLayer(WebCore::GraphicsLayer const*, WebCore::GraphicsContext&, WebCore::IntRect const&, WTF::OptionSet<WebCore::PaintBehavior>, WebCore::EventRegionContext*)::$_25::operator()(WebCore::RenderLayer&, WTF::OptionSet<WebCore::RenderLayer::PaintLayerFlag>) const
19  0x361d80433 WebCore::RenderLayerBacking::paintIntoLayer(WebCore::GraphicsLayer const*, WebCore::GraphicsContext&, WebCore::IntRect const&, WTF::OptionSet<WebCore::PaintBehavior>, WebCore::EventRegionContext*)
20  0x361d820a6 WebCore::RenderLayerBacking::paintContents(WebCore::GraphicsLayer const*, WebCore::GraphicsContext&, WebCore::FloatRect const&, unsigned int)
21  0x36171f76f WebCore::GraphicsLayer::paintGraphicsLayerContents(WebCore::GraphicsContext&, WebCore::FloatRect const&, unsigned int)
22  0x3617d9cef WebCore::GraphicsLayerCA::platformCALayerPaintContents(WebCore::PlatformCALayer*, WebCore::GraphicsContext&, WebCore::FloatRect const&, unsigned int)
23  0x35f3a7c9c WebCore::PlatformCALayer::drawLayerContents(WebCore::GraphicsContext&, WebCore::PlatformCALayer*, WTF::Vector<WebCore::FloatRect, 5ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&, unsigned int)
24  0x31df3025c WebKit::RemoteLayerBackingStore::drawInContext(WebCore::GraphicsContext&)
25  0x31df2f6dd WebKit::RemoteLayerBackingStore::display()
26  0x31f5762fc WebKit::PlatformCALayerRemote::recursiveBuildTransaction(WebKit::RemoteLayerTreeContext&, WebKit::RemoteLayerTreeTransaction&)
27  0x31f57658b WebKit::PlatformCALayerRemote::recursiveBuildTransaction(WebKit::RemoteLayerTreeContext&, WebKit::RemoteLayerTreeTransaction&)
28  0x31f57658b WebKit::PlatformCALayerRemote::recursiveBuildTransaction(WebKit::RemoteLayerTreeContext&, WebKit::RemoteLayerTreeTransaction&)
29  0x31f57658b WebKit::PlatformCALayerRemote::recursiveBuildTransaction(WebKit::RemoteLayerTreeContext&, WebKit::RemoteLayerTreeTransaction&)
30  0x31f57658b WebKit::PlatformCALayerRemote::recursiveBuildTransaction(WebKit::RemoteLayerTreeContext&, WebKit::RemoteLayerTreeTransaction&)
31  0x31eaad5a1 WebKit::RemoteLayerTreeContext::buildTransaction(WebKit::RemoteLayerTreeTransaction&, WebCore::PlatformCALayer&)

Also GraphicsContext::drawConsumingImageBuffer() is a virtual method but it is only overriden by NullGraphicsContext. We need DisplayList::Recorder to override it so we can record the drawing command. DisplayList::RecorderImpl and RemoteDisplayListRecorderProxy need to implement the helper method recordDrawConsumingImageBuffer().
Comment 1 Said Abou-Hallawa 2022-02-15 22:08:42 PST
Created attachment 452144 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2022-02-15 22:10:11 PST
<rdar://problem/89007426>
Comment 3 Said Abou-Hallawa 2022-02-25 15:15:14 PST
Created attachment 453270 [details]
Patch
Comment 4 Simon Fraser (smfr) 2022-02-25 16:49:39 PST
Comment on attachment 453270 [details]
Patch

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

> Source/WebKit/ChangeLog:22
> +           drawConsuming() in this case because the backend is till owned by

"till owned"
Comment 5 Said Abou-Hallawa 2022-02-25 17:48:05 PST
Created attachment 453281 [details]
Patch
Comment 6 EWS 2022-02-25 21:07:20 PST
Committed r290542 (247820@main): <https://commits.webkit.org/247820@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 453281 [details].
Comment 7 Jon Lee 2022-03-01 01:22:38 PST
This fixed a few crashes on the GPU Process bot, which need to be gardened
Comment 8 Jon Lee 2022-03-01 16:24:46 PST
Gardening: <https://commits.webkit.org/r290707>
Comment 9 Jon Lee 2022-03-01 16:41:38 PST
Gardening: <https://commits.webkit.org/r290711>