[Pixman] [PATCH 2/2] sse2, mmx: Remove initial unaligned loops in fetchers

Søren Sandmann sandmann at cs.au.dk
Wed Aug 28 20:59:26 PDT 2013

Siarhei Siamashka <siarhei.siamashka at gmail.com> writes:

>> With this new alignment assumption, such an optimization becomes even more
>> impossible, 
> Implementing this optimization does not seem to be too difficult in
> principle. I tried to hack a bit and here is the result:
>     http://lists.freedesktop.org/archives/pixman/2013-August/002863.html
> Basically, we want to be able to update the pointer to the iterator
> output buffer at any time in the middle of loop instead of setting it
> in stone at the time of iterator creation.
> Updating this temporary buffer pointer could be added as a new iterator
> method call (extending the existing get_scanline/write_back/fini). But
> then supporting "only compatible with the aligned buffer" iterators
> would be a little bit more tricky. Either way, the required code
> modifications seem to be rather small.

I like this approach -- it's much simpler than my earlier proposal [1]
where the iterator would have to be told about the destination stride
and update the pointer itself, causing the iterator API to become much
more complex. By just storing a pointer to a pointer, this all goes

The only thing I'm wondering is whether it would be cleaner to do it as
a new fast path in pixman-fast-path.c instead of adding special cases to
the general code? That way, it wouldn't even have to use a destination
iterator, it could just maintain a destination pointer itself.

>> but in any it was always going to require a rather complex internal API
>> to work because iterators are not required to use iter->buffer at all.
> Well, iter->buffer (or iter->direct_dest_buffer_ptr) is more like a
> hint. If the iterator uses it, that's great. If it does not, then we
> still can compare the returned pointer with the pointer to the current
> destination image scanline. And fallback to using a combiner if the
> pointers don't match.
> The first patch in your series (aligning the temporary buffer) is fine.
> It's just that the second patch is dropping the handling of unaligned
> pointers in the fetchers, and this code still could have some use:
>     http://lists.freedesktop.org/archives/pixman/2013-August/002864.html

The main reason for these patches is that I'm writing an SSSE3 bilinear
iterator that really wants an aligned buffer to write to, so I'm fine
with dropping the changes to the MMX/SSE2 iterators.


[1] http://lists.freedesktop.org/archives/pixman/2011-January/000934.html

More information about the Pixman mailing list