RESOLVED FIXED Bug 222101
HTMLCanvasElement::copiedImage() contains old image with GPU Process on
https://bugs.webkit.org/show_bug.cgi?id=222101
Summary HTMLCanvasElement::copiedImage() contains old image with GPU Process on
Kimmo Kinnunen
Reported 2021-02-18 05:39:07 PST
HTMLCanvasElement::copiedImage() contains old image with GPU Process on LayoutTests/fast/canvas/webgl/canvas-2d-webgl-texture.html appears to fail because HTMLCanvasElement::copiedImage() returns a new Image that contains old data. The test is roughly as follows: ctx.fillStyle = "rgb(200, 0, 0)"; ctx.fillRect(0, 0, 256, 256); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d); // Calls HTMLCanvasElement::copiedImage() ctx.fillStyle = "rgb(0, 0, 200)"; ctx.fillRect(0, 0, 256, 256); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d); // Calls HTMLCanvasElement::copiedImage() It appears that while the second copiedImage should contain the blue contents, it still contains the red contents. The copy is done with: RefPtr<NativeImage> ImageBufferCGBitmapBackend::copyNativeImage(BackingStoreCopy copyBehavior) const { switch (copyBehavior) { case CopyBackingStore: return NativeImage::create(adoptCF(CGBitmapContextCreateImage(context().platformContext())));
Attachments
Patch (24.21 KB, patch)
2021-02-22 04:34 PST, Kimmo Kinnunen
no flags
Patch (32.30 KB, patch)
2021-02-22 06:44 PST, Kimmo Kinnunen
no flags
Kimmo Kinnunen
Comment 1 2021-02-18 05:41:32 PST
Said, do you have idea is the ConcreteImageBuffer::copyImage supposed to work? Why RemoteImageBufferProxy::getImageData() has to ask the data from GPU Process while RemoteImageBufferProxy::copyImage() can access the shared memory region in Web Process?
Kimmo Kinnunen
Comment 2 2021-02-22 04:34:10 PST
Kimmo Kinnunen
Comment 3 2021-02-22 06:44:23 PST
Simon Fraser (smfr)
Comment 4 2021-02-22 11:27:03 PST
Comment on attachment 421185 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=421185&action=review > Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:350 > +void RemoteRenderingBackend::getShareableBitmapForImageBuffer(WebCore::RenderingResourceIdentifier identifier, WebCore::PreserveResolution preserveResolution, CompletionHandler<void(ShareableBitmap::Handle&&)>&& completionHandler) Does this need to use a CompletionHandler, since it's synchronous?
Kimmo Kinnunen
Comment 5 2021-02-23 00:36:32 PST
(In reply to Simon Fraser (smfr) from comment #4) > Comment on attachment 421185 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=421185&action=review > > > Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:350 > > +void RemoteRenderingBackend::getShareableBitmapForImageBuffer(WebCore::RenderingResourceIdentifier identifier, WebCore::PreserveResolution preserveResolution, CompletionHandler<void(ShareableBitmap::Handle&&)>&& completionHandler) > > Does this need to use a CompletionHandler, since it's synchronous? I think it needs the CompletionHandler since it is processing a message that has a result. E.g. both async and sync messages post replies with CompletionHandler. Yeah, all get*ForImageBuffer are synchronous, including this getShareableBitmapForImageBuffer().
EWS
Comment 6 2021-02-23 00:58:37 PST
Committed r273301: <https://commits.webkit.org/r273301> All reviewed patches have been landed. Closing bug and clearing flags on attachment 421185 [details].
Radar WebKit Bug Importer
Comment 7 2021-02-23 00:59:15 PST
Said Abou-Hallawa
Comment 8 2021-03-01 22:46:03 PST
*** Bug 220553 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.