[AD] asm blit bug

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Daniel Schlyder found a bug in the asm blit code. It seems to happen only
on his Win2k machine. The problem lies at the end of the routine:

- src/i386/ispr32.s: end of _linear_draw_sprite32()
   popw %es

   movl S_BMP, %edx
   UNWRITE_BANK()

   popl %ebx
   popl %esi
   popl %edi
   movl %ebp, %esp
   popl %ebp
   ret

This code is *not* affected by the bug.

- src/i386/iblit32.s: end of _linear_blit32()
   movl B_SOURCE, %edx
   UNWRITE_BANK()

   movl B_DEST, %edx
   UNWRITE_BANK()

   popl %ebx
   popl %esi
   popl %edi
   popw %es
   movl %ebp, %esp
   popl %ebp
   ret

This code is affected by the bug.


First thing: why does _linear_blit32() call UNWRITE_BANK() for the source
bitmap ? I think we can save some CPU cycles here, but removing the 2 lines
doesn't solve the bug.

Second thing: %es is restored *after* UNWRITE_BANK() in _linear_blit32().
This is the bug. Replacing the code of _linear_blit32() by that of
_linear_draw_sprite32() fixes it.

This bad restoring order affects all iblit*.s, partially igfx8.s, no other
igfx*.s and none of ispr*.s
Therefore, if no one disagrees, I'm going to remove the unnecessary
UNWRITE_BANK() in the iblit*.s files and even the %es restoring order for
all the files.

--
Eric Botcazou
ebotcazou@xxxxxxxxxx



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/