Improve performance when reading back textures

RESOLVED FIXED in mozilla24

Status

()

Core
Graphics
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: tzimmermann, Assigned: tzimmermann)

Tracking

Trunk
mozilla24
ARM
Gonk (Firefox OS)
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [fixed-in-birch])

Attachments

(3 attachments, 2 obsolete attachments)

Created attachment 711208 [details]
Oprofile results for SwapRAndBComponents

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 :)
Created attachment 711229 [details] [diff] [review]
BGRA test in GetOptimalReadFormats

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)
Created attachment 711232 [details] [diff] [review]
Use BGRA for reading textures if available

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)
Created attachment 711234 [details] [diff] [review]
Improve component swapping when reading texture in RGBA format

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)
Created attachment 711235 [details]
Oprofile results for patched SwapRAndBComponents

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
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.