summaryrefslogtreecommitdiff
path: root/extra/xf86-video-xgi/git-fixes.patch
blob: f15fea88ab8e750180c48dd2ae493a4248845d94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
diff --git a/man/xgi.man b/man/xgi.man
index 19880f2..5699ae4 100644
--- a/man/xgi.man
+++ b/man/xgi.man
@@ -1,4 +1,3 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/xgi/xgi.man,v 1.14 2003/11/12 16:50:36 twini Exp $
 .\" shorthand for double quote that works everywhere.
 .ds q \N'34'
 .TH XGI __drivermansuffix__ __vendorversion__
diff --git a/src/vb_init.c b/src/vb_init.c
index 8338410..50980c4 100755
--- a/src/vb_init.c
+++ b/src/vb_init.c
@@ -131,6 +131,8 @@ static void XGINew_SetDRAMDefaultRegister340(PXGI_HW_DEVICE_INFO, USHORT,
 static void XGINew_SetDRAMDefaultRegisterXG45(PXGI_HW_DEVICE_INFO, USHORT, 
     PVB_DEVICE_INFO);
 static UCHAR XGINew_Get340DRAMType(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO);
+/* horrible */
+#define XGINew_GetXG20DRAMType XGINew_Get340DRAMType
 
 static int XGINew_SetDDRChannel(int index, UCHAR ChannelNo,
     UCHAR XGINew_ChannelAB, const USHORT DRAMTYPE_TABLE[][5],
@@ -1451,7 +1453,7 @@ void XGINew_SetDRAMDefaultRegister340( PXGI_HW_DEVICE_INFO HwDeviceExtension ,
     }
 
     temp3 = 0 ;
-    for( k = 0 ; k < 4 ; k++ )
+    for( k = 1 ; k < 4 ; k++ )
     {
         XGI_SetRegANDOR((XGIIOADDRESS) P3d4 , 0x6E , 0xFC , temp3 ) ;		/* CR6E_D[1:0] select channel */
         temp2 = 0 ;
diff --git a/src/vgatypes.h b/src/vgatypes.h
index 8a60927..7484661 100755
--- a/src/vgatypes.h
+++ b/src/vgatypes.h
@@ -1,5 +1,3 @@
-/* $XFree86$ */
-/* $XdotOrg$ */
 /*
  * General type definitions for universal mode switching modules
  *
diff --git a/src/xgi.h b/src/xgi.h
index 715502f..e818631 100755
--- a/src/xgi.h
+++ b/src/xgi.h
@@ -981,6 +981,7 @@ int compute_vclk(int Clock, int *out_n, int *out_dn, int *out_div,
 void XGI_WaitBeginRetrace(XGIIOADDRESS RelIO);
 void XGI_WaitEndRetrace(XGIIOADDRESS RelIO);
 
+#include <unistd.h>
 /* 2005/11/21 added by jjtseng */
 #define DelayS(sec) usleep((sec)*1000000)
 #define DelayMS(millisec) usleep((millisec)*1000)
diff --git a/src/xgi_accel.c b/src/xgi_accel.c
index c072691..4c298ed 100755
--- a/src/xgi_accel.c
+++ b/src/xgi_accel.c
@@ -200,20 +200,7 @@ extern int FbDevExist;
 #endif
 
 #if X_BYTE_ORDER == X_BIG_ENDIAN
-static CARD32 BE_SWAP32 (CARD32 val)
-{
-	PDEBUG(ErrorF("X_BIG_ENDIAN...\n"));
-    if (CurrentColorDepth == 8)
-	    return   ((((val) & 0x000000ff) << 24) | \
-                  (((val) & 0x0000ff00) << 8) |  \
-                  (((val) & 0x00ff0000) >> 8) |  \
-                  (((val) & 0xff000000) >> 24));
-    if (CurrentColorDepth == 24)
-        return val;
-    if (CurrentColorDepth == 16)
-        return ((((val) & 0x0000ffff) << 16) | \
-		         (((val) & 0xffff0000) >> 16));
-}    
+#define BE_SWAP32(x) lswapl(x)
 #else 
 static CARD32 BE_SWAP32 (CARD32 val)
 {
diff --git a/src/xgi_dga.c b/src/xgi_dga.c
index 04f90aa..8bd84bc 100755
--- a/src/xgi_dga.c
+++ b/src/xgi_dga.c
@@ -103,18 +103,18 @@ XGISetupDGAMode(
 
 	if(pMode->HDisplay != otherPitch) {
 
-	    newmodes = xrealloc(modes, (*num + 2) * sizeof(DGAModeRec));
+	    newmodes = realloc(modes, (*num + 2) * sizeof(DGAModeRec));
 	    oneMore  = TRUE;
 
 	} else {
 
-	    newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec));
+	    newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec));
 	    oneMore  = FALSE;
 
 	}
 
 	if(!newmodes) {
-	    xfree(modes);
+	    free(modes);
 	    return NULL;
 	}
 	modes = newmodes;
diff --git a/src/xgi_dri.c b/src/xgi_dri.c
index 93687e1..e575c19 100755
--- a/src/xgi_dri.c
+++ b/src/xgi_dri.c
@@ -46,7 +46,6 @@
 
 #include "xf86.h"
 #include "xf86_OSproc.h"
-#include "xf86Priv.h"
 
 #include "xf86PciInfo.h"
 #include "xf86Pci.h"
@@ -145,13 +144,13 @@ XGIInitVisualConfigs(ScreenPtr pScreen)
     }
     if (!(pXGIConfigs = (XGIConfigPrivPtr)xnfcalloc(sizeof(XGIConfigPrivRec),
 						    numConfigs))) {
-      xfree(pConfigs);
+      free(pConfigs);
       return FALSE;
     }
     if (!(pXGIConfigPtrs = (XGIConfigPrivPtr*)xnfcalloc(sizeof(XGIConfigPrivPtr),
 							  numConfigs))) {
-      xfree(pConfigs);
-      xfree(pXGIConfigs);
+      free(pConfigs);
+      free(pXGIConfigs);
       return FALSE;
     }
     for (i=0; i<numConfigs; i++)
@@ -333,7 +332,7 @@ Bool XGIDRIScreenInit(ScreenPtr pScreen)
   pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
 
   if (!DRIScreenInit(pScreen, pDRIInfo, &pXGI->drmSubFD)) {
-    xfree(pDRIInfo->devPrivate);
+    free(pDRIInfo->devPrivate);
     pDRIInfo->devPrivate=0;
     DRIDestroyInfoRec(pXGI->pDRIInfo);
     pXGI->pDRIInfo=0;
@@ -537,14 +536,14 @@ XGIDRICloseScreen(ScreenPtr pScreen)
 
   if (pXGI->pDRIInfo) {
     if (pXGI->pDRIInfo->devPrivate) {
-      xfree(pXGI->pDRIInfo->devPrivate);
+      free(pXGI->pDRIInfo->devPrivate);
       pXGI->pDRIInfo->devPrivate=0;
     }
     DRIDestroyInfoRec(pXGI->pDRIInfo);
     pXGI->pDRIInfo=0;
   }
-  if (pXGI->pVisualConfigs) xfree(pXGI->pVisualConfigs);
-  if (pXGI->pVisualConfigsPriv) xfree(pXGI->pVisualConfigsPriv);
+  if (pXGI->pVisualConfigs) free(pXGI->pVisualConfigs);
+  if (pXGI->pVisualConfigsPriv) free(pXGI->pVisualConfigsPriv);
 
   if(pXGI->agpSize){
 /* ErrorF("Freeing agp memory\n"); */
diff --git a/src/xgi_driver.c b/src/xgi_driver.c
index b4f83b8..b8b8679 100755
--- a/src/xgi_driver.c
+++ b/src/xgi_driver.c
@@ -54,7 +54,7 @@
 #include "fb.h"
 #include "micmap.h"
 #include "xf86.h"
-#include "xf86Priv.h"
+#include "xf86Module.h"
 #include "xf86_OSproc.h"
 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
 #include "xf86Resources.h"
@@ -106,6 +106,10 @@
 #include <unistd.h>
 #endif
 
+#ifndef DEFAULT_DPI
+#define DEFAULT_DPI 96
+#endif
+
 /* Jong 01/22/2009; compiler error; type conflict */
 /*
 #include <fcntl.h>
@@ -556,13 +560,13 @@ XGIFreeRec(ScrnInfoPtr pScrn)
              * head.
              */
             if (pXGIEnt->BIOS)
-                xfree(pXGIEnt->BIOS);
+                free(pXGIEnt->BIOS);
             pXGIEnt->BIOS = pXGI->BIOS = NULL;
             if (pXGIEnt->XGI_Pr)
-                xfree(pXGIEnt->XGI_Pr);
+                free(pXGIEnt->XGI_Pr);
             pXGIEnt->XGI_Pr = pXGI->XGI_Pr = NULL;
             if (pXGIEnt->RenderAccelArray)
-                xfree(pXGIEnt->RenderAccelArray);
+                free(pXGIEnt->RenderAccelArray);
             pXGIEnt->RenderAccelArray = pXGI->RenderAccelArray = NULL;
         }
         else {
@@ -573,19 +577,19 @@ XGIFreeRec(ScrnInfoPtr pScrn)
     }
     else {
         if (pXGI->BIOS)
-            xfree(pXGI->BIOS);
+            free(pXGI->BIOS);
         pXGI->BIOS = NULL;
         if (pXGI->XGI_Pr)
-            xfree(pXGI->XGI_Pr);
+            free(pXGI->XGI_Pr);
         pXGI->XGI_Pr = NULL;
         if (pXGI->RenderAccelArray)
-            xfree(pXGI->RenderAccelArray);
+            free(pXGI->RenderAccelArray);
         pXGI->RenderAccelArray = NULL;
     }
 
 #ifdef XGIMERGED
     if (pXGI->MetaModes)
-        xfree(pXGI->MetaModes);
+        free(pXGI->MetaModes);
     pXGI->MetaModes = NULL;
 
     if (pXGI->CRT1Modes) {
@@ -595,8 +599,8 @@ XGIFreeRec(ScrnInfoPtr pScrn)
                 do {
                     DisplayModePtr p = pScrn->currentMode->next;
                     if (pScrn->currentMode->Private)
-                        xfree(pScrn->currentMode->Private);
-                    xfree(pScrn->currentMode);
+                        free(pScrn->currentMode->Private);
+                    free(pScrn->currentMode);
                     pScrn->currentMode = p;
                 } while (pScrn->currentMode != pScrn->modes);
             }
@@ -612,7 +616,7 @@ XGIFreeRec(ScrnInfoPtr pScrn)
     pXGI->pVbe = NULL;
     if (pScrn->driverPrivate == NULL)
         return;
-    xfree(pScrn->driverPrivate);
+    free(pScrn->driverPrivate);
     pScrn->driverPrivate = NULL;
 }
 
@@ -975,7 +979,7 @@ XGIProbe(DriverPtr drv, int flags)
                                     numDevSections, drv, &usedChips);
 
     /* Free it since we don't need that list after this */
-    xfree(devSections);
+    free(devSections);
     if (numUsed <= 0)
         return FALSE;
 
@@ -1015,7 +1019,7 @@ XGIProbe(DriverPtr drv, int flags)
 
 #endif
         }
-    xfree(usedChips);
+    free(usedChips);
 
     return foundScreen;
 }
@@ -1044,11 +1048,11 @@ XGICopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest,
 
 	ErrorF("XGICopyModeNLink()...Use Virtual Size-1\n");
 
-    if (!((mode = xalloc(sizeof(DisplayModeRec)))))
+    if (!((mode = malloc(sizeof(DisplayModeRec)))))
         return dest;
     memcpy(mode, i, sizeof(DisplayModeRec));
-    if (!((mode->Private = xalloc(sizeof(XGIMergedDisplayModeRec))))) {
-        xfree(mode);
+    if (!((mode->Private = malloc(sizeof(XGIMergedDisplayModeRec))))) {
+        free(mode);
         return dest;
     }
     ((XGIMergedDisplayModePtr) mode->Private)->CRT1 = i;
@@ -1125,8 +1129,8 @@ XGICopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest,
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                    "Skipped %dx%d, not enough video RAM or beyond hardware specs\n",
                    mode->HDisplay, mode->VDisplay);
-        xfree(mode->Private);
-        xfree(mode);
+        free(mode->Private);
+        free(mode);
 
         return dest;
     }
@@ -1559,10 +1563,10 @@ XGIFreeCRT2Structs(XGIPtr pXGI)
                                    pXGI->CRT2pScrn->monitor->Modes);
             }
             if (pXGI->CRT2pScrn->monitor->DDC)
-                xfree(pXGI->CRT2pScrn->monitor->DDC);
-            xfree(pXGI->CRT2pScrn->monitor);
+                free(pXGI->CRT2pScrn->monitor->DDC);
+            free(pXGI->CRT2pScrn->monitor);
         }
-        xfree(pXGI->CRT2pScrn);
+        free(pXGI->CRT2pScrn);
         pXGI->CRT2pScrn = NULL;
     }
 }
@@ -2438,7 +2442,7 @@ XGIDDCPreInit(ScrnInfoPtr pScrn)
 
 #ifdef XGIMERGED
     if (pXGI->MergedFB) {
-        pXGI->CRT2pScrn->monitor = xalloc(sizeof(MonRec));
+        pXGI->CRT2pScrn->monitor = malloc(sizeof(MonRec));
         if (pXGI->CRT2pScrn->monitor) {
             DisplayModePtr tempm = NULL, currentm = NULL, newm = NULL;
             memcpy(pXGI->CRT2pScrn->monitor, pScrn->monitor, sizeof(MonRec));
@@ -2446,11 +2450,11 @@ XGIDDCPreInit(ScrnInfoPtr pScrn)
             pXGI->CRT2pScrn->monitor->Modes = NULL;
             tempm = pScrn->monitor->Modes;
             while (tempm) {
-                if (!(newm = xalloc(sizeof(DisplayModeRec))))
+                if (!(newm = malloc(sizeof(DisplayModeRec))))
                     break;
                 memcpy(newm, tempm, sizeof(DisplayModeRec));
-                if (!(newm->name = xalloc(strlen(tempm->name) + 1))) {
-                    xfree(newm);
+                if (!(newm->name = malloc(strlen(tempm->name) + 1))) {
+                    free(newm);
                     break;
                 }
                 strcpy(newm->name, tempm->name);
@@ -2490,7 +2494,7 @@ XGIDDCPreInit(ScrnInfoPtr pScrn)
                         "Failed to allocate memory for CRT2 monitor, %s.\n",
                         mergeddisstr);
             if (pXGI->CRT2pScrn)
-                xfree(pXGI->CRT2pScrn);
+                free(pXGI->CRT2pScrn);
             pXGI->CRT2pScrn = NULL;
             pXGI->MergedFB = FALSE;
         }
@@ -3540,7 +3544,7 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
         /* Do some MergedFB mode initialisation */
 #ifdef XGIMERGED
         if (pXGI->MergedFB) {
-        pXGI->CRT2pScrn = xalloc(sizeof(ScrnInfoRec));
+        pXGI->CRT2pScrn = malloc(sizeof(ScrnInfoRec));
         if (!pXGI->CRT2pScrn) {
             XGIErrorLog(pScrn,
                         "Failed to allocate memory for 2nd pScrn, %s\n",
@@ -3586,7 +3590,7 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
                     XGIErrorLog(pScrn, mergednocrt1, mergeddisstr);
                 }
                 if (pXGI->CRT2pScrn)
-                    xfree(pXGI->CRT2pScrn);
+                    free(pXGI->CRT2pScrn);
                 pXGI->CRT2pScrn = NULL;
                 pXGI->MergedFB = FALSE;
             }
@@ -3627,7 +3631,7 @@ XGIPreInit(ScrnInfoPtr pScrn, int flags)
                 XGIErrorLog(pScrn, mergednocrt2, mergeddisstr);
             }
             if (pXGI->CRT2pScrn)
-                xfree(pXGI->CRT2pScrn);
+                free(pXGI->CRT2pScrn);
             pXGI->CRT2pScrn = NULL;
             pXGI->MergedFB = FALSE;
         }
@@ -4901,7 +4905,7 @@ XGIScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
     if (pXGI->ShadowFB) {
         pXGI->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
-        pXGI->ShadowPtr = xalloc(pXGI->ShadowPitch * height);
+        pXGI->ShadowPtr = malloc(pXGI->ShadowPitch * height);
         displayWidth = pXGI->ShadowPitch / (pScrn->bitsPerPixel >> 3);
         FBStart = pXGI->ShadowPtr;
     }
@@ -5777,17 +5781,17 @@ XGICloseScreen(int scrnIndex, ScreenPtr pScreen)
     }
 
     if (pXGI->ShadowPtr) {
-        xfree(pXGI->ShadowPtr);
+        free(pXGI->ShadowPtr);
         pXGI->ShadowPtr = NULL;
     }
 
     if (pXGI->DGAModes) {
-        xfree(pXGI->DGAModes);
+        free(pXGI->DGAModes);
         pXGI->DGAModes = NULL;
     }
 
     if (pXGI->adaptor) {
-        xfree(pXGI->adaptor);
+        free(pXGI->adaptor);
         pXGI->adaptor = NULL;
         pXGI->ResetXv = pXGI->ResetXvGamma = NULL;
     }
