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
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
|
/********************************************************************
Copyright 1998, 1999 by Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved
Permission to use, copy, modify, distribute, and sell this software and
its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Precision Insight not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission. Precision Insight
and its suppliers make no representations about the suitability of this
software for any purpose. It is provided "as is" without express or
implied warranty.
PRECISION INSIGHT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**********************************************************************/
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c,v 1.18 2002/10/08 22:14:10 tsi Exp $ */
/*
* The original Precision Insight driver for
* XFree86 v.3.3 has been sponsored by Red Hat.
*
* Authors:
* Jens Owen (jens@tungstengraphics.com)
* Kevin E. Martin (kevin@precisioninsight.com)
*
* Port to Xfree86 v.4.0
* 1998, 1999 by Egbert Eich (Egbert.Eich@Physik.TU-Darmstadt.DE)
*/
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86_ansic.h"
#include "compiler.h"
/* Drivers that use XAA need this */
#include "xf86fbman.h"
#include "miline.h"
#include "neo.h"
#include "neo_reg.h"
#include "neo_macros.h"
static void Neo2200Sync(ScrnInfoPtr pScrn);
static void Neo2200SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
int ydir, int rop,
unsigned int planemask,
int trans_color);
#ifdef NOT_BROKEN
static void Neo2200SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX,
int srcY, int dstX, int dstY,
int w, int h);
#else
static void Neo2200SubsequentScreenToScreenCopyBroken(ScrnInfoPtr pScrn, int srcX,
int srcY, int dstX, int dstY,
int w, int h);
#endif
static void Neo2200SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop,
unsigned int planemask);
static void Neo2200SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y,
int w, int h);
static void Neo2200SetupForScanlineCPUToScreenColorExpandFill(
ScrnInfoPtr pScrn,
int fg, int bg,
int rop,
unsigned int planemask);
static void Neo2200SubsequentScanlineCPUToScreenColorExpandFill(
ScrnInfoPtr pScrn,
int x, int y,
int w, int h,
int skipleft);
static void Neo2200SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
#if 0
static void Neo2200SetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
int patternx,
int patterny,
int bg,
int fg,
int rop,
unsigned int planemask);
static void Neo2200SubsequentMono8x8PatternFill(ScrnInfoPtr pScrn,
int patternx,
int patterny,
int x, int y,
int w, int h);
#endif
static unsigned int neo2200Rop[16] = {
0x000000, /* 0x0000 - GXclear */
0x080000, /* 0x1000 - GXand */
0x040000, /* 0x0100 - GXandReverse */
0x0c0000, /* 0x1100 - GXcopy */
0x020000, /* 0x0010 - GXandInvert */
0x0a0000, /* 0x1010 - GXnoop */
0x060000, /* 0x0110 - GXxor */
0x0e0000, /* 0x1110 - GXor */
0x010000, /* 0x0001 - GXnor */
0x090000, /* 0x1001 - GXequiv */
0x050000, /* 0x0101 - GXinvert */
0x0d0000, /* 0x1101 - GXorReverse */
0x030000, /* 0x0011 - GXcopyInvert */
0x0b0000, /* 0x1011 - GXorInverted */
0x070000, /* 0x0111 - GXnand */
0x0f0000 /* 0x1111 - GXset */
};
Bool
Neo2200AccelInit(ScreenPtr pScreen)
{
XAAInfoRecPtr infoPtr;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
NEOPtr nPtr = NEOPTR(pScrn);
NEOACLPtr nAcl = NEOACLPTR(pScrn);
nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec();
if(!infoPtr) return FALSE;
/*
* Set up the main acceleration flags.
*/
infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS;
if(nAcl->cacheEnd > nAcl->cacheStart) infoPtr->Flags |= PIXMAP_CACHE;
#if 0
infoPtr->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES;
#endif
/* sync */
infoPtr->Sync = Neo2200Sync;
/* screen to screen copy */
infoPtr->ScreenToScreenCopyFlags = (NO_TRANSPARENCY | NO_PLANEMASK);
infoPtr->SetupForScreenToScreenCopy =
Neo2200SetupForScreenToScreenCopy;
infoPtr->SubsequentScreenToScreenCopy
#ifdef NOT_BROKEN
= Neo2200SubsequentScreenToScreenCopy;
#else
= Neo2200SubsequentScreenToScreenCopyBroken;
#endif
/* solid filled rectangles */
infoPtr->SolidFillFlags = NO_PLANEMASK;
infoPtr->SetupForSolidFill =
Neo2200SetupForSolidFillRect;
infoPtr->SubsequentSolidFillRect =
Neo2200SubsequentSolidFillRect;
/* cpu to screen color expansion */
/*
* We do CPUToScreenColorExpand (ab)using the Scanline functions:
* the neo chipsets need byte padding however we can only do dword
* padding. Fortunately the graphics engine doesn't choke if we
* transfer up to 3 bytes more than it wants.
*/
if (!nPtr->strangeLockups) {
infoPtr->ScanlineCPUToScreenColorExpandFillFlags = ( NO_PLANEMASK |
#ifdef NEO_DO_CLIPPING
LEFT_EDGE_CLIPPING |
#endif
SCANLINE_PAD_DWORD |
CPU_TRANSFER_PAD_DWORD |
BIT_ORDER_IN_BYTE_MSBFIRST );
infoPtr->ScanlineColorExpandBuffers =
(unsigned char **)xnfalloc(sizeof(char*));
infoPtr->ScanlineColorExpandBuffers[0] =
(unsigned char *)(nPtr->NeoMMIOBase + 0x100000);
infoPtr->NumScanlineColorExpandBuffers = 1;
infoPtr->SetupForScanlineCPUToScreenColorExpandFill =
Neo2200SetupForScanlineCPUToScreenColorExpandFill;
infoPtr->SubsequentScanlineCPUToScreenColorExpandFill =
Neo2200SubsequentScanlineCPUToScreenColorExpandFill;
infoPtr->SubsequentColorExpandScanline =
Neo2200SubsequentColorExpandScanline;
}
#if 0
/* 8x8 pattern fills */
infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK
| HARDWARE_PATTERN_PROGRAMMED_ORIGIN
|BIT_ORDER_IN_BYTE_MSBFIRST;
infoPtr->SetupForMono8x8PatternFill =
Neo2200SetupForMono8x8PatternFill;
infoPtr->SubsequentMono8x8PatternFillRect =
Neo2200SubsequentMono8x8PatternFill;
#endif
/*
* Setup some global variables
*/
/* Initialize for 8bpp or 15/16bpp support accelerated */
switch (pScrn->bitsPerPixel) {
case 8:
nAcl->BltModeFlags = NEO_MODE1_DEPTH8;
nAcl->PixelWidth = 1;
break;
case 15:
case 16:
nAcl->BltModeFlags = NEO_MODE1_DEPTH16;
nAcl->PixelWidth = 2;
break;
case 24:
if (nPtr->noAccelSet || nPtr->NeoChipset == NM2230
|| nPtr->NeoChipset == NM2360
|| nPtr->NeoChipset == NM2380) {
nAcl->BltModeFlags = NEO_MODE1_DEPTH24;
nAcl->PixelWidth = 3;
} else
return FALSE;
break;
default:
return FALSE;
}
nAcl->Pitch = pScrn->displayWidth * nAcl->PixelWidth;
/* Initialize for widths */
switch (pScrn->displayWidth) {
case 320:
nAcl->BltModeFlags |= NEO_MODE1_X_320;
break;
case 640:
nAcl->BltModeFlags |= NEO_MODE1_X_640;
break;
case 800:
nAcl->BltModeFlags |= NEO_MODE1_X_800;
break;
case 1024:
nAcl->BltModeFlags |= NEO_MODE1_X_1024;
break;
case 1152:
nAcl->BltModeFlags |= NEO_MODE1_X_1152;
break;
case 1280:
nAcl->BltModeFlags |= NEO_MODE1_X_1280;
break;
case 1600:
nAcl->BltModeFlags |= NEO_MODE1_X_1600;
break;
default:
return FALSE;
}
return(XAAInit(pScreen, infoPtr));
}
static void
Neo2200Sync(ScrnInfoPtr pScrn)
{
NEOPtr nPtr = NEOPTR(pScrn);
WAIT_ENGINE_IDLE();
}
static void
Neo2200SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
int rop,
unsigned int planemask,
int trans_color)
{
NEOPtr nPtr = NEOPTR(pScrn);
NEOACLPtr nAcl = NEOACLPTR(pScrn);
nAcl->tmpBltCntlFlags = (NEO_BC3_SKIP_MAPPING | neo2200Rop[rop]);
/* set blt control */
WAIT_ENGINE_IDLE();
/*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/
OUTREG(NEOREG_BLTSTAT, nAcl->BltModeFlags << 16);
OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags);
OUTREG(NEOREG_PITCH, (nAcl->Pitch<<16)
| (nAcl->Pitch & 0xffff));
}
#ifdef NOT_BROKEN
static void
Neo2200SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
int srcX, int srcY,
int dstX, int dstY,
int w, int h)
{
NEOPtr nPtr = NEOPTR(pScrn);
NEOACLPtr nAcl = NEOACLPTR(pScrn);
if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) {
/* start with upper left corner */
WAIT_ENGINE_IDLE();
#if 0
OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags);
#endif
OUTREG(NEOREG_SRCSTARTOFF,
(srcY * nAcl->Pitch) + (srcX * nAcl->PixelWidth));
OUTREG(NEOREG_DSTSTARTOFF,
(dstY * nAcl->Pitch) + (dstX * nAcl->PixelWidth));
OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
}
else {
/* start with lower right corner */
WAIT_ENGINE_IDLE();
#if 0
OUTREG(NEOREG_BLTCNTL, (nAcl->tmpBltCntlFlags
| NEO_BC0_X_DEC
| NEO_BC0_DST_Y_DEC
| NEO_BC0_SRC_Y_DEC));
#endif
OUTREG(NEOREG_SRCSTARTOFF,
((srcY+h-1) * nAcl->Pitch) + ((srcX+w-1)
* nAcl->PixelWidth));
OUTREG(NEOREG_DSTSTARTOFF,
((dstY+h-1) * nAcl->Pitch) + ((dstX+w-1)
* nAcl->PixelWidth));
OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
}
}
#else /* NOT_BROKEN */
static void
Neo2200SubsequentScreenToScreenCopyBroken(ScrnInfoPtr pScrn,
int srcX, int srcY,
int dstX, int dstY,
int w, int h)
{
NEOPtr nPtr = NEOPTR(pScrn);
NEOACLPtr nAcl = NEOACLPTR(pScrn);
if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) {
if ((((dstX < 64) && ((srcX + w + 64) >= pScrn->displayWidth)) ||
((dstX == 0) && (w > (pScrn->displayWidth - 64)))) && (w > 64)) {
#define COPY_64 \
OUTREG(NEOREG_SRCSTARTOFF,\
(srcY * nAcl->Pitch) + (srcX * nAcl->PixelWidth));\
OUTREG(NEOREG_DSTSTARTOFF,\
(dstY * nAcl->Pitch) + (dstX * nAcl->PixelWidth));\
OUTREG(NEOREG_XYEXT, (h<<16) | (64));
#define COPY_W \
OUTREG(NEOREG_SRCSTARTOFF,\
(srcY * nAcl->Pitch) + (srcX1 * nAcl->PixelWidth));\
OUTREG(NEOREG_DSTSTARTOFF,\
(dstY * nAcl->Pitch) + (dstX1 * nAcl->PixelWidth));\
OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
int srcX1 = srcX + 64;
int dstX1 = dstX + 64;
w -= 64;
/* start with upper left corner */
WAIT_ENGINE_IDLE();
OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags);
if (srcX < dstX) {
COPY_W;
WAIT_ENGINE_IDLE();
COPY_64;
} else {
COPY_64;
WAIT_ENGINE_IDLE();
COPY_W;
}
#undef COPY_W
#undef COPY_64
} else {
/* start with upper left corner */
WAIT_ENGINE_IDLE();
OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags);
OUTREG(NEOREG_SRCSTARTOFF,
(srcY * nAcl->Pitch) + (srcX * nAcl->PixelWidth));
OUTREG(NEOREG_DSTSTARTOFF,
(dstY * nAcl->Pitch) + (dstX * nAcl->PixelWidth));
OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
}
} else {
if (((((dstX + w) > (pScrn->displayWidth - 64)) && (srcX == 0))
|| (((dstX + w + 64) >= pScrn->displayWidth)
&& (w > (pScrn->displayWidth - 64)))) && (w > 64)) {
#define COPY_64 \
OUTREG(NEOREG_SRCSTARTOFF, \
((srcY+h-1) * nAcl->Pitch) + ((srcX1+64-1) \
* nAcl->PixelWidth)); \
OUTREG(NEOREG_DSTSTARTOFF, \
((dstY+h-1) * nAcl->Pitch) + ((dstX1+64-1) \
* nAcl->PixelWidth)); \
OUTREG(NEOREG_XYEXT, (h<<16) | (64 & 0xffff));
#define COPY_W \
OUTREG(NEOREG_SRCSTARTOFF, \
((srcY+h-1) * nAcl->Pitch) + ((srcX + w -1) \
* nAcl->PixelWidth)); \
OUTREG(NEOREG_DSTSTARTOFF, \
((dstY+h-1) * nAcl->Pitch) + ((dstX + w -1) \
* nAcl->PixelWidth)); \
OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
int srcX1, dstX1;
w -= 64;
srcX1 = srcX + w;
dstX1 = dstX + w;
/* start with lower right corner */
WAIT_ENGINE_IDLE();
OUTREG(NEOREG_BLTCNTL, (nAcl->tmpBltCntlFlags
| NEO_BC0_X_DEC
| NEO_BC0_DST_Y_DEC
| NEO_BC0_SRC_Y_DEC));
if (srcX < dstX) {
COPY_64;
WAIT_ENGINE_IDLE();
COPY_W;
} else {
COPY_W;
WAIT_ENGINE_IDLE();
COPY_64;
}
#undef COPY_W
#undef COPY_64
} else {
/* start with lower right corner */
WAIT_ENGINE_IDLE();
OUTREG(NEOREG_BLTCNTL, (nAcl->tmpBltCntlFlags
| NEO_BC0_X_DEC
| NEO_BC0_DST_Y_DEC
| NEO_BC0_SRC_Y_DEC));
OUTREG(NEOREG_SRCSTARTOFF,
((srcY+h-1) * nAcl->Pitch) + ((srcX+w-1)
* nAcl->PixelWidth));
OUTREG(NEOREG_DSTSTARTOFF,
((dstY+h-1) * nAcl->Pitch) + ((dstX+w-1)
* nAcl->PixelWidth));
OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
}
}
}
#endif /* NOT_BROKEN */
static void
Neo2200SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop,
unsigned int planemask)
{
NEOPtr nPtr = NEOPTR(pScrn);
NEOACLPtr nAcl = NEOACLPTR(pScrn);
WAIT_ENGINE_IDLE();
/* set blt control */
/*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/
OUTREG(NEOREG_BLTSTAT, nAcl->BltModeFlags << 16);
OUTREG(NEOREG_BLTCNTL, NEO_BC0_SRC_IS_FG |
NEO_BC3_SKIP_MAPPING |
NEO_BC3_DST_XY_ADDR |
NEO_BC3_SRC_XY_ADDR | neo2200Rop[rop]);
/* set foreground color */
OUTREG(NEOREG_FGCOLOR, color);
}
static void
Neo2200SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
{
NEOPtr nPtr = NEOPTR(pScrn);
WAIT_ENGINE_IDLE();
OUTREG(NEOREG_DSTSTARTOFF, (y <<16) | (x & 0xffff));
OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
}
static void
Neo2200SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int fg, int bg,
int rop,
unsigned int planemask)
{
NEOPtr nPtr = NEOPTR(pScrn);
NEOACLPtr nAcl = NEOACLPTR(pScrn);
if (bg == -1) {
/* transparent setup */
nAcl->tmpBltCntlFlags = ( NEO_BC0_SYS_TO_VID |
NEO_BC0_SRC_MONO |
NEO_BC0_SRC_TRANS |
NEO_BC3_SKIP_MAPPING |
NEO_BC3_DST_XY_ADDR |
#ifdef NEO_DO_CLIPPING
NEO_BC3_CLIP_ON |
#endif
neo2200Rop[rop]);
WAIT_ENGINE_IDLE();
/*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/
OUTREG(NEOREG_BLTSTAT, nAcl->BltModeFlags << 16);
OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags);
OUTREG(NEOREG_FGCOLOR, fg);
}
else {
/* opaque setup */
nAcl->tmpBltCntlFlags = ( NEO_BC0_SYS_TO_VID |
NEO_BC0_SRC_MONO |
NEO_BC3_SKIP_MAPPING |
NEO_BC3_DST_XY_ADDR |
#ifdef NEO_DO_CLIPPING
NEO_BC3_CLIP_ON |
#endif
neo2200Rop[rop]);
WAIT_ENGINE_IDLE();
/*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/
OUTREG(NEOREG_BLTSTAT, nAcl->BltModeFlags << 16);
OUTREG(NEOREG_FGCOLOR, fg);
OUTREG(NEOREG_BGCOLOR, bg);
}
}
static void
Neo2200SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int x, int y,
int w, int h,
int skipleft)
{
NEOPtr nPtr = NEOPTR(pScrn);
NEOACLPtr nAcl = NEOACLPTR(pScrn);
#ifdef NEO_DO_CLIPPING
w = (w + 31) & ~31;
#else
nAcl->CPUToScreenColorExpandFill_x = x;
nAcl->CPUToScreenColorExpandFill_y = y;
nAcl->CPUToScreenColorExpandFill_w = w;
nAcl->CPUToScreenColorExpandFill_h = h;
nAcl->CPUToScreenColorExpandFill_skipleft = skipleft;
#endif
OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags
| ((skipleft << 2) & 0x1C));
#ifdef NEO_DO_CLIPPING
OUTREG(NEOREG_CLIPLT, (y << 16) | (x + skipleft));
OUTREG(NEOREG_CLIPRB, ((y + h) << 16) | (x + w));
#endif
OUTREG(NEOREG_SRCSTARTOFF, 0);
OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff));
#ifdef NEO_DO_CLIPPING
OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
#else
OUTREG(NEOREG_XYEXT, (1<<16) | (w & 0xffff));
#endif
}
static void
Neo2200SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
{
NEOPtr nPtr = NEOPTR(pScrn);
NEOACLPtr nAcl = NEOACLPTR(pScrn);
#ifdef NEO_DO_CLIPPING
/* Should I be waiting for fifo slots to prevent retries ?
How do I do that on this engine ? */
#else
if (!(--nAcl->CPUToScreenColorExpandFill_h))
return;
WAIT_ENGINE_IDLE();
OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags
| ((nAcl->CPUToScreenColorExpandFill_skipleft << 2) & 0x1C));
OUTREG(NEOREG_SRCSTARTOFF, 0);
OUTREG(NEOREG_DSTSTARTOFF, ((++nAcl->CPUToScreenColorExpandFill_y)<<16)
| (nAcl->CPUToScreenColorExpandFill_x & 0xffff));
OUTREG(NEOREG_XYEXT, (1<<16)
| (nAcl->CPUToScreenColorExpandFill_w & 0xffff));
#endif
}
#if 0
static void
Neo2200SetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
int patternx,
int patterny,
int fg, int bg,
int rop, unsigned int planemask)
{
NEOPtr nPtr = NEOPTR(pScrn);
NEOACLPtr nAcl = NEOACLPTR(pScrn);
if (bg == -1) {
/* transparent setup */
nAcl->tmpBltCntlFlags = ( NEO_BC0_SRC_MONO |
NEO_BC0_FILL_PAT |
NEO_BC0_SRC_TRANS |
NEO_BC3_SKIP_MAPPING |
NEO_BC3_DST_XY_ADDR |
neo2200Rop[rop]);
WAIT_ENGINE_IDLE();
/*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/
OUTREG(NEOREG_BLTSTAT, nAcl->BltModeFlags << 16);
OUTREG(NEOREG_FGCOLOR, fg);
OUTREG(NEOREG_SRCSTARTOFF,
(patterny * pScrn->displayWidth * pScrn->bitsPerPixel
+ patternx) >> 3);
}
else {
/* opaque setup */
nAcl->tmpBltCntlFlags = ( NEO_BC0_SRC_MONO |
NEO_BC0_FILL_PAT |
NEO_BC3_SKIP_MAPPING |
NEO_BC3_DST_XY_ADDR |
neo2200Rop[rop]);
WAIT_ENGINE_IDLE();
/*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/
OUTREG(NEOREG_BLTSTAT, nAcl->BltModeFlags << 16);
OUTREG(NEOREG_FGCOLOR, fg);
OUTREG(NEOREG_BGCOLOR, bg);
OUTREG(NEOREG_SRCSTARTOFF,
(patterny * pScrn->displayWidth * pScrn->bitsPerPixel
+ patternx) >> 3);
}
}
static void
Neo2200SubsequentMono8x8PatternFill(ScrnInfoPtr pScrn,
int patternx,
int patterny,
int x, int y,
int w, int h)
{
NEOPtr nPtr = NEOPTR(pScrn);
NEOACLPtr nAcl = NEOACLPTR(pScrn);
patterny &= 0x7;
WAIT_ENGINE_IDLE();
OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags |
(patterny << 20) |
((patternx << 10) & 0x1C00));
OUTREG(NEOREG_SRCBITOFF, patternx);
OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff));
OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
}
#endif
|