Closed Bug 133261 Opened 22 years ago Closed 22 years ago

Optimize the background Tiling

Categories

(Core :: Layout, defect, P1)

defect

Tracking

()

RESOLVED DUPLICATE of bug 148598

People

(Reporter: dcone, Assigned: dcone)

References

Details

(Keywords: topperf, Whiteboard: [ADT2])

Attachments

(7 files, 4 obsolete files)

Windows Patblt seems to cause more problems than is solves, I think the thing to 
do to increase the performance would be.

1.)  Use the progressive doubling algorithm.. and cache any tiles that we make 
with the nsImage.  The slowest part of the algorithm is the making of the larger 
tiles.. and I think if we cached these.. all our speed issues would go away.

2.)  Don't use the PatBlt at all.  Seems to have some issues with drivers and 
speed on platforms.
Keywords: perf
Priority: -- → P1
Target Milestone: --- → Future
Changing QA contact
QA Contact: petersen → amar
*** Bug 131890 has been marked as a duplicate of this bug. ***
With the patch installed I see problems rendering:
http://espn.go.com/mlb/news/2001/0927/1255952.html. Black lines appear in the
middle of page. If I reverse the patch and rebuild. It displays properly.

Don, thanks for cleaning up this code could you do a little more cleaning while
were at it?

0. Need a comment at the beginning that explains why we can't use the gdi patblt
call, so others will not go back and re introduce the patblt call.

1. Remove the extra semi-colon at the end of this line
+  PRInt32 x0,y0,x1,y1,x,y,width,height,canRaster,TileBufferWidth,TileBufferHeight;;

2. Change TheHDC to theHDC. Local variables should start with lowercase letter

3. If creating the tmpBitmap fails you should display a NS_WARNING and put a
comment in that you fall through to the draw a single tile at a time code. 

if(0 == tmpBitmap){
      ::DeleteObject(memDC);

4. This needs more explanation
  // see if the memory needed to do a progressive tile is available
  if ( (mAlphaDepth < 8) && (canRaster!=DT_RASPRINTER) &&
(256!=mNumPaletteColors) &&
(4*imageScaledWidth*imageScaledHeight)<MAX_BUFFERSIZE ) {

  It should mention that we will only tile into an offscreen if the tile is less
than 1/4 size of the buffer. If the tile is larger than that it is just as fast
to just blit it directly without going to temporary offscreen, 
  

5. Could you change aTileRect to aDestRect. It's referred to as the destination
rect in the calling code and I keep getting
aTileRect confused with actual size of an individual tile. 

aTileRect -> aDestRect
tileWidth -> destWidth;
tileHeight -> destHeight;

For the temporary buffer used for tiling could you change the prefix for the
names from Tile to Tiling. Again, It easy to confuse a single tile with the
entire temporary tiling buffer.

TileBufferWidth -> TilingBufferWidth
TileBufferHeight -> TilingBufferHeight

6. MAX_BUFFERSIZE is also a little to generic it should something like
MOZ_MAX_TILING_BUFFERSIZE


7. Could you replace the commas (,) with (;) colons at the end of the following
statements
destScaledWidth  = PR_MAX(PRInt32(mBHead->biWidth*scale), 1),
validX = 0,
validY = 0,
validWidth  = mBHead->biWidth,  


Thanks!
Attached patch newest patch. (obsolete) — Splinter Review
Attachment #79504 - Attachment is obsolete: true
Attached image test image
Attached image test image
A checkin on the 16th or 17th to the trunk has caused a major 
performance hit on scrolling/rendering pages on my system (Windows XP).  Recent
earlier nightly builds have no problems.

Examples of the problem:

http://www.aintitcool.com/
http://whirlpool.net.au/

Testcase showing the problem clearly:

http://members.optushome.com.au/clef/mozilla/pa/

^^ this was a testcase that was solved with the patblt changes last month.  It
has now regressed and is horribly slow (100% cpu).

I narrowed down the nightlies between which the checkin occurred:

2002-04-16-06 2002041603 GOOD
2002-04-17-17 2002041710 BAD

The latest 1.0 branch nightly does not have the problem I believe.

This makes alt-tabbing between affected sites incredibly slow too. 
Blocks: 102321
Please anyone and everyone apply this patch.. see if your slowness goes away. 
Post to this bug your results.	Thanx
Attachment #79862 - Attachment is obsolete: true
Attached patch Updated patch. (never say final) (obsolete) — Splinter Review
There is no limit on the size of the buffer created with this patch.  Failure
of progressive double will do the slow blit.
Attachment #80063 - Attachment is obsolete: true
Un-futuring.  If this gets into trunk soon and looks good, it might be
considered for RC2 (maybe) because of the wildly varying perf on win32 platforms
now.
Target Milestone: Future → ---
Blocks: 135626
Don: Can you update to the tip and repost your patch? I have a fresh pull from
today and I can not apply attachment id=80071. Thanks!
Attachment #80071 - Attachment is obsolete: true
Build Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0+) Gecko/20020508
on Win 2k and a circa 450mhz pentium.

Something's regressed Mozilla's performance with this site:

http://www.bathspa.ac.uk/igf/

Page has a tiled background image and also a 'fixed-relative-to-viewport'
background to some page elements.

What happened until the 'last week or three': the page scrolled well.

The problem now: scrolling the page is dramatically changed, very processor
intensive, and 'laggy'. If 'setiathome' is running in the background this
exacerbates the effect.
Found this bug while looking for why pages on thinkgeek.com seem to be scrolling
slowly.  Seems to be a very tall and thin background image that's repeated a
lot, so I'm guessing it's this bug.
Keywords: mozilla1.1
Blocks: 46942
Keywords: mozilla1.0
Blocks: 150272
Blocks: 148598
Blocks: 100%CPU-bg
Severity: normal → major
Keywords: perf
Somebody pls change the OS to ALL same issue on Linux.
OS: Windows NT → All
Hardware: PC → All
Nominating for nsbeta1, as this is perf issue, we should take a look at for the
next release.
Keywords: nsbeta1
Whiteboard: [ADT2]
For some reason, these test cases do not show how bad the problem is. I think
the images are not as large as commonly run into for reporters of this bug. Even
a 1kb 100x4000 PNG makes pages nearly unusable.

Will attach test case.
Attached image Background image to use
Does this still appear after fixing bug 148598 ?
I don't see any problem with last testcase.
Verifying problem with attachment in Comment #22.  As soon as the background PNG
loads, scrolling goes from *very* quick to unbelievably choppy and slow. 
Testing on Win2k, Moz 1.1b Build 2002072104.  
I'll have to try this one out under 1.0 in Linux & Windows later today.
2002073118 trunk shows great improvement on last test case.
 Scrolling is really fast on branch build: 2002-08-05 on WIN2K. Performance has
improved a lot on the given testcases.
Using build 2002080704 on Win2k, still showing noticeable slowdown on test
cases.  Slightly faster than the 1.1b "offical" release, but definitely still a
lag for me.

Perhaps I should try the 20020805 build, to test for possible regression?
It is definitely worse in 2002080614 than in the last build I had (20020804).
The problem is back.
Ah. Changes that had improved performance were backed out on 08-02. See bug 148598.
I am gonna duplicate this against 148598 because I am addressing these issues
there.  

*** This bug has been marked as a duplicate of 148598 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: