Magellan Linux

Contents of /trunk/xorg-old/patches-6.8.2-r10/5115_all_4.3.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: 9905 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 diff -p -u -r1.56 radeon_driver.c
209 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c 25 Jan 2003 22:25:44 -0000 1.56
210 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c 2 Feb 2003 18:36:02 -0000
211 @@ -132,6 +132,9 @@ typedef enum {
212 OPTION_BUFFER_SIZE,
213 OPTION_DEPTH_MOVE,
214 OPTION_PAGE_FLIP,
215 +#ifdef RADEON_DRI_REINIT
216 + OPTION_DRI_REINIT,
217 +#endif
218 OPTION_NO_BACKBUFFER,
219 #endif
220 OPTION_PANEL_OFF,
221 @@ -161,6 +164,9 @@ const OptionInfoRec RADEONOptions[] = {
222 { OPTION_DEPTH_MOVE, "EnableDepthMoves", OPTV_BOOLEAN, {0}, FALSE },
223 { OPTION_PAGE_FLIP, "EnablePageFlip", OPTV_BOOLEAN, {0}, FALSE },
224 { OPTION_NO_BACKBUFFER, "NoBackBuffer", OPTV_BOOLEAN, {0}, FALSE },
225 +#ifdef RADEON_DRI_REINIT
226 + { OPTION_DRI_REINIT, "DRIReinit", OPTV_BOOLEAN, {0}, FALSE },
227 +#endif
228 #endif
229 { OPTION_PANEL_OFF, "PanelOff", OPTV_BOOLEAN, {0}, FALSE },
230 { OPTION_DDC_MODE, "DDCMode", OPTV_BOOLEAN, {0}, FALSE },
231 @@ -3891,6 +3897,16 @@ Bool RADEONScreenInit(int scrnIndex, Scr
232 } else {
233 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering disabled\n");
234 }
235 +
236 +#ifdef RADEON_DRI_REINIT
237 + if ((info->directRenderingInitialized = info->directRenderingEnabled)) {
238 + if ((info->DRIReinit = xf86ReturnOptValBool(info->Options,
239 + OPTION_DRI_REINIT, FALSE)))
240 + xf86DrvMsg(scrnIndex, X_CONFIG, "Will re-initialize the DRI on VT "
241 + "switches\n");
242 + }
243 +#endif
244 +
245 #endif
246
247 info->BlockHandler = pScreen->BlockHandler;
248 @@ -5577,6 +5593,22 @@ Bool RADEONEnterVT(int scrnIndex, int fl
249 RADEONEngineRestore(pScrn);
250
251 #ifdef XF86DRI
252 +#ifdef RADEON_DRI_REINIT
253 + if (info->DRIReinit && !info->directRenderingEnabled
254 + && info->directRenderingInitialized)
255 + {
256 + if (RADEONDRIScreenInit(pScrn->pScreen)
257 + && RADEONDRIFinishScreenInit(pScrn->pScreen))
258 + {
259 + info->directRenderingEnabled = TRUE;
260 + DRILock(pScrn->pScreen, 0);
261 + } else {
262 + xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
263 + "Direct rendering disabled after VT switch.\n");
264 + }
265 + }
266 +#endif
267 +
268 if (info->directRenderingEnabled) {
269 RADEONCP_START(pScrn, info);
270 DRIUnlock(pScrn->pScreen);
271 @@ -5601,10 +5633,25 @@ void RADEONLeaveVT(int scrnIndex, int fl
272 RADEONSavePtr save = &info->ModeReg;
273
274 RADEONTRACE(("RADEONLeaveVT\n"));
275 +
276 #ifdef XF86DRI
277 - if (RADEONPTR(pScrn)->directRenderingEnabled) {
278 + if (info->directRenderingEnabled) {
279 DRILock(pScrn->pScreen, 0);
280 - RADEONCP_STOP(pScrn, info);
281 +
282 +#ifdef RADEON_DRI_REINIT
283 + if (info->DRIReinit) {
284 + int auth, pid, uid;
285 + unsigned long magic, ioctls;
286 + /* We can only disable the DRI if no client has the DRM open */
287 + if (drmGetClient(info->drmFD, 1, &auth, &pid, &uid, &magic, &ioctls)) {
288 + RADEONDRICloseScreen(pScrn->pScreen);
289 + info->directRenderingEnabled = FALSE;
290 + }
291 + }
292 +
293 + if (info->directRenderingEnabled)
294 +#endif
295 + RADEONCP_STOP(pScrn, info);
296 }
297 #endif
298