Closed
Bug 61410
Opened 24 years ago
Closed 24 years ago
Poor performance dealing with fully opaque rgb+alpha images
Categories
(Core :: Graphics: ImageLib, defect, P3)
Tracking
()
VERIFIED
FIXED
mozilla0.8
People
(Reporter: inkumbi, Assigned: tor)
Details
(Keywords: perf)
Attachments
(4 files)
2.25 KB,
patch
|
Details | Diff | Splinter Review | |
4.20 KB,
patch
|
Details | Diff | Splinter Review | |
5.98 KB,
patch
|
Details | Diff | Splinter Review | |
1.26 KB,
patch
|
Details | Diff | Splinter Review |
Whenever I access a page with a background that is a .png image, Mozilla
crashes, or is extremely slow to load (taking 10-30 minutes). This is in the
latest mozilla nightly build, and the problem disappears when the background
image is changed to a .gif.
Comment 1•24 years ago
|
||
Tim Allen, how about a testcase or URL where we can see this problem.
http://www.mozilla.org/quality/bug-writing-guidelines.html
you can see a test URL at http://www.treehouse.org.za/without-png.html
http://www.treehouse.org.za/with-png.html is identical, except that the
background image is a PNG rather than a GIF
Thanks!
Comment 3•24 years ago
|
||
what build are you using?
Confirmed with: Linux 2000112708
Loading the page hangs mozilla and gives a very high load to my X server
Setting severity to major.
Severity: normal → major
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 5•24 years ago
|
||
over to imagelib, as people are seeing this.
Severity: major → critical
Keywords: crash
Comment 6•24 years ago
|
||
updating component and owner. I see some slowness in laying out the page bug no
crash.
Assignee: asa → pnunn
Component: Browser-General → ImageLib
QA Contact: doronr → tpreston
sorry, misworded there.. I meant hang not crash. Sorry for the mistake.
It turns out that bg.gif is a 5x5 image with notransparency while bg.png is a
1x3 RGBA image with a fully opaque alpha channel. It's not really fair to
compare the two.
If you convert the GIF to a 5x5 RGB PNG, then they load in equivalent times. If
you add an alpha channel to the 5x5 PNG then page loading is at least 6 times
slower. If you use the original bg.png then loading is at least 25/8 times
slower than that.
The problem seems to be in alpha processing.
Two things are working against performance with small tiled RGBA images:
* drawing composited requires readback from the framebuffer
* we don't coalesce the tiles for alpha compositing as we do for
opaque or binary images, so mozilla ends up roundtripping the
server a lot.
Comment 10•24 years ago
|
||
and that is why it makes sense to put alpha channel handling
in the compositor.
Assignee | ||
Comment 11•24 years ago
|
||
No, that's why it makes sense to use the platforms graphics capablities more
effectively. The first problem can be solved by using the Render extension
where available, and the second was just bryner and I running out of time
before RTM.
Comment 12•24 years ago
|
||
If you want to support and maintain more than one platform,
putting alpha in the compositor and then using the platform
goodies to speed rendering in gfx seem a better design.
Comment 13•24 years ago
|
||
but if you want to run with it, I have cache issues as
a higher task priority. If you'd like the bug, have at it.
Be sure to touch base with kmcclusky & dcone.
-p
Assignee | ||
Comment 14•24 years ago
|
||
I was planning on doing this in gfx2 for X11. Any news regarding the status
of gfx2 (greenlighted?)?
Comment 15•24 years ago
|
||
I've not heard any news from pav.
-p
Assignee | ||
Comment 17•24 years ago
|
||
File: bg.png (154 bytes)
chunk IHDR at offset 0x0000c, length 13
1 x 3 image, 32-bit RGB+alpha, non-interlaced
chunk gAMA at offset 0x00025, length 4: 0.45455
chunk bKGD at offset 0x00035, length 6: red = 0 green = 0 blue = 0
chunk pHYs at offset 0x00047, length 9: 2833x2833 pixels/meter (72 dpi)
chunk tIME at offset 0x0005c, length 7: 2 Nov 2000 18:00:25 GMT
chunk IDAT at offset 0x0006f, length 23
zlib: deflated, 32K window, default compression
chunk IEND at offset 0x00092, length 0
Keywords: crash
Summary: Crash when background image is a PNG → Poor performance dealing with fully opaque rgb+alpha images
Assignee | ||
Comment 18•24 years ago
|
||
Comment 19•24 years ago
|
||
r=blizzard
Comment 20•24 years ago
|
||
+ if ((mAlphaDepth==8) && (!mAlphaValid)) {
Dude, overparenthesized code makes me whine (also, this line makes my eyes hurt:
+ unsigned char *alpha=mAlphaBits+mAlphaRowBytes*y+mDecodedX1;
Spaces around at least the lower-precedence operator + occurrences would be more
readable IMHO).
Ok, a non-nit:
+ PRBool mAlphaValid;
+
Use PRPackedBool and pack with other *int8 and PRPackedBool typed members such
as mFlags, mAlphaDepth, mNumBytesPixel, and mIsTopToBottom (assuming that member
is PRPackedBool, not PRBool). Access time should not suffer on common
CPU/ISA/memory architectures, but you'll save at least two words per instance.
/be
Assignee | ||
Comment 21•24 years ago
|
||
Comment 22•24 years ago
|
||
Couldn't mDepth be PRUint8 and packed into the last (currently-three-byte) group
of PRPackedBool/*int8 members?
Final nit whine:
+ if ((partial) || ((mAlphaDepth == 8) && mAlphaValid)) {
has nicely unparenthesized mAlphaValid but overparenthesized partial; similar
paren-style inconsistencies appear elsewhere; and of course, mAlphaDepth == 8
need not be parenthesized against &&. (/me flees the foolish consistency little
mind hobgoblin...)
/be
Assignee | ||
Comment 23•24 years ago
|
||
Assignee | ||
Comment 24•24 years ago
|
||
Shuffled nsImageGTK a bit more and removed some extraneous parantheses.
If you want more removed, do it yourself.
Comment 25•24 years ago
|
||
Beauty, thanks -- sr=brendan@mozilla.org.
/be
Assignee | ||
Comment 26•24 years ago
|
||
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 27•24 years ago
|
||
Fix wasn't quite right, as ImageUpdated is called before SetDecodedRect.
This means we weren't checking the right region (and in the case of an
image that only made one call to ImageUpdated, weren't checking at all).
The attached patch moves the mAlphaValid check down to SetDecodedRect.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 28•24 years ago
|
||
Comment 29•24 years ago
|
||
r/sr=blizzard
Comment 30•24 years ago
|
||
r=pavlov
Assignee | ||
Comment 31•24 years ago
|
||
Checked in.
Assignee | ||
Comment 32•24 years ago
|
||
Let's try actually closing the bug...
Status: REOPENED → RESOLVED
Closed: 24 years ago → 24 years ago
Resolution: --- → FIXED
That patch caused bustage on nebiros, for good reason. The |return| that you
moved with the code is bad in a function that returns a value. I'm guessing it
should just be taken out, since there's a |return NS_OK| just below, right?
Comment 34•24 years ago
|
||
David Baron, should this bug still be closed or re-opened?
You need to log in
before you can comment on or make changes to this bug.
Description
•