Closed Bug 1978356 Opened 1 year ago Closed 1 year ago

[HDR/Linux] Try to avoid texture creation for fullscreen video - optimize playback

Categories

(Core :: Graphics: WebRender, task)

task

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: stransky, Assigned: stransky)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file, 3 obsolete files)

[HDR] Force direct video compositing for fullscreen only.

Flags: needinfo?(stransky)

Glenn,
is it possible to get info if RenderDMABUFTextureHost is composited or not? Could we get such info from RenderCompositorNative for instance? We may skip the texture creation in such case - for instance fullscreen playback.
Thanks.

Component: Audio/Video: Playback → Graphics: WebRender
Flags: needinfo?(gwatson)

I'm not quite sure what you mean by "is composited or not" - could you clarify / be a bit more specific what you want to determine?

Flags: needinfo?(gwatson)

I want to get info if dmabuf surface from RenderDMABUFTextureHost is going to be propagated for direct composition as overlay/underlay as we discussed at Bug 1976233 or if that promotion failed for RenderDMABUFTextureHost.
Thanks.

Flags: needinfo?(stransky) → needinfo?(gwatson)

It's not very easy to determine this until fairly late in the frame building process, since it depends on evaluating a number of conditions (such as clips, transforms, filters etc that affect the primitive to be promoted). When in the frame do you need to know if it will be directly composited? Would it be enough to know when we request / lock the texture pointer or is that too late?

Flags: needinfo?(gwatson)

(In reply to Glenn Watson [:gw] from comment #4)

Would it be enough to know when we request / lock the texture pointer or is that too late?

Glenn, that's perfectly fine.

Flags: needinfo?(gwatson)

OK, it should be possible to pass some information along by extending the signature of the lock callback at [1].

I'm not sure exactly what information you require here, and it's probably a fair bit of convoluted plumbing, but we should have calculated everything we would need to know by the time this is called, I think.

[1] https://searchfox.org/mozilla-central/source/gfx/wr/webrender_api/src/image.rs#117

Flags: needinfo?(gwatson)
Flags: needinfo?(stransky)

(In reply to Glenn Watson [:gw] from comment #6)

OK, it should be possible to pass some information along by extending the signature of the lock callback at [1].

I'm not sure exactly what information you require here, and it's probably a fair bit of convoluted plumbing, but we should have calculated everything we would need to know by the time this is called, I think.

[1] https://searchfox.org/mozilla-central/source/gfx/wr/webrender_api/src/image.rs#117

Hello Glenn,

that would be useful. What I need is to put a flag (bool for instance) if the ExternalImage returned by lock is going to be directly put to screen (by underlay/overlay) or going to be blended to other layers.

That allows to skip texture creation as Wayland uses wl_buffers to put content on screen. That may help for fullscreen video/webgl playback for instance.

Thanks.

Flags: needinfo?(stransky) → needinfo?(gwatson)
Attached file Bug 1978356 - WIP (obsolete) —

Could you apply the WIP patch locally and see if that works correctly for what you want?

Flags: needinfo?(gwatson) → needinfo?(stransky)

Thanks Glenn, I updated the patch to take action. But deferred_resolve.is_composited is always false so it doesn't work as expected (even is the texture is actually directly composited).

Flags: needinfo?(stransky) → needinfo?(gwatson)

Hmmm, the patch seems to work as expected for me, but it must do something different with the preferences you have enabled, perhaps. Could you give me steps to repro it (page URL, non-default prefs etc)?

Flags: needinfo?(gwatson) → needinfo?(stransky)
Duplicate of this bug: 1976233

Hello Glenn,
tested latest trunk with the patch. Set gfx.wayland.hdr to true, restart, open any video clip (from disk for instance) or load clip YT.
is_composited is always false even if direct composition is used (a clip played from disk).
Thanks!

Flags: needinfo?(stransky) → needinfo?(gwatson)
Attachment #9503444 - Attachment is obsolete: true
Flags: needinfo?(gwatson)
Attached file Bug 1978356 - WIP [2] (obsolete) —

Could you try with the updated WIP [2] patch attached here? I think this should work now, however even if it does I'll probably need to think of a better way to plumb this information through, as it's quite convoluted and error-prone.

Glenn, that works fine!
Thanks.

Flags: needinfo?(gwatson)
Attachment #9503979 - Attachment is obsolete: true

Attached complete patch which works for me.

Assignee: nobody → stransky
Attachment #9504472 - Attachment description: WIP: Bug 1978356 - [HDR/Linux] Don't create textures for directly composited surfaces → Bug 1978356 - [HDR/Linux] Don't create textures for directly composited surfaces r?gw
Status: NEW → ASSIGNED
Flags: needinfo?(gwatson)
Pushed by ctodea@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f91ca4600971 https://hg.mozilla.org/integration/autoland/rev/5183042abefd Revert "Bug 1978356 - [HDR/Linux] Don't create textures for directly composited surfaces r=gw" for causing build bustages

Backed out for causing build bustages

- Backout link
- Push with failures
- Failure log

Flags: needinfo?(stransky)

[task 2025-08-06T07:51:34.608+00:00] error[E0050]: method lock has 3 parameters but the declaration in trait lock has 4

[task 2025-08-06T07:51:34.608+00:00] error[E0050]: method lock has 3 parameters but the declaration in trait lock has 4
[task 2025-08-06T07:51:34.608+00:00] --> webrender\src\renderer\mod.rs:6200:13
[task 2025-08-06T07:51:34.608+00:00] |
[task 2025-08-06T07:51:34.608+00:00] 6200 | fn lock(&mut self, key: ExternalImageId, channel_index: u8) -> ExternalImage {
[task 2025-08-06T07:51:34.608+00:00] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 4 parameters, found 3
[task 2025-08-06T07:51:34.608+00:00] |
[task 2025-08-06T07:51:34.608+00:00] = note: lock from trait: fn(&mut Self, ExternalImageId, u8, bool) -> ExternalImage<'_>

Flags: needinfo?(stransky)
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 143 Branch

Is that resulting in an enhancement for the end user that we may mention into our release notes? Thanks.

Flags: needinfo?(stransky)

(In reply to Pascal Chevrel:pascalc from comment #27)

Is that resulting in an enhancement for the end user that we may mention into our release notes? Thanks.

It may save GPU resources when Linux/HDR is enabled (but not now).

Flags: needinfo?(stransky)

OK, I am changing the bug to an engineering task bug then to fit our bug types nomenclature, thanks!

Type: enhancement → task
QA Whiteboard: [qa-triage-done-c144/b143]
Attachment #9504386 - Attachment is obsolete: true
See Also: → 2011821
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: