recipes: xorg/driver/*: Fix build issues by fixing old cpp macros references
[dragora.git] / patches / xf86-video-nv / fix-old-cpp-macros_nv.patch
blob56fdad10832b8215b0f8efaa36cf93a799b5f98f
1 Upstream: no (Too lazy)
2 Reason: Fixes building the package by getting rid of old cpp macros
3 that are no longer accepted
4 diff --git a/src/g80_driver.c b/src/g80_driver.c
5 index 719b96c..3b8e55b 100644
6 --- a/src/g80_driver.c
7 +++ b/src/g80_driver.c
8 @@ -151,7 +151,7 @@ G80PreInit(ScrnInfoPtr pScrn, int flags)
10 G80Ptr pNv;
11 EntityInfoPtr pEnt;
12 -#if XSERVER_LIBPCIACCESS
13 +#if defined(XSERVER_LIBPCIACCESS)
14 struct pci_device *pPci;
15 int err;
16 void *p;
17 @@ -184,14 +184,14 @@ G80PreInit(ScrnInfoPtr pScrn, int flags)
18 pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
19 if(pEnt->location.type != BUS_PCI) goto fail;
20 pPci = xf86GetPciInfoForEntity(pEnt->index);
21 -#if XSERVER_LIBPCIACCESS
22 +#if defined(XSERVER_LIBPCIACCESS)
23 /* Need this to unmap */
24 pNv->pPci = pPci;
25 #endif
26 primary = xf86IsPrimaryPci(pPci);
28 /* The ROM size sometimes isn't read correctly, so fix it up here. */
29 -#if XSERVER_LIBPCIACCESS
30 +#if defined(XSERVER_LIBPCIACCESS)
31 if(pPci->rom_size == 0)
32 /* The BIOS is 64k */
33 pPci->rom_size = 64 * 1024;
34 @@ -304,7 +304,7 @@ G80PreInit(ScrnInfoPtr pScrn, int flags)
35 pScrn->memPhysBase = MEMBASE(pPci, 1);
36 pScrn->fbOffset = 0;
38 -#if XSERVER_LIBPCIACCESS
39 +#if defined(XSERVER_LIBPCIACCESS)
40 err = pci_device_map_range(pPci, pPci->regions[0].base_addr, G80_REG_SIZE,
41 PCI_DEV_MAP_FLAG_WRITABLE, &p);
42 if(err) {
43 @@ -336,7 +336,7 @@ G80PreInit(ScrnInfoPtr pScrn, int flags)
45 /* Determine the size of BAR1 */
46 /* Some configs have BAR1 < total RAM < 256 MB */
47 -#if XSERVER_LIBPCIACCESS
48 +#if defined(XSERVER_LIBPCIACCESS)
49 BAR1sizeKB = pPci->regions[1].size / 1024;
50 #else
51 BAR1sizeKB = 1UL << (pPci->size[1] - 10);
52 @@ -366,7 +366,7 @@ G80PreInit(ScrnInfoPtr pScrn, int flags)
53 xf86DrvMsg(pScrn->scrnIndex, X_PROBED, " Mapped memory: %.1f MB\n",
54 pScrn->videoRam / 1024.0);
56 -#if XSERVER_LIBPCIACCESS
57 +#if defined(XSERVER_LIBPCIACCESS)
58 err = pci_device_map_range(pPci, pPci->regions[1].base_addr,
59 pScrn->videoRam * 1024,
60 PCI_DEV_MAP_FLAG_WRITABLE |
61 @@ -521,7 +521,7 @@ G80CloseScreen(CLOSE_SCREEN_ARGS_DECL)
63 if(xf86ServerIsExiting()) {
64 if(pNv->int10) xf86FreeInt10(pNv->int10);
65 -#if XSERVER_LIBPCIACCESS
66 +#if defined(XSERVER_LIBPCIACCESS)
67 pci_device_unmap_range(pNv->pPci, pNv->mem, pNv->videoRam * 1024);
68 pci_device_unmap_range(pNv->pPci, (void*)pNv->reg, G80_REG_SIZE);
69 #else
70 diff --git a/src/g80_type.h b/src/g80_type.h
71 index f4b73a3..5b1f975 100644
72 --- a/src/g80_type.h
73 +++ b/src/g80_type.h
74 @@ -41,7 +41,7 @@ typedef enum AccelMethod {
75 } AccelMethod;
77 typedef struct G80Rec {
78 -#if XSERVER_LIBPCIACCESS
79 +#if defined(XSERVER_LIBPCIACCESS)
80 struct pci_device *pPci;
81 #endif
82 volatile CARD32 * reg;
83 diff --git a/src/nv_const.h b/src/nv_const.h
84 index 8f9799c..b0cc14f 100644
85 --- a/src/nv_const.h
86 +++ b/src/nv_const.h
87 @@ -6,7 +6,7 @@
88 #define NV_DRIVER_NAME "nv"
90 /* libpciaccess gratuitous API changes */
91 -#if XSERVER_LIBPCIACCESS
92 +#if defined(XSERVER_LIBPCIACCESS)
93 #define MEMBASE(p,n) (p)->regions[n].base_addr
94 #define VENDOR_ID(p) (p)->vendor_id
95 #define DEVICE_ID(p) (p)->device_id
96 diff --git a/src/nv_dac.c b/src/nv_dac.c
97 index 2269ae3..8d79ed8 100644
98 --- a/src/nv_dac.c
99 +++ b/src/nv_dac.c
100 @@ -42,7 +42,7 @@ NVDACPanelTweaks(NVPtr pNv, NVRegPtr state)
101 we can do is experiment and apply hacks. */
103 if(((pNv->Chipset & 0xffff) == 0x0328) && (state->bpp == 32)) {
104 -#if XSERVER_LIBPCIACCESS
105 +#if defined(XSERVER_LIBPCIACCESS)
106 if (((pNv->PciInfo->subvendor_id & 0xffff) == 0x1179) &&
107 ((pNv->PciInfo->subdevice_id & 0xffff) == 0x0020))
108 #else
109 diff --git a/src/nv_driver.c b/src/nv_driver.c
110 index 3a74038..cf185f8 100644
111 --- a/src/nv_driver.c
112 +++ b/src/nv_driver.c
113 @@ -43,7 +43,7 @@ Bool G80GetScrnInfoRec(PciChipsets *chips, int chip);
114 /* Mandatory functions */
115 static const OptionInfoRec * NVAvailableOptions(int chipid, int busid);
116 static void NVIdentify(int flags);
117 -#if XSERVER_LIBPCIACCESS
118 +#if defined(XSERVER_LIBPCIACCESS)
119 static Bool NVPciProbe(DriverPtr, int entity, struct pci_device*, intptr_t data);
120 #else
121 static Bool NVProbe(DriverPtr drv, int flags);
122 @@ -76,7 +76,7 @@ static void NVRestore(ScrnInfoPtr pScrn);
123 static Bool NVModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
124 static Bool NVSetModeVBE(ScrnInfoPtr pScrn, DisplayModePtr pMode);
126 -#if XSERVER_LIBPCIACCESS
127 +#if defined(XSERVER_LIBPCIACCESS)
128 /* For now, just match any NVIDIA display device and sort through them in the
129 * probe routine */
131 @@ -109,7 +109,7 @@ _X_EXPORT DriverRec NV = {
132 NV_VERSION,
133 NV_DRIVER_NAME,
134 NVIdentify,
135 -#if XSERVER_LIBPCIACCESS
136 +#if defined(XSERVER_LIBPCIACCESS)
137 NULL,
138 #else
139 NVProbe,
140 @@ -118,7 +118,7 @@ _X_EXPORT DriverRec NV = {
141 NULL,
143 NULL,
144 -#if XSERVER_LIBPCIACCESS
145 +#if defined(XSERVER_LIBPCIACCESS)
146 NVPciIdMatchList,
147 NVPciProbe,
148 #endif
149 @@ -712,7 +712,7 @@ nvSetup(pointer module, pointer opts, int *errmaj, int *errmin)
150 if (!setupDone) {
151 setupDone = TRUE;
152 xf86AddDriver(&NV, module,
153 -#if XSERVER_LIBPCIACCESS
154 +#if defined(XSERVER_LIBPCIACCESS)
155 HaveDriverFuncs
156 #else
158 @@ -785,14 +785,14 @@ NVGetScrnInfoRec(PciChipsets *chips, int chip)
161 static CARD32
162 -#if XSERVER_LIBPCIACCESS
163 +#if defined(XSERVER_LIBPCIACCESS)
164 NVGetPCIXpressChip (struct pci_device *dev)
165 #else
166 NVGetPCIXpressChip (pciVideoPtr pVideo)
167 #endif
169 volatile CARD32 *regs;
170 -#if XSERVER_LIBPCIACCESS
171 +#if defined(XSERVER_LIBPCIACCESS)
172 uint32_t pciid, pcicmd;
173 void *tmp;
175 @@ -902,7 +902,7 @@ NVIsSupported(CARD32 id)
178 /* Mandatory */
179 -#if XSERVER_LIBPCIACCESS
180 +#if defined(XSERVER_LIBPCIACCESS)
181 static Bool
182 NVPciProbe(DriverPtr drv, int entity, struct pci_device *dev, intptr_t data)
184 @@ -2097,7 +2097,7 @@ NVMapMem(ScrnInfoPtr pScrn)
186 NVPtr pNv = NVPTR(pScrn);
188 -#if XSERVER_LIBPCIACCESS
189 +#if defined(XSERVER_LIBPCIACCESS)
190 void *tmp;
192 pci_device_map_range(pNv->PciInfo, pNv->FbAddress, pNv->FbMapSize,
193 @@ -2144,7 +2144,7 @@ NVUnmapMem(ScrnInfoPtr pScrn)
195 pNv = NVPTR(pScrn);
197 -#if XSERVER_LIBPCIACCESS
198 +#if defined(XSERVER_LIBPCIACCESS)
199 pci_device_unmap_range(pNv->PciInfo, pNv->FbBase, pNv->FbMapSize);
200 #else
201 xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pNv->FbBase, pNv->FbMapSize);
202 diff --git a/src/nv_hw.c b/src/nv_hw.c
203 index 9291912..90c7ac7 100644
204 --- a/src/nv_hw.c
205 +++ b/src/nv_hw.c
206 @@ -653,7 +653,7 @@ static void nv30UpdateArbitrationSettings (
207 *lwm = graphics_lwm >> 3;
210 -#if XSERVER_LIBPCIACCESS
211 +#if defined(XSERVER_LIBPCIACCESS)
212 static inline uint32_t
213 pciaccessReadLong(struct pci_device *const dev, pciaddr_t offset) {
214 uint32_t tmp;
215 @@ -670,7 +670,7 @@ static void nForceUpdateArbitrationSettings (
216 NVPtr pNv
219 -#if XSERVER_LIBPCIACCESS
220 +#if defined(XSERVER_LIBPCIACCESS)
221 struct pci_device *const dev1 = pci_device_find_by_slot(0, 0, 0, 1);
222 struct pci_device *const dev2 = pci_device_find_by_slot(0, 0, 0, 2);
223 struct pci_device *const dev3 = pci_device_find_by_slot(0, 0, 0, 3);
224 diff --git a/src/nv_setup.c b/src/nv_setup.c
225 index 92ca3ec..8c57675 100644
226 --- a/src/nv_setup.c
227 +++ b/src/nv_setup.c
228 @@ -287,7 +287,7 @@ static void nv10GetConfig (NVPtr pNv)
230 #endif
232 -#if XSERVER_LIBPCIACCESS
233 +#if defined(XSERVER_LIBPCIACCESS)
235 /* [AGP]: I don't know if this is correct */
236 struct pci_device *dev = pci_device_find_by_slot(0, 0, 0, 1);
237 @@ -346,7 +346,7 @@ NVCommonSetup(ScrnInfoPtr pScrn)
238 int FlatPanel = -1; /* really means the CRTC is slaved */
239 Bool Television = FALSE;
240 void *tmp;
241 -#if XSERVER_LIBPCIACCESS
242 +#if defined(XSERVER_LIBPCIACCESS)
243 int err;
244 #endif
246 @@ -378,7 +378,7 @@ NVCommonSetup(ScrnInfoPtr pScrn)
247 pVga->MMIOBase = (CARD8 *)pNv;
248 pVga->MMIOOffset = 0;
250 -#if XSERVER_LIBPCIACCESS
251 +#if defined(XSERVER_LIBPCIACCESS)
252 err = pci_device_map_range(pNv->PciInfo, pNv->IOAddress, 0x01000000,
253 PCI_DEV_MAP_FLAG_WRITABLE, &tmp);
254 if (err != 0) {
255 diff --git a/src/nv_type.h b/src/nv_type.h
256 index e705d4c..68ca210 100644
257 --- a/src/nv_type.h
258 +++ b/src/nv_type.h
259 @@ -78,7 +78,7 @@ typedef struct {
260 CARD32 Architecture;
261 CARD32 CursorStart;
262 EntityInfoPtr pEnt;
263 -#if XSERVER_LIBPCIACCESS
264 +#if defined(XSERVER_LIBPCIACCESS)
265 struct pci_device *PciInfo;
266 #else
267 pciVideoPtr PciInfo;
268 diff --git a/src/riva_driver.c b/src/riva_driver.c
269 index 759501e..910e63d 100644
270 --- a/src/riva_driver.c
271 +++ b/src/riva_driver.c
272 @@ -825,7 +825,7 @@ RivaMapMem(ScrnInfoPtr pScrn)
274 * Map IO registers to virtual address space
276 -#if XSERVER_LIBPCIACCESS
277 +#if defined(XSERVER_LIBPCIACCESS)
278 void *tmp;
280 pci_device_map_range(pRiva->PciInfo, pRiva->IOAddress, 0x1000000,
281 @@ -890,7 +890,7 @@ RivaUnmapMem(ScrnInfoPtr pScrn)
283 * Unmap IO registers to virtual address space
285 -#if XSERVER_LIBPCIACCESS
286 +#if defined(XSERVER_LIBPCIACCESS)
287 pci_device_unmap_range(pRiva->PciInfo, pRiva->IOBase, 0x1000000);
288 pci_device_unmap_range(pRiva->PciInfo, pRiva->FbBase, pRiva->FbMapSize);
289 #else
290 diff --git a/src/riva_setup.c b/src/riva_setup.c
291 index 533f6e8..602e6dc 100644
292 --- a/src/riva_setup.c
293 +++ b/src/riva_setup.c
294 @@ -233,7 +233,7 @@ Riva3Setup(ScrnInfoPtr pScrn)
295 pRiva->riva.EnableIRQ = 0;
296 pRiva->riva.IO = VGA_IOBASE_COLOR;
298 -#if XSERVER_LIBPCIACCESS
299 +#if defined(XSERVER_LIBPCIACCESS)
300 #define MAP(ptr, offset, size) { \
301 void *tmp; \
302 pci_device_map_range(pRiva->PciInfo, (offset), (size), \
303 diff --git a/src/riva_type.h b/src/riva_type.h
304 index 4adeb2b..ee999c8 100644
305 --- a/src/riva_type.h
306 +++ b/src/riva_type.h
307 @@ -53,7 +53,7 @@ typedef struct {
308 RIVA_HW_STATE SavedReg;
309 RIVA_HW_STATE ModeReg;
310 EntityInfoPtr pEnt;
311 -#if XSERVER_LIBPCIACCESS
312 +#if defined(XSERVER_LIBPCIACCESS)
313 struct pci_device *PciInfo;
314 #else
315 pciVideoPtr PciInfo;
316 diff --git a/src/nv_driver.c b/src/nv_driver.c
317 index cf185f8..d35af55 100644
318 --- a/src/nv_driver.c
319 +++ b/src/nv_driver.c
320 @@ -766,7 +766,7 @@ NVGetScrnInfoRec(PciChipsets *chips, int chip)
321 pScrn->driverName = NV_DRIVER_NAME;
322 pScrn->name = NV_NAME;
324 -#if !XSERVER_LIBPCIACCESS
325 +#ifndef XSERVER_LIBPCIACCESS
326 pScrn->Probe = NVProbe;
327 #endif
328 pScrn->PreInit = NVPreInit;
329 @@ -1390,7 +1390,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
331 /* Find the PCI info for this screen */
332 pNv->PciInfo = xf86GetPciInfoForEntity(pNv->pEnt->index);
333 -#if !XSERVER_LIBPCIACCESS
334 +#ifndef XSERVER_LIBPCIACCESS
335 pNv->PciTag = pciTag(pNv->PciInfo->bus, pNv->PciInfo->device,
336 pNv->PciInfo->func);
337 #endif
338 diff --git a/src/riva_driver.c b/src/riva_driver.c
339 index 910e63d..a365380 100644
340 --- a/src/riva_driver.c
341 +++ b/src/riva_driver.c
342 @@ -385,7 +385,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
344 /* Find the PCI info for this screen */
345 pRiva->PciInfo = xf86GetPciInfoForEntity(pRiva->pEnt->index);
346 -#if !XSERVER_LIBPCIACCESS
347 +#ifndef XSERVER_LIBPCIACCESS
348 pRiva->PciTag = pciTag(pRiva->PciInfo->bus, pRiva->PciInfo->device,
349 pRiva->PciInfo->func);
350 #endif