summaryrefslogtreecommitdiff
path: root/src/ffb_stubs.c
blob: aa01018eeda99abad3a36bf581918f3458bc11ec (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
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
/*
 * Acceleration for the Creator and Creator3D framebuffer - Unaccelerated stuff.
 *
 * 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
 * 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.
 *
 */
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_stubs.c,v 1.2 2000/05/23 04:47:45 dawes Exp $ */

#include "ffb.h"
#include "ffb_regs.h"
#include "ffb_rcache.h"
#include "ffb_fifo.h"

#include "pixmapstr.h"
#include "scrnintstr.h"

#define PSZ 8
#include "cfb.h"
#undef PSZ
#include "cfb32.h"

/* CFB is just too clever for it's own good.  There are paths
 * in cfb for 8bpp that just arbitrarily change the ROP of the
 * GC and assume it just works even without revalidating that
 * GC.  So for now we turn this stuff off.  -DaveM
 */
#undef USE_SFB_TRICKS

#ifdef USE_SFB_TRICKS
/* Sorry, have to expose some CFB internals to get the stubs right. -DaveM */
struct cfb_gcstate {
	unsigned long pmask;
	int alu, rop, and, xor;
};

#define CFB_STATE_SAVE(__statep, __gcp, __privp) \
do {	(__statep)->pmask = (__gcp)->planemask; \
	(__statep)->alu = (__gcp)->alu; \
	(__statep)->rop = (__privp)->rop; \
	(__statep)->and = (__privp)->and; \
	(__statep)->xor = (__privp)->xor; \
} while(0)

#define CFB_STATE_RESTORE(__statep, __gcp, __privp) \
do {	(__gcp)->planemask = (__statep)->pmask; \
	(__gcp)->alu = (__statep)->alu; \
	(__privp)->rop = (__statep)->rop; \
	(__privp)->and = (__statep)->and; \
	(__privp)->xor = (__statep)->xor; \
} while(0)

#define CFB_STATE_SET_SFB(__gcp, __privp) \
do {	(__gcp)->alu = GXcopy; \
	(__gcp)->planemask = (((__gcp)->depth==8)?0xff:0xffffff); \
	(__privp)->rop = GXcopy; \
	(__privp)->and = 0; \
	(__privp)->xor = (__gcp)->fgPixel; \
} while(0)
#endif

/* Stubs so we can wait for the raster processor to
 * unbusy itself before we let the cfb code write
 * directly to the framebuffer.
 */
void
CreatorSolidSpansGeneralStub (DrawablePtr pDrawable, GCPtr pGC,
			      int nInit, DDXPointPtr pptInit,
			      int *pwidthInit, int fSorted)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	if (pGC->depth == 8)
		cfbSolidSpansGeneral(pDrawable, pGC, nInit, pptInit,
				     pwidthInit, fSorted);
	else
		cfb32SolidSpansGeneral(pDrawable, pGC, nInit, pptInit,
				       pwidthInit, fSorted);
}

void
CreatorSegmentSSStub (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSeg)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	if (pGC->depth == 8) {
		if (devPriv->oneRect &&
		    ((pDrawable->x >= pGC->pScreen->width - 32768) &&
		     (pDrawable->y >= pGC->pScreen->height - 32768)))
			cfb8SegmentSS1Rect(pDrawable, pGC, nseg, pSeg);
		else
			cfbSegmentSS(pDrawable, pGC, nseg, pSeg);
	} else
		cfb32SegmentSS(pDrawable, pGC, nseg, pSeg);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	if (pGC->depth == 8) {
		if (devPriv->oneRect &&
		    ((pDrawable->x >= pGC->pScreen->width - 32768) &&
		     (pDrawable->y >= pGC->pScreen->height - 32768)))
			cfb8SegmentSS1Rect(pDrawable, pGC, nseg, pSeg);
		else
			cfbSegmentSS(pDrawable, pGC, nseg, pSeg);
	} else
		cfb32SegmentSS(pDrawable, pGC, nseg, pSeg);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}

void
CreatorLineSSStub (DrawablePtr pDrawable, GCPtr pGC,
		   int mode, int npt, DDXPointPtr ppt)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	if (pGC->depth == 8) {
		if (devPriv->oneRect &&
		    ((pDrawable->x >= pGC->pScreen->width - 32768) &&
		     (pDrawable->y >= pGC->pScreen->height - 32768)))
			cfb8LineSS1Rect(pDrawable, pGC, mode, npt, ppt);
		else
			cfbLineSS(pDrawable, pGC, mode, npt, ppt);
	} else
		cfb32LineSS(pDrawable, pGC, mode, npt, ppt);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	if (pGC->depth == 8) {
		if (devPriv->oneRect &&
		    ((pDrawable->x >= pGC->pScreen->width - 32768) &&
		     (pDrawable->y >= pGC->pScreen->height - 32768)))
			cfb8LineSS1Rect(pDrawable, pGC, mode, npt, ppt);
		else
			cfbLineSS(pDrawable, pGC, mode, npt, ppt);
	} else
		cfb32LineSS(pDrawable, pGC, mode, npt, ppt);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}

