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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
/*
* Acceleration for the Creator and Creator3D framebuffer - fast inner loops.
*
* Copyright (C) 1999 David S. Miller (davem@redhat.com)
* Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*/
#ifndef FFBLOOPS_H
#define FFBLOOPS_H
#ifdef USE_VIS
extern void FFB_STIPPLE_LOAD(volatile unsigned int *d,
unsigned int *s);
extern void FFB_PPT_BOX_LOOP(FFBPtr ffbpriv,
ffb_fbcPtr ffb,
BoxPtr pbox, BoxPtr pbox_last,
DDXPointPtr ppt);
extern void FFB_BOX_LOOP(FFBPtr ffbpriv,
ffb_fbcPtr ffb,
BoxPtr pbox,
BoxPtr pbox_last);
extern void FFB_RECT_LOOP(FFBPtr ffbpriv,
ffb_fbcPtr ffb,
xRectangle *prect,
xRectangle *prect_last,
int xOrg, int yOrg);
extern void FFB_PPT_WIDTH_LOOP(FFBPtr ffbpriv,
ffb_fbcPtr ffb,
DDXPointPtr ppt, DDXPointPtr ppt_last,
int *pwidth);
extern DDXPointPtr FFB_PPT_LOOP1(FFBPtr ffbpriv,
ffb_fbcPtr ffb,
DDXPointPtr ppt, DDXPointPtr ppt_last,
int xOrg, int yOrg);
extern DDXPointPtr FFB_PPT_LOOP2(FFBPtr ffbpriv,
ffb_fbcPtr ffb,
DDXPointPtr ppt, DDXPointPtr ppt_last,
int x, int y);
extern DDXPointPtr FFB_LINE_LOOP1(FFBPtr ffbpriv,
ffb_fbcPtr ffb,
DDXPointPtr ppt, DDXPointPtr ppt_last,
int xOrg, int yOrg);
extern DDXPointPtr FFB_LINE_LOOP2(FFBPtr ffbpriv,
ffb_fbcPtr ffb,
DDXPointPtr ppt, DDXPointPtr ppt_last,
int *x, int *y);
#else /* !USE_VIS */
#define FFB_STIPPLE_LOAD(_d,_s) \
do { \
volatile unsigned int *d = (_d); \
unsigned int *s = (_s); \
int i; \
\
for (i = 0; i < (32 / 2); i++, d+=2, s+=2) \
FFB_WRITE64(d, s[0], s[1]); \
} while (0)
#define FFB_PPT_BOX_LOOP(pFfb, ffb, pbox, _pbox_last, ppt) \
do { \
BoxPtr pbox_last = (BoxPtr)(_pbox_last); \
while (pbox <= pbox_last) { \
FFBFifo(pFfb, 7); \
ffb->drawop = FFB_DRAWOP_VSCROLL; \
FFB_WRITE64(&ffb->by, ppt->y, ppt->x); \
FFB_WRITE64_2(&ffb->dy, pbox->y1, pbox->x1); \
FFB_WRITE64_3(&ffb->bh, (pbox->y2 - pbox->y1), (pbox->x2 - pbox->x1)); \
pbox++; ppt++; \
} \
} while (0)
#define FFB_BOX_LOOP(pFfb, ffb, pbox, _pbox_last) \
do { \
BoxPtr pbox_last = (BoxPtr)(_pbox_last); \
while (pbox <= pbox_last) { \
FFBFifo(pFfb, 4); \
FFB_WRITE64(&ffb->by, pbox->y1, pbox->x1); \
FFB_WRITE64_2(&ffb->bh, (pbox->y2 - pbox->y1), (pbox->x2 - pbox->x1)); \
pbox++; \
} \
} while (0)
#define FFB_RECT_LOOP(pFfb, ffb, prect, _prect_last, xOrg, yOrg) \
do { \
xRectangle *prect_last = (xRectangle *)(_prect_last); \
for (; prect <= prect_last; prect++) { \
register int x, y, w, h; \
x = prect->x + xOrg; \
y = prect->y + yOrg; \
w = prect->width; \
h = prect->height; \
if (extents->x2 <= x || \
extents->x1 >= x + w || \
extents->y2 <= y || \
extents->y1 >= y + h) \
continue; \
FFBFifo(pFfb, 4); \
FFB_WRITE64(&ffb->by, y, x); \
FFB_WRITE64_2(&ffb->bh, h, w); \
} \
} while (0)
#define FFB_PPT_WIDTH_LOOP(pFfb, ffb, ppt, _ppt_last, pwidth) \
do { \
DDXPointPtr ppt_last = (DDXPointPtr)(_ppt_last); \
while (ppt <= ppt_last) { \
register int x, y, w; \
x = ppt->x; \
y = ppt->y; \
w = *pwidth++; \
FFBFifo(pFfb, 5); \
ffb->ppc = 0; \
FFB_WRITE64(&ffb->by, y, x); \
FFB_WRITE64_2(&ffb->bh, y, (x + w)); \
ppt++; \
} \
} while (0)
static __inline__ DDXPointPtr FFB_PPT_LOOP1(FFBPtr pFfb,
ffb_fbcPtr ffb,
DDXPointPtr ppt, DDXPointPtr ppt_last,
int xOrg, int yOrg)
{
while (ppt <= ppt_last) {
FFBFifo(pFfb, 2);
FFB_WRITE64_2(&ffb->bh, (ppt->y + yOrg), (ppt->x + xOrg));
ppt++;
}
return ppt;
}
static __inline__ DDXPointPtr FFB_PPT_LOOP2(FFBPtr pFfb,
ffb_fbcPtr ffb,
DDXPointPtr ppt, DDXPointPtr ppt_last,
int x, int y)
{
register int __x = x, __y = y;
while (ppt <= ppt_last) {
FFBFifo(pFfb, 2);
__x += ppt->x;
__y += ppt->y;
FFB_WRITE64_2(&ffb->bh, __y, __x);
ppt++;
}
return ppt;
}
static __inline__ DDXPointPtr FFB_LINE_LOOP1(FFBPtr pFfb,
ffb_fbcPtr ffb,
DDXPointPtr ppt, DDXPointPtr ppt_last,
int xOrg, int yOrg)
{
while (ppt <= ppt_last) {
FFBFifo(pFfb, 3);
ffb->ppc = 0;
FFB_WRITE64_2(&ffb->bh, (ppt->y + yOrg), (ppt->x + xOrg));
ppt++;
}
return ppt;
}
static __inline__ DDXPointPtr FFB_LINE_LOOP2(FFBPtr pFfb,
ffb_fbcPtr ffb,
DDXPointPtr ppt, DDXPointPtr ppt_last,
int *x, int *y)
{
register int __x = *x, __y = *y;
while (ppt <= ppt_last) {
FFBFifo(pFfb, 3);
ffb->ppc = 0;
__x += ppt->x;
__y += ppt->y;
FFB_WRITE64_2(&ffb->bh, __y, __x);
ppt++;
}
*x = __x;
*y = __y;
return ppt;
}
#endif /* !USE_VIS */
#endif /* FFBLOOPS_H */
|