WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
217735
[GPU Process] Enable Document based ImageBitmap and OffscreenCanvas drawing to use GPU Process rendering
https://bugs.webkit.org/show_bug.cgi?id=217735
Summary
[GPU Process] Enable Document based ImageBitmap and OffscreenCanvas drawing t...
Said Abou-Hallawa
Reported
2020-10-14 15:35:16 PDT
We need to create RemoteImageBuffer for ImageBitmap and OffscreenCanvas. Later we need to especially record drawing the ImageBitmap and OffscreenCanvas into another 2D canvas or RenderLayer such that the backend of the ImageBuffer is not accessed in the Web Process.
Attachments
Patch
(27.72 KB, patch)
2020-10-14 15:55 PDT
,
Said Abou-Hallawa
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(30.46 KB, patch)
2020-10-14 16:29 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(30.47 KB, patch)
2020-10-14 16:59 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(30.40 KB, patch)
2020-10-14 22:52 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(28.75 KB, patch)
2020-10-15 00:55 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(34.34 KB, patch)
2020-11-02 21:04 PST
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(34.64 KB, patch)
2020-11-02 23:38 PST
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(28.37 KB, patch)
2020-11-03 23:57 PST
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Show Obsolete
(7)
View All
Add attachment
proposed patch, testcase, etc.
Said Abou-Hallawa
Comment 1
2020-10-14 15:55:59 PDT
Created
attachment 411382
[details]
Patch
Said Abou-Hallawa
Comment 2
2020-10-14 16:29:10 PDT
Created
attachment 411386
[details]
Patch
Said Abou-Hallawa
Comment 3
2020-10-14 16:59:49 PDT
Created
attachment 411389
[details]
Patch
Said Abou-Hallawa
Comment 4
2020-10-14 22:52:59 PDT
Created
attachment 411408
[details]
Patch
Said Abou-Hallawa
Comment 5
2020-10-15 00:55:50 PDT
Created
attachment 411416
[details]
Patch
Simon Fraser (smfr)
Comment 6
2020-10-15 10:16:56 PDT
Comment on
attachment 411416
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=411416&action=review
> Source/WebCore/html/ImageBitmap.cpp:84 > + auto document = scriptExecutionContext.isDocument() ? &downcast<Document>(scriptExecutionContext) : nullptr; > + auto hostWindow = (document && document->view() && document->view()->root()) ? document->view()->root()->hostWindow() : nullptr;
ImageBitmap is: Exposed=(Window,Worker), so this needs to work in Workers too, where scriptExecutionContext.isDocument() will be false.
Kenneth Russell
Comment 7
2020-10-15 11:20:06 PDT
Comment on
attachment 411416
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=411416&action=review
>> Source/WebCore/html/ImageBitmap.cpp:84 >> + auto hostWindow = (document && document->view() && document->view()->root()) ? document->view()->root()->hostWindow() : nullptr; > > ImageBitmap is: > > Exposed=(Window,Worker), > > so this needs to work in Workers too, where scriptExecutionContext.isDocument() will be false.
Yes - are there wpt or layout tests covering creation and use of ImageBitmaps on workers? If not, please add one.
Radar WebKit Bug Importer
Comment 8
2020-10-21 15:36:15 PDT
<
rdar://problem/70548262
>
Said Abou-Hallawa
Comment 9
2020-11-02 21:04:32 PST
Created
attachment 413003
[details]
Patch
Said Abou-Hallawa
Comment 10
2020-11-02 23:38:49 PST
Created
attachment 413006
[details]
Patch
Said Abou-Hallawa
Comment 11
2020-11-03 00:34:42 PST
Comment on
attachment 411416
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=411416&action=review
>>> Source/WebCore/html/ImageBitmap.cpp:84 >>> + auto hostWindow = (document && document->view() && document->view()->root()) ? document->view()->root()->hostWindow() : nullptr; >> >> ImageBitmap is: >> >> Exposed=(Window,Worker), >> >> so this needs to work in Workers too, where scriptExecutionContext.isDocument() will be false. > > Yes - are there wpt or layout tests covering creation and use of ImageBitmaps on workers? If not, please add one.
Getting the the worker ImageBitmap to create a remote ImageBuffer will need many changes in different areas of the code: 1. We need to have a way to create an ImageBuffer without having to have a HostWindow, for example PlatformStrategies::createImageBuffer(). 2. The RemoteImageBufferProxy needs to be created on the main thread. WebProcess::ensureGPUProcessConnection() asserts RELEASE_ASSERT(RunLoop::isMain()); 3. Executing any operation on this RemoteImageBufferProxy has to be on the main thread also because it creates the WeakPtr<RemoteRenderingBackendProxy> on the main thread. So I would suggest making this bug for the document based ImageBitmap. Enabling the GPU rendering for the worker ImageBitmap can be tracked by a separate bug. These tests use ImageBitmaps on workers: imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-in-worker-transfer.html imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-serializable.html
Said Abou-Hallawa
Comment 12
2020-11-03 00:45:13 PST
See
bug 218482
Simon Fraser (smfr)
Comment 13
2020-11-03 10:15:20 PST
Comment on
attachment 413006
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=413006&action=review
> Source/WebCore/ChangeLog:3 > + [GPU Process] Enable Document based ImageBitmap and OffscreenCanvas drawing to go through GPU
"to go through GPU" -> "to use GPU Process rendering"
> Source/WebCore/html/ImageBitmap.cpp:84 > + auto document = scriptExecutionContext.isDocument() ? &downcast<Document>(scriptExecutionContext) : nullptr; > + auto hostWindow = (document && document->view() && document->view()->root()) ? document->view()->root()->hostWindow() : nullptr;
Does this code ever run in a Worker thread? If so, this is very non-threadsafe.
> Source/WebKit/WebProcess/WebPage/WebPage.cpp:3808 > WebProcess::singleton().setUseGPUProcessForMedia(settings.useGPUProcessForMediaEnabled()); > + WebProcess::singleton().setUseGPUProcessForCanvas(m_shouldRenderCanvasInGPUProcess);
Why are these two lines different?
Said Abou-Hallawa
Comment 14
2020-11-03 23:57:21 PST
Created
attachment 413143
[details]
Patch
Said Abou-Hallawa
Comment 15
2020-11-04 00:00:11 PST
Comment on
attachment 413006
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=413006&action=review
>> Source/WebCore/ChangeLog:3 >> + [GPU Process] Enable Document based ImageBitmap and OffscreenCanvas drawing to go through GPU > > "to go through GPU" -> "to use GPU Process rendering"
Title was changed.
>> Source/WebCore/html/ImageBitmap.cpp:84 >> + auto hostWindow = (document && document->view() && document->view()->root()) ? document->view()->root()->hostWindow() : nullptr; > > Does this code ever run in a Worker thread? If so, this is very non-threadsafe.
This code was cleaned up.
>> Source/WebKit/WebProcess/WebPage/WebPage.cpp:3808 >> + WebProcess::singleton().setUseGPUProcessForCanvas(m_shouldRenderCanvasInGPUProcess); > > Why are these two lines different?
This part was removed from this bug and is being tracked by
bug 218549
.
EWS
Comment 16
2020-11-04 13:31:56 PST
Committed
r269381
: <
https://trac.webkit.org/changeset/269381
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 413143
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug