]> git.pld-linux.org Git - packages/XFree86-Servers.git/blob - XFree86-Servers-cyrix.patch
- move compressed patch to distfiles
[packages/XFree86-Servers.git] / XFree86-Servers-cyrix.patch
1 diff -ruN XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/Imakefile XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/Imakefile
2 --- XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/Imakefile Wed Jun 23 08:37:21 1999
3 +++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/Imakefile       Sat Oct 24 03:54:44 1998
4 @@ -1,4 +1,4 @@
5 -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/Imakefile,v 1.1.2.9 1999/06/23 12:37:21 hohndel Exp $
6 +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/Imakefile,v 1.1.2.8 1998/10/22 04:31:05 hohndel Exp $
7  XCOMM
8  XCOMM This is an Imakefile for the cyrix driver.  
9  XCOMM 
10 @@ -6,10 +6,10 @@
11  #include <Server.tmpl>
12  
13  SRCS = cyrix_driver.c cyrix_accel.c cyrix_cursor.c cyrix_cmap.c cyrix_bank.s \
14 -       cyrix_asm.s gxrender.c
15 +       cyrix_asm.s
16  
17  OBJS = cyrix_driver.o cyrix_accel.o cyrix_cursor.o cyrix_cmap.o cyrix_bank.o \
18 -       cyrix_asm.o gxrender.o
19 +       cyrix_asm.o
20  
21  DEFINES = -DPSZ=8
22  
23 @@ -61,7 +61,6 @@
24  InstallLinkKitNonExecFile(cyrix_driver.c,$(LINKKITDIR)/drivers/vga256/cyrix)
25  InstallLinkKitNonExecFile(cyrix_bank.s,$(LINKKITDIR)/drivers/vga256/cyrix)
26  InstallLinkKitNonExecFile(cyrix_asm.s,$(LINKKITDIR)/drivers/vga256/cyrix)
27 -InstallLinkKitNonExecFile(gxrender.c,$(LINKKITDIR)/drivers/vga256/cyrix)
28  InstallLinkKitNonExecFile(Imakefile,$(LINKKITDIR)/drivers/vga256/cyrix)
29  
30  XCOMM
31 @@ -82,4 +81,3 @@
32  XCOMM Install Link Kit Non Exec File(Imakefile,$(LINKKITDIR)/drivers/vga16/cyrix)
33  
34  DependTarget()
35 -
36 diff -ruN XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix.h XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix.h
37 --- XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix.h   Tue Dec 22 02:49:58 1998
38 +++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix.h Fri Nov  6 11:41:51 1998
39 @@ -1,5 +1,5 @@
40  
41 -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix.h,v 1.1.2.6 1998/12/22 07:49:58 hohndel Exp $ */
42 +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix.h,v 1.1.2.5 1998/11/06 09:47:02 hohndel Exp $ */
43  
44  /* this code is partly based on the MediaGX sources from the GGI project
45     based on CYRIX example code (gxvideo.c) and included with CYRIX and
46 @@ -88,10 +88,9 @@
47  #define CYRIXsetVectorMode()                 \
48                       GX_REG(GP_VECTOR_MODE)  = (vectorMode)
49  
50 -#define IfDest(rop, planemask, val)                                        \
51 -                                 (( (((rop) & 0x5) ^ (((rop) & 0xA) >> 1)) \
52 -                                 || (~((planemask) & 0xFF))                \
53 -                                 ) ? (val) : 0)
54 +#define IfDest(xrop, val)   ((((xrop) & 0x5) ^ (((xrop) & 0xA) >> 1)) ? (val) : 0)
55 +
56 +
57  
58  /* Generic MediaGX hardware register and value definitions */
59  
60 diff -ruN XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_accel.c XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_accel.c
61 --- XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_accel.c     Wed Jun 23 08:37:21 1999
62 +++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_accel.c   Fri Nov  6 11:41:51 1998
63 @@ -1,7 +1,6 @@
64 -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_accel.c,v 1.1.2.6 1999/06/23 12:37:21 hohndel Exp $ */
65 +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_accel.c,v 1.1.2.3 1998/11/06 09:47:04 hohndel Exp $ */
66  
67  /*
68 - * Copyright 1999 by Brian Falardeau.
69   * Copyright 1998 by Annius Groenink, Amsterdam.
70   *
71   * Permission to use, copy, modify, distribute, and sell this software and its
72 @@ -33,6 +32,7 @@
73  #include "cyrix.h"
74  #include "miline.h"
75  
76 +
77  /* size of color expand source area (embedded in frame buffer) */
78  #define CYRIXexpandSize       32768
79  
80 @@ -41,64 +41,17 @@
81     upper nybble inverted X raster operation (bits 0 - 3 correspond to
82     bits 3 - 0 and 7 - 4 in Windows style ROP).  In some routines,
83     the role of source and pattern is inverted. */
84 -
85 -/* The following ROPs only use pattern and destination data. */
86 -/* They are used when the planemask specifies all planes (no mask). */
87 -
88 -static const int windowsROPpat[16] = { 
89 -       0x00, /* GXclear = 0 */ 
90 -       0xA0, /* GXand = pat AND dst */ 
91 -       0x50, /* GXandReverse = pat AND NOT dst */
92 -       0xF0, /* GXcopy = pat */ 
93 -       0x0A, /* GXandInverted = NOT pat AND dst */ 
94 -       0xAA, /* GXnoop = dst */ 
95 -       0x5A, /* GXxor = pat XOR dst */  
96 -       0xFA, /* GXor = pat OR dst */
97 -       0x05, /* GXnor = NOT pat AND NOT dst */ 
98 -       0xA5, /* GXequiv = NOT pat XOR dst */ 
99 -       0x55, /* GXinvert = NOT dst */ 
100 -       0xF5, /* GXorReverse = pat OR NOT dst */ 
101 -       0x0F, /* GXcopyInverted = NOT pat */ 
102 -       0xAF, /* GXorInverted = NOT pat OR dst */ 
103 -       0x5F, /* GXnand = NOT pat OR NOT dst */ 
104 -       0xFF, /* GXset = 1 */ 
105 -};
106 -
107 -/* The following ROPs use source data to specify a planemask. */
108 -/* If the planemask (src) is one, then the result is the appropriate */
109 -/* combination of pattern and destination data.  If the planemask (src) */
110 -/* is zero, then the result is always just destination data. */
111 -
112 -static const int windowsROPsrcMask[16] = { 
113 -       0x22, /* GXclear => 0 if src = 1, dst if src = 0 */ 
114 -       0xA2, /* GXand = pat AND dst if src = 1, dst if src = 0 */
115 -       0x62, /* GXandReverse = pat AND NOT dst if src = 1, dst if src = 0 */
116 -       0xE2, /* GXcopy = pat if src = 1, dst if src = 0 */ 
117 -       0x2A, /* GXandInverted = NOT pat AND dst if src = 1, dst if src = 0 */ 
118 -       0xAA, /* GXnoop = dst if src = 1, dst if src = 0 */
119 -       0x6A, /* GXxor = pat XOR dst if src = 1, dst if src = 0 */
120 -       0xEA, /* GXor = pat OR dst if src = 1, dst if src = 0 */
121 -    0x26, /* GXnor = NOT pat AND NOT dst if src = 1, dst if src = 0 */
122 -       0xA6, /* GXequiv = NOT pat XOR dst if src = 1, dst if src = 0 */
123 -       0x66, /* GXinvert = NOT dst if src = 1, dst if src = 0 */
124 -       0xE6, /* GXorReverse = pat OR NOT dst if src = 1, dst if src = 0 */
125 -    0x2E, /* GXcopyInverted = NOT pat if src = 1, dst if src = 0 */
126 -       0xAE, /* GXorInverted = NOT pat OR dst if src = 1, dst if src = 0 */
127 -       0x6E, /* GXnand = NOT pat OR NOT dst if src = 1, dst if src = 0 */
128 -       0xEE, /* GXset = 1 if src = 1, dst if src = 0 */
129 -};
130 -
131 -/* The following ROPs use pattern data to specify a planemask. */
132 -/* If the planemask (pat) is one, then the result is the appropriate */
133 -/* combination of source and destination data.  If the planemask (pat) */
134 -/* is zero, then the result is always just destination data. */
135 -
136  static const int windowsROPpatMask[16] = { 0x0A, 0x8A, 0x4A, 0xCA,
137                                             0x2A, 0xAA, 0x6A, 0xEA,
138                                             0x1A, 0x9A, 0x5A, 0xDA,
139                                             0x3A, 0xBA, 0x7A, 0xFA };
140  
141 +static const int windowsROPsrcMask[16] = { 0x22, 0xA2, 0x62, 0xE2,
142 +                                           0x2A, 0xAA, 0x6A, 0xEA,
143 +                                           0x26, 0xA6, 0x66, 0xE6,
144 +                                           0x2E, 0xAE, 0x6E, 0xEE };
145  
146 +static int bltBufWidth;
147  
148  static int blitMode;
149  static int vectorMode;
150 @@ -106,85 +59,25 @@
151  static int copyXdir;
152  static int setBlitModeOnSync = 0;
153  
154 -/* STATIC VARIABLES FOR THIS FILE */
155 -/* Used to maintain state between setup and rendering calls. */
156 -
157 -static int CYRIXsavedROP;
158 -static int CYRIXtransparent;
159 -static int CYRIXtransColor;
160 -static int CYRIXstartMonoExpand = 0;
161 -
162 -static unsigned short CYRIXsaveX, CYRIXsaveY, CYRIXsaveW, CYRIXsaveH;
163  
164  /* Forward declaration of functions used in the driver */
165 -
166  void CYRIXAccelSync();
167  void CYRIXAccelInit();
168  void CYRIXSetupForFillRectSolid();
169  void CYRIXSubsequentFillRectSolid();
170 -void CYRIXSetupFor8x8PatternColorExpand();
171 -void CYRIXSubsequent8x8PatternColorExpand();
172  void CYRIXSetupForScreenToScreenCopy();
173  void CYRIXSubsequentScreenToScreenCopy();
174 -
175  void CYRIXSubsequentBresenhamLine();
176 +void CYRIXSetupFor8x8PatternColorExpand();
177 +void CYRIXSubsequent8x8PatternColorExpand();
178  void CYRIXSetupForCPUToScreenColorExpand();
179  void CYRIXSubsequentCPUToScreenColorExpand();
180  
181 -/* Routines in GXRENDER.C */
182 -
183 -void gxr_initialize(unsigned char *regptr, unsigned short bpp, 
184 -       unsigned short BB0base, unsigned short BB1base, 
185 -       unsigned short BBwidthPixels);
186 -
187 -void gxr_wait_until_idle(void);
188 -
189 -void gxr_load_solid_source(unsigned short color);
190 -
191 -void gxr_load_mono_source(unsigned short bgcolor, unsigned short fgcolor,
192 -       unsigned short transparent);
193 -
194 -void gxr_load_solid_pattern(unsigned short color);
195 -
196 -void gxr_load_mono_pattern(unsigned short bgcolor, unsigned short fgcolor, 
197 -       unsigned long data0, unsigned long data1, unsigned char transparency);
198 -
199 -void gxr_load_raster_operation(unsigned char rop);
200 -
201 -void gxr_pattern_fill(unsigned short x, unsigned short y, 
202 -       unsigned short width, unsigned short height);
203 -
204 -void gxr_screen_to_screen_blt(unsigned short srcx, unsigned short srcy,
205 -       unsigned short dstx, unsigned short dsty, unsigned short width, 
206 -       unsigned short height);
207 -
208 -void gxr_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy,
209 -       unsigned short dstx, unsigned short dsty, unsigned short width, 
210 -       unsigned short height, unsigned short color);
211 -
212 -void gxr_text_glyph(unsigned short srcx, unsigned short srcy,
213 -       unsigned short dstx, unsigned short dsty, unsigned short width, 
214 -       unsigned short height, unsigned char *data, unsigned short pitch); 
215 -
216 -void gxr_bresenham_line(unsigned short x, unsigned short y, 
217 -       unsigned short length, unsigned short initerr, 
218 -       unsigned short axialerr, unsigned short diagerr, 
219 -       unsigned short flags);
220 -
221 -/*
222 -//---------------------------------------------------------------------------
223 -// CYRIXAccelInit
224 -//
225 -// This routine hooks the acceleration routines and sets appropriate flags.
226 -//---------------------------------------------------------------------------
227 -*/
228  
229 +/* Acceleration init function, sets up pointers to our accelerated functions */
230  void 
231  CYRIXAccelInit() 
232 -{
233 -       int bltBufWidth;
234 -
235 -       /* General acceleration flags */
236 +{      /* General acceleration flags */
237         xf86AccelInfoRec.Flags = PIXMAP_CACHE
238                                | BACKGROUND_OPERATIONS
239                                | HARDWARE_PATTERN_SCREEN_ORIGIN
240 @@ -245,344 +138,232 @@
241  
242         /* calculate the pixel width of a blit buffer for convenience */
243         bltBufWidth = CYRIXbltBufSize / (vgaBitsPerPixel / 8);
244 +} 
245  
246 -       /* pass parameters to GXRENDER.C file */
247  
248 -       gxr_initialize((unsigned char *) GXregisters, 
249 -               (unsigned short) vgaBitsPerPixel,
250 -               (unsigned short) CYRIXbltBuf0Address, 
251 -               (unsigned short) CYRIXbltBuf1Address, 
252 -               (unsigned short) bltBufWidth);
253 -} 
254 +/* set colors - called through access macros in cyrix.h */
255 +static __inline__ void CYRIXsetColors01(reg, col0, col1)
256 +int reg;
257 +int col0;
258 +int col1;
259 +{      if (vgaBitsPerPixel == 16)
260 +               GX_REG(reg) = ((col1 & 0xFFFF) << 16) | (col0 & 0xFFFF);
261 +       else
262 +       {       col0 &= 0xFF;
263 +               col1 &= 0xFF;
264 +               GX_REG(reg) = (col1 << 24) | (col1 << 16) | (col0 << 8) | col0;
265 +}      }
266  
267 -/*
268 -//---------------------------------------------------------------------------
269 -// CYRIXAccelSync
270 -//
271 -// This routine is called before accessing the frame buffer directly to 
272 -// make sure that the graphics pipeline is idle.  It is also called after
273 -// loading the monochrome data into BB0 for bitmap to screen BLTs.
274 -//---------------------------------------------------------------------------
275 -*/
276  
277 +/* The generic Sync() function that waits for everything to
278 +   be completed (e.g. before writing to the frame buffer
279 +   directly). */
280  void
281  CYRIXAccelSync()
282 -{      
283 -       /* CHECK IF END TO CPU TO SCREEN EXPAND BLT */
284 -
285 -       if (CYRIXstartMonoExpand)
286 -       {       
287 -               /* START CPU TO SCREEN EXPAND BLT */
288 -               /* Data has already been loaded into BB0, so use NULL pointer. */
289 -
290 -               /* this is formally incorrect: XAA may use both BB0 and BB1
291 -                  for the text source bitmap, so READ_DST_FB1 should not be
292 -              used.  So far, this problem has not manifested itself in
293 -              practice. */
294 -
295 -               CYRIXstartMonoExpand = 0;
296 -               gxr_text_glyph(0, 0, CYRIXsaveX, CYRIXsaveY, CYRIXsaveW, 
297 -                       CYRIXsaveH, 0, 0);
298 +{      if (setBlitModeOnSync)
299 +       {       setBlitModeOnSync = 0;
300 +               CYRIXsetupSync();
301 +               CYRIXsetBlitMode();
302         }
303 -       
304 -       /* WAIT UNTIL IDLE */
305 -
306 -       gxr_wait_until_idle();
307 +       while (GX_REG(GP_BLIT_STATUS) &
308 +              (BS_BLIT_BUSY|BS_PIPELINE_BUSY|BS_BLIT_PENDING));
309  }
310  
311  
312 -/*
313 -//---------------------------------------------------------------------------
314 -// CYRIXSetupForFillRectSolid
315 -//
316 -// This routine is called to setup the solid pattern color for future
317 -// rectangular fills or vectors.
318 -//---------------------------------------------------------------------------
319 -*/
320 -
321 +/* Solid rectangles */
322  void 
323  CYRIXSetupForFillRectSolid(color, rop, planemask)
324  int color, rop;
325  unsigned int planemask;
326 -{
327 -       /* LOAD THE SOLID PATTERN COLOR */
328 -
329 -       gxr_load_solid_pattern((unsigned short) color);
330 -
331 -       /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
332 -
333 -       if (planemask == (unsigned int) -1)
334 -       {
335 -               /* use normal pattern ROPs if all planes are enabled */
336 -
337 -               gxr_load_raster_operation(windowsROPpat[rop & 0x0F]);
338 -       }
339 -       else
340 -       {
341 -               /* select ROP that uses planemask in src data */
342 -
343 -               gxr_load_solid_source((unsigned short) planemask);
344 -               gxr_load_raster_operation(windowsROPsrcMask[rop & 0x0F]);
345 -       }
346 +{      CYRIXsetupSync();
347 +       CYRIXsetSourceColors01(color, color);
348 +       CYRIXsetPatColors01(planemask, 0);
349 +       CYRIXsetPatMode(rop, RM_PAT_DISABLE);
350 +       blitMode = BM_READ_SRC_NONE | BM_WRITE_FB | BM_SOURCE_EXPAND
351 +                | IfDest(rop, BM_READ_DST_FB0);
352 +       vectorMode = IfDest(rop, VM_READ_DST_FB);
353  }
354      
355 -/*
356 -//---------------------------------------------------------------------------
357 -// CYRIXSubsequentFillRectSolid
358 -//
359 -// This routine is called to fill a rectangular region using the previously
360 -// specified solid pattern and raster operation.  
361 -//
362 -// Sample application uses:
363 -//   - Window backgrounds. 
364 -//   - x11perf: rectangle tests (-rect500).
365 -//   - x11perf: fill trapezoid tests (-trap100).
366 -//   - x11perf: horizontal line segments (-hseg500).
367 -//---------------------------------------------------------------------------
368 -*/
369      
370  void 
371  CYRIXSubsequentFillRectSolid(x, y, w, h)
372  int x, y, w, h;
373 -{
374 -       /* call routine to fill rectangular region */
375 -
376 -       gxr_pattern_fill((unsigned short) x, (unsigned short) y, 
377 -               (unsigned short) w, (unsigned short) h);
378 -}
379 -
380 -/*
381 -//---------------------------------------------------------------------------
382 -// CYRIXSetupFor8x8PatternColorExpand
383 -//
384 -// This routine is called to setup the monochrome pattern (8x8) and raster 
385 -// operation for future rectangular fills.
386 -//---------------------------------------------------------------------------
387 -*/
388 -
389 -void CYRIXSetupFor8x8PatternColorExpand(patternx, patterny, bg, fg, rop, planemask)
390 -int patternx, patterny;
391 -int bg, fg, rop;
392 -unsigned int planemask;
393 -{      int trans = (bg == -1);
394 -
395 -       /* LOAD PATTERN COLORS AND DATA */
396 -
397 -       gxr_load_mono_pattern((unsigned short) bg, (unsigned short) fg,
398 -               (unsigned long) patternx, (unsigned long) patterny, 
399 -               (unsigned char) trans);
400 -
401 -       /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
402 -
403 -       if (planemask == (unsigned int) -1)
404 -       {
405 -               /* use normal pattern ROPs if all planes are enabled */
406 -
407 -               gxr_load_raster_operation(windowsROPpat[rop & 0x0F]);
408 -       }
409 -       else
410 -       {
411 -               /* select ROP that uses planemask in src data */
412 -
413 -               gxr_load_solid_source((unsigned short) planemask);
414 -               gxr_load_raster_operation(windowsROPsrcMask[rop & 0x0F]);
415 +{      /* divide the operation into columns if required; use twice the
416 +           blit buffer width because buffer 0 will overflow into buffer 1 */
417 +       while (w > 2 * bltBufWidth)
418 +       {       CYRIXSubsequentFillRectSolid(x, y, 2 * bltBufWidth, h);
419 +               x += 2 * bltBufWidth;
420 +               w -= 2 * bltBufWidth;
421         }
422 +       CYRIXsetupSync();
423 +       CYRIXsetDstXY(x, y);
424 +       CYRIXsetWH(w, h);
425 +       CYRIXsetBlitMode();
426  }
427  
428 -/*
429 -//---------------------------------------------------------------------------
430 -// CYRIXSubsequent8x8PatternColorExpand
431 -//
432 -// This routine is called to fill a rectangular region using the previously
433 -// specified monochrome pattern (8x8) and raster operation.
434 -//
435 -// Sample application uses:
436 -//   - Patterned desktops
437 -//   - x11perf: stippled rectangle tests (-srect500).
438 -//   - x11perf: opaque stippled rectangle tests (-osrect500).
439 -//---------------------------------------------------------------------------
440 -*/
441 -
442 -void CYRIXSubsequent8x8PatternColorExpand(patternx, patterny, x, y, w, h)
443 -int patternx, patterny;
444 -int x, y, w, h;
445 -{
446 -       /* call routine to fill rectangular region */
447 -
448 -       gxr_pattern_fill((unsigned short) x, (unsigned short) y, 
449 -               (unsigned short) w, (unsigned short) h);
450 -}
451 -
452 -/*
453 -//---------------------------------------------------------------------------
454 -// CYRIXSetupForScreenToScreenCopy
455 -//
456 -// This routine is called to setup the planemask and raster operation 
457 -// for future screen to screen BLTs.
458 -//---------------------------------------------------------------------------
459 -*/
460  
461 +/* Screen to screen copies */
462  void 
463  CYRIXSetupForScreenToScreenCopy(xdir, ydir, rop, planemask, transparency_color)
464  int xdir, ydir;
465  int rop;
466  unsigned int planemask;
467  int transparency_color;
468 -{
469 -       /* LOAD PLANEMASK INTO PATTERN DATA */
470 +{      CYRIXsetupSync();
471 +       CYRIXsetPatColors01(planemask, 0);
472  
473 -       gxr_load_solid_pattern((unsigned short) planemask);
474 -       
475 -       /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
476 +       if (transparency_color == -1)
477 +       {       CYRIXsetPatMode(rop, RM_PAT_DISABLE);
478 +               transMode = 0;
479 +       }
480 +       else
481 +       {       CYRIXsetPatModeTrans(RM_PAT_DISABLE);
482 +               transMode = 1;
483  
484 -       gxr_load_raster_operation(windowsROPpatMask[rop & 0x0F]);
485 +               /* fill blit buffer 1 with the transparency color */
486 +               if (vgaBitsPerPixel == 16)
487 +               {       int              k   = CYRIXbltBufSize / 4;
488 +                       CARD32           val = (transparency_color << 16) |
489 +                                              transparency_color;
490 +                       volatile CARD32* buf = &(GX_REG(CYRIXbltBuf1Address));
491 +
492 +                       while (--k >= 0) buf[k] = val;
493 +               }
494 +               else
495 +                       memset(GXregisters + CYRIXbltBuf1Address,
496 +                              transparency_color, CYRIXbltBufSize);
497 +       }
498  
499 -       /* SAVE TRANSPARENCY FLAG */
500 +       blitMode = BM_READ_SRC_FB | BM_WRITE_FB | BM_SOURCE_COLOR
501 +                | (transMode ? IfDest(rop, BM_READ_DST_FB1) : BM_READ_DST_NONE)
502 +                | (ydir < 0 ? BM_REVERSE_Y : 0);
503  
504 -       CYRIXtransparent = (transparency_color == -1) ? 0 : 1;
505 -       CYRIXtransColor = transparency_color;
506 +       copyXdir = xdir;
507  }
508  
509 -/*
510 -//---------------------------------------------------------------------------
511 -// CYRIXSubsequentScreenToScreenCopy
512 -//
513 -// This routine is called to perform a screen to screen BLT using the 
514 -// previously specified planemask, raster operation, and transparency flag.
515 -//
516 -// Sample application uses (non-transparent):
517 -//   - Moving windows.
518 -//   - x11perf: scroll tests (-scroll500).
519 -//   - x11perf: copy from window to window (-copywinwin500).
520 -//
521 -// No application found using transparency.
522 -//---------------------------------------------------------------------------
523 -*/
524 -
525  void 
526  CYRIXSubsequentScreenToScreenCopy(x1, y1, x2, y2, w, h)
527  int x1, y1, x2, y2, w, h;
528 -{
529 -       if (CYRIXtransparent)
530 -       {
531 -               /* CALL ROUTINE FOR TRANSPARENT SCREEN TO SCREEN BLT */
532 -               /* Should only be called for the "copy" raster operation. */
533 -
534 -               gxr_screen_to_screen_xblt(
535 -                       (unsigned short) x1, (unsigned short) y1, 
536 -                       (unsigned short) x2, (unsigned short) y2, 
537 -                       (unsigned short) w, (unsigned short) h, 
538 -                       (unsigned short) CYRIXtransColor);
539 +{      int up       = (blitMode & BM_REVERSE_Y);
540 +
541 +       /* divide the operation into columns when necessary */
542 +       if (copyXdir < 0)
543 +       {       int x_offset = w - bltBufWidth;
544 +
545 +               while (x_offset > 0)
546 +               {       CYRIXSubsequentScreenToScreenCopy(x1 + x_offset, y1,
547 +                                                         x2 + x_offset, y2,
548 +                                                         bltBufWidth, h);
549 +                       x_offset -= bltBufWidth;
550 +                       w -= bltBufWidth;
551 +       }       }
552 +       else while (w > bltBufWidth)
553 +       {       CYRIXSubsequentScreenToScreenCopy(x1, y1, x2, y2,
554 +                                                 bltBufWidth, h);
555 +               x1 += bltBufWidth;
556 +               x2 += bltBufWidth;
557 +               w -= bltBufWidth;
558         }
559 -       else
560 -       {
561 -               /* CALL ROUTINE FOR NORMAL SCREEN TO SCREEN BLT */
562  
563 -               gxr_screen_to_screen_blt(
564 -                       (unsigned short) x1, (unsigned short) y1, 
565 -                       (unsigned short) x2, (unsigned short) y2, 
566 -                       (unsigned short) w, (unsigned short) h);
567 +       CYRIXsetupSync();
568 +       CYRIXsetSrcXY(x1, (up ? (y1 + h - 1) : y1));
569 +       CYRIXsetDstXY(x2, (up ? (y2 + h - 1) : y2));
570 +
571 +       /* in transparent mode, one line reads the transparency color
572 +          into a processor-internal register, and the remaining lines
573 +          can be done in a single second pass */
574 +       if (transMode)
575 +       {       blitMode |= BM_READ_DST_BB1;
576 +               CYRIXsetWH(w, 1);
577 +               CYRIXsetBlitMode();
578 +               h--;
579 +               if (!h) return;
580 +               if (up) { y1--; y2--; }
581 +               else { y1++; y2++; }
582 +               CYRIXsetupSync();
583 +               blitMode &= ~(BM_READ_DST_BB1);
584         }
585 +       CYRIXsetWH(w, h);
586 +       CYRIXsetBlitMode();
587  }
588  
589 -/*
590 -//---------------------------------------------------------------------------
591 -// CYRIXSubsequentBresenhamLine
592 -//
593 -// This routine is called to render a vector using the specified Bresenham
594 -// parameters.  
595 -//
596 -// Sample application uses:
597 -//   - Window outlines on window move.
598 -//   - x11perf: line segments (-seg500).
599 -//---------------------------------------------------------------------------
600 -*/
601  
602 +/* Bresenham lines */
603  void
604  CYRIXSubsequentBresenhamLine(x1, y1, octant, err, e1, e2, length)
605  int x1, y1, octant, err, e1, e2, length;
606 -{      
607 -       unsigned short flags;
608 -
609 -       /* DETERMINE YMAJOR AND DIRECTION FLAGS */
610 -
611 -       if (octant & YMAJOR)
612 -       {       flags = VM_Y_MAJOR;
613 -               if (!(octant & XDECREASING)) flags |= VM_MINOR_INC;
614 -               if (!(octant & YDECREASING)) flags |= VM_MAJOR_INC;
615 +{      if (octant & YMAJOR)
616 +       {       vectorMode = (vectorMode & VM_READ_DST_FB) | VM_Y_MAJOR;
617 +               if (!(octant & XDECREASING)) vectorMode |= VM_MINOR_INC;
618 +               if (!(octant & YDECREASING)) vectorMode |= VM_MAJOR_INC;
619         }
620         else
621 -       {       flags = VM_X_MAJOR;
622 -               if (!(octant & XDECREASING)) flags |= VM_MAJOR_INC;
623 -               if (!(octant & YDECREASING)) flags |= VM_MINOR_INC;
624 +       {       vectorMode = (vectorMode & VM_READ_DST_FB) | VM_X_MAJOR;
625 +               if (!(octant & XDECREASING)) vectorMode |= VM_MAJOR_INC;
626 +               if (!(octant & YDECREASING)) vectorMode |= VM_MINOR_INC;
627         }
628  
629 -       /* CALL ROUTINE TO DRAW VECTOR */
630 -
631 -       gxr_bresenham_line((unsigned short) x1, (unsigned short) y1, 
632 -               (unsigned short) length, (unsigned short) err, 
633 -               (unsigned short) e1, (unsigned short) e2, (unsigned short) flags);      
634 +       CYRIXsetupSync();
635 +       CYRIXsetDstXY(x1, y1);
636 +       CYRIXsetWH(length, (err & 0xFFFF));
637 +       CYRIXsetSrcXY((e1 & 0xFFFF), (e2 & 0xFFFF));
638 +       CYRIXsetVectorMode();
639  }
640  
641 -/*
642 -//---------------------------------------------------------------------------
643 -// CYRIXSetupForCPUToScreenColorExpand
644 -//
645 -// This routine is called to setup the planemask, colors, and raster 
646 -// operation for future monocrome bitmap to screen BLTs.
647 -//---------------------------------------------------------------------------
648 -*/
649  
650 -void CYRIXSetupForCPUToScreenColorExpand(bg, fg, rop, planemask)
651 +/* 8x8 pattern color expand */
652 +void CYRIXSetupFor8x8PatternColorExpand(patternx, patterny, bg, fg, rop, planemask)
653 +int patternx, patterny;
654  int bg, fg, rop;
655  unsigned int planemask;
656  {      int trans = (bg == -1);
657  
658 -       /* LOAD SOURCE COLORS */
659 +       CYRIXsetupSync();
660 +       CYRIXsetSourceColors01(planemask, planemask);
661 +       CYRIXsetPatColors01(trans ? 0 : bg, fg);
662 +       CYRIXsetPatData(patternx, patterny);
663 +       CYRIXsetPatModeX(rop, RM_PAT_MONO | (trans ? RM_PAT_TRANSPARENT : 0));
664  
665 -       gxr_load_mono_source((unsigned short) bg, (unsigned short) fg, 
666 -               (unsigned short) trans);
667 +       blitMode = BM_READ_SRC_NONE | BM_WRITE_FB | BM_SOURCE_EXPAND
668 +                | (trans ? IfDest(rop, BM_READ_DST_FB0) : BM_READ_DST_NONE);
669 +}
670  
671 -       /* LOAD PLANEMASK INTO PATTERN DATA */
672 +void CYRIXSubsequent8x8PatternColorExpand(patternx, patterny, x, y, w, h)
673 +int patternx, patterny;
674 +int x, y, w, h;
675 +{      CYRIXSubsequentFillRectSolid(x, y, w, h);
676 +}
677  
678 -       gxr_load_solid_pattern((unsigned short) planemask);
679 -       
680 -       /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
681  
682 -       gxr_load_raster_operation(windowsROPpatMask[rop & 0x0F]);
683 -}
684 +/* CPU-to-screen color expansion */
685 +void CYRIXSetupForCPUToScreenColorExpand(bg, fg, rop, planemask)
686 +int bg, fg, rop;
687 +unsigned int planemask;
688 +{      int trans = (bg == -1);
689  
690 -/*
691 -//---------------------------------------------------------------------------
692 -// CYRIXSubsequentCPUToScreenColorExpand
693 -//
694 -// This routine is called to render expanded monocrome bitmap data to the
695 -// screen using the previously specified colors and raster operation.  Since
696 -// the server loads the monochrome data into BB0, not the driver, this 
697 -// routine just sets a flag and saves the parameters to use when the server
698 -// is done loading the data and calls the CYRIXAccelSync function. 
699 -//
700 -// Sample application uses:
701 -//   - Text in windows.
702 -//   - x11perf: text (-ftext, -f8text, -f9text, ...).
703 -//---------------------------------------------------------------------------
704 -*/
705 +       CYRIXsetupSync();
706 +       CYRIXsetSourceColors01(trans ? 0 : bg, fg);
707 +       CYRIXsetPatColors01(planemask, 0);
708 +
709 +       CYRIXsetPatMode(rop, RM_PAT_DISABLE | (trans ? RM_SRC_TRANSPARENT : 0));
710 +
711 +       /* this is formally incorrect: XAA may use both BB0 and BB1
712 +          for the text source bitmap, so READ_DST_FB1 should not be
713 +          used.  So far, this problem has not manifested itself in
714 +          practice. */
715 +       blitMode = BM_READ_SRC_BB0 | BM_WRITE_FB | BM_SOURCE_EXPAND
716 +                | (trans ? IfDest(rop, BM_READ_DST_FB1) : BM_READ_DST_NONE);
717 +}
718  
719  void CYRIXSubsequentCPUToScreenColorExpand(x, y, w, h, skipleft)
720  int x, y, w, h;
721  int skipleft;
722 -{
723 -       CYRIXstartMonoExpand = 1;
724 -       CYRIXsaveX = x;
725 -       CYRIXsaveY = y;
726 -       CYRIXsaveW = w;
727 -       CYRIXsaveH = h;
728 -
729 -       /* WAIT UNTIL IDLE BEFORE ALLOWING WRITES TO BLT BUFFERS */
730 -       /* Server will load the monochrome data into BB0 after this. */
731 +{      CYRIXsetupSync();
732 +       CYRIXsetSrcXY(0, 0);
733 +       CYRIXsetDstXY(x, y);
734 +       CYRIXsetWH(w, h);
735  
736 -       gxr_wait_until_idle();
737 +       CYRIXAccelSync();
738 +       setBlitModeOnSync = 1;
739  }
740 -
741 -/* END OF FILE */
742  
743 diff -ruN XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_driver.c XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_driver.c
744 --- XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_driver.c    Wed Jun 23 08:37:22 1999
745 +++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_driver.c  Fri Nov  6 11:41:51 1998
746 @@ -1,12 +1,9 @@
747 -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_driver.c,v 1.1.2.7 1999/06/23 12:37:22 hohndel Exp $ */
748 +/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/cyrix_driver.c,v 1.1.2.6 1998/11/06 09:47:08 hohndel Exp $ */
749  /*
750 - * Copyright 1999 by Brian Falardeau 
751   * Copyright 1998 by Annius V. Groenink (A.V.Groenink@zfc.nl, avg@cwi.nl),
752   *                   Dirk H. Hohndel (hohndel@suse.de),
753   *                   Portions: the GGI project & confidential CYRIX databooks.
754   *
755 - * Substitute Brian Falardeau into a copy of the following legal jargon...
756 - *
757   * Permission to use, copy, modify, distribute, and sell this software and its
758   * documentation for any purpose is hereby granted without fee, provided that
759   * the above copyright notice appear in all copies and that both that
760 @@ -25,17 +22,13 @@
761   * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
762   * PERFORMANCE OF THIS SOFTWARE.
763   */
764 +/* $XConsortium: $ */
765  
766  /*************************************************************************/
767  
768  /*
769     Log for the cyrix driver source as a whole
770  
771 -   May 1999, Brian Falardeau:
772 -   - Fixed interaction with SoftVGA for setting 2K pitch at 1280x1024.
773 -   - Added CRTC tables for 60 Hz and 75 Hz modes.
774 -   - Removed enabling display compression directly for VSA1.
775 -
776     5th Nov 1998 avg  - Fixed blit buffer organization using CPU_WRITE
777                         instruction.  Support for older chipsets (color
778                         treatment and different CPU_WRITE opcode).
779 @@ -115,35 +108,50 @@
780  #include "extensions/xf86dgastr.h"
781  #endif
782  
783 +#ifdef XF86VGA16
784 +#define MONOVGA
785 +#endif
786  
787 +#if !defined(MONOVGA) && !defined(XF86VGA16)
788  #include "vga256.h"
789 +#endif
790 +
791  #include "cyrix.h"
792  
793  pciTagRec CyrixPciTag;
794  extern vgaHWCursorRec vgaHWCursor;
795  
796 -#define NUM_STD_CRTC_REGS 25
797 -#define NUM_EXT_CRTC_REGS 16
798 -
799  typedef struct {
800         vgaHWRec std; /* IBM VGA */
801         struct vgaCYRIXext
802 -       {       
803 -               /* override of miscellaneous output register value */
804 -
805 -               unsigned char miscOutput;
806 -
807 -               /* override of standard CRTC register values */
808 -
809 -               unsigned char stdCRTCregs[NUM_STD_CRTC_REGS];
810 -
811 -               /* extended CRTC register values (specific to MediaGX) */
812 -
813 -               unsigned char extCRTCregs[NUM_EXT_CRTC_REGS];
814 +       {       /* extended SoftVGA registers */
815 +               unsigned char VerticalTimingExtension;
816 +               unsigned char ExtendedAddressControl;
817 +               unsigned char ExtendedOffset;
818 +               unsigned char ExtendedColorControl;
819 +               unsigned char DisplayCompression;
820 +               unsigned char DriverControl;
821 +               unsigned char DACControl;
822 +               unsigned char ClockControl;
823 +               unsigned char CrtClockFrequency;
824 +               unsigned char CrtClockFrequencyFraction;
825 +               unsigned char RefreshRate;
826 +
827 +               /* display controller hardware registers */
828 +               CARD32 DcGeneralCfg;
829 +               CARD32 DcCursStOffset;
830 +               CARD32 DcCbStOffset;
831 +               CARD32 DcLineDelta;
832 +               CARD32 DcBufSize;
833 +               CARD32 DcCursorX;
834 +               CARD32 DcCursorY;
835 +               CARD32 DcCursorColor;
836  
837                 /* graphics pipeline registers */
838 -
839                 CARD32 GpBlitStatus;
840 +
841 +               /* save area for cursor image */
842 +               char cursorPattern[256];
843         }       ext;
844  } vgaCYRIXRec, *vgaCYRIXPtr;
845  
846 @@ -158,9 +166,11 @@
847  static void    CYRIXRestore();
848  static void    CYRIXAdjust();
849  
850 +#ifndef MONOVGA
851  static void    CYRIXFbInit();
852  static Bool    CYRIXScreenInit();
853  static Bool    CYRIXPitchAdjust();
854 +#endif
855  
856  void    CYRIXSetRead();
857  void    CYRIXSetWrite();
858 @@ -177,7 +187,11 @@
859         CYRIXAdjust,
860         vgaHWSaveScreen,
861         (void (*)())NoopDDA,     /* CYRIXGetMode */
862 +#ifndef MONOVGA
863         CYRIXFbInit,
864 +#else
865 +       (void (*)())NoopDDA,     /* CYRIXFbInit */
866 +#endif
867         CYRIXSetRead,
868         CYRIXSetWrite,
869         CYRIXSetReadWrite,
870 @@ -191,9 +205,9 @@
871         VGA_NO_DIVIDE_VERT,      /* ChipInterlaceType */
872         {0,},                    /* ChipOptionFlags */
873         8,                       /* ChipRounding */
874 -       TRUE,                    /* ChipUseLinearAddressing */
875 -       0x40800000,              /* ChipLinearBase */
876 -       0x001FFFFF,              /* ChipLinearSize */
877 +       FALSE,                   /* ChipUseLinearAddressing */
878 +       0,                       /* ChipLinearBase */
879 +       0,                       /* ChipLinearSize */
880         TRUE,                    /* ChipHas16bpp */
881         FALSE,                   /* ChipHas24bpp */
882         FALSE,                   /* ChipHas32bpp */
883 @@ -207,10 +221,6 @@
884  
885  char* GXregisters;
886  
887 -int CYRIXvsaversion;                   /* VSA version */
888 -#define CYRIX_VSA1     1
889 -#define CYRIX_VSA2  2
890 -
891  int CYRIXcbufferAddress;      /* relative to video base */
892  int CYRIXoffscreenAddress;
893  int CYRIXcursorAddress;
894 @@ -225,94 +235,6 @@
895  
896  #define newstate ((vgaCYRIXPtr)vgaNewVideoState)
897  
898 -typedef struct {
899 -       int xsize;
900 -       int ysize;
901 -       int clock;
902 -       unsigned char miscOutput;
903 -       unsigned char stdCRTCregs[NUM_STD_CRTC_REGS];
904 -       unsigned char extCRTCregs[NUM_EXT_CRTC_REGS];
905 -} vgaCYRIXmode;
906 -
907 -vgaCYRIXmode CYRIXmodes[] =
908 -{
909 -/*------------------------------------------------------------------------------*/
910 -       { 640, 480,         /* 640x480 */
911 -         25,               /* 25 MHz clock = 60 Hz refresh rate */
912 -         0xE3,             /* miscOutput register */
913 -       { 0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E, /* standard CRTC */ 
914 -         0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
915 -         0xEA, 0x0C, 0xDF, 0x50, 0x00, 0xE7, 0x04, 0xE3, 0xFF },    
916 -       { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
917 -         0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } },
918 -/*------------------------------------------------------------------------------*/
919 -       { 800, 600,         /* 800x600 */
920 -         40,               /* 40 MHz clock = 60 Hz refresh rate */
921 -         0x23,             /* miscOutput register */
922 -       { 0x7F, 0x63, 0x64, 0x82, 0x6B, 0x1B, 0x72, 0xF0, /* standard CRTC */ 
923 -         0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
924 -         0x59, 0x0D, 0x57, 0x64, 0x00, 0x57, 0x73, 0xE3, 0xFF },    
925 -       { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
926 -         0x00, 0x00, 0x01, 0x03, 0xA0, 0x50, 0x00, 0x00 } },
927 -/*------------------------------------------------------------------------------*/
928 -       { 1024, 768,        /* 1024x768 */
929 -         65,               /* 65 MHz clock = 60 Hz refresh rate */
930 -         0xE3,             /* miscOutput register */
931 -       { 0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xF5, /* standard CRTC */ 
932 -         0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
933 -         0x04, 0x0A, 0xFF, 0x80, 0x00, 0xFF, 0x25, 0xE3, 0xFF },    
934 -       { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
935 -         0x00, 0x00, 0x01, 0x03, 0x80, 0x41, 0x00, 0x00 } },
936 -/*------------------------------------------------------------------------------*/
937 -       { 1280, 1024,       /* 1280x1024 */
938 -         108,              /* 108 MHz clock = 60 Hz refresh rate */
939 -         0x23,             /* miscOutput register */
940 -       { 0xCF, 0x9F, 0xA0, 0x92, 0xAA, 0x19, 0x28, 0x52, /* standard CRTC */ 
941 -         0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
942 -         0x01, 0x04, 0xFF, 0xA0, 0x00, 0x00, 0x29, 0xE3, 0xFF },    
943 -       { 0x00, 0x51, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
944 -         0x00, 0x00, 0x01, 0x03, 0x80, 0x6C, 0x00, 0x00 } },
945 -/*------------------------------------------------------------------------------*/
946 -       { 640, 480,         /* 640x480 */
947 -         31,               /* 31.5 MHz clock = 75 Hz refresh rate */
948 -         0xE3,             /* miscOutput register */
949 -       { 0x64, 0x4F, 0x4F, 0x88, 0x54, 0x9B, 0xF2, 0x1F, /* standard CRTC */ 
950 -         0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
951 -         0xE1, 0x04, 0xDF, 0x50, 0x00, 0xDF, 0xF3, 0xE3, 0xFF },    
952 -       { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
953 -         0x00, 0x00, 0x01, 0x03, 0xA0, 0x3F, 0x00, 0x00 } },
954 -/*------------------------------------------------------------------------------*/
955 -       { 800, 600,         /* 800x600 */
956 -         99,               /* 99 MHz clock = 75 Hz refresh rate */
957 -         0x23,             /* miscOutput register */
958 -       { 0x7F, 0x63, 0x63, 0x83, 0x68, 0x11, 0x6F, 0xF0, /* standard CRTC */ 
959 -         0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
960 -         0x59, 0x1C, 0x57, 0x64, 0x00, 0x57, 0x70, 0xE3, 0xFF },    
961 -       { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
962 -         0x00, 0x00, 0x01, 0x03, 0xA0, 0x63, 0x00, 0x00 } },
963 -/*------------------------------------------------------------------------------*/
964 -       { 1024, 768,        /* 1024x768 */
965 -         79,               /* 79 MHz clock = 75 Hz refresh rate */
966 -         0xE3,             /* miscOutput register */
967 -       { 0x9F, 0x7F, 0x7F, 0x83, 0x84, 0x8F, 0x1E, 0xF5, /* standard CRTC */ 
968 -         0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
969 -         0x01, 0x04, 0xFF, 0x80, 0x00, 0xFF, 0x1F, 0xE3, 0xFF },    
970 -       { 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
971 -         0x00, 0x00, 0x01, 0x03, 0x80, 0x4F, 0x00, 0x00 } },
972 -/*------------------------------------------------------------------------------*/
973 -       { 1280, 1024,       /* 1280x1024 */
974 -         135,              /* 135 MHz clock = 75 Hz refresh rate */
975 -         0x23,             /* miscOutput register */
976 -       { 0xCE, 0x9F, 0x9F, 0x92, 0xA4, 0x15, 0x28, 0x52, /* standard CRTC */ 
977 -         0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
978 -         0x01, 0x04, 0xFF, 0xA0, 0x00, 0x00, 0x29, 0xE3, 0xFF },    
979 -       { 0x00, 0x51, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, /* extended CRTC */
980 -         0x00, 0x00, 0x01, 0x03, 0x80, 0x87, 0x00, 0x00 } },
981 -/*------------------------------------------------------------------------------*/
982 -};
983 -
984 -#define NUM_CYRIX_MODES sizeof(CYRIXmodes)/sizeof(vgaCYRIXmode)
985 -
986  static char *
987  CYRIXIdent(n)
988  int n;
989 @@ -478,6 +400,7 @@
990         vga256InfoRec.bankedMono = TRUE;
991         OFLG_SET(CLOCK_OPTION_PROGRAMABLE, &vga256InfoRec.clockOptions);
992  
993 +#ifndef MONOVGA
994         /* define option set valid for the driver */
995         OFLG_SET(OPTION_SW_CURSOR, &CYRIX.ChipOptionFlags);
996         OFLG_SET(OPTION_HW_CURSOR, &CYRIX.ChipOptionFlags);
997 @@ -496,12 +419,13 @@
998         CYRIX.ChipLinearSize  = (1024 * vga256InfoRec.videoRam);
999  
1000         CYRIX.ChipUseLinearAddressing = TRUE;
1001 +#endif
1002  
1003         /* map the entire area from GX_BASE (scratchpad area)
1004            up to the end of the control registers */
1005         GXregisters = (char*)xf86MapVidMem(vga256InfoRec.scrnIndex,
1006                                     EXTENDED_REGION,
1007 -                                   (void*)physbase, 0x20000);
1008 +                                   (void*)physbase, 0x9000);
1009  
1010         if (!GXregisters)
1011         {       ErrorF("%s %s: Cannot map hardware registers\n",
1012 @@ -509,80 +433,27 @@
1013                 goto probeFailed;
1014         }
1015  
1016 -       /* check VSA version */
1017 -       /* VSA2 contains a "CX" signature at registers 0x35 and 0x36. */
1018 -       /* The SoftVGA interface changed slightly for VSA2.  Originally, */
1019 -       /* VSA2 was intended for MXi only, but it may someday be */
1020 -       /* provided for MediaGX systems as well. */
1021 -
1022 -       CYRIXvsaversion = CYRIX_VSA2;
1023 -       outb(vgaIOBase + 4, 0x35);
1024 -       if (inb(vgaIOBase + 5) != 'C') CYRIXvsaversion = CYRIX_VSA1;
1025 -       outb(vgaIOBase + 4, 0x36);
1026 -       if (inb(vgaIOBase + 5) != 'X') CYRIXvsaversion = CYRIX_VSA1;
1027 -       if (CYRIXvsaversion == CYRIX_VSA1)
1028 -       {
1029 -               ErrorF("%s %s: VSA1 detected\n", 
1030 -                       XCONFIG_PROBED, vga256InfoRec.name);
1031 -       }
1032 -       else
1033 -       {
1034 -               ErrorF("%s %s: VSA2 detected\n", 
1035 -                       XCONFIG_PROBED, vga256InfoRec.name);
1036 -       }
1037         return(TRUE);
1038  }
1039  
1040 -/*------------------------------------------------------------------------*\
1041 -** FbInit()
1042 -** 
1043 -** From README file: "The FbInit() function is required for drivers with
1044 -** accelerated graphics support.  It is used to replace default cfb.banked
1045 -** functions with accelerated chip-specific versions.
1046 -**
1047 -** For the Cyrix driver, this routine is also used to allocate video 
1048 -** memory.  This is more complicated than it needs to be...
1049 -**
1050 -** For VSA1, SoftVGA manages all of graphics memory, including the 
1051 -** compression buffer, cursor buffer, and offscreen memory.  The driver 
1052 -** should not allocate memory itself.  For offscreen memory it reads 
1053 -** registers 0x3C and 0x3D.  For the cursor buffer it reads the hardware 
1054 -** register after validating a mode.  For compression, it just sets bit 0
1055 -** of register 0x49 if it wants to use compression, and SoftVGA will 
1056 -** enable it if memory has been allocated.
1057 -**
1058 -** This model, however, breaks down for this driver.  There is a bug in 
1059 -** SoftVGA that keeps the 0x3C register from working properly.  This bug
1060 -** also prevents compression from being enabled when using a virtual 
1061 -** desktop.  This driver also cannot use the memory past 2 Meg, which 
1062 -** effects the memory calculation. 
1063 -**
1064 -** Therefore, this driver does what it is not supposed to and allocates
1065 -** video memory itself.  But, this is required due to bugs in SoftVGA and,
1066 -** as it turns out, works out fine (with limiting compression use).
1067 -**
1068 -** For VSA2, the driver is supposed to do this allocation itself.
1069 -\*------------------------------------------------------------------------*/
1070  
1071 +#ifndef MONOVGA
1072  static void
1073  CYRIXFbInit()
1074  {      int lineDelta    = vga256InfoRec.displayWidth * (vgaBitsPerPixel / 8);
1075         int virtualDelta = vga256InfoRec.virtualX * (vgaBitsPerPixel / 8);
1076 -       int base;
1077  
1078         vgaSetScreenInitHook(CYRIXScreenInit);
1079  
1080 -       /* always put the cursor at the end of video memory. */
1081 -
1082 -       CYRIXcursorAddress = CYRIX.ChipLinearSize - 256;
1083 -
1084         /* offscreen memory is, normally, right after the frame buffer;
1085 +          always put the cursor at the end of video memory.
1086 +          
1087            (It would be nice to use the ignored 64KB block at the end of
1088            the video memory (2112 - 2048) for the hardware cursor, but
1089            it is not mapped.  This will not be a problem in Xfree 3.9 */
1090 -
1091         CYRIXoffscreenAddress = (lineDelta * vga256InfoRec.virtualY);
1092 -       CYRIXoffscreenSize = CYRIXcursorAddress - CYRIXoffscreenAddress;
1093 +       CYRIXcursorAddress    = CYRIX.ChipLinearSize - 256;
1094 +       CYRIXoffscreenSize    = CYRIXcursorAddress - CYRIXoffscreenAddress;
1095  
1096         /* if there is enough room between lines, put the compression
1097            buffer there */
1098 @@ -591,7 +462,7 @@
1099                 CYRIXcbLineDelta    = (lineDelta >> 2);
1100                 if (xf86Verbose > 1)
1101                         ErrorF("%s %s: Interleaving frame buffer and compression buffer\n",
1102 -                                  XCONFIG_PROBED, vga256InfoRec.name);
1103 +                              XCONFIG_PROBED, vga256InfoRec.name);
1104         }
1105         /* otherwise, put it directly after the virtual frame */
1106         else
1107 @@ -600,7 +471,7 @@
1108                 if (cbuffer_size > CYRIXoffscreenSize)
1109                 {       CYRIXcbLineDelta  =  0;
1110                         ErrorF("%s %s: No room for the compression buffer\n",
1111 -                                  XCONFIG_PROBED, vga256InfoRec.name);
1112 +                              XCONFIG_PROBED, vga256InfoRec.name);
1113                 }
1114                 else
1115                 {       CYRIXcbufferAddress    = CYRIXoffscreenAddress;
1116 @@ -609,43 +480,25 @@
1117                         CYRIXoffscreenSize    -= cbuffer_size;
1118         }       }
1119  
1120 -       /* print results of offscreen memory configuration */
1121 -
1122 -       if (CYRIXoffscreenSize <= 0)
1123 -       {
1124 -               ErrorF("%s %s: No offscreen memory available.\n", 
1125 -                       XCONFIG_PROBED, vga256InfoRec.name);
1126 -       }
1127 -       else
1128 -       {
1129 -               ErrorF("%s %s: Offscreen memory from 0x%8.8X-0x%8.8X\n",
1130 -                       XCONFIG_PROBED, vga256InfoRec.name, 
1131 -                       CYRIXoffscreenAddress, 
1132 -                       CYRIXoffscreenAddress+CYRIXoffscreenSize-1);
1133 -       }
1134 -
1135 -    /* call CYRIXAccelInit to setup the XAA accelerated functions */
1136 -
1137 +        /* call CYRIXAccelInit to setup the XAA accelerated functions */
1138         if (!OFLG_ISSET(OPTION_NOACCEL, &vga256InfoRec.options))
1139                 CYRIXAccelInit();
1140  
1141         /* install hardware cursor routines */
1142 -
1143         if (OFLG_ISSET(OPTION_HW_CURSOR, &vga256InfoRec.options))
1144 -       {       if (CYRIXoffscreenSize > 0)
1145 +       {       if (CYRIXoffscreenSize >= 0)
1146                 {       vgaHWCursor.Initialized = TRUE;
1147                         vgaHWCursor.Init = CYRIXCursorInit;
1148                         vgaHWCursor.Restore = CYRIXRestoreCursor;
1149                         vgaHWCursor.Warp = CYRIXWarpCursor;
1150                         vgaHWCursor.QueryBestSize = CYRIXQueryBestSize;
1151 -                       ErrorF("%s %s: Using hardware cursor at %8.8X\n",
1152 -                               XCONFIG_PROBED, vga256InfoRec.name, CYRIXcursorAddress);
1153 +                       if (xf86Verbose)
1154 +                          ErrorF("%s %s: Using hardware cursor\n",
1155 +                                 XCONFIG_PROBED, vga256InfoRec.name);
1156                 }
1157                 else
1158 -               {
1159                         ErrorF("%s %s: No room for hardware cursor\n",
1160 -                               XCONFIG_PROBED, vga256InfoRec.name);
1161 -               }
1162 +                              XCONFIG_PROBED, vga256InfoRec.name);
1163         }
1164  }
1165  
1166 @@ -696,6 +549,7 @@
1167  
1168         return pitch;
1169  }
1170 +#endif /* not MONOVGA */
1171  
1172  
1173  static void
1174 @@ -747,121 +601,210 @@
1175  
1176  static void
1177  CYRIXresetVGA()
1178 -{
1179 -       int i;
1180 +{      unsigned char temp;
1181 +       /* switch off compression and cursor the hard way */
1182 +       GX_REG(DC_UNLOCK)  = DC_UNLOCK_VALUE;
1183 +       GX_REG(DC_GENERAL_CFG) &= ~(DC_GCFG_CMPE | DC_GCFG_DECE | DC_GCFG_FDTY | DC_GCFG_CURE);
1184 +       GX_REG(DC_UNLOCK)  = 0;
1185 +       CYRIXmarkLinesDirty();
1186  
1187         /* reset SoftVGA extensions to standard VGA behaviour */
1188 -
1189 -       for (i = 0; i < NUM_EXT_CRTC_REGS; i++)
1190 -       {
1191 -               outb(vgaIOBase + 4, 0x40 + i);
1192 -               outb(vgaIOBase + 5, 0x00);
1193 -       }
1194 +       outb(vgaIOBase + 4, CrtcExtendedAddressControl);
1195 +       temp = inb(vgaIOBase + 5);
1196 +       outb(vgaIOBase + 5, temp & 0xf8);
1197 +       outb(vgaIOBase + 4, CrtcExtendedStartAddress);
1198 +       outb(vgaIOBase + 5, 0x00);
1199 +       outb(vgaIOBase + 4, CrtcWriteMemoryAperture);
1200 +       temp = inb(vgaIOBase + 5);
1201 +       outb(vgaIOBase + 5, temp & 0xe0);
1202 +       outb(vgaIOBase + 4, CrtcReadMemoryAperture);
1203 +       temp = inb(vgaIOBase + 5);
1204 +       outb(vgaIOBase + 5, temp & 0xe0);
1205 +       outb(vgaIOBase + 4, CrtcDriverControl);
1206 +       temp = inb(vgaIOBase + 5);
1207 +       outb(vgaIOBase + 5, temp & 0xfe);
1208 +       outb(vgaIOBase + 4, CrtcDisplayCompression);
1209 +       temp = inb(vgaIOBase + 5);
1210 +       outb(vgaIOBase + 5, temp & 0xf0);
1211  }
1212  
1213  static void
1214  CYRIXRestore(restore)
1215  vgaCYRIXPtr restore;
1216 -{      unsigned char i, temp, temp2;
1217 -       unsigned long value;
1218 -
1219 -       /* unlock extended CRTC registers */
1220 -
1221 -       outb(vgaIOBase + 4, 0x30);
1222 -       outb(vgaIOBase + 5, 0x57);
1223 -       outb(vgaIOBase + 5, 0x4C);
1224 +{      unsigned char temp;
1225 +       vgaProtect(TRUE);               /* Blank the screen */
1226  
1227 -       /* SIGNAL THE BEGINNING OF THE MODE SWITCH 
1228 -       SoftVGA will hold off validating the back end hardware. */
1229 -
1230 -       outb(vgaIOBase + 4, CrtcModeSwitchControl);
1231 -       outb(vgaIOBase + 5, 0x01);
1232 +       /* it would be ideal to be able to use the ModeSwitchControl
1233 +          register to protect SoftVGA from reading the configuration
1234 +          before all registers have been written.  But that bit must be
1235 +          set somewhere in the middle of vgaHWRestore (after restoring
1236 +          the font). Luckily things seem to work without it. */
1237  
1238         /* restore standard VGA portion */
1239 -
1240         CYRIXresetVGA();
1241         vgaHWRestore((vgaHWPtr)restore);
1242 +       CYRIXmarkLinesDirty();
1243  
1244 -       /* override restored miscellaneous output regiter value */
1245 -       
1246 -       outb(0x3C2, restore->ext.miscOutput);
1247 -
1248 -       /* override restored standard CRTC register values */
1249 -
1250 -       outb(vgaIOBase + 4, 0x11); 
1251 -       outb(vgaIOBase + 5, 0x00);
1252 -       for (i = 0; i < NUM_STD_CRTC_REGS; i++)
1253 -       {
1254 -               outb(vgaIOBase + 4, i);
1255 -               outb(vgaIOBase + 5, restore->ext.stdCRTCregs[i]);
1256 -       }
1257 -       
1258         /* restore SoftVGA extended registers */
1259 +       outb(vgaIOBase + 4, CrtcDriverControl);
1260 +       temp = inb(vgaIOBase + 5);
1261 +       outb(vgaIOBase + 5, (restore->ext.DriverControl & 0x01)
1262 +                         | (temp & 0xfe));
1263 +
1264 +       outb(vgaIOBase + 4, CrtcVerticalTimingExtension);
1265 +       temp = inb(vgaIOBase + 5);
1266 +       outb(vgaIOBase + 5, (restore->ext.VerticalTimingExtension & 0x55)
1267 +                         | (temp & 0xaa));
1268 +
1269 +       outb(vgaIOBase + 4, CrtcExtendedAddressControl);
1270 +       temp = inb(vgaIOBase + 5);
1271 +       outb(vgaIOBase + 5, (restore->ext.ExtendedAddressControl & 0x07)
1272 +                         | (temp & 0xf8));
1273 +
1274 +       outb(vgaIOBase + 4, CrtcExtendedOffset);
1275 +       temp = inb(vgaIOBase + 5);
1276 +       outb(vgaIOBase + 5, (restore->ext.ExtendedOffset & 0x03)
1277 +                         | (temp & 0xfc));
1278 +
1279 +       outb(vgaIOBase + 4, CrtcExtendedColorControl);
1280 +       temp = inb(vgaIOBase + 5);
1281 +       outb(vgaIOBase + 5, (restore->ext.ExtendedColorControl & 0x07)
1282 +                         | (temp & 0xf8));
1283 +
1284 +       outb(vgaIOBase + 4, CrtcDisplayCompression);
1285 +       temp = inb(vgaIOBase + 5);
1286 +       outb(vgaIOBase + 5, (restore->ext.DisplayCompression & 0x0f)
1287 +                         | (temp & 0xf0));
1288 +
1289 +       outb(vgaIOBase + 4, CrtcDACControl);
1290 +       temp = inb(vgaIOBase + 5);
1291 +       outb(vgaIOBase + 5, (restore->ext.DACControl & 0x0e)
1292 +                         | (temp & 0xf1));
1293 +
1294 +       if (restore->std.NoClock >= 0)
1295 +       {       outb(vgaIOBase + 4, CrtcClockControl);
1296 +               temp = inb(vgaIOBase + 5);
1297 +               outb(vgaIOBase + 5, (restore->ext.ClockControl & 0xb0)
1298 +                                 | (temp & 0x4f));
1299 +
1300 +               outb(vgaIOBase + 4, CrtcClockFrequency);
1301 +               outb(vgaIOBase + 5, restore->ext.CrtClockFrequency);
1302 +
1303 +               outb(vgaIOBase + 4, CrtcClockFrequencyFraction);
1304 +               outb(vgaIOBase + 5, restore->ext.CrtClockFrequencyFraction);
1305 +
1306 +               outb(vgaIOBase + 4, CrtcRefreshRate);
1307 +               outb(vgaIOBase + 5, restore->ext.RefreshRate);
1308 +       }
1309 +
1310 +       /* let SoftVGA programming settle before we access DC registers,
1311 +          but don't wait too long */
1312 +       usleep(1000);
1313 +       CYRIXmarkLinesDirty();
1314 +
1315 +       /* restore display controller hardware registers */
1316 +#ifndef MONOVGA
1317 +#define DCFG_MASK       (DC_GCFG_FDTY | DC_GCFG_DECE | DC_GCFG_CMPE)
1318 +#define GPBS_MASK       (BC_16BPP | BC_FB_WIDTH_2048)
1319  
1320 -       for (i = 0; i < NUM_EXT_CRTC_REGS; i++)
1321 -       {
1322 -               outb(vgaIOBase + 4, 0x40+i);
1323 -               outb(vgaIOBase + 5, restore->ext.extCRTCregs[i]);
1324 -       }
1325 +       GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE;
1326  
1327 -       /* signal the end of the mode switch */
1328 +       GX_REG(DC_CURS_ST_OFFSET) = restore->ext.DcCursStOffset;
1329 +       GX_REG(DC_CB_ST_OFFSET)  = restore->ext.DcCbStOffset;
1330 +       GX_REG(DC_LINE_DELTA)    = (GX_REG(DC_LINE_DELTA) & 0xFFC00FFF)
1331 +                                | (restore->ext.DcLineDelta & 0x003FF000);
1332 +       GX_REG(DC_BUF_SIZE)      = (GX_REG(DC_BUF_SIZE) & 0xFFFF01FF)
1333 +                                 | (restore->ext.DcBufSize & 0x0000FE00);
1334 +       GX_REG(DC_CURSOR_X)      = restore->ext.DcCursorX;
1335 +       GX_REG(DC_CURSOR_Y)      = restore->ext.DcCursorY;
1336 +       GX_REG(DC_CURSOR_COLOR)  = restore->ext.DcCursorColor;
1337  
1338 -       outb(vgaIOBase + 4, CrtcModeSwitchControl);
1339 -       outb(vgaIOBase + 5, 0x00);
1340 +       GX_REG(DC_GENERAL_CFG)   = (GX_REG(DC_GENERAL_CFG) & (~DCFG_MASK))
1341 +                                | (restore->ext.DcGeneralCfg & DCFG_MASK);
1342  
1343 -       /* wait until SoftVGA has validated the mode.
1344 -          This is for VSA1 only, where SoftVGA waits until the next
1345 -          vertical blank to recalculate the hardware state.  For VSA2
1346 -          the hardware us updated immediately, so this is not needed. 
1347 -          THIS MUST BE DONE FOR VSA1 before loading the GP_BLT_STATUS
1348 -          register, otherwise SoftVGA will override the value. */
1349 +       GX_REG(DC_UNLOCK) = 0;
1350  
1351 -       if (CYRIXvsaversion == CYRIX_VSA1)
1352 -       {
1353 -               outb(vgaIOBase + 4, 0x33); 
1354 -               while(inb(vgaIOBase + 5) & 0x80); 
1355 -       }
1356 +       GX_REG(GP_BLIT_STATUS)   = (GX_REG(GP_BLIT_STATUS) & (~GPBS_MASK))
1357 +                                | (restore->ext.GpBlitStatus & GPBS_MASK);
1358  
1359 -       /* overrite what SoftVGA may have stored into GP_BLIT_STATUS */
1360 +       /* restore cursor pattern */
1361 +       if (restore->ext.DcCursStOffset < 1024 * vga256InfoRec.videoRam)
1362 +               memcpy((char*)vgaLinearBase + restore->ext.DcCursStOffset,
1363 +                      restore->ext.cursorPattern, 256);
1364 +#endif
1365  
1366 -       GX_REG(GP_BLIT_STATUS) = restore->ext.GpBlitStatus;
1367 +       vgaProtect(FALSE);              /* Turn on screen */
1368  }
1369  
1370  static void *
1371  CYRIXSave(save)
1372  vgaCYRIXPtr save;
1373 -{      unsigned char i;
1374 -       struct vgaCYRIXext ext;
1375 +{      struct vgaCYRIXext ext;
1376  
1377 -       /* save miscellaneous output register */
1378 +#ifndef MONOVGA
1379 +       /* save graphics pipeline registers */
1380 +       ext.GpBlitStatus   = GX_REG(GP_BLIT_STATUS);
1381  
1382 -       ext.miscOutput = inb(0x3CC);
1383 +       /* save display controller hardware registers */
1384 +       GX_REG(DC_UNLOCK)  = DC_UNLOCK_VALUE;
1385 +       ext.DcGeneralCfg   = GX_REG(DC_GENERAL_CFG);
1386 +       ext.DcCursStOffset = GX_REG(DC_CURS_ST_OFFSET);
1387 +       ext.DcCbStOffset   = GX_REG(DC_CB_ST_OFFSET);
1388 +       ext.DcLineDelta    = GX_REG(DC_LINE_DELTA);
1389 +       ext.DcBufSize      = GX_REG(DC_BUF_SIZE);
1390 +       ext.DcCursorX      = GX_REG(DC_CURSOR_X);
1391 +       ext.DcCursorY      = GX_REG(DC_CURSOR_Y);
1392 +       ext.DcCursorColor  = GX_REG(DC_CURSOR_COLOR);
1393 +       GX_REG(DC_UNLOCK)  = 0;
1394 +
1395 +       /* save cursor pattern.
1396 +          In the 3.3.1 solution, we don't need to do this
1397 +          if it is in the extra 64KB block of frame buffer memory
1398 +          that we ignore (and is not mapped anyway) */
1399 +       if (ext.DcCursStOffset < 1024 * vga256InfoRec.videoRam)
1400 +               memcpy(ext.cursorPattern,
1401 +                      (char*)vgaLinearBase + ext.DcCursStOffset, 256);
1402 +#endif
1403  
1404 -       /* save standard CRTC registers */
1405 +       /* save SoftVGA extended registers */
1406 +       outb(vgaIOBase + 4, CrtcVerticalTimingExtension);
1407 +       ext.VerticalTimingExtension = inb(vgaIOBase + 5);
1408  
1409 -       for (i = 0; i < NUM_STD_CRTC_REGS; i++)
1410 -       {
1411 -               outb(vgaIOBase + 4, i);
1412 -               ext.stdCRTCregs[i] = inb(vgaIOBase + 5);
1413 -       }
1414 +       outb(vgaIOBase + 4, CrtcExtendedAddressControl);
1415 +       ext.ExtendedAddressControl = inb(vgaIOBase + 5);
1416  
1417 -       /* save extended CRTC registers */
1418 +       outb(vgaIOBase + 4, CrtcExtendedOffset);
1419 +       ext.ExtendedOffset = inb(vgaIOBase + 5);
1420  
1421 -       for (i = 0; i < NUM_EXT_CRTC_REGS; i++)
1422 -       {
1423 -               outb(vgaIOBase + 4, 0x40+i);
1424 -               ext.extCRTCregs[i] = inb(vgaIOBase + 5);
1425 -       }
1426 +       outb(vgaIOBase + 4, CrtcExtendedColorControl);
1427 +       ext.ExtendedColorControl = inb(vgaIOBase + 5);
1428  
1429 -       /* save graphics pipeline registers */
1430 +       outb(vgaIOBase + 4, CrtcDisplayCompression);
1431 +       ext.DisplayCompression = inb(vgaIOBase + 5);
1432  
1433 -       ext.GpBlitStatus   = GX_REG(GP_BLIT_STATUS);
1434 +       outb(vgaIOBase + 4, CrtcDriverControl);
1435 +       ext.DriverControl = inb(vgaIOBase + 5);
1436  
1437 -       /* save standard VGA portion */
1438 +       outb(vgaIOBase + 4, CrtcDACControl);
1439 +       ext.DACControl = inb(vgaIOBase + 5);
1440 +
1441 +       outb(vgaIOBase + 4, CrtcClockControl);
1442 +       ext.ClockControl = inb(vgaIOBase + 5);
1443 +
1444 +       outb(vgaIOBase + 4, CrtcClockFrequency);
1445 +       ext.CrtClockFrequency = inb(vgaIOBase + 5);
1446  
1447 +       outb(vgaIOBase + 4, CrtcClockFrequencyFraction);
1448 +       ext.CrtClockFrequencyFraction = inb(vgaIOBase + 5);
1449 +
1450 +       outb(vgaIOBase + 4, CrtcRefreshRate);
1451 +       ext.RefreshRate = inb(vgaIOBase + 5);
1452 +
1453 +       /* save standard VGA portion */
1454         CYRIXresetVGA();
1455         save = (vgaCYRIXPtr)vgaHWSave((vgaHWPtr)save, sizeof(vgaCYRIXRec));
1456         save->ext = ext;
1457 +
1458         return ((void *) save);
1459  }
1460  
1461 @@ -869,108 +812,101 @@
1462  static Bool
1463  CYRIXInit(mode)
1464  DisplayModePtr mode;
1465 -{      int i, mode_index;
1466 -       int clock = vga256InfoRec.clock[mode->Clock] / 1000;
1467 -       int min, diff;
1468 -       int offset_shift = (vgaBitsPerPixel == 16) ? 2 :
1469 +{      int offset_shift = (vgaBitsPerPixel == 16) ? 2 :
1470                             (vgaBitsPerPixel == 8) ? 3 : 4;
1471         int line_offset = vga256InfoRec.displayWidth >> offset_shift;
1472  
1473         /* initialize standard VGA portion */
1474 -
1475         if (!vgaHWInit(mode,sizeof(vgaCYRIXRec)))
1476                 return(FALSE);
1477  
1478 -       /* search for specified mode in the table */
1479 -    /* Need to find the entry with the closest dot clock value */ 
1480 -       /* Assume within at least 200 MHz and then maintain closest natch. */
1481 -
1482 -       mode_index = 0;
1483 -       min = 200; 
1484 -       for (i = 0; i < NUM_CYRIX_MODES; i++)
1485 -       {
1486 -               diff = clock - CYRIXmodes[i].clock;
1487 -               if (diff < 0) diff = -diff;
1488 -               if ((mode->CrtcHDisplay == CYRIXmodes[i].xsize) &&
1489 -                       (mode->CrtcVDisplay == CYRIXmodes[i].ysize) &&
1490 -                       (diff < min))
1491 -               {
1492 -                       mode_index = i;
1493 -                       min = diff;
1494 -               }
1495 -       }
1496 -
1497 -       /* override standard miscOutput register value */
1498 -
1499 -       newstate->ext.miscOutput = CYRIXmodes[mode_index].miscOutput;
1500 +       newstate->std.CRTC[19] = line_offset;
1501  
1502 -       /* override standard CRTC register values */
1503 +       /* initialize SoftVGA extended registers */
1504 +       newstate->ext.VerticalTimingExtension =
1505 +               ((mode->CrtcVSyncStart & 0x400) >> 4) |
1506 +               (((mode->CrtcVDisplay - 1) & 0x400) >> 8) |
1507 +               (((mode->CrtcVTotal - 2) & 0x400) >> 10) |
1508 +               ((mode->CrtcVSyncStart & 0x400) >> 6);
1509  
1510 -       for (i = 0; i < NUM_STD_CRTC_REGS; i++)
1511 -       {
1512 -               newstate->ext.stdCRTCregs[i] = 
1513 -                       CYRIXmodes[mode_index].stdCRTCregs[i];
1514 -       }
1515 -
1516 -       /* set extended CRTC registers */
1517 -
1518 -       for (i = 0; i < NUM_EXT_CRTC_REGS; i++)
1519 -       {
1520 -               newstate->ext.extCRTCregs[i] = 
1521 -                       CYRIXmodes[mode_index].extCRTCregs[i];
1522 -       }
1523 -
1524 -       /* override pitch from the mode tables */
1525 -       /* (same tables are used for 8BPP and 16BPP) */
1526 +       if (vgaBitsPerPixel < 8)
1527 +               newstate->ext.ExtendedAddressControl = EAC_DIRECT_FRAME_BUFFER;
1528 +       else
1529 +               newstate->ext.ExtendedAddressControl = EAC_DIRECT_FRAME_BUFFER |
1530 +                                                      EAC_PACKED_CHAIN4;
1531  
1532 -       newstate->ext.stdCRTCregs[19] = line_offset;
1533 -       newstate->ext.extCRTCregs[5] = ((line_offset >> 8) & 0x03);
1534 +       newstate->ext.ExtendedOffset = ((line_offset >> 8) & 0x03);
1535  
1536 -       /* override color control from the mode tables */
1537 -       /* (same tables are used for 8BPP and 16BPP) */
1538 +       newstate->ext.ExtendedColorControl = (vgaBitsPerPixel == 16)
1539 +                                           ? ECC_16BPP | ECC_565_FORMAT
1540 +                                           : ECC_8BPP;
1541 +
1542 +       /* display compression is set using the DC registers */
1543 +       newstate->ext.DisplayCompression = 0x00;
1544 +
1545 +       /* we drive the palette through the display controller (in new
1546 +          chipsets only) in 8bpp and 16bpp (that is, whenever the
1547 +          hardware cursor is used). */
1548 +       if (vgaBitsPerPixel < 8)
1549 +               newstate->ext.DriverControl = 0x00;
1550 +       else
1551 +               newstate->ext.DriverControl = DRVCT_DISPLAY_DRIVER_ACTIVE;
1552  
1553 -       newstate->ext.extCRTCregs[6] = (vgaBitsPerPixel == 16)
1554 -               ? ECC_16BPP | ECC_565_FORMAT : ECC_8BPP;
1555 +       /* set `16 bit bus' or else compression will hang the
1556 +          system in 16bpp mode */
1557 +       if (vgaBitsPerPixel == 16)
1558 +               newstate->ext.DACControl = DACCT_ENABLE_16BIT_BUS;
1559 +       else
1560 +               newstate->ext.DACControl = 0;
1561  
1562 -       /* enable display compression when appropriate */
1563  
1564 -       if (CYRIXvsaversion == CYRIX_VSA1)
1565 -       {
1566 -               /* For VSA1, SoftVGA manages the compression buffer. */
1567 -               /* Enabling compression directly causes unpredictable results. */
1568 -               /* Only enable if not panning (there is a bug in SoftVGA that */
1569 -               /* will put the compression buffer in the wrong place when */
1570 -               /* using a virtual desktop. */
1571 -               /* By setting bit 0 of register 0x49, SoftVGA will enable */
1572 -               /* compression whenever possible, based on memory available */
1573 -               /* and starting address of memory. */
1574 -
1575 -           if ((mode->CrtcVDisplay == vga256InfoRec.virtualY) &&
1576 -                       (mode->CrtcHDisplay == vga256InfoRec.virtualX))
1577 -               {
1578 -                       newstate->ext.extCRTCregs[9] = 0x01;
1579 -                       ErrorF("%s %s: Display compression enabled.\n", 
1580 -                               XCONFIG_PROBED, vga256InfoRec.name);
1581 -               }
1582 -               else
1583 -               {
1584 -                       ErrorF("%s %s: Display compression disabled.\n", 
1585 -                               XCONFIG_PROBED, vga256InfoRec.name);
1586 -               }
1587 +       if (newstate->std.NoClock >= 0)
1588 +       {       int entier_clock   = (vga256InfoRec.clock[mode->Clock] / 1000);
1589 +               int clock_fraction = (vga256InfoRec.clock[mode->Clock] / 100)
1590 +                                  - (entier_clock * 10);
1591 +
1592 +               newstate->ext.ClockControl = CLKCT_EXT_CLOCK_MODE;
1593 +               newstate->ext.CrtClockFrequency = entier_clock;
1594 +               newstate->ext.CrtClockFrequencyFraction = clock_fraction;
1595 +               newstate->ext.RefreshRate = 0 /* relevant to VGA BIOS only */;
1596 +       }
1597 +
1598 +#ifndef MONOVGA
1599 +       /* initialize masked contents of display controller
1600 +          hardware registers. */
1601 +       newstate->ext.DcCursStOffset =  CYRIXcursorAddress;
1602 +       newstate->ext.DcCbStOffset  =  CYRIXcbufferAddress;
1603 +       newstate->ext.DcLineDelta   =  CYRIXcbLineDelta << 12;
1604 +       newstate->ext.DcBufSize     =  0x41 << 9;
1605 +       newstate->ext.DcCursorX     =  0;
1606 +       newstate->ext.DcCursorY     =  0;
1607 +       newstate->ext.DcCursorColor =  0;
1608 +
1609 +       /* Compression  is enabled only  when a buffer  was allocated by
1610 +          FbInit  and provided that the displayed screen is the virtual
1611 +          screen.  If the line delta is not 1024 or 2048, entire frames
1612 +          will be flagged dirty as opposed to lines.  Problems with 16bpp
1613 +          and line-dirty flagging seem to have been solved now.  */
1614 +       if (CYRIXcbLineDelta != 0 &&
1615 +           mode->CrtcVDisplay == vga256InfoRec.virtualY &&
1616 +           mode->CrtcHDisplay == vga256InfoRec.virtualX)
1617 +       {       newstate->ext.DcGeneralCfg = DC_GCFG_DECE
1618 +                                          | DC_GCFG_CMPE;
1619 +               if (/* vgaBitsPerPixel != 8 ||   -- this is OK now */
1620 +                  (vga256InfoRec.displayWidth * (vgaBitsPerPixel / 8)) & 0x03FF)
1621 +                       newstate->ext.DcGeneralCfg |= DC_GCFG_FDTY;
1622         }
1623         else
1624 -       {
1625 -               /* ### TO DO ### */
1626 -               /* Enable display compression directly for VSA2. */
1627 -               /* For VSA2, the display driver manages all graphics memory. */
1628 -       }
1629 +               newstate->ext.DcGeneralCfg = 0;
1630  
1631 -       /* initialize the graphics pipeline registers */
1632  
1633 +       /* initialize the graphics pipeline registers */
1634         newstate->ext.GpBlitStatus  =  ((vga256InfoRec.displayWidth == 2048) ?
1635                                         BC_FB_WIDTH_2048 : BC_FB_WIDTH_1024) |
1636                                        ((vgaBitsPerPixel == 16) ?
1637                                         BC_16BPP : BC_8BPP);
1638 +#endif
1639 +
1640         return(TRUE);
1641  }
1642  
1643 @@ -978,68 +914,31 @@
1644  CYRIXAdjust(x, y)
1645  int x, y;
1646  {      int Base = (y * vga256InfoRec.displayWidth + x);
1647 -       unsigned long active, sync, count1, count2;
1648  
1649         if (vgaBitsPerPixel > 8) Base *= (vgaBitsPerPixel / 8);
1650         if (vgaBitsPerPixel < 8) Base /= 2;
1651  
1652 -       /* wait until out of active display area */
1653 -
1654 -       active = GX_REG(DC_V_TIMING_1) & 0x07FF;        
1655 -       sync = GX_REG(DC_V_TIMING_3) & 0x07FF;
1656 -
1657 -       do
1658 -       {
1659 -               /* read twice to avoid transition values */
1660 -
1661 -               count1 = GX_REG(DC_V_LINE_CNT) & 0x07FF;
1662 -               count2 = GX_REG(DC_V_LINE_CNT) & 0x07FF;
1663 -       } while ((count1 != count2) || (count1 < active) || (count1 >= sync));
1664 -
1665 -       /* load the start address directly */
1666 -
1667 +       /* doing this using the SoftVGA registers does not work reliably */
1668         GX_REG(DC_UNLOCK) = DC_UNLOCK_VALUE;
1669         GX_REG(DC_FB_ST_OFFSET) = Base;
1670         GX_REG(DC_UNLOCK) = 0;
1671  }
1672  
1673 -/*------------------------------------------------------------------------*\
1674 -** ValidMode()
1675 -** 
1676 -** From README file: "The ValidMode() function is required.  It is used to 
1677 -** check for any chipset dependent reasons why a graphics mode might not be
1678 -** valid.  It gets called by higher levels of the code after the Probe()
1679 -** stage.  In many cases no special checking will be required and this 
1680 -** function will simply return TRUE always."
1681 -**
1682 -** For the Cyrix driver, this routine loops through modes provided in a 
1683 -** table at the beginning of this file and returns OK if it finds a match.
1684 -** These tables were required to make the standard VESA 60 Hz and 75 Hz 
1685 -** modes work correctly.  Doing this, however, takes away the flexibility 
1686 -** of adding different resolutions or different refresh rates to the 
1687 -** XF86Config file.
1688 -\*------------------------------------------------------------------------*/
1689 -
1690  static int
1691  CYRIXValidMode(mode, verbose, flag)
1692  DisplayModePtr mode;
1693  Bool verbose;
1694  int flag;
1695 -{
1696 -       int i;
1697 -
1698 -       /* loop through table of modes */
1699 -
1700 -       for (i = 0; i < NUM_CYRIX_MODES; i++)
1701 -       {
1702 -               if ((mode->CrtcHDisplay == CYRIXmodes[i].xsize) &&
1703 -                       (mode->CrtcVDisplay == CYRIXmodes[i].ysize))
1704 -               {
1705 -                       return MODE_OK;
1706 -               }
1707 +{      /* note (avg): there seems to be a lot more to this if you look
1708 +          at the GGI code (adjustment). */
1709 +       if (mode->CrtcHSyncStart - mode->CrtcHDisplay >= 24 ||
1710 +            mode->CrtcHSyncStart - mode->CrtcHDisplay <= 8)
1711 +       {       if (verbose)
1712 +                       ErrorF("%s %s: mode %s: horizontal sync out of range (sync - display should be between 8 and 24)\n",
1713 +                               XCONFIG_PROBED, vga256InfoRec.name, mode->name
1714 +                               );
1715 +               return MODE_HSYNC;
1716         }
1717 -       return MODE_BAD;
1718 +       return(MODE_OK);
1719  }
1720 -
1721 -/* END OF FILE */
1722  
1723 diff -ruN XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/gxrender.c XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/gxrender.c
1724 --- XFree86-3.3.5/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/gxrender.c        Thu Jun 24 01:59:41 1999
1725 +++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/gxrender.c      Wed Dec 31 19:00:00 1969
1726 @@ -1,1237 +0,0 @@
1727 -/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/drivers/cyrix/gxrender.c,v 1.1.2.1 1999/06/24 05:59:41 hohndel Exp $ */
1728 -/*
1729 -//---------------------------------------------------------------------------
1730 -// gxrender.c
1731 -//
1732 -// This file gives examples of using the MediaGX graphics unit to provide
1733 -// acceleration for 2D display drivers.  It is intended to provide an 
1734 -// absraction layer for new display driver development.  This code handles
1735 -// the quirks of the MediaGX graphics unit to allow faster developemt times
1736 -// for new drivers.
1737 -//---------------------------------------------------------------------------
1738 -*/
1739 -
1740 -/* GRAPHICS PIPELINE REGISTER DEFINITIONS */
1741 -
1742 -#define GP_DST_XCOOR           0x8100          /* x destination origin */
1743 -#define GP_DST_YCOOR           0x8102          /* y destination origin */
1744 -#define GP_WIDTH                       0x8104          /* pixel width */
1745 -#define GP_HEIGHT                      0x8106          /* pixel height */
1746 -#define GP_SRC_XCOOR           0x8108          /* x source origin */
1747 -#define GP_SRC_YCOOR           0x810A          /* y source origin */
1748 -
1749 -#define GP_VECTOR_LENGTH       0x8104          /* vector length */
1750 -#define GP_INIT_ERROR          0x8106          /* vector initial error */
1751 -#define GP_AXIAL_ERROR         0x8108          /* axial error increment */
1752 -#define GP_DIAG_ERROR          0x810A          /* diagonal error increment */
1753 -
1754 -#define GP_SRC_COLOR_0         0x810C          /* source color 0 */
1755 -#define GP_SRC_COLOR_1         0x810E          /* source color 1 */
1756 -#define GP_PAT_COLOR_0         0x8110          /* pattern color 0 */
1757 -#define GP_PAT_COLOR_1         0x8112          /* pattern color 1 */
1758 -#define GP_PAT_COLOR_2         0x8114          /* pattern color 2 */
1759 -#define GP_PAT_COLOR_3         0x8116          /* pattern color 3 */
1760 -#define GP_PAT_DATA_0          0x8120          /* bits 31:0 of pattern */
1761 -#define GP_PAT_DATA_1          0x8124          /* bits 63:32 of pattern */
1762 -#define GP_PAT_DATA_2          0x8128          /* bits 95:64 of pattern */
1763 -#define GP_PAT_DATA_3          0x812C          /* bits 127:96 of pattern */
1764 -
1765 -#define GP_RASTER_MODE         0x8200          /* raster operation */
1766 -#define GP_VECTOR_MODE         0x8204          /* vector mode register */
1767 -#define GP_BLIT_MODE           0x8208          /* blit mode register */
1768 -#define GP_BLIT_STATUS         0x820C          /* blit status register */
1769 -
1770 -/* "GP_VECTOR_MODE" BIT DEFINITIONS */
1771 -
1772 -#define VM_X_MAJOR                     0x0000          /* X major vector */
1773 -#define VM_Y_MAJOR                     0x0001          /* Y major vector */
1774 -#define VM_MAJOR_INC           0x0002          /* positive major axis step */
1775 -#define VM_MINOR_INC           0x0004          /* positive minor axis step */
1776 -#define VM_READ_DST_FB         0x0008          /* read destination data */
1777 -
1778 -/* "GP_RASTER_MODE" BIT DEFINITIONS */
1779 -
1780 -#define RM_PAT_DISABLE         0x0000          /* pattern is disabled */
1781 -#define RM_PAT_MONO                    0x0100          /* 1BPP pattern expansion */
1782 -#define RM_PAT_DITHER          0x0200          /* 2BPP pattern expansion */
1783 -#define RM_PAT_COLOR           0x0300          /* 8BPP or 16BPP pattern */
1784 -#define RM_PAT_MASK                    0x0300          /* mask for pattern mode */
1785 -#define RM_PAT_TRANSPARENT     0x0400          /* transparent 1BPP pattern */
1786 -#define RM_SRC_TRANSPARENT     0x0800          /* transparent 1BPP source */
1787 -
1788 -/* "GP_BLIT_STATUS" BIT DEFINITIONS */
1789 -
1790 -#define BS_BLIT_BUSY           0x0001          /* blit engine is busy */
1791 -#define BS_PIPELINE_BUSY       0x0002          /* graphics pipeline is bus */
1792 -#define BS_BLIT_PENDING                0x0004          /* blit pending */
1793 -#define BC_8BPP                                0x0000          /* 8BPP mode */
1794 -#define BC_16BPP                       0x0100          /* 16BPP mode */
1795 -#define BC_FB_WIDTH_1024       0x0000          /* framebuffer width = 1024 */
1796 -#define BC_FB_WIDTH_2048       0x0200          /* framebuffer width = 2048 */
1797 -
1798 -/* "GP_BLIT_MODE" BIT DEFINITIONS */
1799 -
1800 -#define        BM_READ_SRC_NONE        0x0000          /* source foreground color */
1801 -#define BM_READ_SRC_FB         0x0001          /* read source from FB  */
1802 -#define BM_READ_SRC_BB0                0x0002          /* read source from BB0 */
1803 -#define BM_READ_SRC_BB1                0x0003          /* read source from BB1 */
1804 -#define BM_READ_SRC_MASK       0x0003          /* read source mask */
1805 -
1806 -#define        BM_READ_DST_NONE        0x0000          /* no destination data */
1807 -#define BM_READ_DST_BB0                0x0008          /* destination from BB0 */
1808 -#define BM_READ_DST_BB1                0x000C          /* destination from BB1 */
1809 -#define BM_READ_DST_FB0                0x0010          /* dest from FB (store BB0) */
1810 -#define BM_READ_DST_FB1                0x0014          /* dest from FB (store BB1)*/
1811 -#define BM_READ_DST_MASK       0x001C          /* read destination mask */
1812 -
1813 -#define BM_WRITE_FB                    0x0000          /* write to framebuffer */
1814 -#define        BM_WRITE_MEM            0x0020          /* write to memory */
1815 -#define BM_WRITE_MASK          0x0020          /* write mask */
1816 -
1817 -#define        BM_SOURCE_COLOR         0x0000          /* source is 8BPP or 16BPP */
1818 -#define BM_SOURCE_EXPAND       0x0040          /* source is 1BPP */
1819 -#define BM_SOURCE_TEXT         0x00C0          /* source is 1BPP text */
1820 -#define BM_SOURCE_MASK         0x00C0          /* source mask */
1821 -
1822 -#define BM_REVERSE_Y           0x0100          /* reverse Y direction */
1823 -
1824 -/* THE DRIVER NEEDS TO MAINTAIN THE SIZE AND LOCATION OF THE BLT BUFFERS
1825 -// These constants will work with 2K or 3K config, 8 or 16 BPP.  The driver
1826 -// should set them, however, to optimize for the current config.  Otherwise
1827 -// screen to screen BLTs, for example, may be visibly split into two vertical
1828 -// sections when they do not need to be.
1829 -*/
1830 -
1831 -/* STATIC VARIABLES FOR GXRENDER.C FILE */
1832 -
1833 -unsigned char *GXRregptr;
1834 -unsigned short GXRbpp;
1835 -unsigned short GXRbb0Base;
1836 -unsigned short GXRbb1Base;
1837 -unsigned short GXRbufferWidthPixels;
1838 -
1839 -unsigned short GXRpatternFlags;
1840 -unsigned short GXRsourceFlags;
1841 -unsigned short GXRsavedColor;
1842 -unsigned short GXRsavedRop;
1843 -unsigned short GXRusesDstData;
1844 -
1845 -/* MACROS FOR REGISTER ACCESS 
1846 -// These macros asssume that a pointer was specified during initialization.
1847 -// They also assume 32-bit access is possible (16-bit access such as for 
1848 -// Windows 98 display drivers would require different macros).
1849 -*/
1850
1851 -#define WRITE_REG8(offset, value) \
1852 -       (*(volatile unsigned char *)(GXRregptr + (offset))) = (value)
1853 -
1854 -#define WRITE_REG16(offset, value) \
1855 -       (*(volatile unsigned short *)(GXRregptr + (offset))) = (value)
1856 -
1857 -#define WRITE_REG32(offset, value) \
1858 -       (*(volatile unsigned long *)(GXRregptr + (offset))) = (value)
1859 -
1860 -#define READ_REG16(offset) \
1861 -    (*(volatile unsigned short *)(GXRregptr + (offset)))
1862 -
1863 -#define READ_REG32(offset) \
1864 -    (*(volatile unsigned long *)(GXRregptr + (offset)))
1865 -
1866 -/*
1867 -//---------------------------------------------------------------------------
1868 -// GXR_INITIALIZE
1869 -//
1870 -// This routine initializes the parameters for the current configuration.
1871 -//
1872 -//     REGPTR     pointer to GX memory mapped registers
1873 -//     BPP        bits per pixel (8 pr 16)
1874 -//     
1875 -//---------------------------------------------------------------------------
1876 -*/
1877 -
1878 -void gxr_initialize(unsigned char *regptr, unsigned short bpp, 
1879 -       unsigned short BB0base, unsigned short BB1base, 
1880 -       unsigned short BBwidthPixels)
1881 -{
1882 -       GXRregptr = regptr;
1883 -       GXRbpp = bpp;
1884 -       GXRbb0Base = BB0base;
1885 -       GXRbb1Base = BB1base;
1886 -       GXRbufferWidthPixels = BBwidthPixels;
1887 -}
1888 -
1889 -/*
1890 -//---------------------------------------------------------------------------
1891 -// GXR_WAIT_UNTIL_IDLE
1892 -//
1893 -// This routine waits until the graphics engine is idle.
1894 -//---------------------------------------------------------------------------
1895 -*/
1896 -
1897 -void gxr_wait_until_idle(void)
1898 -{
1899 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_BUSY);
1900 -}
1901 -
1902 -/*
1903 -//---------------------------------------------------------------------------
1904 -// GXR_LOAD_SOLID_SOURCE
1905 -//
1906 -// This routine is used to specify a solid source color.  For the Xfree96
1907 -// display driver, the source color is used to specify a planemask and the 
1908 -// ROP is adjusted accordingly.
1909 -//---------------------------------------------------------------------------
1910 -*/
1911 -
1912 -void gxr_load_solid_source(unsigned short color)
1913 -{
1914 -       /* CLEAR TRANSPARENCY FLAG */
1915 -
1916 -       GXRsourceFlags = 0;
1917 -
1918 -       /* FORMAT 8 BPP COLOR */
1919 -       /* GX requires 8BPP color data be duplicated into bits [15:8]. */
1920 -
1921 -       if (!(READ_REG16(GP_BLIT_STATUS) & BC_16BPP))
1922 -       {
1923 -               color &= 0x00FF;
1924 -               color |= (color << 8);
1925 -       }
1926 -       
1927 -       /* POLL UNTIL ABLE TO WRITE THE SOURCE COLOR */
1928 -
1929 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
1930 -       WRITE_REG16(GP_SRC_COLOR_0, color);
1931 -}
1932 -
1933 -/*
1934 -//---------------------------------------------------------------------------
1935 -// GXR_LOAD_MONO_SOURCE
1936 -//
1937 -// This routine is used to specify the monochrome source colors.  
1938 -//---------------------------------------------------------------------------
1939 -*/
1940 -
1941 -void gxr_load_mono_source(unsigned short bgcolor, unsigned short fgcolor,
1942 -       unsigned short transparent)
1943 -{
1944 -       /* SET TRANSPARENCY FLAG */
1945 -
1946 -       GXRsourceFlags = transparent ? RM_SRC_TRANSPARENT : 0;
1947 -
1948 -       /* FORMAT 8 BPP COLOR */
1949 -       /* GX requires 8BPP color data be duplicated into bits [15:8]. */
1950 -
1951 -       if (!(READ_REG16(GP_BLIT_STATUS) & BC_16BPP))
1952 -       {
1953 -               bgcolor &= 0x00FF;
1954 -               bgcolor |= (bgcolor << 8);
1955 -               fgcolor &= 0x00FF;
1956 -               fgcolor |= (fgcolor << 8);
1957 -       }
1958 -
1959 -       /* POLL UNTIL ABLE TO WRITE THE SOURCE COLOR */
1960 -
1961 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
1962 -       WRITE_REG16(GP_SRC_COLOR_0, bgcolor);
1963 -       WRITE_REG16(GP_SRC_COLOR_1, fgcolor);
1964 -}
1965 -
1966 -/*
1967 -//---------------------------------------------------------------------------
1968 -// GXR_LOAD_SOLID_PATTERN
1969 -//
1970 -// This routine is used to specify a solid pattern color.  It is called 
1971 -// before performing solid rectangle fills or more complicated BLTs that 
1972 -// use a solid pattern color. 
1973 -//
1974 -// The driver should always call "gxr_load_raster_operation" after a call 
1975 -// to this routine to make sure that the pattern flags are set appropriately.
1976 -//---------------------------------------------------------------------------
1977 -*/
1978 -
1979 -void gxr_load_solid_pattern(unsigned short color)
1980 -{
1981 -       /* SET PATTERN FLAGS */
1982 -
1983 -       GXRpatternFlags = 0;
1984 -
1985 -       /* FORMAT 8 BPP COLOR */
1986 -       /* GX requires 8BPP color data be duplicated into bits [15:8]. */
1987 -
1988 -       if (!(READ_REG16(GP_BLIT_STATUS) & BC_16BPP))
1989 -       {
1990 -               color &= 0x00FF;
1991 -               color |= (color << 8);
1992 -       }
1993 -
1994 -       /* SAVE THE REFORMATTED COLOR FOR LATER */
1995 -       /* Used to call the "gxr_solid_fill" routine for special cases. */
1996 -
1997 -       GXRsavedColor = color;
1998 -
1999 -       /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */
2000 -
2001 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2002 -       WRITE_REG16(GP_PAT_COLOR_0, color);
2003 -}
2004 -
2005 -/*
2006 -//---------------------------------------------------------------------------
2007 -// GXR_LOAD_MONO_PATTERN
2008 -//
2009 -// This routine is used to specify a monochrome pattern. 
2010 -//---------------------------------------------------------------------------
2011 -*/
2012 -
2013 -void gxr_load_mono_pattern(unsigned short bgcolor, unsigned short fgcolor, 
2014 -       unsigned long data0, unsigned long data1, unsigned char transparent)
2015 -{
2016 -       /* SET PATTERN FLAGS */
2017 -
2018 -       GXRpatternFlags = transparent ? RM_PAT_MONO | RM_PAT_TRANSPARENT : 
2019 -               RM_PAT_MONO;
2020 -       
2021 -       /* FORMAT 8 BPP COLOR */
2022 -       /* GX requires 8BPP color data be duplicated into bits [15:8]. */
2023 -
2024 -       if (!(READ_REG16(GP_BLIT_STATUS) & BC_16BPP))
2025 -       {
2026 -               bgcolor &= 0x00FF;
2027 -               bgcolor |= (bgcolor << 8);
2028 -               fgcolor &= 0x00FF;
2029 -               fgcolor |= (fgcolor << 8);
2030 -       }
2031 -
2032 -       /* POLL UNTIL ABLE TO WRITE THE PATTERN COLORS AND DATA */
2033 -
2034 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2035 -       WRITE_REG16(GP_PAT_COLOR_0, bgcolor);
2036 -       WRITE_REG16(GP_PAT_COLOR_1, fgcolor);
2037 -       WRITE_REG32(GP_PAT_DATA_0, data0);
2038 -       WRITE_REG32(GP_PAT_DATA_1, data1);
2039 -}
2040 -
2041 -/*
2042 -//---------------------------------------------------------------------------
2043 -// GXR_LOAD_RASTER_OPERATION
2044 -//
2045 -// This routine loads the specified raster operation.  It sets the pattern
2046 -// flags appropriately.
2047 -//---------------------------------------------------------------------------
2048 -*/
2049 -
2050 -void gxr_load_raster_operation(unsigned char rop)
2051 -{
2052 -       unsigned short rop16;
2053 -
2054 -       /* GENERATE 16-BIT VERSION OF ROP WITH PATTERN FLAGS */
2055 -
2056 -       rop16 = (unsigned short) rop | GXRpatternFlags;
2057 -       if ((rop & 0x33) ^ ((rop >> 2) & 0x33))
2058 -               rop16 |= GXRsourceFlags;
2059 -
2060 -       /* SAVE ROP FOR LATER COMPARISONS */
2061 -       /* Need to have the pattern flags included */
2062 -
2063 -       GXRsavedRop = rop16;
2064 -       
2065 -       /* SET FLAG INDICATING ROP REQUIRES DESTINATION DATA */
2066 -       /* True if even bits (0:2:4:6) do not equal the correspinding */
2067 -       /* even bits (1:3:5:7). */
2068 -
2069 -       GXRusesDstData = ((rop & 0x55) ^ ((rop >> 1) & 0x55));
2070 -
2071 -       /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */
2072 -       /* Only one operation can be pending at a time. */ 
2073 -
2074 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2075 -       WRITE_REG16(GP_RASTER_MODE, rop16);
2076 -}
2077 -
2078 -/*
2079 -//---------------------------------------------------------------------------
2080 -// GXR_SOLID_FILL
2081 -//
2082 -// This routine MUST be used when performing a solid rectangle fill with 
2083 -// the ROPs of PATCOPY (0xF0), BLACKNESS (0x00), WHITENESS (0xFF), or 
2084 -// PATINVERT (0x0F).  There is a bug in GXm for these cases that requires a 
2085 -// workaround.  
2086 -//
2087 -// For BLACKNESS (ROP = 0x00), set the color to 0x0000.  
2088 -// For WHITENESS (ROP = 0xFF), set the color to 0xFFFF.
2089 -// For PATINVERT (ROP = 0x0F), invert the desired color.
2090 -//
2091 -//      X               screen X position (left)
2092 -//      Y               screen Y position (top)
2093 -//      WIDTH           width of rectangle, in pixels
2094 -//      HEIGHT          height of rectangle, in scanlines
2095 -//      COLOR           fill color
2096 -//
2097 -// THIS ROUTINE SHOULD NOT BE DIRECTLY CALLED FROM THE DRIVER.  The driver 
2098 -// should always use gxr_pattern_fill and let that routine call this one
2099 -// when approipriate.  This is to hide quirks specific to MediaGX hardware.
2100 -//---------------------------------------------------------------------------
2101 -*/
2102 -
2103 -void gxr_solid_fill(unsigned short x, unsigned short y, 
2104 -       unsigned short width, unsigned short height, unsigned short color)
2105 -{
2106 -       unsigned short section;
2107 -
2108 -       /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
2109 -       /* Only one operation can be pending at a time. */ 
2110 -
2111 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2112 -
2113 -       /* SET REGISTERS TO DRAW RECTANGLE */
2114 -
2115 -       WRITE_REG16(GP_DST_XCOOR, x);
2116 -       WRITE_REG16(GP_DST_YCOOR, y);
2117 -       WRITE_REG16(GP_HEIGHT, height);
2118 -       WRITE_REG16(GP_RASTER_MODE, 0x00F0); /* PATCOPY */
2119 -       WRITE_REG16(GP_PAT_COLOR_0, color);
2120 -
2121 -       /* CHECK WIDTH FOR GX BUG WORKAROUND */ 
2122 -
2123 -       if (width <= 16)
2124 -       {
2125 -               /* OK TO DRAW SMALL RECTANGLE IN ONE PASS */
2126 -
2127 -               WRITE_REG16(GP_WIDTH, width);
2128 -               WRITE_REG16(GP_BLIT_MODE, 0);
2129 -       }
2130 -       else
2131 -       {
2132 -               /* DRAW FIRST PART OF RECTANGLE */
2133 -               /* Get to a 16 pixel boundary. */
2134 -
2135 -               section = 0x10 - (x & 0x0F);
2136 -               WRITE_REG16(GP_WIDTH, section);
2137 -               WRITE_REG16(GP_BLIT_MODE, 0);
2138 -
2139 -               /* POLL UNTIL ABLE TO LOAD THE SECOND RECTANGLE */
2140 -
2141 -               while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2142 -               WRITE_REG16(GP_DST_XCOOR, x + section);
2143 -               WRITE_REG16(GP_DST_YCOOR, y);
2144 -               WRITE_REG16(GP_WIDTH, width - section);
2145 -               WRITE_REG16(GP_BLIT_MODE, 0);
2146 -       }
2147 -}    
2148 -
2149 -/*
2150 -//----------------------------------------------------------------------------
2151 -// GXR_PATTERN_FILL
2152 -//
2153 -// This routine is used to fill a rectangular region.  The pattern must 
2154 -// be previously loaded using one of gxr_load_*_pattern routines.  Also, the 
2155 -// raster operation must be previously specified using the 
2156 -// "gxr_load_raster_operation" routine.
2157 -//
2158 -//      X               screen X position (left)
2159 -//      Y               screen Y position (top)
2160 -//      WIDTH           width of rectangle, in pixels
2161 -//      HEIGHT          height of rectangle, in scanlines
2162 -//----------------------------------------------------------------------------
2163 -*/
2164 -
2165 -void gxr_pattern_fill(unsigned short x, unsigned short y, 
2166 -       unsigned short width, unsigned short height)
2167 -{
2168 -       unsigned short section, buffer_width, blit_mode;
2169 -
2170 -       /* CHECK IF OPTIMIZED SOLID CASES */
2171 -    /* Check all 16 bits of the ROP to include solid pattern flags. */
2172 -
2173 -       switch(GXRsavedRop)
2174 -       {
2175 -               /* CHECK FOR SPECIAL CASES WITHOUT DESTINATION DATA */
2176 -               /* Need hardware workaround for fast "burst write" cases. */
2177 -
2178 -               case 0x00F0:
2179 -                       gxr_solid_fill(x, y, width, height, GXRsavedColor);
2180 -                       break;
2181 -               case 0x000F:
2182 -                       gxr_solid_fill(x, y, width, height, ~GXRsavedColor);
2183 -                       break;
2184 -               case 0x0000:
2185 -                       gxr_solid_fill(x, y, width, height, 0x0000);
2186 -                       break;
2187 -               case 0x00FF:
2188 -                       gxr_solid_fill(x, y, width, height, 0xFFFF);
2189 -                       break;
2190 -               
2191 -               /* REMAINING CASES REQUIRE DESTINATION DATA OR NOT SOLID COLOR */
2192 -
2193 -               default:
2194 -                       
2195 -                       /* DETERMINE BLT MODE VALUE */
2196 -                       /* Still here for non-solid patterns without destination data. */
2197 -
2198 -                       blit_mode = GXRusesDstData ? BM_READ_DST_FB0 : 0;
2199 -
2200 -                       /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
2201 -                       /* Write the registers that do not change for each section. */
2202 -
2203 -                       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2204 -                       WRITE_REG16(GP_HEIGHT, height);
2205 -
2206 -                       /* SINCE ONLY DESTINATION DATA, WE CAN USE BOTH BB0 AND BB1. */
2207 -                       /* Therefore, width available = BLT buffer width * 2. */
2208 -
2209 -                       buffer_width = GXRbufferWidthPixels << 1;
2210 -
2211 -                       /* REPEAT UNTIL FINISHED WITH RECTANGLE */
2212 -                       /* Perform BLT in vertical sections, as wide as the BLT buffer */
2213 -                       /* allows.  Hardware does not split the operations, so */
2214 -                       /* software must do it to avoid large scanlines that would */
2215 -                       /* overflow the BLT buffers. */
2216 -
2217 -                       while(width > 0)
2218 -                       {
2219 -                               /* DETERMINE WIDTH OF SECTION */
2220 -
2221 -                               if (width > buffer_width) section = buffer_width;
2222 -                               else section = width;
2223 -
2224 -                               /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
2225 -
2226 -                               while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2227 -                               WRITE_REG16(GP_DST_XCOOR, x);
2228 -                               WRITE_REG16(GP_DST_YCOOR, y);
2229 -                               WRITE_REG16(GP_WIDTH, section);
2230 -                               WRITE_REG16(GP_BLIT_MODE, blit_mode);
2231 -
2232 -                               /* ADJUST PARAMETERS FOR NEXT SECTION */
2233 -
2234 -                               width -= section;
2235 -                               x += section;
2236 -                       }
2237 -                       break;
2238 -       }
2239 -}    
2240 -
2241 -/*
2242 -//----------------------------------------------------------------------------
2243 -// SCREEN TO SCREEN BLT
2244 -//
2245 -// This routine should be used to perform a screen to screen BLT when the 
2246 -// ROP does not require destination data.
2247 -//
2248 -//      SRCX            screen X position to copy from
2249 -//      SRCY            screen Y position to copy from
2250 -//      DSTX            screen X position to copy to
2251 -//      DSTY            screen Y position to copy to
2252 -//      WIDTH           width of rectangle, in pixels
2253 -//      HEIGHT          height of rectangle, in scanlines
2254 -//----------------------------------------------------------------------------
2255 -*/
2256 -
2257 -void gxr_screen_to_screen_blt(unsigned short srcx, unsigned short srcy,
2258 -       unsigned short dstx, unsigned short dsty, unsigned short width, 
2259 -       unsigned short height)
2260 -{
2261 -       unsigned short section, buffer_width;
2262 -       unsigned short blit_mode;
2263 -
2264 -       /* CHECK IF RASTER OPERATION REQUIRES DESTINATION DATA */
2265 -
2266 -       blit_mode = GXRusesDstData ? BM_READ_DST_FB1 | BM_READ_SRC_FB : 
2267 -               BM_READ_SRC_FB;
2268 -
2269 -       /* CHECK Y DIRECTION */
2270 -       /* Hardware has support for negative Y direction. */
2271 -
2272 -       if (dsty > srcy) 
2273 -       {
2274 -               blit_mode |= BM_REVERSE_Y;
2275 -               srcy += height - 1;
2276 -               dsty += height - 1;
2277 -       }
2278 -
2279 -       /* CHECK X DIRECTION */
2280 -       /* Hardware does not support negative X direction since at the time */ 
2281 -       /* of development all supported resolutions could fit a scanline of */ 
2282 -       /* data at once into the BLT buffers (using both BB0 and BB1).  This */
2283 -       /* code is more generic to allow for any size BLT buffer. */
2284 -
2285 -       if (dstx > srcx)
2286 -       {
2287 -               srcx += width;
2288 -               dstx += width;
2289 -       }
2290 -
2291 -       /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
2292 -       /* Write the registers that do not change for each section. */
2293 -
2294 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2295 -       WRITE_REG16(GP_HEIGHT, height);
2296 -
2297 -       /* CHECK AVAILABLE BLT BUFFER SIZE */
2298 -       /* Can use both BLT buffers if no destination data is required. */
2299 -
2300 -       buffer_width = GXRusesDstData ? GXRbufferWidthPixels :
2301 -               GXRbufferWidthPixels << 1;
2302 -
2303 -       /* REPEAT UNTIL FINISHED WITH RECTANGLE */
2304 -       /* Perform BLT in vertical sections, as wide as the BLT buffer allows. */
2305 -       /* Hardware does not split the operations, so software must do it to */ 
2306 -       /* avoid large scanlines that would overflow the BLT buffers. */
2307 -
2308 -       while(width > 0)
2309 -       {
2310 -               /* CHECK WIDTH OF CURRENT SECTION */
2311 -
2312 -               if (width > buffer_width) section = buffer_width;
2313 -               else section = width;
2314 -
2315 -               /* PROGRAM REGISTERS THAT ARE THE SAME FOR EITHER X DIRECTION */
2316 -
2317 -               while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2318 -               WRITE_REG16(GP_SRC_YCOOR, srcy);
2319 -               WRITE_REG16(GP_DST_YCOOR, dsty);
2320 -               WRITE_REG16(GP_WIDTH, section);
2321 -
2322 -               /* CHECK X DIRECTION */
2323 -
2324 -               if (dstx > srcx)
2325 -               {
2326 -                       /* NEGATIVE X DIRECTION */
2327 -                       /* Still positive X direction within the section. */
2328 -
2329 -                       srcx -= section;
2330 -                       dstx -= section;
2331 -                       WRITE_REG16(GP_SRC_XCOOR, srcx);
2332 -                       WRITE_REG16(GP_DST_XCOOR, dstx);
2333 -                       WRITE_REG16(GP_BLIT_MODE, blit_mode);
2334 -               } 
2335 -               else
2336 -               {
2337 -                       /* POSITIVE X DIRECTION */
2338 -
2339 -                       WRITE_REG16(GP_SRC_XCOOR, srcx);
2340 -                       WRITE_REG16(GP_DST_XCOOR, dstx);
2341 -                       WRITE_REG16(GP_BLIT_MODE, blit_mode);
2342 -                       dstx += section;
2343 -                       srcx += section;
2344 -               }
2345 -               width -= section;
2346 -       }
2347 -}    
2348 -
2349 -/*
2350 -//----------------------------------------------------------------------------
2351 -// SCREEN TO SCREEN TRANSPARENT BLT
2352 -//
2353 -// This routine should be used to perform a screen to screen BLT when a 
2354 -// specified color should by transparent.  The only supported ROP is SRCCOPY.
2355 -//
2356 -//      SRCX            screen X position to copy from
2357 -//      SRCY            screen Y position to copy from
2358 -//      DSTX            screen X position to copy to
2359 -//      DSTY            screen Y position to copy to
2360 -//      WIDTH           width of rectangle, in pixels
2361 -//      HEIGHT          height of rectangle, in scanlines
2362 -//      COLOR           transparent color
2363 -//----------------------------------------------------------------------------
2364 -*/
2365 -
2366 -void gxr_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy,
2367 -       unsigned short dstx, unsigned short dsty, unsigned short width, 
2368 -       unsigned short height, unsigned short color)
2369 -{
2370 -       unsigned short section, buffer_width;
2371 -       unsigned short blit_mode = BM_READ_SRC_FB;
2372 -       unsigned short i;
2373 -
2374 -       /* CHECK Y DIRECTION */
2375 -       /* Hardware has support for negative Y direction. */
2376 -
2377 -       if (dsty > srcy) 
2378 -       {
2379 -               blit_mode |= BM_REVERSE_Y;
2380 -               srcy += height - 1;
2381 -               dsty += height - 1;
2382 -       }
2383 -
2384 -       /* CHECK X DIRECTION */
2385 -       /* Hardware does not support negative X direction since at the time */
2386 -       /* of development all supported resolutions could fit a scanline of */ 
2387 -       /* data at once into the BLT buffers (using both BB0 and BB1).  This */
2388 -       /* code is more generic to allow for any size BLT buffer. */
2389 -
2390 -       if (dstx > srcx)
2391 -       {
2392 -               srcx += width;
2393 -               dstx += width;
2394 -       }
2395 -
2396 -       /* CALCULATE BLT BUFFER SIZE */
2397 -       /* Need to use BB1 to store the BLT buffer data. */
2398 -
2399 -       buffer_width = GXRbufferWidthPixels;
2400 -
2401 -       /* WRITE TRANSPARENCY COLOR TO BLT BUFFER 1 */
2402 -
2403 -       if (!(READ_REG16(GP_BLIT_STATUS) & BC_16BPP))
2404 -       {
2405 -               color &= 0x00FF;
2406 -               color |= (color << 8);
2407 -       }
2408 -
2409 -       /* WAIT UNTIL PIPELINE IS NOT BUSY BEFORE LOADING DATA INTO BB1 */
2410 -       /* Need to make sure any previous BLT using BB1 is complete. */
2411 -
2412 -       while(READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY);
2413 -       for (i = 0; i < 16; i+=2)
2414 -       {
2415 -               WRITE_REG16(GXRbb1Base+i, color);
2416 -       }
2417 -
2418 -       /* DO BOGUS BLT TO LATCH DATA FROM BB1 */
2419 -       /* Already know graphics pipeline is idle. */
2420 -
2421 -       WRITE_REG32(GP_DST_XCOOR, 0);
2422 -       WRITE_REG32(GP_SRC_XCOOR, 0);
2423 -       WRITE_REG16(GP_WIDTH, 16);
2424 -       WRITE_REG16(GP_HEIGHT, 1);
2425 -       WRITE_REG16(GP_RASTER_MODE, 0x00CC);
2426 -       WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_FB | BM_READ_DST_BB1);
2427 -       
2428 -       /* WRITE REGISTERS FOR REAL SCREEN TO SCREEN BLT */
2429 -
2430 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2431 -       WRITE_REG16(GP_HEIGHT, height);
2432 -       WRITE_REG16(GP_RASTER_MODE, 0x10C6);
2433 -       WRITE_REG32(GP_PAT_COLOR_0, 0xFFFFFFFF);
2434 -
2435 -       /* REPEAT UNTIL FINISHED WITH RECTANGLE */
2436 -       /* Perform BLT in vertical sections, as wide as the BLT buffer allows. */
2437 -       /* Hardware does not split the operations, so software must do it to */
2438 -       /* avoid large scanlines that would overflow the BLT buffers. */
2439 -
2440 -       while(width > 0)
2441 -       {
2442 -               /* CHECK WIDTH OF CURRENT SECTION */
2443 -
2444 -               if (width > buffer_width) section = buffer_width;
2445 -               else section = width;
2446 -
2447 -               /* PROGRAM REGISTERS THAT ARE THE SAME FOR EITHER X DIRECTION */
2448 -
2449 -               while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2450 -               WRITE_REG16(GP_SRC_YCOOR, srcy);
2451 -               WRITE_REG16(GP_DST_YCOOR, dsty);
2452 -               WRITE_REG16(GP_WIDTH, section);
2453 -
2454 -               /* CHECK X DIRECTION */
2455 -               /* Again, this must be done in software, and can be removed if the */
2456 -               /* display driver knows that the BLT buffers will always be large */
2457 -               /* enough to contain an entire scanline of a screen to screen BLT. */
2458 -
2459 -               if (dstx > srcx)
2460 -               {
2461 -                       /* NEGATIVE X DIRECTION */
2462 -                       /* Still positive X direction within the section. */
2463 -
2464 -                       srcx -= section;
2465 -                       dstx -= section;
2466 -                       WRITE_REG16(GP_SRC_XCOOR, srcx);
2467 -                       WRITE_REG16(GP_DST_XCOOR, dstx);
2468 -                       WRITE_REG16(GP_BLIT_MODE, blit_mode);
2469 -               } 
2470 -               else
2471 -               {
2472 -                       /* POSITIVE X DIRECTION */
2473 -
2474 -                       WRITE_REG16(GP_SRC_XCOOR, srcx);
2475 -                       WRITE_REG16(GP_DST_XCOOR, dstx);
2476 -                       WRITE_REG16(GP_BLIT_MODE, blit_mode);
2477 -                       dstx += section;
2478 -                       srcx += section;
2479 -               }
2480 -               width -= section;
2481 -       }
2482 -}    
2483 -
2484 -/*
2485 -//----------------------------------------------------------------------------
2486 -// COLOR BITMAP TO SCREEN BLT
2487 -//
2488 -// This routine transfers color bitmap data to the screen.  For most cases,
2489 -// when the ROP is SRCCOPY, it may be faster to write a separate routine that
2490 -// copies the data to the frame buffer directly.  This routine should be 
2491 -// used when the ROP requires destination data.
2492 -//
2493 -// Transparency is handled by another routine.
2494 -//
2495 -//      SRCX            X offset within source bitmap
2496 -//      SRCY            Y offset within source bitmap
2497 -//      DSTX            screen X position to render data
2498 -//      DSTY            screen Y position to render data
2499 -//      WIDTH           width of rectangle, in pixels
2500 -//      HEIGHT          height of rectangle, in scanlines
2501 -//      *DATA           pointer to bitmap data
2502 -//      PITCH           pitch of bitmap data (bytes between scanlines)
2503 -//      ROP             ternary raster operation (0x00-0xFF).
2504 -//----------------------------------------------------------------------------
2505 -*/
2506 -
2507 -void gxr_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy,
2508 -       unsigned short dstx, unsigned short dsty, unsigned short width, 
2509 -       unsigned short height, unsigned char *data, unsigned short pitch, 
2510 -       unsigned char rop)
2511 -{
2512 -       unsigned short section, buffer_width;
2513 -       unsigned short blit_mode = BM_READ_SRC_BB0;
2514 -       unsigned short line_srcx, line_dstx, line_width;
2515 -       unsigned short offset, i;
2516 -
2517 -       /* CHECK IF ROP REQUIRES DESTINATION DATA */
2518 -       /* Even bits (0:2:4:6) do not equal corresponding odd bits (1:3:5:7). */
2519 -
2520 -       if ((rop & 0x55) ^ ((rop >> 1) & 0x55))
2521 -               blit_mode |= BM_READ_DST_FB1;
2522 -
2523 -       /* CHECK SIZE OF BLT BUFFER */
2524 -
2525 -       buffer_width = GXRbufferWidthPixels;
2526 -       
2527 -       /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
2528 -       /* Write the registers that do not change for each section. */
2529 -
2530 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2531 -       WRITE_REG16(GP_HEIGHT, 1);
2532 -       WRITE_REG16(GP_RASTER_MODE, (unsigned short) rop & 0x00FF);
2533 -
2534 -       /* REPEAT FOR EACH SCANLINE */
2535 -
2536 -       offset = srcy * pitch;
2537 -
2538 -       while(height > 0)
2539 -       {
2540 -               line_width = width;
2541 -               line_srcx = srcx;
2542 -               line_dstx = dstx;
2543 -
2544 -               while(line_width > 0)
2545 -               {
2546 -                       /* CHECK WIDTH OF CURRENT SECTION */
2547 -
2548 -                       if (line_width > buffer_width) section = buffer_width;
2549 -                       else section = line_width;
2550 -
2551 -                       /* TRANSFER SCANLINE OF BITMAP DATA TO BLT BUFFER 0 */
2552 -                       /* Need to wait for BS_PIPELINE_BUSY to make sure that the */ 
2553 -                       /* data in BB0 for the previous scanline is no longer used. */
2554 -                       /* This can be heavily optimized to not do a byte at a time. */
2555 -
2556 -                       while(READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY);
2557 -                       if (READ_REG16(GP_BLIT_STATUS) & BC_16BPP)
2558 -                       {
2559 -                               for (i = 0; i < section; i++)
2560 -                               {
2561 -                                       WRITE_REG16(GXRbb0Base+i, data[offset+((line_srcx+i)<<1)]);
2562 -                               }
2563 -                       }
2564 -                       else
2565 -                       {
2566 -                               for (i = 0; i < section; i++)
2567 -                               {
2568 -                                       WRITE_REG8(GXRbb0Base+i, data[line_srcx+offset+i]);
2569 -                               }
2570 -                       }
2571 -
2572 -                       /* RENDER FROM BB0 TO FRAME BUFFER */
2573 -
2574 -                       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2575 -                       WRITE_REG16(GP_DST_XCOOR, line_dstx);
2576 -                       WRITE_REG16(GP_DST_YCOOR, dsty);
2577 -                       WRITE_REG16(GP_WIDTH, section);
2578 -                       WRITE_REG16(GP_BLIT_MODE, blit_mode);
2579 -
2580 -                       line_width -= section;
2581 -                       line_dstx += section;
2582 -                       line_srcx += section;
2583 -               }
2584 -               height--;
2585 -               dsty++;
2586 -               offset += pitch;
2587 -       }
2588 -}    
2589 -
2590 -/*
2591 -//----------------------------------------------------------------------------
2592 -// COLOR BITMAP TO SCREEN TRANSPARENT BLT
2593 -//
2594 -// This routine transfers color bitmap data to the screen with transparency.
2595 -// The transparent color is specified.  The only supported ROP is SRCCOPY, 
2596 -// meaning that transparency cannot be applied if the ROP requires 
2597 -// destination data (this is a hardware restriction).
2598 -//
2599 -//      SRCX            X offset within source bitmap
2600 -//      SRCY            Y offset within source bitmap
2601 -//      DSTX            screen X position to render data
2602 -//      DSTY            screen Y position to render data
2603 -//      WIDTH           width of rectangle, in pixels
2604 -//      HEIGHT          height of rectangle, in scanlines
2605 -//      *DATA           pointer to bitmap data
2606 -//      PITCH           pitch of bitmap data (bytes between scanlines)
2607 -//      COLOR           transparent color
2608 -//----------------------------------------------------------------------------
2609 -*/
2610 -
2611 -void gxr_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy,
2612 -       unsigned short dstx, unsigned short dsty, unsigned short width, 
2613 -       unsigned short height, unsigned char *data, unsigned short pitch, 
2614 -       unsigned short color)
2615 -{
2616 -       unsigned short section, buffer_width;
2617 -       unsigned short blit_mode = BM_READ_SRC_BB0;
2618 -       unsigned short line_srcx, line_dstx, line_width;
2619 -       unsigned short offset, i, first_blt = 1;
2620 -
2621 -       /* CHECK SIZE OF BLT BUFFER */
2622 -
2623 -       buffer_width = GXRbufferWidthPixels;
2624 -       
2625 -       /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
2626 -       /* Write the registers that do not change for each section. */
2627 -
2628 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2629 -       WRITE_REG16(GP_HEIGHT, 1);
2630 -       WRITE_REG16(GP_RASTER_MODE, 0x10C6);
2631 -       WRITE_REG32(GP_PAT_COLOR_0, 0xFFFFFFFF);
2632 -
2633 -       /* CALCULATE OFFSET INTO BITMAP DATA */
2634 -
2635 -       offset = srcy * pitch;
2636 -
2637 -       /* REPEAT FOR EACH SCANLINE */
2638 -
2639 -       while(height > 0)
2640 -       {
2641 -               line_width = width;
2642 -               line_srcx = srcx;
2643 -               line_dstx = dstx;
2644 -
2645 -               while(line_width > 0)
2646 -               {
2647 -                       /* CHECK WIDTH OF CURRENT SECTION */
2648 -
2649 -                       if (line_width > buffer_width) section = buffer_width;
2650 -                       else section = line_width;
2651 -
2652 -                       /* TRANSFER SCANLINE OF BITMAP DATA TO BLT BUFFER 0 */
2653 -                       /* Need to wait for BS_PIPELINE_BUSY to make sure that the */ 
2654 -                       /* data in BB0 for the previous scanline is no longer used. */
2655 -                       /* This can be heavily optimized to not do a byte at a time. */
2656 -
2657 -                       while(READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY);
2658 -                       if (READ_REG16(GP_BLIT_STATUS) & BC_16BPP)
2659 -                       {
2660 -                               for (i = 0; i < section; i++)
2661 -                               {
2662 -                                       WRITE_REG16(GXRbb0Base+i, data[offset+((line_srcx+i)<<1)]);
2663 -                               }
2664 -                       }
2665 -                       else
2666 -                       {
2667 -                               for (i = 0; i < section; i++)
2668 -                               {
2669 -                                       WRITE_REG8(GXRbb0Base+i, data[line_srcx+offset+i]);
2670 -                               }
2671 -                       }
2672 -
2673 -                       /* RENDER FROM BB0 TO FRAME BUFFER */
2674 -
2675 -                       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2676 -                       WRITE_REG16(GP_DST_XCOOR, line_dstx);
2677 -                       WRITE_REG16(GP_DST_YCOOR, dsty);
2678 -                       WRITE_REG16(GP_WIDTH, section);
2679 -
2680 -                       /* NEED TO DO EXTRA WORK FOR THE FIRST BLT */
2681 -
2682 -                       if (first_blt)
2683 -                       {
2684 -                               /* WRITE TRANSPARENCY COLOR TO BLT BUFFER 1 */
2685 -                               /* This can be heavily optimized to not do 16-bits at a time. */
2686 -
2687 -                               if (READ_REG16(GP_BLIT_STATUS) & BC_16BPP)
2688 -                               {
2689 -                                       for (i = 0; i < section; i++)
2690 -                                       {
2691 -                                               WRITE_REG16(GXRbb1Base+i*2, color);
2692 -                                       }
2693 -                               }
2694 -                               else
2695 -                               {
2696 -                                       for (i = 0; i < section; i++)
2697 -                                       {
2698 -                                               WRITE_REG8(GXRbb1Base+i, (unsigned char) color);
2699 -                                       }
2700 -                               }
2701 -                               WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_BB0 | BM_READ_DST_BB1);
2702 -                               first_blt = 0;
2703 -                       }
2704 -                       else
2705 -                       {
2706 -                               /* AFTER FIRST BLT, THE TRANSPARENCY DATA IS LATCHED */
2707 -                               /* Save time by not reading data from BB1. */
2708 -
2709 -                               WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_BB0);
2710 -                       }
2711 -                       line_width -= section;
2712 -                       line_dstx += section;
2713 -                       line_srcx += section;
2714 -               }
2715 -               height--;
2716 -               dsty++;
2717 -               offset += pitch;
2718 -       }
2719 -}    
2720 -
2721 -/*
2722 -//----------------------------------------------------------------------------
2723 -// MONOCHROME BITMAP TO SCREEN BLT
2724 -//
2725 -// This routine transfers monochrome bitmap data to the screen.  
2726 -//
2727 -//      SRCX            X offset within source bitmap
2728 -//      SRCY            Y offset within source bitmap
2729 -//      DSTX            screen X position to render data
2730 -//      DSTY            screen Y position to render data
2731 -//      WIDTH           width of rectangle, in pixels
2732 -//      HEIGHT          height of rectangle, in scanlines
2733 -//      *DATA           pointer to bitmap data
2734 -//      PITCH           pitch of bitmap data (bytes between scanlines)
2735 -//      FGCOLOR         color for bits = 1
2736 -//      BGCOLOR         color for bits = 0
2737 -//      ROP             ternary raster operation (0x00-0xFF).
2738 -//      TRANSPARENT     zero for opaque, otherwise transparent
2739 -//----------------------------------------------------------------------------
2740 -*/
2741 -
2742 -void gxr_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy,
2743 -       unsigned short dstx, unsigned short dsty, unsigned short width, 
2744 -       unsigned short height, unsigned char *data, unsigned short pitch, 
2745 -       unsigned short fgcolor, unsigned short bgcolor, unsigned char rop,
2746 -       unsigned char transparent)
2747 -{
2748 -       unsigned short section, buffer_width;
2749 -       unsigned short blit_mode = BM_READ_SRC_BB0 | BM_SOURCE_EXPAND;
2750 -       unsigned short line_srcx, line_dstx, line_width;
2751 -       unsigned short offset, i, bytes, raster_mode;
2752 -
2753 -       /* FORMAT 8BPP COLOR */
2754 -    /* GX requires that 8BPP color data be duplicated into bits [15:8]. */
2755 -
2756 -       if (!(READ_REG16(GP_BLIT_STATUS) & BC_16BPP))
2757 -       {
2758 -               fgcolor &= 0x00FF;
2759 -               fgcolor |= (fgcolor << 8);
2760 -               bgcolor &= 0x00FF;
2761 -               bgcolor |= (bgcolor << 8);
2762 -       }
2763 -
2764 -       /* CHECK IF ROP REQUIRES DESTINATION DATA */
2765 -       /* Even bits (0:2:4:6) do not equal corresponding odd bits (1:3:5:7). */
2766 -
2767 -       if ((rop & 0x55) ^ ((rop >> 1) & 0x55))
2768 -               blit_mode |= BM_READ_DST_FB1;
2769 -
2770 -       /* CALCULATE RASTER MODE */
2771 -       /* Set mono flag.  Transparency set based on input parameter. */
2772 -
2773 -       raster_mode = ((unsigned short) rop & 0x00FF);
2774 -       if (transparent) raster_mode |= RM_SRC_TRANSPARENT;
2775 -
2776 -       /* CHECK SIZE OF BLT BUFFER */
2777 -
2778 -       buffer_width = GXRbufferWidthPixels;
2779 -       
2780 -       /* CALCULATE OFFSET INTO BITMAP DATA */
2781 -
2782 -       offset = srcy * pitch;
2783 -
2784 -       /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
2785 -       /* Write the registers that do not change for each section. */
2786 -
2787 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2788 -       WRITE_REG16(GP_HEIGHT, 1);
2789 -       WRITE_REG16(GP_RASTER_MODE, raster_mode);
2790 -       WRITE_REG16(GP_SRC_COLOR_0, bgcolor);
2791 -       WRITE_REG16(GP_SRC_COLOR_1, fgcolor);
2792 -
2793 -       /* REPEAT FOR EACH SCANLINE */
2794 -
2795 -       while(height > 0)
2796 -       {
2797 -               line_width = width;
2798 -               line_srcx = srcx;
2799 -               line_dstx = dstx;
2800 -
2801 -               while(line_width > 0)
2802 -               {
2803 -                       /* CHECK WIDTH OF CURRENT SECTION */
2804 -                       /* Only divide into sections if reading destination data. */  
2805 -                       /* Since the source data is monochrome, it will always fit. */
2806 -
2807 -                       section = line_width;
2808 -                       if ((line_width > buffer_width) && (blit_mode & BM_READ_DST_FB1)) 
2809 -                               section = buffer_width;
2810 -
2811 -                       /* BYTES TO TRANSFER */
2812 -                       /* Add two bytes to handle truncating and alignment. */
2813 -
2814 -                       bytes = (section >> 3) + 2;
2815 -
2816 -                       /* TRANSFER SCANLINE OF BITMAP DATA TO BLT BUFFER 0 */
2817 -                       /* Need to wait for BS_PIPELINE_BUSY to make sure that the */ 
2818 -                       /* data in BB0 for the previous scanline is no longer used. */
2819 -                       /* This can be heavily optimized to not do a byte at a time. */
2820 -
2821 -                       while(READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY);
2822 -                       for (i = 0; i < bytes; i++)
2823 -                       {
2824 -                               WRITE_REG8(GXRbb0Base+i, data[(line_srcx >> 3)+offset+i]);
2825 -                       }
2826 -
2827 -                       /* RENDER FROM BB0 TO FRAME BUFFER */
2828 -
2829 -                       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2830 -                       WRITE_REG16(GP_DST_XCOOR, line_dstx);
2831 -                       WRITE_REG16(GP_DST_YCOOR, dsty);
2832 -                       WRITE_REG16(GP_SRC_XCOOR, line_srcx & 7);
2833 -                       WRITE_REG16(GP_WIDTH, section);
2834 -                       WRITE_REG16(GP_BLIT_MODE, blit_mode);
2835 -
2836 -                       line_width -= section;
2837 -                       line_dstx += section;
2838 -                       line_srcx += section;
2839 -               }
2840 -               height--;
2841 -               dsty++;
2842 -               offset += pitch;
2843 -       }
2844 -}    
2845 -
2846 -/*
2847 -//----------------------------------------------------------------------------
2848 -// TEXT GLYPH
2849 -//
2850 -// This routine draws a single character of text.  It can only be used for 
2851 -// characters that are less than or equal to 64x64 in size, since it 
2852 -// transfers the entire data into the BLT buffers at once.  Larger characters
2853 -// should use the monochrome bitmap to screen routine.  The only supported 
2854 -// ROP is SRCCOPY, again since the BLT buffer size is limited. 
2855 -// 
2856 -//      SRCX            X offset within source bitmap
2857 -//      SRCY            Y offset within source bitmap
2858 -//      DSTX            screen X position to render data
2859 -//      DSTY            screen Y position to render data
2860 -//      WIDTH           width of rectangle, in pixels
2861 -//      HEIGHT          height of rectangle, in scanlines
2862 -//      *DATA           pointer to bitmap data (NULL if already loaded)
2863 -//      PITCH           pitch of bitmap data (bytes between scanlines)
2864 -//
2865 -// For the Xfree86 display driver, the OS is given a pointer to BB0.  
2866 -// Therefore, the data is already loaded when the driver is called, so the
2867 -// driver simply passes a NULL pointer to this routine.
2868 -//
2869 -// This same type of routine could be developed for "icons", or small 
2870 -// color bitmaps that can fit entirely in the BLT buffer. 
2871 -//----------------------------------------------------------------------------
2872 -*/
2873 -
2874 -void gxr_text_glyph(unsigned short srcx, unsigned short srcy,
2875 -       unsigned short dstx, unsigned short dsty, unsigned short width, 
2876 -       unsigned short height, unsigned char *data, unsigned short pitch)
2877 -{
2878 -       unsigned short offset, i, j, buffer_offset, bytes, blit_mode;
2879 -
2880 -       blit_mode = BM_READ_SRC_BB0 | BM_SOURCE_EXPAND;
2881 -       if (GXRusesDstData) blit_mode |= BM_READ_DST_FB1;
2882 -
2883 -       /* CHECK IF DATA NEEDS TO BE TRANSFERRED */
2884 -
2885 -       if (data != 0)
2886 -       {
2887 -               /* TRANSFER ENTIRE BITMAP DATA TO BLT BUFFER 0 */
2888 -               /* Need to wait for BS_PIPELINE_BUSY to make sure that the */ 
2889 -               /* data in BB0 for any previous BLT is no longer used. */
2890 -               /* This data transfer has lots of room for performance optimization. */
2891 -
2892 -               buffer_offset = 0;
2893 -               offset = srcy * pitch + (srcx >> 3);
2894 -               bytes = ((width + (srcx & 7) + 7) >> 3);
2895 -               while(READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY);
2896 -               for (j = 0; j < height; j++)
2897 -               {
2898 -                       for (i = 0; i < bytes; i++)
2899 -                       {
2900 -                               WRITE_REG8(GXRbb0Base+buffer_offset, data[offset+i]);
2901 -                               buffer_offset++;
2902 -                       }
2903 -                       offset += pitch;
2904 -               }
2905 -       }
2906 -
2907 -       /* RENDER FROM BB0 TO FRAME BUFFER */
2908 -       /* Already know that the pipeline is idle from loading data. */
2909 -
2910 -       WRITE_REG16(GP_DST_XCOOR, dstx);
2911 -       WRITE_REG16(GP_DST_YCOOR, dsty);
2912 -       WRITE_REG16(GP_SRC_XCOOR, srcx & 7);
2913 -       WRITE_REG16(GP_WIDTH, width);
2914 -       WRITE_REG16(GP_HEIGHT, height);
2915 -       WRITE_REG16(GP_BLIT_MODE, blit_mode);
2916 -}    
2917 -
2918 -/*
2919 -//----------------------------------------------------------------------------
2920 -// BRESENHAM LINE
2921 -//
2922 -// This routine draws a vector using the specified Bresenham parameters.  
2923 -// Currently this file does not support a routine that accepts the two 
2924 -// endpoints of a vector and calculates the Bresenham parameters.  If it 
2925 -// ever does, this routine is still required for vectors that have been 
2926 -// clipped.
2927 -//
2928 -//      X               screen X position to start vector
2929 -//      Y               screen Y position to start vector
2930 -//      LENGTH          length of the vector, in pixels
2931 -//      INITERR         Bresenham initial error term
2932 -//      AXIALERR        Bresenham axial error term
2933 -//      DIAGERR         Bresenham diagonal error term
2934 -//      FLAGS           VM_YMAJOR, VM_MAJOR_INC, VM_MINOR_INC
2935 -//----------------------------------------------------------------------------
2936 -*/
2937 -
2938 -void gxr_bresenham_line(unsigned short x, unsigned short y, 
2939 -               unsigned short length, unsigned short initerr, 
2940 -               unsigned short axialerr, unsigned short diagerr, 
2941 -               unsigned short flags)
2942 -{
2943 -       unsigned short vector_mode = flags;
2944 -       if (GXRusesDstData) vector_mode |= VM_READ_DST_FB;
2945 -
2946 -       /* CHECK NULL LENGTH */
2947 -
2948 -       if (!length) return;
2949 -
2950 -       /* LOAD THE REGISTERS FOR THE VECTOR */
2951 -
2952 -       while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING);
2953 -       WRITE_REG16(GP_DST_XCOOR, x);
2954 -       WRITE_REG16(GP_DST_YCOOR, y);
2955 -       WRITE_REG16(GP_VECTOR_LENGTH, length);
2956 -       WRITE_REG16(GP_INIT_ERROR, initerr);
2957 -       WRITE_REG16(GP_AXIAL_ERROR, axialerr);
2958 -       WRITE_REG16(GP_DIAG_ERROR, diagerr);
2959 -       WRITE_REG16(GP_VECTOR_MODE, vector_mode);
2960 -}
2961 -
2962 -/* END OF FILE */
2963 -
This page took 0.534523 seconds and 3 git commands to generate.