fix-old-cpp-macros_nv.patch 11 KB

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