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)

x86
Linux
defect

Tracking

()

VERIFIED FIXED
mozilla0.8

People

(Reporter: inkumbi, Assigned: tor)

Details

(Keywords: perf)

Attachments

(4 files)

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.
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!
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
over to imagelib, as people are seeing this.
Severity: major → critical
Keywords: crash
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.
and that is why it makes sense to put alpha channel handling in the compositor.
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.
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.
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
I was planning on doing this in gfx2 for X11. Any news regarding the status of gfx2 (greenlighted?)?
I've not heard any news from pav. -p
over to tor
Assignee: pnunn → tor
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
Status: NEW → ASSIGNED
Keywords: perf
Target Milestone: --- → mozilla0.8
r=blizzard
+ 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
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
Attached patch more tweaksSplinter Review
Shuffled nsImageGTK a bit more and removed some extraneous parantheses. If you want more removed, do it yourself.
Beauty, thanks -- sr=brendan@mozilla.org. /be
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
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 → ---
Attached patch patch fixupSplinter Review
r/sr=blizzard
r=pavlov
Checked in.
Let's try actually closing the bug...
Status: REOPENED → RESOLVED
Closed: 24 years ago24 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?
David Baron, should this bug still be closed or re-opened?
Verified fixed linux build 2002012909
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: