Closed Bug 838995 Opened 11 years ago Closed 11 years ago

Improve performance when reading back textures

Categories

(Core :: Graphics, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: tzimmermann, Assigned: tzimmermann)

Details

(Whiteboard: [fixed-in-birch])

Attachments

(3 files, 2 obsolete files)

Using oprofile, I did some profiling of the Crystal Skull app on FFOS. I found that it spends around 10% of the time in libxul.so, and 40% of that time in the function SwapRAndBComponents, which converts images between RGBA and BGRA.
We don't actually care about this -- readback is death to begin with, and we're going to be skipping the readback entirely with bug 837591 and/or bug 716859.  (However, if we do need to fix this specific issue, we should just not do SwapRAndBComponents at all -- we can do the swap for free in the final fragment shader in the compositor, we just have to tell it what the RB order is.)
I'll attach some patches and you can still decide whether to take them or not. They are already finished, so it's not much of a difference for me.
Ah ok -- if you already have patches done, no reason not to take 'em :)
Actually a patch for bug 743918, which gets fixed as a side effect. I thought it might be better to keep this a separate change.
Attachment #711229 - Flags: review?(vladimir)
This change increase the frame rate of the Crystal Skull app from ~8 to ~10 fps, because the call to SwapRandBComponents is not necessary any more.
Attachment #711232 - Flags: review?(vladimir)
This patch increase the performance in the (very) slow path. As a nice side effect, the code is now endian-agnostic. I think the original code only worked in little-endian machines.
Attachment #711234 - Flags: review?(vladimir)
These are the oprofile results for the patched implementation of SwapRAndBComponents. It now takes only ~30% of the time in libxul; in stead of ~40%.
Comment on attachment 711234 [details] [diff] [review]
Improve component swapping when reading texture in RGBA format

Gah, apologies for forgetting about this.

The SwapRAndBComponents stuff is good, no reason not to take it.  The others don't apply any more as the code went away..
Attachment #711234 - Flags: review?(vladimir) → review+
Attachment #711229 - Flags: review?(vladimir) → review-
Attachment #711232 - Attachment is obsolete: true
Attachment #711232 - Flags: review?(vladimir)
Attachment #711229 - Attachment is obsolete: true
Thanks! And sorry for the delay here. I've been busy with other stuff.
Whiteboard: [fixed-in-birch]
https://hg.mozilla.org/mozilla-central/rev/492e19f9dd98
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: