[openbeos] Re: app_server: MMX/SSE help wanted

On Wed, 11 Aug 2004, Adi Oanca wrote:

Axel Dörfler wrote:
Adi Oanca <e2joseph@xxxxxxxxxx> wrote:

So from the SIMD coders perspective, it would be very good if Haiku would offer some control over data alignment for bitmap allocations.
This includes not only the base address of the bitmap, but should ideally extend to each bitmap row, in cases where each row has to be processed separately (e.g. by blur routines:). Of course there'd be some 'waste', but I don't think this would matter too much on modern systems. Binary compatibility shouldn't be a problem either, as the BeBook already says that BytesPerRow() are decisive on determing a bitmaps actual size.


This might be implemented by an additional constructor without too much fuss, I'd guess. It would be great if you could implement this, as this would make SIMD coding much easier and less bug-prone.

OK, you'll have that. Now, I have to see how. :-) Axel, can you help?


What he means is: we would need a change of the public API, that is add another BBitmap constructor that allows an alignment. What we could also do is to add another bitmap flag to force an ideal alignment for the current CPU.

What I mean is: I don't know how to align data to 8 or 16 byte boundaries.
The only way I can think of is a kernel/VM function telling me the physical memory address for a virtual one, so I can start writing bitmap data at multiple of 8/16 depending of what we're using MMX/SSE.

You can just align the virtual memory address to get physically aligned memory as long as the page size is a multiple of your alignment factor.
But I suspect MMX/SSE operate on virtual addresses anyway.


CU, Ingo

Other related posts: