summaryrefslogtreecommitdiffstats
path: root/meta-moblin
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2009-02-05 14:06:34 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2009-02-05 14:06:34 +0000
commit31ab259720d9a776da2e6244ac559ba25c3f9d37 (patch)
tree8974a3ec248c6d561588d33d287341c05e8978c7 /meta-moblin
parenta1b17ee0ceb7d443c6a7943947eca8009feba2fb (diff)
downloadpoky-31ab259720d9a776da2e6244ac559ba25c3f9d37.tar.gz
xf86-video-psb: Update to work with modern xservers
Diffstat (limited to 'meta-moblin')
-rw-r--r--meta-moblin/packages/xorg-driver/files/104_disable_locks.diff49
-rw-r--r--meta-moblin/packages/xorg-driver/files/pci.patch627
-rw-r--r--meta-moblin/packages/xorg-driver/xf86-video-psb_git.bb9
3 files changed, 677 insertions, 8 deletions
diff --git a/meta-moblin/packages/xorg-driver/files/104_disable_locks.diff b/meta-moblin/packages/xorg-driver/files/104_disable_locks.diff
index 1f0a5ba9c2..4b25517d58 100644
--- a/meta-moblin/packages/xorg-driver/files/104_disable_locks.diff
+++ b/meta-moblin/packages/xorg-driver/files/104_disable_locks.diff
@@ -1,8 +1,36 @@
1Index: git/src/psb_driver.c 1Index: git/src/psb_driver.c
2=================================================================== 2===================================================================
3--- git.orig/src/psb_driver.c 2008-12-12 15:14:28.000000000 +0000 3--- git.orig/src/psb_driver.c 2009-02-05 13:28:59.000000000 +0000
4+++ git/src/psb_driver.c 2008-12-30 14:18:16.000000000 +0000 4+++ git/src/psb_driver.c 2009-02-05 13:28:59.000000000 +0000
5@@ -1326,7 +1326,7 @@ 5@@ -325,7 +325,7 @@
6
7 if (!Initialised) {
8 Initialised = TRUE;
9- xf86AddDriver(&psb, Module, 0);
10+ xf86AddDriver(&psb, Module, HaveDriverFuncs);
11 LoaderRefSymLists(fbSymbols, ddcSymbols, shadowSymbols,
12 psbvgahwSymbols,
13 #ifdef XF86DRI
14@@ -839,6 +839,9 @@
15 xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Linear framebuffer at 0x%lX\n",
16 (unsigned long)pScrn->memPhysBase);
17
18+
19+ pDevice->PciInfo = xf86GetPciInfoForEntity(pDevice->pEnt->index);
20+
21 /* color weight */
22 if (!xf86SetWeight(pScrn, rzeros, rzeros)) {
23 return (FALSE);
24@@ -1030,7 +1033,7 @@
25 return FALSE;
26
27 pDevice->regPhys = pDevice->PciInfo->regions[0].base_addr;
28- pDevice->regSize = 1 << pDevice->PciInfo->regions[0].size;
29+ pDevice->regSize = pDevice->PciInfo->regions[0].size;
30
31 pDevice->regMap = xf86MapVidMem(scrnIndex, VIDMEM_MMIO_32BIT,
32 pDevice->regPhys, pDevice->regSize);
33@@ -1303,7 +1306,7 @@
6 34
7 pScrn->pScreen = pScreen; 35 pScrn->pScreen = pScreen;
8 36
@@ -11,7 +39,7 @@ Index: git/src/psb_driver.c
11 pPsb->front = psbScanoutCreate(pScrn, pScrn->bitsPerPixel >> 3, 39 pPsb->front = psbScanoutCreate(pScrn, pScrn->bitsPerPixel >> 3,
12 pScrn->depth, pScrn->virtualX, 40 pScrn->depth, pScrn->virtualX,
13 pScrn->virtualY, 0, -1, 0); 41 pScrn->virtualY, 0, -1, 0);
14@@ -1489,7 +1489,9 @@ 42@@ -1466,7 +1469,9 @@
15 43
16 return psbEnterVT(pScreen->myNum, 0); 44 return psbEnterVT(pScreen->myNum, 0);
17 out_err_unlock: 45 out_err_unlock:
@@ -21,3 +49,16 @@ Index: git/src/psb_driver.c
21 out_err: 49 out_err:
22 psbRestoreHWState(pDevice); 50 psbRestoreHWState(pDevice);
23 return FALSE; 51 return FALSE;
52Index: git/src/psb_ioctl.c
53===================================================================
54--- git.orig/src/psb_ioctl.c 2009-02-05 13:43:39.000000000 +0000
55+++ git/src/psb_ioctl.c 2009-02-05 13:44:14.000000000 +0000
56@@ -167,7 +167,7 @@
57 buf->size = rep->size;
58 buf->offset = rep->offset;
59 buf->mapHandle = rep->arg_handle;
60- buf->mask = rep->mask;
61+ buf->mask = rep->proposed_flags;
62 buf->start = rep->buffer_start;
63 buf->fenceFlags = rep->fence_flags;
64 buf->replyFlags = rep->rep_flags;
diff --git a/meta-moblin/packages/xorg-driver/files/pci.patch b/meta-moblin/packages/xorg-driver/files/pci.patch
new file mode 100644
index 0000000000..2bdf43158f
--- /dev/null
+++ b/meta-moblin/packages/xorg-driver/files/pci.patch
@@ -0,0 +1,627 @@
1Index: git/configure.ac
2===================================================================
3--- git.orig/configure.ac 2008-12-12 15:14:28.000000000 +0000
4+++ git/configure.ac 2009-02-04 16:38:32.000000000 +0000
5@@ -1,3 +1,4 @@
6+AC_DEFUN(CC_AC_CHECK_FILE, $2)
7 # Copyright 2005 Adam Jackson.
8 #
9 # Permission is hereby granted, free of charge, to any person obtaining a
10@@ -65,17 +66,19 @@
11 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto xf86dgaproto $REQUIRED_MODULES])
12 sdkdir=$(pkg-config --variable=sdkdir xorg-server)
13
14+PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
15+
16 # Checks for libraries.
17
18 # Checks for header files.
19 AC_HEADER_STDC
20
21 if test "$DRI" != no; then
22- AC_CHECK_FILE([${sdkdir}/dri.h],
23+ CC_AC_CHECK_FILE([${sdkdir}/dri.h],
24 [have_dri_h="yes"], [have_dri_h="no"])
25- AC_CHECK_FILE([${sdkdir}/sarea.h],
26+ CC_AC_CHECK_FILE([${sdkdir}/sarea.h],
27 [have_sarea_h="yes"], [have_sarea_h="no"])
28- AC_CHECK_FILE([${sdkdir}/dristruct.h],
29+ CC_AC_CHECK_FILE([${sdkdir}/dristruct.h],
30 [have_dristruct_h="yes"], [have_dristruct_h="no"])
31 fi
32
33Index: git/exa/exa.c
34===================================================================
35--- git.orig/exa/exa.c 2008-12-12 15:14:28.000000000 +0000
36+++ git/exa/exa.c 2009-02-04 16:38:32.000000000 +0000
37@@ -44,7 +44,6 @@
38 #include "exa.h"
39 #include "cw.h"
40
41-static int exaGeneration;
42 int exaScreenPrivateIndex;
43 int exaPixmapPrivateIndex;
44
45@@ -239,7 +238,7 @@
46 * for scratch pixmaps, or to represent the visible screen.
47 */
48 static PixmapPtr
49-exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
50+exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, int usage_hint)
51 {
52 PixmapPtr pPixmap;
53 ExaPixmapPrivPtr pExaPixmap;
54@@ -249,7 +248,7 @@
55 if (w > 32767 || h > 32767)
56 return NullPixmap;
57
58- pPixmap = fbCreatePixmap (pScreen, w, h, depth);
59+ pPixmap = fbCreatePixmap (pScreen, w, h, depth, usage_hint);
60 if (!pPixmap)
61 return NULL;
62 pExaPixmap = ExaGetPixmapPriv(pPixmap);
63@@ -606,12 +605,6 @@
64 #ifdef RENDER
65 ps = GetPictureScreenIfSet(pScreen);
66 #endif
67- if (exaGeneration != serverGeneration)
68- {
69- exaScreenPrivateIndex = AllocateScreenPrivateIndex();
70- exaPixmapPrivateIndex = AllocatePixmapPrivateIndex();
71- exaGeneration = serverGeneration;
72- }
73
74 pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1);
75
76@@ -623,7 +616,7 @@
77
78 pExaScr->info = pScreenInfo;
79
80- pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr;
81+ dixSetPrivate(&pScreen->devPrivates, &exaScreenPrivateIndex, pExaScr);
82
83 pExaScr->migration = ExaMigrationAlways;
84
85Index: git/exa/exa_priv.h
86===================================================================
87--- git.orig/exa/exa_priv.h 2008-12-12 15:14:28.000000000 +0000
88+++ git/exa/exa_priv.h 2009-02-04 16:38:32.000000000 +0000
89@@ -129,7 +129,8 @@
90
91 extern int exaScreenPrivateIndex;
92 extern int exaPixmapPrivateIndex;
93-#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)(s)->devPrivates[exaScreenPrivateIndex].ptr)
94+
95+#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr) dixLookupPrivate(&s->devPrivates, &exaScreenPrivateIndex))
96 #define ExaScreenPriv(s) ExaScreenPrivPtr pExaScr = ExaGetScreenPriv(s)
97
98 /** Align an offset to an arbitrary alignment */
99@@ -145,8 +146,8 @@
100 #define EXA_PIXMAP_SCORE_PINNED 1000
101 #define EXA_PIXMAP_SCORE_INIT 1001
102
103-#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)(p)->devPrivates[exaPixmapPrivateIndex].ptr)
104-#define ExaSetPixmapPriv(p,a) ((p)->devPrivates[exaPixmapPrivateIndex].ptr = (pointer) (a))
105+#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixLookupPrivate(&p->devPrivates, &exaPixmapPrivateIndex))
106+#define ExaSetPixmapPriv(p,a) (dixSetPrivate(&p->devPrivates, &exaScreenPrivateIndex, (a)))
107 #define ExaPixmapPriv(p) ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p)
108
109 typedef struct {
110Index: git/exa/exa_render.c
111===================================================================
112--- git.orig/exa/exa_render.c 2008-12-12 15:14:28.000000000 +0000
113+++ git/exa/exa_render.c 2009-02-04 16:38:32.000000000 +0000
114@@ -898,7 +898,7 @@
115 width = extents.x2 - extents.x1;
116 height = extents.y2 - extents.y1;
117 pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
118- maskFormat->depth);
119+ maskFormat->depth, 0);
120 if (!pMaskPixmap)
121 return;
122 component_alpha = NeedsComponent(maskFormat->format);
123@@ -960,7 +960,7 @@
124
125 /* Create the (real) temporary pixmap to store the current glyph in */
126 pPixmap = (*pScreen->CreatePixmap) (pScreen, maxwidth, maxheight,
127- list->format->depth);
128+ list->format->depth, 0);
129 if (!pPixmap)
130 return;
131
132Index: git/exa/examodule.c
133===================================================================
134--- git.orig/exa/examodule.c 2008-12-12 15:14:28.000000000 +0000
135+++ git/exa/examodule.c 2009-02-04 16:38:32.000000000 +0000
136@@ -42,8 +42,7 @@
137 OptionInfoPtr options;
138 } ExaXorgScreenPrivRec, *ExaXorgScreenPrivPtr;
139
140-static int exaXorgServerGeneration;
141-static int exaXorgScreenPrivateIndex;
142+int exaXorgScreenPrivateIndex;
143
144 typedef enum {
145 EXAOPT_MIGRATION_HEURISTIC,
146@@ -69,8 +68,8 @@
147 exaXorgCloseScreen (int i, ScreenPtr pScreen)
148 {
149 ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
150- ExaXorgScreenPrivPtr pScreenPriv =
151- pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr;
152+
153+ ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, &exaXorgScreenPrivateIndex);
154
155 pScreen->CloseScreen = pScreenPriv->SavedCloseScreen;
156
157@@ -86,8 +85,8 @@
158 exaXorgEnableDisableFBAccess (int index, Bool enable)
159 {
160 ScreenPtr pScreen = screenInfo.screens[index];
161- ExaXorgScreenPrivPtr pScreenPriv =
162- pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr;
163+
164+ ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, &exaXorgScreenPrivateIndex);
165
166 if (!enable)
167 exaEnableDisableFBAccess (index, enable);
168@@ -111,11 +110,6 @@
169 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
170 ExaXorgScreenPrivPtr pScreenPriv;
171
172- if (exaXorgServerGeneration != serverGeneration) {
173- exaXorgScreenPrivateIndex = AllocateScreenPrivateIndex();
174- exaXorgServerGeneration = serverGeneration;
175- }
176-
177 pScreenPriv = xcalloc (1, sizeof(ExaXorgScreenPrivRec));
178 if (pScreenPriv == NULL)
179 return;
180@@ -166,7 +160,7 @@
181 pExaScr->info->DownloadFromScreen = NULL;
182 }
183
184- pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr = pScreenPriv;
185+ dixSetPrivate(&pScreen->devPrivates, &exaXorgScreenPrivateIndex, pScreenPriv);
186
187 pScreenPriv->SavedEnableDisableFBAccess = pScrn->EnableDisableFBAccess;
188 pScrn->EnableDisableFBAccess = exaXorgEnableDisableFBAccess;
189Index: git/src/i830_bios.c
190===================================================================
191--- git.orig/src/i830_bios.c 2008-12-12 15:14:28.000000000 +0000
192+++ git/src/i830_bios.c 2009-02-04 16:38:32.000000000 +0000
193@@ -97,7 +97,7 @@
194 INTEL_VBIOS_SIZE);
195 vbeFree(pVbe);
196 } else {
197- xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, INTEL_VBIOS_SIZE);
198+ pci_device_read_rom(pI830->PciInfo, bios);
199 }
200
201 if (0)
202@@ -159,7 +159,7 @@
203 for (bdb_block_off = bdb->header_size; bdb_block_off < bdb->bdb_size;
204 bdb_block_off += block_size) {
205 int start = bdb_off + bdb_block_off;
206- int id, i, num_entries;
207+ int id, num_entries;
208 struct lvds_bdb_1 *lvds1;
209 struct lvds_bdb_2 *lvds2;
210 struct lvds_bdb_2_fp_params *fpparam;
211Index: git/src/psb_dri.c
212===================================================================
213--- git.orig/src/psb_dri.c 2008-12-12 15:14:28.000000000 +0000
214+++ git/src/psb_dri.c 2009-02-04 16:38:32.000000000 +0000
215@@ -139,9 +139,9 @@
216 return;
217
218 pDevice->irq = drmGetInterruptFromBusID(pDevice->drmFD,
219- pDevice->pciInfo->bus,
220- pDevice->pciInfo->device,
221- pDevice->pciInfo->func);
222+ ((pDevice->PciInfo->domain << 8) | pDevice->PciInfo->bus),
223+ pDevice->PciInfo->dev,
224+ pDevice->PciInfo->func);
225 if ((drmCtlInstHandler(pDevice->drmFD, pDevice->irq))) {
226 xf86DrvMsg(-1, X_WARNING, "[drm] Failed to install IRQ handler.\n");
227 pDevice->irq = -1;
228@@ -530,7 +530,6 @@
229 DRIInfoPtr pDRIInfo;
230 PsbDRIPtr pPsbDRI;
231 int major, minor, patch;
232- pciVideoPtr pciInfo;
233
234 PSB_DEBUG(pScrn->scrnIndex, 2, "psbDRIScreenInit\n");
235
236@@ -568,8 +567,8 @@
237 pDRIInfo->clientDriverName = NULL;
238 pDRIInfo->busIdString = xalloc(64);
239 sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
240- pDevice->pciInfo->bus,
241- pDevice->pciInfo->device, pDevice->pciInfo->func);
242+ ((pDevice->PciInfo->domain << 8) | pDevice->PciInfo->bus),
243+ pDevice->PciInfo->dev, pDevice->PciInfo->func);
244 pDRIInfo->ddxDriverMajorVersion = PSB_DRIDDX_VERSION_MAJOR;
245 pDRIInfo->ddxDriverMinorVersion = PSB_DRIDDX_VERSION_MINOR;
246 pDRIInfo->ddxDriverPatchVersion = PSB_DRIDDX_VERSION_PATCH;
247@@ -608,8 +607,8 @@
248 }
249
250 pPsbDRI->pciVendor = PCI_VENDOR_INTEL;
251- pciInfo = xf86GetPciInfoForEntity(pDevice->pEnt->index);
252- pPsbDRI->pciDevice = pciInfo->chipType;
253+ /*pciInfo = xf86GetPciInfoForEntity(pDevice->pEnt->index);*/
254+ pPsbDRI->pciDevice = pDevice->PciInfo->device_id;
255 pPsbDRI->lockSAreaSize = PSB_DRI_LOCK_SAREA_SIZE;
256 #if PSB_LEGACY_DRI
257 pPsbDRI->lockSAreaHandle = 0;
258Index: git/src/psb_driver.c
259===================================================================
260--- git.orig/src/psb_driver.c 2008-12-12 15:14:28.000000000 +0000
261+++ git/src/psb_driver.c 2009-02-04 16:48:40.000000000 +0000
262@@ -58,7 +58,7 @@
263 /* Mandatory functions */
264 static const OptionInfoRec *psbAvailableOptions(int chipid, int busid);
265 static void psbIdentify(int flags);
266-static Bool psbProbe(DriverPtr drv, int flags);
267+static Bool psbProbe(DriverPtr drv, int entity_num, struct pci_device *device, intptr_t match_data);
268 static Bool psbPreInit(ScrnInfoPtr pScrn, int flags);
269 static Bool psbScreenInit(int Index, ScreenPtr pScreen, int argc,
270 char **argv);
271@@ -92,6 +92,13 @@
272 #define makedev(x,y) ((dev_t)(((x) << 8) | (y)))
273 #endif
274
275+
276+static const struct pci_id_match psbDeviceMatch[] = {
277+ { 0x8086, PCI_CHIP_PSB1, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0 },
278+ { 0x8086, PCI_CHIP_PSB2, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0 },
279+ { 0, 0, 0 },
280+};
281+
282 /*
283 * This contains the functions needed by the server after loading the
284 * driver module. It must be supplied, and gets added the driver list by
285@@ -104,10 +111,13 @@
286 PSB_VERSION,
287 PSB_DRIVER_NAME,
288 psbIdentify,
289- psbProbe,
290+ NULL,
291 psbAvailableOptions,
292 NULL,
293- 0
294+ 0,
295+ NULL,
296+ psbDeviceMatch,
297+ psbProbe
298 };
299
300 enum GenericTypes
301@@ -350,122 +360,85 @@
302 * do a minimal probe for supported hardware.
303 */
304
305-static Bool
306-psbProbe(DriverPtr drv, int flags)
307+
308+/*psbProbe(DriverPtr drv, int flags)*/
309+static Bool psbProbe (DriverPtr driver,
310+ int entity_num,
311+ struct pci_device *device,
312+ intptr_t match_data)
313 {
314+ ScrnInfoPtr scrn = NULL;
315 Bool foundScreen = FALSE;
316- int numDevSections, numUsed;
317- GDevPtr *devSections = NULL;
318- int *usedChips = NULL;
319- int i;
320+ int numUsed;
321 EntityInfoPtr pEnt;
322 PsbDevicePtr pPsbDev;
323 DevUnion *pPriv;
324
325+
326 PSB_DEBUG(-1, 2, "psbProbe\n");
327 numUsed = 0;
328
329- /*
330- * Find the config file Device sections that match this
331- * driver, and return if there are none.
332- */
333-
334- if ((numDevSections = xf86MatchDevice(PSB_NAME, &devSections)) <= 0)
335- return (FALSE);
336-
337- if (xf86GetPciVideoInfo()) {
338-
339- /*
340- * This function allocates screens to devices according to
341- * bus ids in the config file. Multiple device sections may point
342- * to the same PCI device.
343- */
344-
345- numUsed = xf86MatchPciInstances(PSB_NAME, PCI_VENDOR_INTEL,
346- psbChipsets, psbPCIchipsets,
347- devSections, numDevSections, drv,
348- &usedChips);
349- }
350-
351- if (numUsed <= 0)
352- goto out;
353-
354- if (flags & PROBE_DETECT) {
355- foundScreen = TRUE;
356- goto out;
357- }
358-
359- if (psbEntityIndex == -1)
360- psbEntityIndex = xf86AllocateEntityPrivateIndex();
361+ scrn = xf86ConfigPciEntity (scrn, 0, entity_num, psbPCIchipsets,
362+ NULL,
363+ NULL, NULL, NULL, NULL);
364
365- for (i = 0; i < numUsed; i++) {
366- ScrnInfoPtr pScrn = NULL;
367-
368- /* Allocate a ScrnInfoRec */
369- if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
370- psbPCIchipsets, NULL, NULL, NULL,
371- NULL, NULL))) {
372- pScrn->driverVersion = PSB_VERSION;
373- pScrn->driverName = PSB_DRIVER_NAME;
374- pScrn->name = PSB_NAME;
375- pScrn->Probe = psbProbe;
376- pScrn->PreInit = psbPreInit;
377- pScrn->ScreenInit = psbScreenInit;
378- pScrn->SwitchMode = psbSwitchMode;
379- pScrn->AdjustFrame = psbAdjustFrame;
380- pScrn->EnterVT = psbEnterVT;
381- pScrn->LeaveVT = psbLeaveVT;
382- pScrn->FreeScreen = psbFreeScreen;
383- pScrn->ValidMode = NULL;
384- foundScreen = TRUE;
385- }
386+ if (scrn != NULL)
387+ {
388+ scrn->driverVersion = PSB_VERSION;
389+ scrn->driverName = PSB_DRIVER_NAME;
390+ scrn->name = PSB_NAME;
391+ scrn->Probe = NULL;
392+ scrn->PreInit = psbPreInit;
393+ scrn->ScreenInit = psbScreenInit;
394+ scrn->SwitchMode = psbSwitchMode;
395+ scrn->AdjustFrame = psbAdjustFrame;
396+ scrn->EnterVT = psbEnterVT;
397+ scrn->LeaveVT = psbLeaveVT;
398+ scrn->FreeScreen = psbFreeScreen;
399+ scrn->ValidMode = NULL;
400+ foundScreen = TRUE;
401
402 /*
403 * We support dual head, And need a per-device structure.
404 */
405
406 pPsbDev = NULL;
407- pEnt = xf86GetEntityInfo(usedChips[i]);
408- xf86SetEntitySharable(usedChips[i]);
409+ pEnt = xf86GetEntityInfo(entity_num);
410+ xf86SetEntitySharable(entity_num);
411
412- pPriv = xf86GetEntityPrivate(pScrn->entityList[0], psbEntityIndex);
413+ /* Allocate an entity private if necessary */
414+ if (psbEntityIndex < 0)
415+ psbEntityIndex = xf86AllocateEntityPrivateIndex();
416+
417+ pPriv = xf86GetEntityPrivate(scrn->entityList[0], psbEntityIndex);
418
419 if (!pPriv->ptr) {
420- PSB_DEBUG(pScrn->scrnIndex, 3, "Allocating new device\n");
421+ PSB_DEBUG(scrn->scrnIndex, 3, "Allocating new device\n");
422
423 pPriv->ptr = xnfcalloc(sizeof(PsbDevice), 1);
424 pPsbDev = pPriv->ptr;
425 pPsbDev->lastInstance = -1;
426 pPsbDev->pEnt = pEnt;
427- pPsbDev->pciInfo = xf86GetPciInfoForEntity(pEnt->index);
428- pPsbDev->pciTag = pciTag(pPsbDev->pciInfo->bus,
429- pPsbDev->pciInfo->device,
430- pPsbDev->pciInfo->func);
431 pPsbDev->refCount = 0;
432- pPsbDev->pScrns[0] = pScrn;
433+ pPsbDev->pScrns[0] = scrn;
434 } else {
435 pPsbDev = pPriv->ptr;
436- PSB_DEBUG(pScrn->scrnIndex, 3, "Secondary screen %d\n",
437+ PSB_DEBUG(scrn->scrnIndex, 3, "Secondary screen %d\n",
438 pPsbDev->lastInstance + 1);
439- pPsbDev->pScrns[1] = pScrn;
440+ pPsbDev->pScrns[1] = scrn;
441 }
442
443 pPsbDev->lastInstance++;
444 pPsbDev->numScreens = pPsbDev->lastInstance + 1;
445
446- xf86SetEntityInstanceForScreen(pScrn, pScrn->entityList[0],
447+ xf86SetEntityInstanceForScreen(scrn, scrn->entityList[0],
448 pPsbDev->lastInstance);
449- pPsbDev->device = xf86GetDevFromEntity(pScrn->entityList[0],
450- pScrn->entityInstanceList[0]);
451+ pPsbDev->device = xf86GetDevFromEntity(scrn->entityList[0],
452+ scrn->entityInstanceList[0]);
453 }
454
455- out:
456- if (usedChips != NULL)
457- xfree(usedChips);
458- if (devSections != NULL)
459- xfree(devSections);
460
461- return foundScreen;
462+ return scrn != NULL;
463 }
464
465 static PsbPtr
466@@ -492,8 +465,10 @@
467 I830Ptr pI830 = &pPsb->i830Ptr;
468
469 pI830->pEnt = pDevice->pEnt;
470- pI830->PciTag = pDevice->pciTag;
471- pI830->PciInfo = pDevice->pciInfo;
472+ pI830->PciInfo = pDevice->PciInfo;
473+ pI830->mmio_bar = pDevice->mmio_bar;
474+ pI830->fb_bar = pDevice->fb_bar;
475+ pI830->gtt_bar = pDevice->gtt_bar;
476 pI830->pDevice = pDevice;
477 }
478
479@@ -607,7 +582,6 @@
480 psbPreInitDRI(ScrnInfoPtr pScrn)
481 {
482 PsbPtr pPsb = psbPTR(pScrn);
483- MessageType from;
484
485 mmInitListHead(&pPsb->sAreaList);
486 pPsb->dri = TRUE;
487@@ -930,12 +904,13 @@
488 400,
489 533,
490 };
491- PCITAG host = pciTag(0, 0, 0);
492- CARD32 clock, period;
493
494- pciWriteLong(host, 0xD0, 0xD0050300);
495+ CARD32 period;
496+ unsigned int clock;
497+
498+ pci_device_cfg_write_u32(pDevice->PciInfo, 0xD0050300, 0xD0);
499
500- clock = pciReadLong(host, 0xD4);
501+ pci_device_cfg_read_u32(pDevice->PciInfo, &clock, 0xD4);
502
503 pPsb->CoreClock = CoreClocks[clock & 0x07];
504 pPsb->MemClock = MemClocks[(clock & 0x08) >> 3];
505@@ -1054,8 +1029,8 @@
506 if (!vgaHWGetHWRec(pDevice->pScrns[0]))
507 return FALSE;
508
509- pDevice->regPhys = pDevice->pciInfo->memBase[0];
510- pDevice->regSize = 1 << pDevice->pciInfo->size[0];
511+ pDevice->regPhys = pDevice->PciInfo->regions[0].base_addr;
512+ pDevice->regSize = 1 << pDevice->PciInfo->regions[0].size;
513
514 pDevice->regMap = xf86MapVidMem(scrnIndex, VIDMEM_MMIO_32BIT,
515 pDevice->regPhys, pDevice->regSize);
516@@ -1076,12 +1051,12 @@
517 * Map the OpRegion SCI region
518 */
519 {
520- CARD32 OpRegion_Phys;
521+ unsigned int OpRegion_Phys;
522 unsigned int OpRegion_Size = 0x100;
523 OpRegionPtr OpRegion;
524 char *OpRegion_String = "IntelGraphicsMem";
525
526- OpRegion_Phys = pciReadLong(pDevice->pciTag, 0xFC);
527+ pci_device_cfg_read_u32(pDevice->PciInfo, &OpRegion_Phys, 0xFC);
528
529 pDevice->OpRegion = xf86MapVidMem(scrnIndex, VIDMEM_MMIO_32BIT,
530 OpRegion_Phys, OpRegion_Size);
531@@ -1107,8 +1082,10 @@
532 }
533 }
534
535- pDevice->stolenBase =
536- (unsigned long)pciReadLong(pDevice->pciTag, PSB_BSM) & 0xFFFFF000;
537+ pci_device_cfg_read_u32(pDevice->PciInfo, &pDevice->stolenBase, PSB_BSM);
538+
539+ pDevice->stolenBase = pDevice->stolenBase & 0xFFFFF000;
540+
541 pDevice->stolenSize = PSB_READ32(PSB_PGETBL_CTL) & 0xFFFFF000;
542
543 pDevice->stolenSize -= pDevice->stolenBase;
544Index: git/src/psb_driver.h
545===================================================================
546--- git.orig/src/psb_driver.h 2008-12-12 15:14:28.000000000 +0000
547+++ git/src/psb_driver.h 2009-02-04 16:38:32.000000000 +0000
548@@ -54,6 +54,9 @@
549 #include "xf86Crtc.h"
550 #include "xf86str.h"
551
552+#include "xorg-server.h"
553+#include <pciaccess.h>
554+
555 #include "libmm/mm_defines.h"
556 #include "libmm/mm_interface.h"
557
558@@ -137,8 +140,10 @@
559 unsigned deviceIndex;
560 EntityInfoPtr pEnt;
561 GDevPtr device;
562- pciVideoPtr pciInfo;
563- PCITAG pciTag;
564+ struct pci_device *PciInfo;
565+ int mmio_bar;
566+ int fb_bar;
567+ int gtt_bar;
568 unsigned long regPhys;
569 unsigned long regSize;
570 unsigned long fbPhys;
571@@ -202,8 +207,10 @@
572 typedef struct _I830Rec
573 {
574 EntityInfoPtr pEnt;
575- PCITAG PciTag;
576- pciVideoPtr PciInfo;
577+ struct pci_device *PciInfo;
578+ int mmio_bar;
579+ int fb_bar;
580+ int gtt_bar;
581 PsbDevicePtr pDevice;
582 } I830Rec, *I830Ptr;
583
584Index: git/src/psb_lvds.c
585===================================================================
586--- git.orig/src/psb_lvds.c 2008-12-12 15:14:28.000000000 +0000
587+++ git/src/psb_lvds.c 2009-02-04 16:38:32.000000000 +0000
588@@ -131,7 +131,7 @@
589
590 #define MAGIC_SCI 0x8001
591 /* Go get the data from SCI */
592- pciWriteLong(pDevice->pciTag, 0xE0, MAGIC_SCI);
593+ pci_device_cfg_write_u32(pDevice->PciInfo, MAGIC_SCI, 0xE0);
594
595 /* wait for the data */
596 loop = (*SciDSLP == 0) ? 10 : *SciDSLP;
597@@ -281,7 +281,7 @@
598 psbLVDSSetBacklight(PsbLVDSOutputPtr pLVDS, int level)
599 {
600 PsbDevicePtr pDevice = pLVDS->psbOutput.pDevice;
601- CARD32 blc_pwm_ctl, blc_pwm_duty_cycle;
602+ CARD32 blc_pwm_duty_cycle;
603 PsbPtr pPsb = psbPTR(pLVDS->psbOutput.pScrn);
604 CARD32 max_pwm_blc;
605 unsigned long newbacklight = 0;
606@@ -322,7 +322,7 @@
607 static CARD32
608 psbLVDSGetMaxBacklight(PsbLVDSOutputPtr pLVDS)
609 {
610- PsbDevicePtr pDevice = pLVDS->psbOutput.pDevice;
611+ /*PsbDevicePtr pDevice = pLVDS->psbOutput.pDevice;*/
612 return BRIGHTNESS_MAX_LEVEL;
613 }
614
615Index: git/src/psb_ioctl.h
616===================================================================
617--- git.orig/src/psb_ioctl.h 2009-02-04 16:47:55.000000000 +0000
618+++ git/src/psb_ioctl.h 2009-02-04 16:48:08.000000000 +0000
619@@ -33,6 +33,8 @@
620 #ifndef _PSB_IOCTL_H_
621 #define _PSB_IOCTL_H_
622
623+#include "libdrm_lists.h"
624+
625 typedef struct _drmBOList
626 {
627 unsigned numTarget;
diff --git a/meta-moblin/packages/xorg-driver/xf86-video-psb_git.bb b/meta-moblin/packages/xorg-driver/xf86-video-psb_git.bb
index c48215523a..7d6d178693 100644
--- a/meta-moblin/packages/xorg-driver/xf86-video-psb_git.bb
+++ b/meta-moblin/packages/xorg-driver/xf86-video-psb_git.bb
@@ -1,20 +1,21 @@
1require xf86-video-common.inc 1require xf86-video-common.inc
2 2
3DESCRIPTION = "X.Org X server -- PIntel i8xx, i9xx display driver" 3DESCRIPTION = "X.Org X server -- PIntel i8xx, i9xx display driver"
4DEPENDS += "virtual/libx11 libxvmc libdrm-psb dri2proto glproto \ 4DEPENDS += "virtual/libx11 libxvmc libdrm dri2proto glproto \
5 virtual/libgl xineramaproto libpciaccess" 5 virtual/libgl xineramaproto libpciaccess"
6RDEPENDS += linux-psb-modules 6RDEPENDS += "kernel-modules"
7 7
8PV = "0.2.6+git${SRCREV}" 8PV = "0.2.6+git${SRCREV}"
9PR = "r4" 9PR = "r5"
10 10
11SRC_URI = "git://git.moblin.org/projects/xf86-video-psb;protocol=git \ 11SRC_URI = "git://git.moblin.org/projects/xf86-video-psb;protocol=git \
12 file://pci.patch;patch=1 \
12 file://104_disable_locks.diff;patch=1" 13 file://104_disable_locks.diff;patch=1"
13 14
14S = "${WORKDIR}/git" 15S = "${WORKDIR}/git"
15 16
16COMPATIBLE_HOST = '(i.86.*-linux)' 17COMPATIBLE_HOST = '(i.86.*-linux)'
17COMPATIBLE_MACHINE = "menlow" 18COMPATIBLE_MACHINE = "(menlow|netbook)"
18 19
19EXTRA_OECONF = "--enable-dri --disable-static" 20EXTRA_OECONF = "--enable-dri --disable-static"
20 21