RESOLVED FIXED Bug 227748
[GPU Process] Enable drawing the SVGImage in the GPU Process
https://bugs.webkit.org/show_bug.cgi?id=227748
Summary [GPU Process] Enable drawing the SVGImage in the GPU Process
Myles C. Maxfield
Reported 2021-07-07 09:57:05 PDT
Attachments
Patch (107.01 KB, patch)
2022-02-07 17:19 PST, Said Abou-Hallawa
no flags
Patch (22.96 KB, patch)
2022-02-10 00:12 PST, Said Abou-Hallawa
no flags
Patch (22.87 KB, patch)
2022-02-14 00:22 PST, Said Abou-Hallawa
no flags
Patch (29.94 KB, patch)
2022-02-16 11:45 PST, Said Abou-Hallawa
no flags
Radar WebKit Bug Importer
Comment 1 2021-07-14 09:58:22 PDT
Said Abou-Hallawa
Comment 2 2022-02-07 15:30:16 PST
We need to revert all these changes: r279722 r284740 r283531
Said Abou-Hallawa
Comment 3 2022-02-07 15:32:10 PST
The intermediate ImageBuffers of the SVGImage need to be "really" compatible with the underlying ImageBuffer of the GraphicsContext. This is tracked by bug 235758.
Said Abou-Hallawa
Comment 4 2022-02-07 17:19:40 PST
Said Abou-Hallawa
Comment 5 2022-02-10 00:12:48 PST
Said Abou-Hallawa
Comment 6 2022-02-14 00:22:53 PST
Sam Weinig
Comment 7 2022-02-14 13:03:06 PST
Comment on attachment 451869 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=451869&action=review > Source/WebCore/svg/graphics/SVGImage.cpp:206 > + auto imageBuffer = ImageBuffer::create(size(), RenderingMode::Unaccelerated, 1, DestinationColorSpace::SRGB(), PixelFormat::BGRA8); Why is this being hard coded to SRGB?
Said Abou-Hallawa
Comment 8 2022-02-16 11:45:09 PST
Simon Fraser (smfr)
Comment 9 2022-02-16 13:19:04 PST
Comment on attachment 452221 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452221&action=review > Source/WebCore/svg/graphics/SVGImage.cpp:213 > + auto imageBuffer = ImageBuffer::create(size(), renderingMode, ShouldUseDisplayList::No, RenderingPurpose::DOM, 1, colorSpace, PixelFormat::BGRA8, hostWindow); Why isn't this createCompatibleBuffer()?
Said Abou-Hallawa
Comment 10 2022-02-16 13:28:17 PST
Comment on attachment 452221 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452221&action=review >> Source/WebCore/svg/graphics/SVGImage.cpp:213 >> + auto imageBuffer = ImageBuffer::create(size(), renderingMode, ShouldUseDisplayList::No, RenderingPurpose::DOM, 1, colorSpace, PixelFormat::BGRA8, hostWindow); > > Why isn't this createCompatibleBuffer()? Because it is hard to a GraphicsContext for all the callers. Here are a few examples: - (void)getPreviewSnapshotImage:(CGImageRef*)cgImage andRects:(NSArray **)rects + (CGImageRef)imageForURL:(NSURL *)url - (WebUITextIndicatorData *)initWithImage:(CGImageRef)image textIndicatorData:(const WebCore::TextIndicatorData&)indicatorData scale:(CGFloat)scale static RetainPtr<UIImage> uiImageForImage(Image* image)
Said Abou-Hallawa
Comment 11 2022-02-16 13:29:44 PST
Comment on attachment 452221 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452221&action=review >>> Source/WebCore/svg/graphics/SVGImage.cpp:213 >>> + auto imageBuffer = ImageBuffer::create(size(), renderingMode, ShouldUseDisplayList::No, RenderingPurpose::DOM, 1, colorSpace, PixelFormat::BGRA8, hostWindow); >> >> Why isn't this createCompatibleBuffer()? > > Because it is hard to a GraphicsContext for all the callers. Here are a few examples: > > - (void)getPreviewSnapshotImage:(CGImageRef*)cgImage andRects:(NSArray **)rects > + (CGImageRef)imageForURL:(NSURL *)url > - (WebUITextIndicatorData *)initWithImage:(CGImageRef)image textIndicatorData:(const WebCore::TextIndicatorData&)indicatorData scale:(CGFloat)scale > static RetainPtr<UIImage> uiImageForImage(Image* image) Because it is hard to *get* a GraphicsContext ...
Simon Fraser (smfr)
Comment 12 2022-02-16 14:07:59 PST
Comment on attachment 452221 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452221&action=review >>>> Source/WebCore/svg/graphics/SVGImage.cpp:213 >>>> + auto imageBuffer = ImageBuffer::create(size(), renderingMode, ShouldUseDisplayList::No, RenderingPurpose::DOM, 1, colorSpace, PixelFormat::BGRA8, hostWindow); >>> >>> Why isn't this createCompatibleBuffer()? >> >> Because it is hard to a GraphicsContext for all the callers. Here are a few examples: >> >> - (void)getPreviewSnapshotImage:(CGImageRef*)cgImage andRects:(NSArray **)rects >> + (CGImageRef)imageForURL:(NSURL *)url >> - (WebUITextIndicatorData *)initWithImage:(CGImageRef)image textIndicatorData:(const WebCore::TextIndicatorData&)indicatorData scale:(CGFloat)scale >> static RetainPtr<UIImage> uiImageForImage(Image* image) > > Because it is hard to *get* a GraphicsContext ... I see. This is just getting a NativeImage from an SVGImage without any notion of what the caller will do with it. In that case it might be risky to sometimes return an Accelerated image. For the code paths involving the GPUP, it might make more sense to create a version of this that takes the destination context.
Said Abou-Hallawa
Comment 13 2022-02-16 14:56:00 PST
Comment on attachment 452221 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452221&action=review >>>>> Source/WebCore/svg/graphics/SVGImage.cpp:213 >>>>> + auto imageBuffer = ImageBuffer::create(size(), renderingMode, ShouldUseDisplayList::No, RenderingPurpose::DOM, 1, colorSpace, PixelFormat::BGRA8, hostWindow); >>>> >>>> Why isn't this createCompatibleBuffer()? >>> >>> Because it is hard to a GraphicsContext for all the callers. Here are a few examples: >>> >>> - (void)getPreviewSnapshotImage:(CGImageRef*)cgImage andRects:(NSArray **)rects >>> + (CGImageRef)imageForURL:(NSURL *)url >>> - (WebUITextIndicatorData *)initWithImage:(CGImageRef)image textIndicatorData:(const WebCore::TextIndicatorData&)indicatorData scale:(CGFloat)scale >>> static RetainPtr<UIImage> uiImageForImage(Image* image) >> >> Because it is hard to *get* a GraphicsContext ... > > I see. This is just getting a NativeImage from an SVGImage without any notion of what the caller will do with it. In that case it might be risky to sometimes return an Accelerated image. > > For the code paths involving the GPUP, it might make more sense to create a version of this that takes the destination context. I can add the new version for nativeImage in a separate patch. Or maybe I can pass an optional pointer to GraphicsContext to the existing one.
EWS
Comment 14 2022-02-16 16:12:51 PST
Committed r289981 (247367@main): <https://commits.webkit.org/247367@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 452221 [details].
Note You need to log in before you can comment on or make changes to this bug.