Closed Bug 1871744 Opened 7 months ago Closed 6 months ago

Intermittently blink of <canvas> with remote canvas on windows

Categories

(Core :: Graphics: Canvas2D, defect)

defect

Tracking

()

RESOLVED FIXED
123 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox121 --- unaffected
firefox122 --- unaffected
firefox123 --- fixed

People

(Reporter: yamadat501, Assigned: sotaro)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

Attached file about-support.txt

Happens with 12/23 nightly on Win11/x64 (Attach about:support)

STR:

  1. Set gfx.canvas.remote to true (it is default)
  2. Open https://developer.mozilla.org/ja/docs/Web/API/Canvas_API/Tutorial/Basic_animations
  3. Show canvas element.

Expected result:
The canvas element animates normally.

Actual result:
The canvas element blinks intermittently.

Works normally when gfx.canvas.remote is false.
So, regression from Bug 1871467?

I'll set regressed by field tentatively for now.

Keywords: regression
Regressed by: 1871467

:lsalzman, since you are the author of the regressor, bug 1871467, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(lsalzman)

Sotaro, are you able to reproduce this? Is this a potential bug in RemoteTextureMap? Could this be related to a failure to allocate a D3D11TextureData, due to too many being processed, or something like that?

Flags: needinfo?(lsalzman) → needinfo?(sotaro.ikeda.g)

I could reproduce the problem on my Win10 PC with the STR. The problem could be easily reproducible when there was other window that run https://webglsamples.org/aquarium/aquarium.html.

I wonder if the following might be related.

ALLOC_MANUAL_SYNCHRONIZATION could be used only when ID3D11Texture2D is allocated by compositor device. But canvas device is not compositor device.

https://searchfox.org/mozilla-central/rev/a9cb718ef1502bc0fe5088476748e334fad9d6a1/gfx/thebes/DeviceManagerDx.cpp#383

Flags: needinfo?(sotaro.ikeda.g)

For now, it seems better to remove ALLOC_MANUAL_SYNCHRONIZATION to address the regression.

(In reply to Sotaro Ikeda [:sotaro PTO Dec/28 -Jan/4] from comment #5)

For now, it seems better to remove ALLOC_MANUAL_SYNCHRONIZATION to address the regression.

But when ALLOC_MANUAL_SYNCHRONIZATION flag was removed, canvas was not rendered :( Going to look into it. I wonder if Bug 1870950 might be related to it.

(In reply to Sotaro Ikeda [:sotaro PTO Dec/28 -Jan/4] from comment #6)

(In reply to Sotaro Ikeda [:sotaro PTO Dec/28 -Jan/4] from comment #5)

For now, it seems better to remove ALLOC_MANUAL_SYNCHRONIZATION to address the regression.

But when ALLOC_MANUAL_SYNCHRONIZATION flag was removed, canvas was not rendered :( Going to look into it. I wonder if Bug 1870950 might be related to it.

With latest m-c the above problem did not happen. Bug 1871811 might address the problem.

Out of curiosity, does setting gfx.canvas.remote.worker-threads to 0 and restarting help? That makes canvas always run on CanvasRenderer thread instead of the CanvasWorkers thread pool. Both should guarantee only one thread ever accesses the texture at a time, but setting the pref to zero ensures it is always the same thread.

From https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgikeyedmutex:
Represents a keyed mutex, which allows exclusive access to a shared resource that is used by multiple devices.

It isn't used on multiple devices. Is there something going wrong with the copy we make?

Assignee: nobody → sotaro.ikeda.g
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

(In reply to Andrew Osmond [:aosmond] (he/him) from comment #9)

Out of curiosity, does setting gfx.canvas.remote.worker-threads to 0 and restarting help?

It did not help for me.

(In reply to Andrew Osmond [:aosmond] (he/him) from comment #10)

It isn't used on multiple devices. Is there something going wrong with the copy we make?

The ID3D11Texture2D is used both with canvas device and compositor device.

D197276 addressed the problem for me.

Set release status flags based on info from the regressing bug 1871467

Moving to a FIFO queue means that textures that were just pushed into the recycling
queue will be reused last, reducing the amount of possible lock contention.

Pushed by sikeda.birchill@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c765c015a552
Remove ALLOC_MANUAL_SYNCHRONIZATION in CanvasTranslator::CreateTextureData() r=gfx-reviewers,lsalzman
Pushed by lsalzman@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/484bd1eca3b5
Use FIFO queue for recycling textures instead of stack. r=sotaro,gfx-reviewers
Duplicate of this bug: 1871861
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch

Confirmed fixed on latest nightly(12-26).
Thanks!!

Duplicate of this bug: 1871583
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: