Bug 15371 - Draw untransformed repeating NPOT sources with tiles
Summary: Draw untransformed repeating NPOT sources with tiles
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/Radeon (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: xf86-video-ati maintainers
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-05 14:20 UTC by Owen Taylor
Modified: 2008-04-17 04:26 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
The patch (10.06 KB, patch)
2008-04-05 14:20 UTC, Owen Taylor
no flags Details | Splinter Review
Additional patch that hopefully gets things working on R100/R200 (1.46 KB, patch)
2008-04-05 15:41 UTC, Owen Taylor
no flags Details | Splinter Review
More R100/R200 fixes (3.91 KB, patch)
2008-04-06 10:37 UTC, Owen Taylor
no flags Details | Splinter Review
Yet further patch of R100/R200 fixups (5.93 KB, patch)
2008-04-06 15:03 UTC, Owen Taylor
no flags Details | Splinter Review
Turn on wrapping when repeating on R100 + R200 (1.28 KB, patch)
2008-04-14 06:42 UTC, Owen Taylor
no flags Details | Splinter Review
Radeon: emulate repeats by drawing in tiles (11.91 KB, patch)
2008-04-14 06:47 UTC, Owen Taylor
no flags Details | Splinter Review
Test case (in pycairo) (7.56 KB, text/plain)
2008-04-14 06:49 UTC, Owen Taylor
no flags Details
Expected output of test case (146.45 KB, image/png)
2008-04-14 06:50 UTC, Owen Taylor
no flags Details

Description Owen Taylor 2008-04-05 14:20:12 UTC
Created attachment 15707 [details] [review]
The patch

When we have a repeating source that's non-power-of-two in a
dimension, we can't turn on wrap for that dimension, but
if we aren't transforming then we can break the destination
area up into tiles, each tile contained completely within
a single copy of the source, and render the tiles one-by-one.

This turns out to make a big difference for the way that cairo
handles horizontal and vertical or gradients, which is to
render a thin strip (POT in the repeating direction, not-necessarily-POT
in the other), then tile it. Not having that as a software
fallback makes my desktop much more usable.
Comment 1 Owen Taylor 2008-04-05 14:22:56 UTC
Ah, one additional comment: the same optimization is made when there
is no mask by the generic EXA code... it actually calls into the
code that would handle a tiled-fill with core X rendering.

This patch is more general by handling the mask. Non-rectangular shapes with gradients are common in many widget themes.
Comment 2 Owen Taylor 2008-04-05 15:41:04 UTC
Created attachment 15709 [details] [review]
Additional patch that hopefully gets things working on R100/R200

In the last patch I didn't know how to conditionalize wrapping
on R100/R200 because there was no code to turn it on at all! 
(Something I fixed for R300 in the patch in bug 14333). I think
this patch corrects that based on the code in radeon_render.c
Comment 3 Owen Taylor 2008-04-06 10:37:42 UTC
Created attachment 15718 [details] [review]
More R100/R200 fixes

Here's another sequential patch:

Further repeat fixes for R100 + R200
 - We need to tile in both directions if either is NPOT
 - It's OK to repeat even if the pixmap is padded
   (pitch > width)

I've also put up a git repo with the three patches here and the
patch they depend upon from bug 15334 in it:

 git://git.fishsoup.net/xf86-video-ati

In the npot-repeat branch.
Comment 4 Owen Taylor 2008-04-06 15:03:37 UTC
Created attachment 15727 [details] [review]
Yet further patch of R100/R200 fixups

 Upon further investigation, matching pitch is actually needed
 for R100 and possibly R200 as well. Add back that test and
 tile if pitch does not match.
Comment 5 Michel Dänzer 2008-04-07 04:17:45 UTC
(In reply to comment #4)
> Upon further investigation, matching pitch is actually needed for R100 and
> possibly R200 as well.

Pretty sure it's necessary on R200 as well - I was writing and testing those tests on an R200 equipped machine.

Also, it might be even better to only flush the 3D cache once after all tiles, if that works.

P.S. I think R5xx and newer can actually handle wrapping with arbitrary dimensions.
Comment 6 Owen Taylor 2008-04-07 07:40:31 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Upon further investigation, matching pitch is actually needed for R100 and
> > possibly R200 as well.
> 
> Pretty sure it's necessary on R200 as well - I was writing and testing those
> tests on an R200 equipped machine.

Thanks ... I got stumped working with agd5f to figure out why the actual drawing-in-tiles wasn't working on R100 (very strange, must be obvious,
but not clear to me yet) and we never got back to testing on R200.
 
> Also, it might be even better to only flush the 3D cache once after all tiles,
> if that works.

Is there any reason the flush can't be moved to DoneComposite? .. not
just after all the tiles from a single box passed in by exa, but after
all the boxes?

> P.S. I think R5xx and newer can actually handle wrapping with arbitrary
> dimensions.

So I've heard. I'll leave that to someone with the hardware and the interest
to figure out. (Maybe requires going through some other texturing path?
the TX_FORMAT restriction is still in the R5xx docs.)


Comment 7 Michel Dänzer 2008-04-07 09:23:27 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > Also, it might be even better to only flush the 3D cache once after all tiles,
> > if that works.
> 
> Is there any reason the flush can't be moved to DoneComposite?

Good idea, just needs testing.
Comment 8 Owen Taylor 2008-04-14 06:42:48 UTC
Created attachment 15897 [details] [review]
Turn on wrapping when repeating on R100 + R200

 Actually enable repeats for R100 and R200. This corresponds
 to a R300 change made in the patch in:
 http://bugs.freedesktop.org/show_bug.cgi?id=15333

This patch, along with the next one compose my attempt at a final
patch ready to commit. They have been tested on R100 and R300, I'm
pretty confident that they work on R200, R500, but I haven't tested
there.
Comment 9 Owen Taylor 2008-04-14 06:47:32 UTC
Created attachment 15898 [details] [review]
Radeon: emulate repeats by drawing in tiles

 When we can't turn on hardware repeats, because the texture
 is non-power-of-two, or has padding at the ends of lines,
 try to draw the image in multiple tiles rather than falling
 back to software. (We can only do this when there is no
 transform.)
Comment 10 Owen Taylor 2008-04-14 06:49:58 UTC
Created attachment 15899 [details]
Test case (in pycairo)

Here's a test case. It needs to be run with a recent version of cairo
(say 1.6.x to be safe), or cairo will fall back to GetImage/PutImage for 
the repeating source.
Comment 11 Owen Taylor 2008-04-14 06:50:42 UTC
Created attachment 15900 [details]
Expected output of test case
Comment 12 Michel Dänzer 2008-04-17 04:26:39 UTC
Patches picked from your Git repository and pushed.

Unfortunately, moving the cache flush to DoneComposite locks up my RV350...


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.