Bug 222411

Summary: WebGL context count is not limited for GPU process
Product: WebKit Reporter: Kimmo Kinnunen <kkinnunen>
Component: WebGLAssignee: Kimmo Kinnunen <kkinnunen>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, cdumez, changseok, cmarcelo, darin, dino, esprehn+autocc, ews-watchlist, gyuyoung.kim, jonlee, kbr, kondapallykalyan, luiz, ryuan.choi, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=234536
https://bugs.webkit.org/show_bug.cgi?id=237464
Bug Depends on:    
Bug Blocks: 217211, 238280    
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch
none
Patch for landing none

Kimmo Kinnunen
Reported 2021-02-25 03:49:48 PST
WebGL context count is not limited for GPU process Without GPU process, we have 20 context limit per web process. With GPU process, we don't have any limit. webgl/many-contexts-access-after-loss.html [ Failure ] webgl/max-active-contexts-console-warning.html [ Failure ] webgl/max-active-contexts-gc.html [ Failure ] webgl/max-active-contexts-oldest-context-lost.html [ Failure ] webgl/max-active-contexts-webglcontextlost-prevent-default.html [ Timeout ]
Attachments
Patch (30.31 KB, patch)
2022-03-02 06:09 PST, Kimmo Kinnunen
ews-feeder: commit-queue-
Patch (30.28 KB, patch)
2022-03-02 06:14 PST, Kimmo Kinnunen
ews-feeder: commit-queue-
Patch (30.19 KB, patch)
2022-03-02 06:35 PST, Kimmo Kinnunen
no flags
Patch (30.36 KB, patch)
2022-03-02 08:45 PST, Kimmo Kinnunen
no flags
Patch (30.46 KB, patch)
2022-03-03 02:57 PST, Kimmo Kinnunen
no flags
Patch for landing (30.46 KB, patch)
2022-03-03 03:11 PST, Kimmo Kinnunen
no flags
Radar WebKit Bug Importer
Comment 1 2021-03-04 01:35:09 PST
Kimmo Kinnunen
Comment 2 2022-03-02 06:09:39 PST
Kimmo Kinnunen
Comment 3 2022-03-02 06:14:15 PST
Kimmo Kinnunen
Comment 4 2022-03-02 06:35:14 PST
Kimmo Kinnunen
Comment 5 2022-03-02 08:45:17 PST
Kenneth Russell
Comment 6 2022-03-02 12:46:52 PST
Comment on attachment 453616 [details] Patch Looks great. r+
Kimmo Kinnunen
Comment 7 2022-03-03 02:57:54 PST
Kimmo Kinnunen
Comment 8 2022-03-03 03:11:57 PST
Created attachment 453716 [details] Patch for landing
Kimmo Kinnunen
Comment 9 2022-03-03 04:22:19 PST
*** Bug 236964 has been marked as a duplicate of this bug. ***
Darin Adler
Comment 10 2022-03-03 11:28:01 PST
Comment on attachment 453714 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453714&action=review > Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:817 > + auto it = contexts.begin(); > + auto* earliest = *it; > + for (++it; it != contexts.end(); ++it) { > + if (earliest->activeOrdinal() > (*it)->activeOrdinal()) > + earliest = *it; > + } I might have written this with a modern for loop even though the loop is less tight: WebGLRenderingContextBase* earliest = nullptr; for (auto& context : contexts) { if (!earliest || earliest->activeOrdinal() > context.activeOrdinal()) earliest = &context; } Or using an algorithm: auto* earliest = *std::min_element(contexts.begin(), contexts.end(), [] (auto& a, auto& b) { return a.activeOrdinal() > b.activeOrdinal(); }); Or some day (not now): auto* earliest = std::ranges::min_element(contexts, [] (auto& a, auto& b) { return a.activeOrdinal() > b.activeOrdinal(); }); I may have the lambda backwards, not sure, so please don’t just paste.
EWS
Comment 11 2022-03-03 22:04:14 PST
Committed r290816 (248052@main): <https://commits.webkit.org/248052@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 453716 [details].
Kimmo Kinnunen
Comment 12 2022-03-04 02:32:24 PST
(In reply to Darin Adler from comment #10) > Or using an algorithm: > > auto* earliest = *std::min_element(contexts.begin(), contexts.end(), [] > (auto& a, auto& b) { > return a.activeOrdinal() > b.activeOrdinal(); > }); > Thanks for the suggestion, bug 237464 tracks this.
Note You need to log in before you can comment on or make changes to this bug.