]> git.pld-linux.org Git - packages/X11.git/blob - X11-i810fb.patch
- another try
[packages/X11.git] / X11-i810fb.patch
1 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h.orig     2004-06-22 16:28:46.000000000 +0200
2 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h  2004-11-25 14:00:55.000000000 +0100
3 @@ -76,6 +76,11 @@
4  #define I810_MAX_SUBPICTURES 2
5  #define I810_TOTAL_SURFACES 9
6  
7 +/* tony: i810 Framebuffer Driver - IOCTL's */
8 +#define I810FB_IOC_AREYOUTHERE         0x46FF
9 +#define I810FB_IOC_RELEASEGART         0x46FA
10 +#define I810FB_IOC_CLAIMGART           0x46F9
11 +  
12  /* Globals */
13  
14  typedef struct _I810Rec *I810Ptr;
15 @@ -146,6 +151,8 @@
16     long BackOffset;
17     int cpp;
18     int MaxClock;
19 +   int FbDescriptor;
20 +   int FbGartClaimed;
21  
22     unsigned int bufferOffset;          /* for I810SelectBuffer */
23     Bool DoneFrontAlloc;
24 @@ -218,6 +225,7 @@
25     I810RegRec ModeReg;
26  
27     XAAInfoRecPtr AccelInfoRec;
28 +   int AccelValid;
29     xf86CursorInfoPtr CursorInfoRec;
30     CloseScreenProcPtr CloseScreen;
31     ScreenBlockHandlerProcPtr BlockHandler;
32 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c.orig       2004-07-30 22:30:52.000000000 +0200
33 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_accel.c    2004-11-25 14:01:22.000000000 +0100
34 @@ -89,6 +89,7 @@
35     pI810->AccelInfoRec = infoPtr = XAACreateInfoRec();
36     if (!infoPtr)
37        return FALSE;
38 +   pI810->AccelValid = 1;
39  
40     pI810->bufferOffset = 0;
41     infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS;
42 @@ -193,6 +194,9 @@
43     int last_head = 0;
44     int first = 0;
45  
46 +   if (!pI810->AccelValid)
47 +     return 0;
48 +
49     /* If your system hasn't moved the head pointer in 2 seconds, I'm going to
50      * call it crashed.
51      */
52 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c.orig      2004-08-25 02:30:41.000000000 +0200
53 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c   2004-11-25 14:03:53.000000000 +0100
54 @@ -668,6 +668,7 @@
55     rgb defaultWeight = { 0, 0, 0 };
56     int mem;
57     Bool enable;
58 +   char filename[16];
59  
60     if (pScrn->numEntities != 1)
61        return FALSE;
62 @@ -678,6 +679,36 @@
63  
64     pI810 = I810PTR(pScrn);
65  
66 +   /* tony:  try to open fb, then query if fb can release GART, 
67 +      finally, ask fb to release GART */
68 +   pI810->FbGartClaimed = 0;
69 +   i = 0;
70 +   while (i < 8) {
71 +       sprintf(filename, "/dev/fb%d", i);
72 +       if (-1 != (pI810->FbDescriptor = open(filename, O_RDONLY, 0))) {
73 +          if (!ioctl(pI810->FbDescriptor, I810FB_IOC_AREYOUTHERE, 0)) 
74 +              break;
75 +         else {
76 +              close(pI810->FbDescriptor);
77 +              pI810->FbDescriptor = 0;
78 +         }      
79 +       }
80 +       else {
81 +          pI810->FbDescriptor = 0;
82 +       }
83 +       ++i;    
84 +   }
85 +   if (pI810->FbDescriptor && !pI810->FbGartClaimed) {
86 +       if (ioctl(pI810->FbDescriptor, I810FB_IOC_CLAIMGART, 0)) {
87 +           close(pI810->FbDescriptor);
88 +           pI810->FbDescriptor = 0;
89 +           return FALSE;
90 +       }
91 +        pI810->FbGartClaimed = 1;
92 +   }        
93 +   /* tony: end */
94 +   
95 +
96     pI810->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
97     if (pI810->pEnt->location.type != BUS_PCI)
98        return FALSE;
99 @@ -2379,13 +2410,18 @@
100  {
101     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
102  
103 -#ifdef XF86DRI
104     I810Ptr pI810 = I810PTR(pScrn);
105 -#endif
106  
107     if (I810_DEBUG & DEBUG_VERBOSE_DRI)
108        ErrorF("\n\nENTER VT\n");
109  
110 +   /* tony: claim GART from fb */
111 +   if (pI810->FbDescriptor && !pI810->FbGartClaimed) {
112 +       if (ioctl(pI810->FbDescriptor, I810FB_IOC_CLAIMGART, 0))
113 +           return FALSE;
114 +        pI810->FbGartClaimed = 1;
115 +   }        
116 +   
117     if (!I810BindGARTMemory(pScrn)) {
118        return FALSE;
119     }
120 @@ -2404,6 +2440,10 @@
121     if (!I810ModeInit(pScrn, pScrn->currentMode))
122        return FALSE;
123     I810AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
124 +
125 +   if (pI810->AccelInfoRec != NULL) 
126 +     pI810->AccelValid = 1;
127 +
128     return TRUE;
129  }
130  
131 @@ -2430,6 +2470,7 @@
132        I810RefreshRing(pScrn);
133        I810Sync(pScrn);
134        pI810->AccelInfoRec->NeedToSync = FALSE;
135 +      pI810->AccelValid = 0;
136     }
137     I810Restore(pScrn);
138  
139 @@ -2440,6 +2481,13 @@
140        return;
141  #endif
142  
143 +   /* tony: give back GART to fb */
144 +   if (pI810->FbDescriptor && pI810->FbGartClaimed) {
145 +       if (ioctl(pI810->FbDescriptor, I810FB_IOC_RELEASEGART, 0))
146 +           return;
147 +        pI810->FbGartClaimed = 0;
148 +   }        
149 +
150     vgaHWLock(hwp);
151  }
152  
153 @@ -2509,6 +2557,17 @@
154  
155     pScrn->vtSema = FALSE;
156     pScreen->CloseScreen = pI810->CloseScreen;
157 +
158 +   /* tony:  give back GART to fb, close the fb device */
159 +   if (pI810->FbDescriptor && pI810->FbGartClaimed) {
160 +       if (ioctl(pI810->FbDescriptor, I810FB_IOC_RELEASEGART, 0))
161 +           return FALSE;
162 +       pI810->FbGartClaimed = 0;
163 +   }        
164 +   if (pI810->FbDescriptor) {
165 +       close(pI810->FbDescriptor);
166 +       pI810->FbDescriptor = 0;
167 +   }           
168     return (*pScreen->CloseScreen) (scrnIndex, pScreen);
169  }
170  
This page took 0.035018 seconds and 3 git commands to generate.