[Pixman] [PATCH] Don't discriminate PAD and REFLECT repeat in standard fast paths

Jonathan Morton jonathan.morton at movial.com
Mon Sep 27 07:51:32 PDT 2010


If I may inject an alternative point of view into this lively
discussion...

I think the current flags system is overcomplicated for the common case.
If any one of a wide variety of flags is set for an operation, this
excludes a huge number of potential fastpaths.  Meanwhile we seem to
have a problem identifying the cases when the standard-form fastpaths
*can* be used.

Oddly enough, I have to solve much the same problem when writing EXA
drivers, since EXA presents information about the operation in a similar
way as to Pixman.  I do so in a much simpler manner:

- I go through each of the features that I know the hardware doesn't
support, such as unusual image formats, alpha maps or component-alpha.
If any of these are set, I tell EXA to fall back to software
immediately.

In Pixman itself, this could simply be setting an ON_CRACK flag (at
least for alpha maps and custom accessors) which forces use of the
general path.

- Next, I examine the transform, filter and repeat state, and use that
to construct a "fetchmode" index.  This has distinct values for "solid"
and "untransformed and covers clip" which are easily tested for later.
The fetchmode fits in 8 bits per source, so 16 bits are enough for a
masked operation.  This is small enough to make a direct lookup table
feasible if necessary.

A big feature of this is that the definitions of the "covers clip" and
"solid" modes are mutually exclusive, and the "solid" mode doesn't care
what repeat mode is used to trigger it as long as it's not "normal".  If
an image is solid, I don't even need to check whether a transform is set
on it - I only need the dimensions and the repeat mode.

Some fetchmodes may not be supported by the hardware, so I make these
fall back to software at this point too.  This is equivalent to
searching the fastpath list in Pixman.

The common cases are as follows:

- Source covers clip without transform, no mask, no crack.
- Source is solid, mask covers clip without transform, no crack.
- Source is transformed (typically in a less-than-general manner) and
may or may not cover clip, no mask, no crack.

Surely it's worth optimising the flags generation for these common
cases?

-- 
------
From: Jonathan Morton
      jonathan.morton at movial.com




More information about the Pixman mailing list