Closed Bug 958008 Opened 11 years ago Closed 11 years ago

Avoid copying images on Android/Gonk when there's nothing to optimize

Categories

(Core :: Graphics, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
1.4 S4 (28mar)
Tracking Status
firefox27 --- wontfix
firefox28 --- fixed
firefox29 --- fixed
firefox30 --- fixed
firefox31 --- fixed
b2g-v1.3 --- wontfix
b2g-v1.3T --- fixed
b2g-v1.4 --- fixed
b2g-v2.0 --- fixed

People

(Reporter: mwu, Assigned: mwu)

References

Details

(Keywords: perf)

Attachments

(1 file, 1 obsolete file)

On Android/Gonk, offscreen surfaces are just gfxImageSurfaces, so there's no point in copying an image to a new gfxImageSurface if there's no format conversion.
Attachment #8357708 - Flags: review?(vladimir)
A cleaner version without ifdefs. I can do the same cleanup for windows.
Attachment #8357708 - Attachment is obsolete: true
Attachment #8357708 - Flags: review?(vladimir)
Attachment #8359044 - Flags: review?(vladimir)
Keywords: perf
Comment on attachment 8359044 [details] [diff] [review] Avoid unnecessary image copy on Android/Gonk, v2 Why not put that straight into gfxPlatform::OptimizeImage?
That's what the first version of my patch did, but it only did it for Android/Gonk. Seems better to put the platform specific fastpaths into the platform specific implementations. Other platforms generally seem to have platform specific offscreen surfaces so they probably don't want this.
Your patch seems to be a general if-already-optimal-don't-optimize, so why not allow that code everywhere?
Even when the format of the image is optimal, how that image is stored might not be optimal. For example, on OSX, we always convert our gfxImageSurface to a gfxQuartzImageSurface. Platforms other than gonk/android seem to always have a more optimal native surface to use rather than gfxImageSurface. I have no idea how much those surfaces improve things.
Comment on attachment 8359044 [details] [diff] [review] Avoid unnecessary image copy on Android/Gonk, v2 Review of attachment 8359044 [details] [diff] [review]: ----------------------------------------------------------------- This looks good to me.
Attachment #8359044 - Flags: review?(vladimir) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Would you merge this into v1.3 branch?
The request was made to add this to 1.3. We can also consider the specific branches for the uplift.
blocking-b2g: --- → 1.3?
How do people feel about only taking this for tarako vs taking it on all devices for 1.3? Other than being concerned with risk (but that's not up to us if mwu and jrmuziel are cool with it), people in triage didn't have much of an opinion either way.
Blocks: 962670
AFAIK, the risk is pretty low, and it's in a code path shared with Fennec so we get extra testing here for free.
What could possibly go wrong? :)
blocking-b2g: 1.3? → 1.3+
We've been keen on any kind of memory usage reduction, so this should play nicely. I imagine this only applies to the peak memory usage, rather than overall, but either way, it should help.
(In reply to Andrew Overholt [:overholt] from comment #13) > What could possibly go wrong? :) In case it's not clear, this was meant as a joke and came out of a semi-hilarious-at-the-time discussion we had during triage :)
Depends on: 960224
Per https://bugzilla.mozilla.org/show_bug.cgi?id=960224#c24 - this needs to be backed out. This caused a 50ms startup performance regression in the Music app. Flagging checkin-needed for a backout on all branches.
Keywords: checkin-needed
Unblocking this due the performance regression risk.
blocking-b2g: 1.3+ → ---
(In reply to Jason Smith [:jsmith] from comment #19) > Unblocking this due the performance regression risk. This wasn't backed out from mozilla-release or mozilla-beta, so those status flags were correct (albeit pointless).
In theory, we should check this back in because this did not actually cause a 50ms regression in the music app. In practice, bug 980035 makes us to not go through this path anymore, so there's no point in checking this code back in.
Status: REOPENED → RESOLVED
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.4 S4 (28mar)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: