[Pixman] [PATCH 4/5] lowlevel-blt-bench: Parse test name strings in general case

Pekka Paalanen ppaalanen at gmail.com
Wed Apr 8 04:03:35 PDT 2015


On Tue, 07 Apr 2015 19:15:02 +0100
"Ben Avison" <bavison at riscosopen.org> wrote:

> Hi,
> 
> Sorry for the delay in following up...
> 
> On Mon, 16 Mar 2015 14:33:47 -0000, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> > I understood these arrays should have been replaced by
> > format_from_string/operator_from_string functions from patch 2 and
> > similar new functions doing lookups in the same arrays.
> >
> > Hmm, but I see there are several alternative spellings for operators,
> > and the formats follow a whole new convention.
> 
> Some background to this might help. Pixman supports a lot of pixel
> formats; of particular significance is the fact that in many cases you
> can have the same bits-per-pixel, divided up into the same bitpattern of
> colour components, but with the red and blue components exchanged.
> 
> Each of Pixman's operations act upon between 1 and 3 bitmaps, each of
> which may have any supported pixel format. But in practice, any given
> application tends to stick to the same colour component ordering for most
> or all of its images, so the actual number of operations you're likely to
> encounter in practice is 1/2 (for 2-image operations) or 1/4 (for 3-image
> operations) of what you might otherwise expect. Furthermore,
> mathematically, an operation on (for example) two a8r8g8b8 images is
> identical to one on two a8b8g8r8 images, so typically a fast path written
> for one will be listed in the fast path table under both image formats.
> Because of this, a naming convention has evolved in the source code where
> fast path names include the string 8888 as an indication that it can be
> applied to either a8r8g8b8 or a8b8g8r8, with the implicit assumption that
> the other image has the same colour component ordering.

Okay.

> lowlevel-blt-bench is most useful when you're testing the effectiveness
> of a particular fast path, so it makes sense that its test pattern names
> reflect the names of the fast path function that you're interested in.
> However, there are a few tests, like "src_0888_8888_rev" or "rpixbuf"
> where the limitations of this approach start to show. I suspected I would
> get objections if I changed the command line of lowlevel-blt-bench, but
> in introducing a new tool, affine-bench, I saw an opportunity to allow
> the pixel formats to be specified more directly, and deliberately made
> its syntax different.
> 
> It is a matter for debate as to whether the two tools should use the same
> syntax or not, and if so, which one they should standardise on. I'd be a
> bit uncomfortable with saying that "8888" is an alias for "a8r8g8b8" or
> "0565" for "r5g6b5", because that's not true in both directions, as I
> have described. I'd probably choose the more verbose form if the
> consensus was that the two tools should match. Is there anyone who cares
> either way, though?

Well, the aliases I was thinking of would indeed go just one way.
"8888" would produce a specific rgba pixel format, but going back to
string would return the accurate name, never "8888". It is what already
happens for the existing tests, doesn't it? They have to pick something
to feed into composite32() and friends.

Building that into the lookup functions would allow sharing the lookup
tables, which I assume was a big point in the original review.

It would mean that you could use both ways of naming pixel formats or
operators as you wish on the command line etc. It's hard to see that as
a drawback: what used to work, will still work exactly the same, and you
can use specific formats too if you want.

Of course the aliases need to be carefully chosen, so that "0888" and
"8888" produce the expected relative component ordering, so things like
src_0888_8888 actually do what they used to.

Maybe I should try writing that code and see how it would look like?
I don't really like having these tables in multiple places either.

Oh yeah, I just recalled, some operator names can have an underscore.
That could make parsing strings similar to src_8888_8888 hard... well,
I'll see that if try it.


Thanks,
pq


More information about the Pixman mailing list