diff --git a/src/xgi_opt.c b/src/xgi_opt.c
index 09346e4..c0608d5 100755
--- a/src/xgi_opt.c
+++ b/src/xgi_opt.c
@@ -195,7 +195,7 @@ xgiOptions(ScrnInfoPtr pScrn)
     xf86CollectOptions(pScrn, NULL);
 
     /* Process the options */
-    if(!(pXGI->Options = xalloc(sizeof(XGIOptions)))) return;
+    if(!(pXGI->Options = malloc(sizeof(XGIOptions)))) return;
 
     memcpy(pXGI->Options, XGIOptions, sizeof(XGIOptions));
 
diff --git a/src/xgi_setup.c b/src/xgi_setup.c
index c1d2cdc..6641b09 100755
--- a/src/xgi_setup.c
+++ b/src/xgi_setup.c
@@ -678,7 +678,7 @@ bAccessVGAPCIInfo(PXGI_HW_DEVICE_INFO pHwDevInfo, ULONG ulOffset, ULONG ulSet, U
 	err = pci_device_cfg_write_u32(pXGI->PciInfo, *pulValue,
 				       ulOffset & ~3);
     } else {
-	err = pci_device_cfg_write_u32(pXGI->PciInfo, pulValue,
+	err = pci_device_cfg_read_u32(pXGI->PciInfo, pulValue,
 				       ulOffset & ~3);
     }
 
diff --git a/src/xgi_video.c b/src/xgi_video.c
index 31cffd5..df76d14 100755
--- a/src/xgi_video.c
+++ b/src/xgi_video.c
@@ -142,7 +142,7 @@ void XGIInitVideo(ScreenPtr pScreen)
             adaptors = &newAdaptor;
         } else {
             newAdaptors =  /* need to free this someplace */
-                xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
+                malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
             if(newAdaptors) {
                 memcpy(newAdaptors, adaptors, num_adaptors *
                                         sizeof(XF86VideoAdaptorPtr));
@@ -157,7 +157,7 @@ void XGIInitVideo(ScreenPtr pScreen)
         xf86XVScreenInit(pScreen, adaptors, num_adaptors);
 
     if(newAdaptors)
-        xfree(newAdaptors);
+        free(newAdaptors);
 
 }
 
@@ -395,7 +395,7 @@ XGISetupImageVideo(ScreenPtr pScreen)
     struct v4l2_standard 	standard;
 # endif//VC    
 
-    if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
+    if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
                             sizeof(XGIPortPrivRec) +
                             sizeof(DevUnion))))
         return NULL;