Closed Bug 1776885 Opened 2 years ago Closed 2 years ago

Add capability of async remote texture on WebGL if CanvasRenderThread is used

Categories

(Core :: Graphics, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: sotaro, Assigned: sotaro)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Attachments

(1 file, 2 obsolete files)

From Kelsey, webgl(and canvas2d) can't actually by-default be async by spec.
RemoteTextureMap::GetTextureHost() could handle a case that there are already multiple remote textures. But it does not handle a case that remote texture is not pushed yet by WebGLParent. This bug is going to handle it.

RemoteTextureMap is going to be added by Bug 1712486 .

Assignee: nobody → sotaro.ikeda.g
Depends on: 1712486

Kelsey prefer more simplified way. Close the bug for now.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---

(In reply to Sotaro Ikeda [:sotaro] from comment #2)

Kelsey prefer more simplified way. Close the bug for now.

Oh, it was my misunderstanding.

  1. be fixed so it follows the spec with regard to showing exactly the right buffer, and 2) Very eventually, we should have a better way to do things
    but we don't have time to do #2 right now and it sounds like #1 isn't that hard so we should just fix it up to work with your current approach.

(In reply to Sotaro Ikeda [:sotaro] from comment #1)

CanvasTranslator::WaitForSurfaceDescriptor() already does similar thing.

Block compositor thread is not ideal. If it is possible, it is better not to block compositor thread.

Summary: Wait remote texture at RemoteTextureMap::GetTextureHost() if it is not pushed yet → Render remote textures in sync with webrender transactions
Blocks: 1777426

For the sync remote texture rendering, it seems that the followings places could be used for sync handling.

  • [1] Wait before starting wr transaction at WebRenderLayerManager.
    • WebRenderLayerManager::EndTransactionWithoutLayer()
    • WebRenderLayerManager::EndEmptyTransaction()
  • [2] Defer to receive wr transaction at WebRenderBridgeParent.
    • WebRenderBridgeParent::RecvSetDisplayList()
    • WebRenderBridgeParent::RecvEmptyTransaction()
  • [3] Retry WebRenderBridgeParent::MaybeGenerateFrame() if remote texture is not ready.
  • [4] Defer WebRender rendering on render thread if remote texture is not ready.
  • [5] Modify and use RenderTextureHostWrapper and swap remote texture within RenderTextureHostWrapper on render thread.

[1] blocks main thread of client process. It is not good. Situatoin seems similar to current situation.
[2] seems hard to implement correctly.

[5] seems ideal place. We could do the swap just before WebRender rendering. At the rendering, remote textures might be ready more. But [5] has a problem. Display list of async pipline needs to be updated on compositor thread.
Then [5] might need also [3] partially. WebGL swap chain uses a same type of texture continuously.
If there are already previous texture of same swap chain. PushResourceUpdates() and PushDisplayItems() could be handled by using the previous texture if current remote texture is not ready.

At first, I tried [5] and [3].

  • On Windows, even when ClientWebGLContext sent IPC message before wr transaction,
    WebGLParent in compositor thread received the message after wr transansaction at WebRenderBridgeParent in compositor thread.
    TopLevelProtocols are different, it might be related.
  • There were cases that remote textures were not ready when they were used for wr rendering.

Then [5] and [3] was not enough. Then [4] was added.
With [5], [4] and [3], the sync rendering seemed to work without blocking threads.

But current implementation have a problem when WebGL run on compositor thread.
It basically works when WebGL run on compositor thread.
But there are cases that does not work. Since compositor thread could call a task in render thread synchronously.
It breaks [4]

Current solution requests that WebGL run on non-compositor thread.

Attachment #9285981 - Attachment is obsolete: true

Sorry, there was a problem with the detection of inactive users. I'm reverting the change.

Assignee: nobody → sotaro.ikeda.g
Depends on: 1781740
Depends on: 1791693
Blocks: 1791711
Blocks: 1801437
Depends on: 1797975
Summary: Render remote textures in sync with webrender transactions → Render remote textures asyc in sync with webrender transactions
Attachment #9283819 - Attachment is obsolete: true
Depends on: 1803501
Summary: Render remote textures asyc in sync with webrender transactions → Render remote textures asyc in sync with webrender transactions if GL is thread safe
Attachment #9305092 - Attachment description: WIP: Bug 1776885 - Render remote textures asyc way in sync with webrender transactions → Bug 1776885 - Render remote textures asyc way in sync with webrender transactions if GL is thread safe
Blocks: 1803734
Attachment #9305092 - Attachment description: Bug 1776885 - Render remote textures asyc way in sync with webrender transactions if GL is thread safe → Bug 1776885 - Render remote textures asyc way in sync with webrender transactions if CanvasRenderThread is used
Summary: Render remote textures asyc in sync with webrender transactions if GL is thread safe → Render remote textures asyc in sync with webrender transactions if CanvasRenderThread is used
Summary: Render remote textures asyc in sync with webrender transactions if CanvasRenderThread is used → Add capability of async remote texture on WebGL if CanvasRenderThread is used
Attachment #9305092 - Attachment description: Bug 1776885 - Render remote textures asyc way in sync with webrender transactions if CanvasRenderThread is used → Bug 1776885 - Add capability of async remote texture on WebGL if CanvasRenderThread is used
Attachment #9305092 - Attachment description: Bug 1776885 - Add capability of async remote texture on WebGL if CanvasRenderThread is used → WIP: Bug 1776885 - Add capability of async remote texture on WebGL if CanvasRenderThread is used
Depends on: 1803732
Attachment #9305092 - Attachment description: WIP: Bug 1776885 - Add capability of async remote texture on WebGL if CanvasRenderThread is used → Bug 1776885 - Add capability of async remote texture on WebGL if CanvasRenderThread is used
Blocks: 1804233
Pushed by sikeda.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d78a41db7a82 Add capability of async remote texture on WebGL if CanvasRenderThread is used r=gfx-reviewers,lsalzman

Backed out for causing reftests failures in ReleaseCompositableRef.

Flags: needinfo?(sotaro.ikeda.g)

Oh, I updated RemoteTextureHostWrapper::NotifyNotUsed() wrong way by mistake.

Flags: needinfo?(sotaro.ikeda.g)
Pushed by sikeda.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1725d4942ce7 Add capability of async remote texture on WebGL if CanvasRenderThread is used r=gfx-reviewers,lsalzman

On a try build, the improvements from this bug didnt seem to kick-in unless I set webgl.out-of-process.async-present.force-sync= False. I may have done something incorrect though...

Status: REOPENED → RESOLVED
Closed: 2 years ago2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
Blocks: 1804447
Whiteboard: [sp3]
Blocks: 1828904
No longer blocks: 1804447
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: