Closed Bug 1632249 Opened 5 years ago Closed 5 years ago

WebGL compositing refactor (for out-of-process)

Categories

(Core :: Graphics: CanvasWebGL, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: jgilbert, Assigned: jgilbert)

References

(Regressed 1 open bug)

Details

(Keywords: perf-alert)

Crash Data

Attachments

(11 files, 1 obsolete file)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

One of the deep assumptions of in-process-webgl was about how backbuffers were presented to the compositor. Out-of-process breaks many assumptions, so we need to rework our approach here.

  • Majorly simplity CanvasRenderer
  • Replace GLScreenBuffer with trivial GLSwapChain
  • Use descriptor structs so that future SharedSurface changes aren't so painful
    to propagate
  • Mortgage/strip out more OffscreenCanvas code for now

Talos motionmark-gl runs look good too, though the reftests should show some breakage still.

Win10 WR R2 is thei only new failure I see:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=976eadf185158bd80d2d8175d54478354e40c5cd

vs merge-base:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=02e94d1d140b542c41ccc49d640f74ab56f4bb5c

I haven't been able to repro it locally on my machines so far. Possible speculative fix by reverting supposedly-unrelated change:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=c13242b6f855e55f7c6a2c0beaca53266960f098

Some hack to add pooling and measure performance on Android. Not refactored for production yet.

Pushed by jgilbert@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bbfe23c61add Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol https://hg.mozilla.org/integration/autoland/rev/16d84439756f WebXR compositing fixes. r=imanol https://hg.mozilla.org/integration/autoland/rev/9ff26bcc580c Create a separate WebGLContext::PresentInto function for WebXR. r=jgilbert https://hg.mozilla.org/integration/autoland/rev/cdaa8a4e9e36 NON_PREMULT TextureClient iff NON_PREMULT CanvasClient. r=handyman

/builds/worker/checkouts/gecko/gfx/gl/SharedSurface.cpp:141:1: error: control reaches end of non-void function [-Werror=return-type]

Old compilers don't realize the switch being exhaustive means the
function always returns, which we workaround here.

Attachment #9154599 - Attachment description: Bug 1632249 - Use a surface pool in WebGL SwapChains → Bug 1632249 - Enable WebGL SwapChain pooling on Android. Use a separate SwapChain for WebVR.
Flags: needinfo?(jgilbert)
Pushed by jgilbert@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dd00e2da3a0f Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol https://hg.mozilla.org/integration/autoland/rev/6e9a89ead3a5 WebXR compositing fixes. r=imanol https://hg.mozilla.org/integration/autoland/rev/71ad2ed8e9ba Create a separate WebGLContext::PresentInto function for WebXR. r=jgilbert https://hg.mozilla.org/integration/autoland/rev/b15d91e64a25 NON_PREMULT TextureClient iff NON_PREMULT CanvasClient. r=handyman https://hg.mozilla.org/integration/autoland/rev/04f5127c85d5 Fix Bb failures. r=gw https://hg.mozilla.org/integration/autoland/rev/c93972b05d4f Mark mCapturedFrameInvalidated even if mIsCanvasDirty. r=handyman
Pushed by jgilbert@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/204b899f436d Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol https://hg.mozilla.org/integration/autoland/rev/7c94d37c446e WebXR compositing fixes. r=imanol https://hg.mozilla.org/integration/autoland/rev/073302d26c5e Create a separate WebGLContext::PresentInto function for WebXR. r=jgilbert https://hg.mozilla.org/integration/autoland/rev/6f19f43e0a0b NON_PREMULT TextureClient iff NON_PREMULT CanvasClient. r=handyman https://hg.mozilla.org/integration/autoland/rev/64fbb616a0f3 Fix Bb failures. r=gw https://hg.mozilla.org/integration/autoland/rev/d5b7fe789001 Mark mCapturedFrameInvalidated even if mIsCanvasDirty. r=handyman https://hg.mozilla.org/integration/autoland/rev/4ff99aab3ee8 Remove unused var g2DContextLayerUserData.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: mozilla79 → ---

It seems that this patch set severely regresses macOS WebGL performance - it causes WebGL to use readback in the content process.
The patch set made it into the current Nightly. I discovered this because my virtu-allhands experience was not great.

(In reply to Markus Stange [:mstange] from comment #21)

It seems that this patch set severely regresses macOS WebGL performance - it causes WebGL to use readback in the content process.
The patch set made it into the current Nightly. I discovered this because my virtu-allhands experience was not great.

It appears to have the same effect on Android, too, by making us use a SharedSurface_Basic instead of a SharedSurface_SurfaceTexture. It appears we now select the SurfaceFactory type based on the "preferred texture type", which is basic on android. Setting gfx.use-surfacetexture-textures = true makes us use SurfaceTextures for canvas again, and it appears to work fine. However, we don't want to do that as it makes us use SurfaceTextures for painted content. We need to distinguish between the preferred texture type for CPU-painted content and for GPU canvas.

FYI, we also saw a Nightly [@ mozilla::layers::CanvasClient::UseTexture ] crash spike that looks related to this bug:
https://crash-stats.mozilla.org/report/index/28b7aa44-07a7-4bb2-ab95-7e2130200612

Pushed by jgilbert@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/16c5dd2cfd60 Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol https://hg.mozilla.org/integration/autoland/rev/0b191b707750 WebXR compositing fixes. r=imanol https://hg.mozilla.org/integration/autoland/rev/4cda148ef28f Create a separate WebGLContext::PresentInto function for WebXR. r=jgilbert https://hg.mozilla.org/integration/autoland/rev/fd4a74ec97a5 NON_PREMULT TextureClient iff NON_PREMULT CanvasClient. r=handyman https://hg.mozilla.org/integration/autoland/rev/8f0fb988dc5a Fix Bb failures. r=gw https://hg.mozilla.org/integration/autoland/rev/2739940a4fb7 Mark mCapturedFrameInvalidated even if mIsCanvasDirty. r=handyman https://hg.mozilla.org/integration/autoland/rev/e326157c5af9 Remove unused var g2DContextLayerUserData. https://hg.mozilla.org/integration/autoland/rev/8439f89e170b Replace GLContextProvider::CreateOffscreen with GLContext::CreateOffscreenDefaultFb. r=lsalzman https://hg.mozilla.org/integration/autoland/rev/05896dbeb434 Determine webgl's layers::TextureType in Present. r=lsalzman https://hg.mozilla.org/integration/autoland/rev/832f39c3b02c Check weakptr value before deref in gl::Texture/Renderbuffer. r=lsalzman https://hg.mozilla.org/integration/autoland/rev/567a8768593e Disable now-failing DXGL test for now.

(In reply to Pulsebot from comment #17)

https://hg.mozilla.org/integration/autoland/rev/c93972b05d4f
Mark mCapturedFrameInvalidated even if mIsCanvasDirty. r=handyman

== Change summary for alert #26188 (as of Thu, 11 Jun 2020 21:41:47 GMT) ==

Regressions:

221% glterrain macosx1014-64-shippable opt e10s stylo 2.92 -> 9.39

For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=26188

(In reply to Alexandru Michis [:malexandru] from comment #15)

Backed out 6 changesets for causing bustages in CanvasRenderingContext2D.cpp

Backout link: https://hg.mozilla.org/integration/autoland/rev/c7dbcbcbb07745ad124640bc639c86a251c66300

== Change summary for alert #26230 (as of Tue, 16 Jun 2020 03:43:13 GMT) ==

Improvements:

35% glterrain macosx1014-64-shippable opt e10s stylo 4.58 -> 2.96

For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=26230

Regressions: 1646007
Attachment #9154599 - Attachment is obsolete: true
Regressions: 1646255
Regressions: 1646408
Regressions: 1646691
Regressions: 1647167
Regressions: 1647491
Flags: needinfo?(jgilbert)
Summary: Out-of-process WebGL compositing → WebGL compositing refactor (for out-of-process)
Keywords: perf-alert
See Also: → 1650248
Regressions: 1642994
Regressions: 1653404
Regressions: CVE-2020-15678
Regressions: 1654459
Regressions: 1656956
Regressions: 1656991
Regressions: 1658591
Regressions: 1658600
Regressions: 1658697
Crash Signature: [@ mozilla::gl::SharedSurface_Basic::ToSurfaceDescriptor]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: