Closed Bug 1296461 Opened 8 years ago Closed 3 years ago

Optimize imgFrames to RGBX off-main-thread

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: seth, Unassigned)

References

Details

Attachments

(1 file)

imgFrame can convert a surface that was initialized as RGBA to RGBX if we determine that it actually has no transparent pixels. This doesn't involve changing any of the image data; we just recreate the wrapping DataSourceSurface with a different format. In bug 1070426, we deferred making this change until imgFrame::Optimize() gets called because of concerns about changing |mImageSurface| while other code may be accessing the imgFrame concurrently. Since that time, doing this has become a lot safer. imgFrame has become a thread safe data structure, and we make the decision about whether an imgFrame has no transparent pixels only in imgFrame::Finish(), rather than at any arbitrary time that a decoder decides to call imgFrame::SetHasNoAlpha(), as was the case back in bug 1070426. Because of those changes, we can now perform this optimization off-main-thread, without waiting for imgFrame::Optimize() to run on the main thread. Let's do it.
Here's the patch. Since |mImageSurface| is protected by the monitor, there's no danger in replacing it in imgFrame::Finish(). The only oddity this could create is that we might have multiple SourceSurfaces for the same imgFrame if somebody called imgFrame::GetSourceSurface() before imgFrame::Finish() got called, but this can happen anyway, since in the (common) case where we get rid of |mImageSurface| in imgFrame::Optimize(), imgFrame::GetSourceSurface() will return a new SourceSurface every time it's called.
Attachment #8782660 - Flags: review?(mchang)
Attachment #8782660 - Flags: review?(edwin)
Blocks: 1296465
A second try job, because we need one that runs on Windows (aka, non-Skia) as well: https://treeherder.mozilla.org/#/jobs?repo=try&revision=1f47a12f9a5d
Attachment #8782660 - Flags: review?(mchang) → review+

The bug assignee didn't login in Bugzilla in the last 7 months.
:aosmond, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: seth.bugzilla → nobody
Flags: needinfo?(aosmond)

This is no longer relevant.

Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(aosmond)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: