Open Bug 1820008 Opened 3 years ago Updated 2 years ago

WebGLContext::BlitBackbufferToCurDriverFB blocks on background thread GL processing

Categories

(Core :: Graphics: CanvasWebGL, defect, P2)

All
macOS
defect

Tracking

()

People

(Reporter: mstange, Assigned: jgilbert)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Attachments

(1 external file)

The long blocking time in PWebGL::Msg_GetFrontBuffer (see bug 1820005) seems to be mostly caused by this call: mGL.GetIntAs<GLenum>(LOCAL_GL_ACTIVE_TEXTURE): https://share.firefox.dev/3SKBh2T

This is on an Apple Silicon machine.

Here's a profile taken with samply which shows the background thread work: https://share.firefox.dev/3KNkHNN

Can we avoid this mGL.GetIntAs<GLenum>(LOCAL_GL_ACTIVE_TEXTURE) call and make the new buffer available to the main thread without waiting for the background GL work?

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

Here's a profile taken with samply which shows the background thread work: https://share.firefox.dev/3KNkHNN

Hmm, this URL didn't correctly apply the hidden threads. Anyway, the interesting threads here are CanvasRenderer and Thread <1256673>.

Whiteboard: [sp3]

Avoiding mGL.GetIntAs<GLenum>(LOCAL_GL_ACTIVE_TEXTURE) is super easy.
I can add a patch today, but I do expect the stall to just move elsewhere.

Assignee: nobody → jgilbert
Flags: needinfo?(mstange.moz)

The fast path doesn't seem to be hit in the React stockcharts case I was looking at, it seems like mActiveTexture might be nullopt. The profile looks the same as before: https://share.firefox.dev/3kVw8II
(I applied the patch from Phabricator locally because I wasn't ready to deal with the unsigned try build trouble on this M1 machine.)

Flags: needinfo?(mstange.moz)

It's likely I think that instead, it's hitting one of the other GetInts in that function, which is what I was guessing.
Shadowing those (texture and sampler bindings) is more tricky and risky.

I added printfs to the function and it says "fGetIntegerv(34016) took 25.4ms". 34016 is 0x84E0 which is LOCAL_GL_ACTIVE_TEXTURE.

The severity field is not set for this bug.
:jgilbert, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jgilbert)
Severity: -- → S3
Flags: needinfo?(jgilbert)
Priority: -- → P2

There is an r+ patch which didn't land and no activity in this bug for 2 weeks.
:jgilbert, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(jgilbert)
Flags: needinfo?(bwerth)
Flags: needinfo?(bwerth)

The patch posted does not solve the issue. Something more invasive and risky is required.

Flags: needinfo?(jgilbert)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: