Closed Bug 2085188 Opened 24 days ago Closed 23 days ago

Hardware decoded video may not be displayed with software WebRender when creating a D3D11 compositor fails

Categories

(Core :: Graphics: WebRender, defect)

Desktop
Windows
defect

Tracking

()

RESOLVED FIXED
161 Branch
Tracking Status
firefox161 --- fixed

People

(Reporter: aosmond, Assigned: aosmond)

References

Details

Attachments

(1 external file)

With software WebRender on Windows, RenderCompositor::Create first tries RenderCompositorD3D11SWGL, which composites with D3D11 (CompositorD3D11). If CompositorD3D11::Initialize fails, e.g. because the swap chain or the device attachments cannot be created, the window silently falls back to plain SWGL (RenderCompositorSWGL).

Nothing records that fallback, so gfxVars::AllowSoftwareWebRenderD3D11 remains true, and everything else keeps assuming D3D11 compositing is used. In particular, video decoders decide whether to output D3D11 textures based on it (KnowsCompositor::SupportsD3D11). Plain SWGL cannot draw D3D11 textures: RenderDXGITextureHost::MapPlane and RenderDXGIYCbCrTextureHost::MapPlane read them back through the device of a RenderCompositorD3D11SWGL, and fail otherwise, so the video is not displayed.

The failure also leaks the SWGL context created by RenderCompositorD3D11SWGL::Create.

Proposed fix:

  • If CompositorD3D11::Initialize fails because the device was removed (DeviceManagerDx::HasDeviceReset), handle it as a device reset, since the device will be recreated.
  • Otherwise, report a new WebRenderError, which the parent handles by clearing gfxVars::AllowSoftwareWebRenderD3D11, similar to how the overlay errors clear their vars. This is the same step gfxPlatform::FallbackFromAcceleration takes when falling back from software WebRender with D3D11 to plain software WebRender.
  • Free the SWGL context on failure.
Blocks: 2085189

When creating a D3D11 compositor for SWGL failed, the window silently
fell back to plain SWGL, while gfxVars::AllowSoftwareWebRenderD3D11 kept
claiming otherwise. Producers such as video decoders would then share
D3D11 textures that the window cannot draw. Clear the var instead,
unless the failure is due to a device reset, which is recoverable. Also
free the SWGL context, which was leaked on failure.

Pushed by aosmond@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f6ee2bf4ad21 https://hg.mozilla.org/integration/autoland/rev/2d65a2b60e2a Stop allowing D3D11 compositing with SWGL if a D3D11 compositor cannot be created. r=gfx-reviewers,lsalzman
Status: ASSIGNED → RESOLVED
Closed: 23 days ago
Resolution: --- → FIXED
Target Milestone: --- → 161 Branch
QA Whiteboard: [qa-triage-done-c162/b161]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: