Contents of /trunk/xorg-old/patches-6.8.2-r10/5135_all_6.8.1-r128-ppc-vgaaccess.patch
Parent Directory | Revision Log
Revision 167 -
(show annotations)
(download)
Tue May 8 20:58:51 2007 UTC (17 years, 4 months ago) by niro
File size: 7428 byte(s)
Tue May 8 20:58:51 2007 UTC (17 years, 4 months ago) by niro
File size: 7428 byte(s)
-import
1 | Make r128 work on PPC without fbdev |
2 | https://bugs.freedesktop.org/show_bug.cgi?id=2089 |
3 | |
4 | VGAAccess patch. To test PPC users should set "UseFBDev" to false and |
5 | "VGAAccess" to false. |
6 | |
7 | Description from https://bugs.freedesktop.org/show_bug.cgi?id=2064 of the Radeon |
8 | version: |
9 | |
10 | This patch adds the "VGAAccess" option (defaults to NO on PPC and YES on |
11 | others) that disables all legacy VGA stuffs in the driver, since they are |
12 | causing various issues on non-x86 machines. |
13 | |
14 | Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h |
15 | diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h:1.4 |
16 | --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h:1.3 Wed Jun 16 09:43:58 2004 |
17 | +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h Fri Dec 17 19:19:32 2004 |
18 | @@ -401,6 +401,8 @@ |
19 | I2CBusPtr pI2CBus; |
20 | CARD32 DDCReg; |
21 | |
22 | + Bool VGAAccess; |
23 | + |
24 | } R128InfoRec, *R128InfoPtr; |
25 | |
26 | #define R128WaitForFifo(pScrn, entries) \ |
27 | Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man |
28 | diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man:1.3 |
29 | --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man:1.2 Fri Apr 23 19:26:46 2004 |
30 | +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man Fri Dec 17 19:19:32 2004 |
31 | @@ -123,6 +123,17 @@ |
32 | .BI "Option \*qShowCache\*q \*q" boolean \*q |
33 | Enable or disable viewing offscreen cache memory. A |
34 | development debug option. Default: off. |
35 | +.TP |
36 | +.BI "Option \*qVGAAccess\*q \*q" boolean \*q |
37 | +Tell the driver if it can do legacy VGA IOs to the card. This is |
38 | +necessary for properly resuming consoles when in VGA text mode, but |
39 | +shouldn't be if the console is using radeonfb or some other graphic |
40 | +mode driver. Some platforms like PowerPC have issues with those, and they aren't |
41 | +necessary unless you have a real text mode in console. The default is |
42 | +.B off |
43 | +on PowerPC and |
44 | +.B on |
45 | +on other architectures. |
46 | |
47 | .SH "SEE ALSO" |
48 | __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__) |
49 | Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c |
50 | diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c:1.15 |
51 | --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c:1.14 Sat Dec 4 22:34:54 2004 |
52 | +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c Fri Dec 17 19:19:32 2004 |
53 | @@ -137,7 +137,8 @@ |
54 | OPTION_PROG_FP_REGS, |
55 | OPTION_FBDEV, |
56 | OPTION_VIDEO_KEY, |
57 | - OPTION_SHOW_CACHE |
58 | + OPTION_SHOW_CACHE, |
59 | + OPTION_VGA_ACCESS |
60 | } R128Opts; |
61 | |
62 | static const OptionInfoRec R128Options[] = { |
63 | @@ -164,6 +165,7 @@ |
64 | { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, |
65 | { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, |
66 | { OPTION_SHOW_CACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE }, |
67 | + { OPTION_VGA_ACCESS, "VGAAccess", OPTV_BOOLEAN, {0}, TRUE }, |
68 | { -1, NULL, OPTV_NONE, {0}, FALSE } |
69 | }; |
70 | |
71 | @@ -1875,13 +1877,6 @@ |
72 | return TRUE; |
73 | } |
74 | |
75 | - if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; |
76 | - xf86LoaderReqSymLists(vgahwSymbols, NULL); |
77 | - if (!vgaHWGetHWRec(pScrn)) { |
78 | - R128FreeRec(pScrn); |
79 | - return FALSE; |
80 | - } |
81 | - |
82 | info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index); |
83 | info->PciTag = pciTag(info->PciInfo->bus, |
84 | info->PciInfo->device, |
85 | @@ -1908,6 +1903,33 @@ |
86 | memcpy(info->Options, R128Options, sizeof(R128Options)); |
87 | xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, info->Options); |
88 | |
89 | + /* By default, don't do VGA IOs on ppc */ |
90 | +#ifdef __powerpc__ |
91 | + info->VGAAccess = FALSE; |
92 | +#else |
93 | + info->VGAAccess = TRUE; |
94 | +#endif |
95 | + |
96 | + xf86GetOptValBool(info->Options, OPTION_VGA_ACCESS, &info->VGAAccess); |
97 | + if (info->VGAAccess) { |
98 | + if (!xf86LoadSubModule(pScrn, "vgahw")) |
99 | + info->VGAAccess = FALSE; |
100 | + else { |
101 | + xf86LoaderReqSymLists(vgahwSymbols, NULL); |
102 | + if (!vgaHWGetHWRec(pScrn)) |
103 | + info->VGAAccess = FALSE; |
104 | + } |
105 | + if (!info->VGAAccess) |
106 | + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Loading VGA module failed," |
107 | + " trying to run without it\n"); |
108 | + } else |
109 | + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VGAAccess option set to FALSE," |
110 | + " VGA module load skipped\n"); |
111 | + if (info->VGAAccess) |
112 | + vgaHWGetIOBase(VGAHWPTR(pScrn)); |
113 | + |
114 | + |
115 | + |
116 | if (!R128PreInitWeight(pScrn)) goto fail; |
117 | |
118 | if(xf86GetOptValInteger(info->Options, OPTION_VIDEO_KEY, &(info->videoKey))) { |
119 | @@ -1996,7 +2018,8 @@ |
120 | if (pInt10) |
121 | xf86FreeInt10(pInt10); |
122 | |
123 | - vgaHWFreeHWRec(pScrn); |
124 | + if (info->VGAAccess) |
125 | + vgaHWFreeHWRec(pScrn); |
126 | R128FreeRec(pScrn); |
127 | return FALSE; |
128 | } |
129 | @@ -2809,16 +2832,30 @@ |
130 | R128InfoPtr info = R128PTR(pScrn); |
131 | unsigned char *R128MMIO = info->MMIO; |
132 | R128SavePtr save = &info->SavedReg; |
133 | - vgaHWPtr hwp = VGAHWPTR(pScrn); |
134 | |
135 | R128TRACE(("R128Save\n")); |
136 | if (info->FBDev) { |
137 | fbdevHWSave(pScrn); |
138 | return; |
139 | } |
140 | - vgaHWUnlock(hwp); |
141 | - vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); /* save mode, fonts, cmap */ |
142 | - vgaHWLock(hwp); |
143 | + |
144 | + if (info->VGAAccess) { |
145 | + vgaHWPtr hwp = VGAHWPTR(pScrn); |
146 | + |
147 | + vgaHWUnlock(hwp); |
148 | +#if defined(__powerpc__) |
149 | + /* temporary hack to prevent crashing on PowerMacs when trying to |
150 | + * read VGA fonts and colormap, will find a better solution |
151 | + * in the future. TODO: Check if there's actually some VGA stuff |
152 | + * setup in the card at all !! |
153 | + */ |
154 | + vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* Save mode only */ |
155 | +#else |
156 | + /* Save mode * & fonts & cmap */ |
157 | + vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS); |
158 | +#endif |
159 | + vgaHWLock(hwp); |
160 | + } |
161 | |
162 | R128SaveMode(pScrn, save); |
163 | |
164 | @@ -2835,7 +2872,6 @@ |
165 | R128InfoPtr info = R128PTR(pScrn); |
166 | unsigned char *R128MMIO = info->MMIO; |
167 | R128SavePtr restore = &info->SavedReg; |
168 | - vgaHWPtr hwp = VGAHWPTR(pScrn); |
169 | |
170 | R128TRACE(("R128Restore\n")); |
171 | if (info->FBDev) { |
172 | @@ -2851,9 +2887,19 @@ |
173 | OUTREG(R128_DP_DATATYPE, restore->dp_datatype); |
174 | |
175 | R128RestoreMode(pScrn, restore); |
176 | - vgaHWUnlock(hwp); |
177 | - vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); |
178 | - vgaHWLock(hwp); |
179 | + if (info->VGAAccess) { |
180 | + vgaHWPtr hwp = VGAHWPTR(pScrn); |
181 | + vgaHWUnlock(hwp); |
182 | +#if defined(__powerpc__) |
183 | + /* Temporary hack to prevent crashing on PowerMacs when trying to |
184 | + * write VGA fonts, will find a better solution in the future |
185 | + */ |
186 | + vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE ); |
187 | +#else |
188 | + vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); |
189 | +#endif |
190 | + vgaHWLock(hwp); |
191 | + } |
192 | |
193 | R128WaitForVerticalSync(pScrn); |
194 | R128Unblank(pScrn); |
195 | @@ -3586,9 +3632,10 @@ |
196 | void R128FreeScreen(int scrnIndex, int flags) |
197 | { |
198 | ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; |
199 | + R128InfoPtr info = R128PTR(pScrn); |
200 | |
201 | R128TRACE(("R128FreeScreen\n")); |
202 | - if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) |
203 | + if (info->VGAAccess && xf86LoaderCheckSymbol("vgaHWFreeHWRec")) |
204 | vgaHWFreeHWRec(pScrn); |
205 | R128FreeRec(pScrn); |
206 | } |
207 |