RESOLVED FIXED 219760
REGRESSION (r270458): Canvas painting is broken when enabling GPU process for DOM
https://bugs.webkit.org/show_bug.cgi?id=219760
Summary REGRESSION (r270458): Canvas painting is broken when enabling GPU process for...
Wenson Hsieh
Reported 2020-12-10 15:56:21 PST
SSIA
Attachments
Patch (3.00 KB, patch)
2020-12-10 16:32 PST, Wenson Hsieh
sabouhallawa: review-
For EWS (1.47 KB, patch)
2020-12-10 17:26 PST, Wenson Hsieh
no flags
Patch (1.89 KB, patch)
2020-12-10 21:25 PST, Wenson Hsieh
thorton: review+
Patch for landing (1.88 KB, patch)
2020-12-11 07:27 PST, Wenson Hsieh
no flags
Said Abou-Hallawa
Comment 1 2020-12-10 16:06:25 PST
The canvas to canvas painting has been broken since bug 218773 was introduced. And the flushing was disabled in Recorder::drawImageBuffer() till r270645 was landed. So what dud exactly r270458 break in the canvas to canvas painting scenario?
Wenson Hsieh
Comment 2 2020-12-10 16:24:53 PST
(In reply to Said Abou-Hallawa from comment #1) > The canvas to canvas painting has been broken since bug 218773 was > introduced. And the flushing was disabled in Recorder::drawImageBuffer() > till r270645 was landed. So what dud exactly r270458 break in the canvas to > canvas painting scenario? Good point — retitled the bug to be more accurate.
Said Abou-Hallawa
Comment 3 2020-12-10 16:28:22 PST
I am still not clear on what is wrong here. Is the drawing inside the canvas wrong? Or is drawing the canvas itself as a NativeImage to a canvas to a layer wrong? Can't you attach a test case to look at?
Wenson Hsieh
Comment 4 2020-12-10 16:32:27 PST
Wenson Hsieh
Comment 5 2020-12-10 16:32:58 PST Comment hidden (obsolete)
Wenson Hsieh
Comment 6 2020-12-10 16:35:10 PST
(In reply to Said Abou-Hallawa from comment #3) > I am still not clear on what is wrong here. Is the drawing inside the canvas > wrong? Or is drawing the canvas itself as a NativeImage to a canvas to a > layer wrong? > > Can't you attach a test case to look at? The issue is that ImageBufferShareableIOSurfaceBackend::backendSize() now always returns (0, 0), which breaks various parts of painting code running in the web process (the canvas => canvas case is just one instance).
Said Abou-Hallawa
Comment 7 2020-12-10 16:52:49 PST
Comment on attachment 415943 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=415943&action=review > Source/WebCore/platform/graphics/ImageBufferBackend.cpp:61 > +IntSize ImageBufferBackend::backendSize() const > +{ > + return calculateBackendSize(logicalSize(), resolutionScale()); > +} I do not think this is the right approach. If you want to add this function, what is the point of having these functions? ImageBufferCairoSurfaceBackend::backendSize() ImageBufferCGBitmapBackend::backendSize() ImageBufferIOSurfaceBackend::backendSize() They can all be deleted if you make this change. When I did r270458, I thought because ImageBufferShareableIOSurfaceBackend does not have an IOSurface, it makes sense to return a backendSize = { 0, 0 }. In fact I thought we should ASSERT_NOT_REACHED if ImageBufferBackend::backendSize() is ever called. The goal of this change was to have a single place to get the backendSize which is the backend itself (IOSurface or CGContext) not from a calculated value. Are you sure you want the backendSize not the logicalSize?
Wenson Hsieh
Comment 8 2020-12-10 16:59:30 PST
(In reply to Said Abou-Hallawa from comment #7) > Comment on attachment 415943 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=415943&action=review > > > Source/WebCore/platform/graphics/ImageBufferBackend.cpp:61 > > +IntSize ImageBufferBackend::backendSize() const > > +{ > > + return calculateBackendSize(logicalSize(), resolutionScale()); > > +} > > I do not think this is the right approach. > > If you want to add this function, what is the point of having these > functions? > > ImageBufferCairoSurfaceBackend::backendSize() > ImageBufferCGBitmapBackend::backendSize() > ImageBufferIOSurfaceBackend::backendSize() > > They can all be deleted if you make this change. When I did r270458, I > thought because ImageBufferShareableIOSurfaceBackend does not have an > IOSurface, it makes sense to return a backendSize = { 0, 0 }. In fact I > thought we should ASSERT_NOT_REACHED if ImageBufferBackend::backendSize() is > ever called. The goal of this change was to have a single place to get the > backendSize which is the backend itself (IOSurface or CGContext) not from a > calculated value. I see — it wasn't clear to me that that was the intent. In that case, it sounds like we'll want to audit the call sites of backendSize() and use logicalSize() instead, if possible. > > Are you sure you want the backendSize not the logicalSize?
Tim Horton
Comment 9 2020-12-10 17:01:57 PST
If we go that way, maybe we make it assert instead of just be empty?
Wenson Hsieh
Comment 10 2020-12-10 17:03:40 PST
(In reply to Tim Horton from comment #9) > If we go that way, maybe we make it assert instead of just be empty? Yeah, it should really be an assertion (and maybe even override ImageBufferShareableIOSurfaceBackend::backendSize() to explicitly return an empty size). This would've made the intention clearer.
Wenson Hsieh
Comment 11 2020-12-10 17:26:08 PST
Wenson Hsieh
Comment 12 2020-12-10 21:25:20 PST
Tim Horton
Comment 13 2020-12-10 22:52:21 PST
Comment on attachment 415965 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=415965&action=review > Source/WebCore/ChangeLog:9 > + changing image buffers. When enabling GPU process for canvas, `ImageBufferShareableIOSurfaceBackend::backendSize` I think this should say "DOM" not "canvas"
Wenson Hsieh
Comment 14 2020-12-11 07:26:06 PST
(In reply to Tim Horton from comment #13) > Comment on attachment 415965 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=415965&action=review > > > Source/WebCore/ChangeLog:9 > > + changing image buffers. When enabling GPU process for canvas, `ImageBufferShareableIOSurfaceBackend::backendSize` > > I think this should say "DOM" not "canvas" Oops, that's right. Fixed!
Wenson Hsieh
Comment 15 2020-12-11 07:27:44 PST
Created attachment 415995 [details] Patch for landing
Wenson Hsieh
Comment 16 2020-12-11 08:07:20 PST
Radar WebKit Bug Importer
Comment 17 2020-12-11 08:08:17 PST
Note You need to log in before you can comment on or make changes to this bug.