summaryrefslogtreecommitdiff
path: root/emulators/tme/patches/patch-aa
blob: 272e69752188c4e67ded6e0a4e8db01b283ee50c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
$NetBSD: patch-aa,v 1.1.1.1 2004/01/23 08:21:59 skrll Exp $

--- generic/fb-xlat-auto.sh.orig	Mon Sep 29 12:42:56 2003
+++ generic/fb-xlat-auto.sh
@@ -1905,50 +1905,82 @@ for src_key in ${src_all}; do
 		echo "             : ${dst_shift}));"
 
 		echo ""
-		echo "      /* put the pixel into both FIFOs again.  if"
-		echo "         dst_bipp is 24 or greater, the FIFOs can"
-		echo "         not entirely take these further pixels,"
-		echo "         so we need to shift: */"
-		echo "      if (dst_bipp >= 24) {"
-		echo "        TME_FB_XLAT_SHIFT_DST(dst_fifo0_may_be_unaligned,"
-		echo "                              dst_fifo0,"
-		echo "                              dst_fifo0_next,"
-		echo "                              dst_fifo0_bits,"
-		echo "                              dst_bipp,"
-		echo "                              dst_raw0,"
-		echo "                              dst_order);"
-		echo "        TME_FB_XLAT_SHIFT_DST(dst_fifo1_may_be_unaligned,"
-		echo "                              dst_fifo1,"
-		echo "                              dst_fifo1_next,"
-		echo "                              dst_fifo1_bits,"
-		echo "                              dst_bipp,"
-		echo "                              dst_raw1,"
-		echo "                              dst_order);"
-		echo "        dst_fifo0 |="
-		echo "          (pixel"
-		echo "           << (dst_order == TME_ENDIAN_BIG"
-		echo "               ? ((32 - dst_bipp) - ${dst_shift})"
-		echo "               : ${dst_shift}));"
-		echo "        dst_fifo1 |="
-		echo "          (pixel"
-		echo "           << (dst_order == TME_ENDIAN_BIG"
-		echo "               ? ((32 - dst_bipp) - ${dst_shift})"
-		echo "               : ${dst_shift}));"
-		echo "      }"
-		echo ""
-		echo "      /* otherwise, the FIFOs can take these further pixels: */"
-		echo "      else {"
-		echo "        dst_fifo0 |="
-		echo "          (pixel"
-		echo "           << (dst_order == TME_ENDIAN_BIG"
-		echo "               ? ((32 - dst_bipp) - (${dst_shift} + dst_bipp))"
-		echo "               : (${dst_shift} + dst_bipp)));"
-		echo "        dst_fifo1 |="
-		echo "          (pixel"
-		echo "           << (dst_order == TME_ENDIAN_BIG"
-		echo "               ? ((32 - dst_bipp) - (${dst_shift} + dst_bipp))"
-		echo "               : (${dst_shift} + dst_bipp)));"
-		echo "      }"
+		if test `expr ${dst_bipp} \>= 24` = 1; then
+		    echo "      /* put the pixel into both FIFOs again.  in"
+		    echo "         this case, dst_bipp is known to be ${dst_bipp},"
+		    echo "         meaning the FIFOs cannot entirely take these"
+		    echo "         further pixels, so we need to shift the FIFOs: */"
+		    indent0=""
+		    indent1=X
+		elif test ${dst_bipp} = 0; then
+		    echo "      /* put the pixel into both FIFOs again.  if"
+		    echo "         dst_bipp is 24 or greater, the FIFOs can"
+		    echo "         not entirely take these further pixels,"
+		    echo "         so we need to shift the FIFOs: */"
+		    echo "      if (dst_bipp >= 24) {"
+		    indent0="  "
+		    indent1="  "
+		else
+		    echo "      /* put the pixel into both FIFOs again.  in"
+		    echo "         this case, dst_bipp is known to be ${dst_bipp},"
+		    echo "         meaning the FIFOs can take these further pixels"
+		    echo "         without shifting the FIFOs, as long as we shift"
+		    echo "         the pixels one pixel further: */"
+		    indent0=X
+		    indent1=""
+		fi
+		if test "X${indent0}" != "XX"; then
+		    echo "${indent0}      TME_FB_XLAT_SHIFT_DST(dst_fifo0_may_be_unaligned,"
+		    echo "${indent0}                            dst_fifo0,"
+		    echo "${indent0}                            dst_fifo0_next,"
+		    echo "${indent0}                            dst_fifo0_bits,"
+		    echo "${indent0}                            dst_bipp,"
+		    echo "${indent0}                            dst_raw0,"
+		    echo "${indent0}                            dst_order);"
+		    echo "${indent0}      TME_FB_XLAT_SHIFT_DST(dst_fifo1_may_be_unaligned,"
+		    echo "${indent0}                            dst_fifo1,"
+		    echo "${indent0}                            dst_fifo1_next,"
+		    echo "${indent0}                            dst_fifo1_bits,"
+		    echo "${indent0}                            dst_bipp,"
+		    echo "${indent0}                            dst_raw1,"
+		    echo "${indent0}                            dst_order);"
+		    echo ""
+		    echo "${indent0}      /* now that we've shifted by dst_bipp, we can"
+		    echo "${indent0}         put the further pixels exactly where the"
+		    echo "${indent0}         first pixels went in the FIFOs: */"
+		    echo "${indent0}      dst_fifo0 |="
+		    echo "${indent0}        (pixel"
+		    echo "${indent0}         << (dst_order == TME_ENDIAN_BIG"
+		    echo "${indent0}             ? ((32 - dst_bipp) - ${dst_shift})"
+		    echo "${indent0}             : ${dst_shift}));"
+		    echo "${indent0}      dst_fifo1 |="
+		    echo "${indent0}        (pixel"
+		    echo "${indent0}         << (dst_order == TME_ENDIAN_BIG"
+		    echo "${indent0}             ? ((32 - dst_bipp) - ${dst_shift})"
+		    echo "${indent0}             : ${dst_shift}));"
+		fi
+		if test ${dst_bipp} = 0; then
+		    echo "      }"
+		    echo ""
+		    echo "      /* otherwise, the FIFOs can take these further pixels,"
+		    echo "         as long as we shift the pixels one pixel further: */"
+		    echo "      else {"
+		fi
+		if test "X${indent1}" != "XX"; then
+		    echo "${indent1}      dst_fifo0 |="
+		    echo "${indent1}        (pixel"
+		    echo "${indent1}         << (dst_order == TME_ENDIAN_BIG"
+		    echo "${indent1}             ? ((32 - dst_bipp) - (${dst_shift} + dst_bipp))"
+		    echo "${indent1}             : (${dst_shift} + dst_bipp)));"
+		    echo "${indent1}      dst_fifo1 |="
+		    echo "${indent1}        (pixel"
+		    echo "${indent1}         << (dst_order == TME_ENDIAN_BIG"
+		    echo "${indent1}             ? ((32 - dst_bipp) - (${dst_shift} + dst_bipp))"
+		    echo "${indent1}             : (${dst_shift} + dst_bipp)));"
+		fi
+		if test ${dst_bipp} = 0; then
+		    echo "      }"
+		fi
 	    fi
 
 	    echo ""