void
CreatorSegmentSDStub (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSeg)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	if (pGC->depth == 8)
		cfbSegmentSD(pDrawable, pGC, nseg, pSeg);
	else
		cfb32SegmentSD(pDrawable, pGC, nseg, pSeg);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	if (pGC->depth == 8)
		cfbSegmentSD(pDrawable, pGC, nseg, pSeg);
	else
		cfb32SegmentSD(pDrawable, pGC, nseg, pSeg);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}

void
CreatorLineSDStub (DrawablePtr pDrawable, GCPtr pGC,
		   int mode, int npt, DDXPointPtr ppt)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	if (pGC->depth == 8)
		cfbLineSD(pDrawable, pGC, mode, npt, ppt);
	else
		cfb32LineSD(pDrawable, pGC, mode, npt, ppt);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	if (pGC->depth == 8)
		cfbLineSD(pDrawable, pGC, mode, npt, ppt);
	else
		cfb32LineSD(pDrawable, pGC, mode, npt, ppt);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}

void
CreatorPolyGlyphBlt8Stub (DrawablePtr pDrawable, GCPtr pGC,
			  int x, int y, unsigned int nglyph, CharInfoPtr *ppci,
			  pointer pglyphBase)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	if (pGC->depth == 8)
		cfbPolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
	else
		cfb32PolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	if (pGC->depth == 8)
		cfbPolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
	else
		cfb32PolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}

void
CreatorImageGlyphBlt8Stub (DrawablePtr pDrawable, GCPtr pGC,
			   int x, int y, unsigned int nglyph,
			   CharInfoPtr *ppci, pointer pglyphBase)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	if (pGC->depth == 8)
		cfbImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
	else
		cfb32ImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	if (pGC->depth == 8)
		cfbImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
	else
		cfb32ImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}

void
CreatorTile32FSCopyStub(DrawablePtr pDrawable, GCPtr pGC,
			int nInit, DDXPointPtr pptInit,
			int *pwidthInit, int fSorted)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	if (pGC->depth == 8)
		cfbTile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	else
		cfb32Tile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	if (pGC->depth == 8)
		cfbTile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	else
		cfb32Tile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}

void
CreatorTile32FSGeneralStub(DrawablePtr pDrawable, GCPtr pGC,
			   int nInit, DDXPointPtr pptInit,
			   int *pwidthInit, int fSorted)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	if (pGC->depth == 8)
		cfbTile32FSGeneral(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	else
		cfb32Tile32FSGeneral(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	if (pGC->depth == 8)
		cfbTile32FSGeneral(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	else
		cfb32Tile32FSGeneral(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}

void
CreatorUnnaturalTileFSStub(DrawablePtr pDrawable, GCPtr pGC,
			   int nInit, DDXPointPtr pptInit,
			   int *pwidthInit, int fSorted)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	if (pGC->depth == 8)
		cfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	else
		cfb32UnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	if (pGC->depth == 8)
		cfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	else
		cfb32UnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}

void
Creator8Stipple32FSStub(DrawablePtr pDrawable, GCPtr pGC,
			int nInit, DDXPointPtr pptInit,
			int *pwidthInit, int fSorted)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	cfb8Stipple32FS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	cfb8Stipple32FS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}

void
CreatorUnnaturalStippleFSStub(DrawablePtr pDrawable, GCPtr pGC,
			      int nInit, DDXPointPtr pptInit,
			      int *pwidthInit, int fSorted)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	if (pGC->depth == 8)
		cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	else
		cfb32UnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	if (pGC->depth == 8)
		cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	else
		cfb32UnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}

void
Creator8OpaqueStipple32FSStub(DrawablePtr pDrawable, GCPtr pGC,
			      int nInit, DDXPointPtr pptInit,
			      int *pwidthInit, int fSorted)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	cfb8OpaqueStipple32FS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	cfb8OpaqueStipple32FS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}

void
CreatorPolyFillRectStub(DrawablePtr pDrawable, GCPtr pGC,
			int nrectFill, xRectangle *prectInit)
{
	WindowPtr pWin = (WindowPtr) pDrawable;
	FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
	ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
	struct cfb_gcstate cfb_state;
	cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif

	FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
	FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
	FFBWait(pFfb, ffb);
	if (pGC->depth == 8)
		cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit);
	else
		cfb32PolyFillRect(pDrawable, pGC, nrectFill, prectInit);
#else
	CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
	FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
	FFBWait(pFfb, ffb);
	CFB_STATE_SET_SFB(pGC, devPriv);
	if (pGC->depth == 8)
		cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit);
	else
		cfb32PolyFillRect(pDrawable, pGC, nrectFill, prectInit);
	CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}