[Scummvm-git-logs] scummvm master -> 94f9956bc4a54ec61f6559c415156203d4b2a025

mikrosk noreply at scummvm.org
Fri Apr 7 10:56:02 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
94f9956bc4 GRAPHICS: ATARI: Fix copyBlit() on 040/060


Commit: 94f9956bc4a54ec61f6559c415156203d4b2a025
    https://github.com/scummvm/scummvm/commit/94f9956bc4a54ec61f6559c415156203d4b2a025
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2023-04-07T12:55:57+02:00

Commit Message:
GRAPHICS: ATARI: Fix copyBlit() on 040/060

The move16 routine needs not only src/dst aligned on 16 bytes but this
requirement must be honored in every iteration. Sometimes an engine
would pass a 16-byte aligned src (by chance) with srcPitch = 13 for
instance.

The routine above it where srcPitch == dstPitch works because there's
never a second iteration with unaligned pointers.

Also, a bit optimized (precalculated some of the jump offsets).

Changed paths:
    graphics/blit-atari.cpp


diff --git a/graphics/blit-atari.cpp b/graphics/blit-atari.cpp
index 7585a8d1c59..796f3746808 100644
--- a/graphics/blit-atari.cpp
+++ b/graphics/blit-atari.cpp
@@ -176,7 +176,7 @@ void copyBlit(byte *dst, const byte *src,
 		}
 
 		syncSuperBlitter();
-	} else if (dstPitch == srcPitch && ((w * bytesPerPixel) == dstPitch)) {
+	} else if (dstPitch == srcPitch && dstPitch == (w * bytesPerPixel)) {
 		if (hasMove16() && ((uintptr)src & (ALIGN - 1)) == 0 && ((uintptr)dst & (ALIGN - 1)) == 0) {
 			__asm__ volatile(
 			"	move.l	%2,d0\n"
@@ -187,7 +187,7 @@ void copyBlit(byte *dst, const byte *src,
 			"	and.l	d0,d1\n"
 			"	neg.l	d1\n"
 			"	lsr.l	#4,d0\n"
-			"	jmp	(2f,pc,d1.l*4)\n"
+			"	jmp		(2f,pc,d1.l*4)\n"
 			"1:\n"
 			"	move16	(%0)+,(%1)+\n"
 			"	move16	(%0)+,(%1)+\n"
@@ -213,7 +213,7 @@ void copyBlit(byte *dst, const byte *src,
 			"	moveq	#0x0f,d0\n"
 			"	and.l	%2,d0\n"
 			"	neg.l	d0\n"
-			"	jmp	(4f,pc,d0.l*2)\n"
+			"	jmp		(4f,pc,d0.l*2)\n"
 			// only 15x move.b as 16 would be handled above
 			"	move.b	(%0)+,(%1)+\n"
 			"	move.b	(%0)+,(%1)+\n"
@@ -239,18 +239,28 @@ void copyBlit(byte *dst, const byte *src,
 			memcpy(dst, src, dstPitch * h);
 		}
 	} else {
-		if (hasMove16() && ((uintptr)src & (ALIGN - 1)) == 0 && ((uintptr)dst & (ALIGN - 1)) == 0) {
+		if (hasMove16() && ((uintptr)src & (ALIGN - 1)) == 0 && ((uintptr)dst & (ALIGN - 1)) == 0
+				&& (srcPitch & (ALIGN - 1)) == 0 && (dstPitch & (ALIGN - 1)) == 0) {
 			__asm__ volatile(
-			"0:\n"
 			"	move.l	%2,d0\n"
+
+			"	moveq	#0x0f,d1\n"
+			"	and.l	d0,d1\n"
+			"	neg.l	d1\n"
+			"	lea		(4f,pc,d1.l*2),a1\n"
+
 			"	lsr.l	#4,d0\n"
 			"	beq.b	3f\n"
 
 			"	moveq	#0x0f,d1\n"
 			"	and.l	d0,d1\n"
 			"	neg.l	d1\n"
+			"	lea		(2f,pc,d1.l*4),a0\n"
 			"	lsr.l	#4,d0\n"
-			"	jmp	(2f,pc,d1.l*4)\n"
+			"	move.l	d0,d1\n"
+			"0:\n"
+			"	move.l	d1,d0\n"
+			"	jmp		(a0)\n"
 			"1:\n"
 			"	move16	(%0)+,(%1)+\n"
 			"	move16	(%0)+,(%1)+\n"
@@ -272,10 +282,7 @@ void copyBlit(byte *dst, const byte *src,
 			"	dbra	d0,1b\n"
 			// handle (w * bytesPerPixel) % 16
 			"3:\n"
-			"	moveq	#0x0f,d0\n"
-			"	and.l	%2,d0\n"
-			"	neg.l	d0\n"
-			"	jmp	(4f,pc,d0.l*2)\n"
+			"	jmp		(a1)\n"
 			// only 15x move.b as 16 would be handled above
 			"	move.b	(%0)+,(%1)+\n"
 			"	move.b	(%0)+,(%1)+\n"
@@ -299,7 +306,7 @@ void copyBlit(byte *dst, const byte *src,
 				: // outputs
 				: "a"(src), "a"(dst), "g"(w * bytesPerPixel), "d"(h - 1),
 				  "g"(dstPitch - w * bytesPerPixel), "g"(srcPitch - w * bytesPerPixel) // inputs
-				: "d0", "d1", "d2", "cc" AND_MEMORY
+				: "d0", "d1", "a0", "a1", "cc" AND_MEMORY
 			);
 		} else {
 			for (uint i = 0; i < h; ++i) {




More information about the Scummvm-git-logs mailing list