[hatari-devel] Improving color alignment with pixels

npomarede at corp.free.fr npomarede at corp.free.fr
Sun Dec 21 19:14:32 CET 2008

On Sun, 21 Dec 2008, Thomas Huth wrote:

> Moving this thread to the new list at berlios.de ...
> On Mon, 15 Dec 2008 11:15:58 +0100 (CET)
> npomarede at corp.free.fr wrote:
>> On Mon, 15 Dec 2008, tobe at freemind-tobe.com wrote:
>>>>> How can i adjust these timings for the blitter ? Actually a word
>>>>> operation can take from 4 to 12 cycles.
>>>>> The cycles buffering implemented in blitter.c was mainly done to
>>>>> fix blitter-rasters, and if possible i would like to get ride of
>>>>> it.
>>>> in order to do this, we would need to adapt
>>>> Cycles_GetCounterOnWriteAcces to have a different result depending
>>>> on whether the write was made by the cpu or by the blitter.
>>>> As the blitter is using iomem funtions, one solution would be to
>>>> add a parameter to the functions to tell if the write is performed
>>>> by the cpu or by the blitter, and use this in
>>>> Cycles_GetCounterOnWriteAcces.
>>>> Once this is done, we can have a case for the cpu timing and
>>>> another one for the blitter.
>>>> Thomas, what would be your opinion on this ?
> Sounds ok for me, I also don't have a idea for a real better solution
> (with good performance).

I just committed a patch to do this. As we only have to differentiate 
between cpu and blitter at the bus level, I added a variable named 
'BusMode' which is by default BUS_MODE_CPU.
When the blitter starts working, it sets BusMode to BUS_MODE_BLITTER.
When done, it sets it back to BUS_MODE_CPU.

This way, the overhead is minimal and I don't think we should see any 
performance impact (no modification to IoMem functions required and no 
parameter to add).

Tobé, you can now adjust blitter specific timings in cycles.c and 
spec512.c (I might put the special case of spec512.c in cycles.c too, so 
only cycles.c will be relevant).

By knowing how many words were already processed by the blitter, you 
should be able to determine how many cycles should be added to have a 
precise value of the write cycle and obtain correct color alignment and 
border removal with the blitter.


More information about the hatari-devel mailing list