Magellan Linux

Contents of /trunk/xorg-old/patches-6.9.0-r1/5115_all_6.9.0-radeon-reinit.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 167 - (show annotations) (download)
Tue May 8 20:58:51 2007 UTC (17 years ago) by niro
File size: 9617 byte(s)
-import

1 Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h
2 ===================================================================
3 RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v
4 retrieving revision 1.34
5 diff -p -u -r1.34 radeon.h
6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h 5 Dec 2002 18:00:41 -0000 1.34
7 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h 2 Feb 2003 18:34:42 -0000
8 @@ -38,6 +38,8 @@
9 #ifndef _RADEON_H_
10 #define _RADEON_H_
11
12 +#define RADEON_DRI_REINIT
13 +
14 #include "xf86str.h"
15
16 /* PCI support */
17 @@ -397,6 +399,10 @@ typedef struct {
18 #ifdef XF86DRI
19 Bool noBackBuffer;
20 Bool directRenderingEnabled;
21 +#ifdef RADEON_DRI_REINIT
22 + Bool directRenderingInitialized;
23 + Bool DRIReinit;
24 +#endif
25 DRIInfoPtr pDRIInfo;
26 int drmFD;
27 int numVisualConfigs;
28 Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c
29 ===================================================================
30 RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v
31 retrieving revision 1.22
32 diff -p -u -r1.22 radeon_accel.c
33 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c 25 Nov 2002 19:58:46 -0000 1.22
34 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c 2 Feb 2003 18:34:44 -0000
35 @@ -391,12 +391,36 @@ void RADEONEngineInit(ScrnInfoPtr pScrn)
36 #ifdef XF86DRI
37
38 #define ACCEL_CP
39 +
40 +#ifdef RADEON_DRI_REINIT
41 +
42 +#define ACCEL_PREAMBLE() \
43 + unsigned char *RADEONMMIO = info->MMIO; \
44 + RING_LOCALS; \
45 + if (info->directRenderingEnabled) \
46 + RADEONCP_REFRESH(pScrn, info)
47 +#define BEGIN_ACCEL(n) do { if (info->directRenderingEnabled) \
48 + BEGIN_RING(2*(n)); \
49 + else \
50 + RADEONWaitForFifo(pScrn, (n)); \
51 + } while(0)
52 +#define OUT_ACCEL_REG(reg, val) do { if (info->directRenderingEnabled) \
53 + OUT_RING_REG(reg, val); \
54 + else \
55 + OUTREG(reg, val); } while(0)
56 +#define FINISH_ACCEL() do { if (info->directRenderingEnabled) \
57 + ADVANCE_RING(); } while(0)
58 +
59 +#else
60 +
61 #define ACCEL_PREAMBLE() \
62 RING_LOCALS; \
63 RADEONCP_REFRESH(pScrn, info)
64 #define BEGIN_ACCEL(n) BEGIN_RING(2*(n))
65 #define OUT_ACCEL_REG(reg, val) OUT_RING_REG(reg, val)
66 #define FINISH_ACCEL() ADVANCE_RING()
67 +
68 +#endif
69
70 #include "radeon_accelfuncs.c"
71
72 Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c
73 ===================================================================
74 RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c,v
75 retrieving revision 1.6
76 diff -p -u -r1.6 radeon_accelfuncs.c
77 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c 21 Jan 2003 18:11:44 -0000 1.6
78 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c 2 Feb 2003 18:34:48 -0000
79 @@ -76,16 +76,18 @@
80 #endif
81
82 #if !defined(UNIXCPP) || defined(ANSICPP)
83 -#define FUNC_NAME_CAT(prefix,suffix) prefix##suffix
84 +#define FUNC_NAME_MMIO(prefix) prefix##MMIO
85 +#define FUNC_NAME_CP(prefix) prefix##CP
86 #else
87 -#define FUNC_NAME_CAT(prefix,suffix) prefix/**/suffix
88 +#define FUNC_NAME_MMIO(prefix) prefix/**/MMIO
89 +#define FUNC_NAME_CP(prefix) prefix/**/CP
90 #endif
91
92 #ifdef ACCEL_MMIO
93 -#define FUNC_NAME(prefix) FUNC_NAME_CAT(prefix,MMIO)
94 +#define FUNC_NAME(prefix) FUNC_NAME_MMIO(prefix)
95 #else
96 #ifdef ACCEL_CP
97 -#define FUNC_NAME(prefix) FUNC_NAME_CAT(prefix,CP)
98 +#define FUNC_NAME(prefix) FUNC_NAME_CP(prefix)
99 #else
100 #error No accel type defined!
101 #endif
102 @@ -701,7 +703,9 @@ RADEONCPScanlinePacket(ScrnInfoPtr pScrn
103 {
104 RADEONInfoPtr info = RADEONPTR(pScrn);
105 int chunk_words = info->scanline_hpass * info->scanline_words;
106 - ACCEL_PREAMBLE();
107 + RING_LOCALS;
108 +
109 + RADEONCP_REFRESH(pScrn, info);
110
111 if (RADEON_VERBOSE) {
112 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
113 @@ -783,6 +787,14 @@ FUNC_NAME(RADEONSetupForScanlineCPUToScr
114
115 #else /* ACCEL_CP */
116
117 +#ifdef RADEON_DRI_REINIT
118 + if (!info->directRenderingEnabled) {
119 + FUNC_NAME_MMIO(RADEONSetupForScanlineCPUToScreenColorExpandFill)
120 + (pScrn, fg, bg, rop, planemask);
121 + return;
122 + }
123 +#endif
124 +
125 info->scanline_fg = fg;
126 info->scanline_bg = bg;
127
128 @@ -849,6 +861,14 @@ FUNC_NAME(RADEONSubsequentScanlineCPUToS
129
130 #else /* ACCEL_CP */
131
132 +#ifdef RADEON_DRI_REINIT
133 + if (!info->directRenderingEnabled) {
134 + FUNC_NAME_MMIO(RADEONSubsequentScanlineCPUToScreenColorExpandFill)
135 + (pScrn, x, y, w, h, skipleft);
136 + return;
137 + }
138 +#endif
139 +
140 info->scanline_x = x;
141 info->scanline_y = y;
142 /* Have to pad the width here and use clipping engine */
143 @@ -914,6 +934,13 @@ FUNC_NAME(RADEONSubsequentScanline)(Scrn
144
145 #else /* ACCEL_CP */
146
147 +#ifdef RADEON_DRI_REINIT
148 + if (!info->directRenderingEnabled) {
149 + FUNC_NAME_MMIO(RADEONSubsequentScanline)(pScrn, bufno);
150 + return;
151 + }
152 +#endif
153 +
154 if (--info->scanline_hpass) {
155 info->scratch_buffer[bufno] += 4 * info->scanline_words;
156 } else if (info->scanline_h) {
157 @@ -966,6 +993,14 @@ FUNC_NAME(RADEONSetupForScanlineImageWri
158
159 #else /* ACCEL_CP */
160
161 +#ifdef RADEON_DRI_REINIT
162 + if (!info->directRenderingEnabled) {
163 + FUNC_NAME_MMIO(RADEONSetupForScanlineImageWrite)
164 + (pScrn, rop, planemask, trans_color, bpp, depth);
165 + return;
166 + }
167 +#endif
168 +
169 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
170 BEGIN_ACCEL(1);
171 #else
172 @@ -1042,6 +1077,14 @@ FUNC_NAME(RADEONSubsequentScanlineImageW
173
174 int pad = 0; /* 32bpp */
175
176 +#ifdef RADEON_DRI_REINIT
177 + if (!info->directRenderingEnabled) {
178 + FUNC_NAME_MMIO(RADEONSubsequentScanlineImageWriteRect)
179 + (pScrn, x, y, w, h, skipleft);
180 + return;
181 + }
182 +#endif
183 +
184 if (pScrn->bitsPerPixel == 8) pad = 3;
185 else if (pScrn->bitsPerPixel == 16) pad = 1;
186
187 Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c
188 ===================================================================
189 RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v
190 retrieving revision 1.43
191 diff -p -u -r1.43 radeon_dri.c
192 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c 25 Jan 2003 22:25:43 -0000 1.43
193 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c 2 Feb 2003 18:36:00 -0000
194 @@ -1705,7 +1710,8 @@ static void RADEONDRIRefreshArea(ScrnInf
195 /* Don't want to do this when no 3d is active and pages are
196 * right-way-round
197 */
198 - if (!pSAREAPriv->pfAllowPageFlip && pSAREAPriv->pfCurrentPage == 0)
199 + if (!info->directRenderingEnabled
200 + || (!pSAREAPriv->pfAllowPageFlip && pSAREAPriv->pfCurrentPage == 0))
201 return;
202
203 (*info->accel->SetupForScreenToScreenCopy)(pScrn,
204 Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c
205 ===================================================================
206 RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v
207 retrieving revision 1.56
208 --- radeon_driver.c.orig 2005-12-29 01:03:30.000000000 +0100
209 +++ radeon_driver.c 2005-12-29 01:06:21.000000000 +0100
210 @@ -151,6 +151,9 @@
211 OPTION_BUFFER_SIZE,
212 OPTION_DEPTH_MOVE,
213 OPTION_PAGE_FLIP,
214 +#ifdef RADEON_DRI_REINIT
215 + OPTION_DRI_REINIT,
216 +#endif
217 OPTION_NO_BACKBUFFER,
218 OPTION_XV_DMA,
219 #endif
220 @@ -215,6 +218,9 @@
221 { OPTION_PAGE_FLIP, "EnablePageFlip", OPTV_BOOLEAN, {0}, FALSE },
222 { OPTION_NO_BACKBUFFER, "NoBackBuffer", OPTV_BOOLEAN, {0}, FALSE },
223 { OPTION_XV_DMA, "DMAForXv", OPTV_BOOLEAN, {0}, FALSE },
224 +#ifdef RADEON_DRI_REINIT
225 + { OPTION_DRI_REINIT, "DRIReinit", OPTV_BOOLEAN, {0}, FALSE },
226 +#endif
227 #endif
228 { OPTION_PANEL_OFF, "PanelOff", OPTV_BOOLEAN, {0}, FALSE },
229 { OPTION_DDC_MODE, "DDCMode", OPTV_BOOLEAN, {0}, FALSE },
230 @@ -4328,6 +4334,16 @@
231 xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n");
232 *ppInt10 = xf86InitInt10(info->pEnt->index);
233 }
234 +
235 +#ifdef RADEON_DRI_REINIT
236 + if ((info->directRenderingInitialized = info->directRenderingEnabled)) {
237 + if ((info->DRIReinit = xf86ReturnOptValBool(info->Options,
238 + OPTION_DRI_REINIT, FALSE)))
239 + xf86DrvMsg(scrnIndex, X_CONFIG, "Will re-initialize the DRI on VT "
240 + "switches\n");
241 + }
242 +#endif
243 +
244 #endif
245 return TRUE;
246 }
247 @@ -8414,6 +8430,22 @@
248 RADEONEngineRestore(pScrn);
249
250 #ifdef XF86DRI
251 +#ifdef RADEON_DRI_REINIT
252 + if (info->DRIReinit && !info->directRenderingEnabled
253 + && info->directRenderingInitialized)
254 + {
255 + if (RADEONDRIScreenInit(pScrn->pScreen)
256 + && RADEONDRIFinishScreenInit(pScrn->pScreen))
257 + {
258 + info->directRenderingEnabled = TRUE;
259 + DRILock(pScrn->pScreen, 0);
260 + } else {
261 + xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
262 + "Direct rendering disabled after VT switch.\n");
263 + }
264 + }
265 +#endif
266 +
267 if (info->directRenderingEnabled) {
268 RADEONCP_START(pScrn, info);
269 DRIUnlock(pScrn->pScreen);
270 @@ -8435,10 +8467,25 @@
271 RADEONSavePtr save = &info->ModeReg;
272
273 RADEONTRACE(("RADEONLeaveVT\n"));
274 +
275 #ifdef XF86DRI
276 - if (RADEONPTR(pScrn)->directRenderingEnabled) {
277 + if (info->directRenderingEnabled) {
278 DRILock(pScrn->pScreen, 0);
279 - RADEONCP_STOP(pScrn, info);
280 +
281 +#ifdef RADEON_DRI_REINIT
282 + if (info->DRIReinit) {
283 + int auth, pid, uid;
284 + unsigned long magic, ioctls;
285 + /* We can only disable the DRI if no client has the DRM open */
286 + if (drmGetClient(info->drmFD, 1, &auth, &pid, &uid, &magic, &ioctls)) {
287 + RADEONDRICloseScreen(pScrn->pScreen);
288 + info->directRenderingEnabled = FALSE;
289 + }
290 + }
291 +
292 + if (info->directRenderingEnabled)
293 +#endif
294 + RADEONCP_STOP(pScrn, info);
295 }
296 #endif
297