Closed Bug 1469964 Opened 6 years ago Closed 6 years ago

Shared surfaces repeatably regenerate image key and reupload whole surface if slow to decode

Categories

(Core :: Graphics: WebRender, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: aosmond, Assigned: aosmond)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(2 files, 2 obsolete files)

If an image is slow to decode (e.g. very large), it will call SourceSurfaceSharedData::Invalidate many times while it is already being displayed by WebRender. As implemented today, this causes us to regenerate the ImageKey key and reupload the entire texture, when only a few rows may have changed.

Instead we should:

1) Use UpdateExternalImage when we need to invalidate instead of deleting the ImageKey and calling AddExternalImage again. While UpdateExternalImage exists in the compositor process, this needs to be exposed via IpcResourceUpdateQueue.

2) Add expose a dirty rect parameter for UpdateExternalImage. Imagelib already knows at the time it calls SourceSurfaceSharedData::Invalidate the region of the image which invalidated. This will allow WebRender to only reupload the rows that changed.
Assignee: nobody → aosmond
Status: NEW → ASSIGNED
Still a work in progress, as I am hitting the "BUG: handle not requested earlier in frame" panic after switching to UpdateExternalImage. I also suspect progressive images may have some trouble with how I tried to avoid reuploading the entire image again when decoding has completed (mDecoded == mFrameRect, but we may still need to post an invalid rect for the rewritten rows in imgFrame::Finish...).
Priority: -- → P1
Whiteboard: [gfx-noted]
This doesn't sound like a user-facing bug. At best it's going to be a perf improvement; dropping to P2.
Priority: P1 → P2
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #3)
> This doesn't sound like a user-facing bug. At best it's going to be a perf
> improvement; dropping to P2.

Yes, there is no correctness aspect to this, just performance.
Attachment #8987056 - Attachment is obsolete: true
Attachment #8991013 - Flags: review?(nical.bugzilla)
Attachment #8991013 - Flags: review?(nical.bugzilla) → review+
Attachment #8991014 - Flags: review?(nical.bugzilla) → review+
Pushed by aosmond@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6ac886d5a6ad
Part 1. Expose WebRender plumbing for partial updates for external images. r=nical
https://hg.mozilla.org/integration/mozilla-inbound/rev/b91599130fba
Part 2. Make shared surfaces use external image update mechanism. r=nical
https://hg.mozilla.org/mozilla-central/rev/6ac886d5a6ad
https://hg.mozilla.org/mozilla-central/rev/b91599130fba
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Blocks: 1621887
No longer blocks: 1621887
Regressions: 1621887
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: