File: | hw/xfree86/common/xf86Config.c |
Location: | line 606, column 5 |
Description: | Value stored to 'temp_path' is never read |
1 | /* |
2 | * Loosely based on code bearing the following copyright: |
3 | * |
4 | * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. |
5 | */ |
6 | |
7 | /* |
8 | * Copyright 1992-2003 by The XFree86 Project, Inc. |
9 | * Copyright 1997 by Metro Link, Inc. |
10 | * |
11 | * Permission is hereby granted, free of charge, to any person obtaining a |
12 | * copy of this software and associated documentation files (the "Software"), |
13 | * to deal in the Software without restriction, including without limitation |
14 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
15 | * and/or sell copies of the Software, and to permit persons to whom the |
16 | * Software is furnished to do so, subject to the following conditions: |
17 | * |
18 | * The above copyright notice and this permission notice shall be included in |
19 | * all copies or substantial portions of the Software. |
20 | * |
21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
24 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
25 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
26 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
27 | * OTHER DEALINGS IN THE SOFTWARE. |
28 | * |
29 | * Except as contained in this notice, the name of the copyright holder(s) |
30 | * and author(s) shall not be used in advertising or otherwise to promote |
31 | * the sale, use or other dealings in this Software without prior written |
32 | * authorization from the copyright holder(s) and author(s). |
33 | */ |
34 | |
35 | /* |
36 | * |
37 | * Authors: |
38 | * Dirk Hohndel <hohndel@XFree86.Org> |
39 | * David Dawes <dawes@XFree86.Org> |
40 | * Marc La France <tsi@XFree86.Org> |
41 | * Egbert Eich <eich@XFree86.Org> |
42 | * ... and others |
43 | */ |
44 | |
45 | #ifdef HAVE_XORG_CONFIG_H1 |
46 | #include <xorg-config.h> |
47 | #endif |
48 | |
49 | #include <sys/types.h> |
50 | #include <grp.h> |
51 | |
52 | #include "xf86.h" |
53 | #include "xf86Modes.h" |
54 | #include "xf86Parser.h" |
55 | #include "xf86tokens.h" |
56 | #include "xf86Config.h" |
57 | #include "xf86Priv.h" |
58 | #include "xf86_OSlib.h" |
59 | #include "configProcs.h" |
60 | #include "globals.h" |
61 | #include "extension.h" |
62 | #include "xf86pciBus.h" |
63 | |
64 | #include "xf86Xinput.h" |
65 | |
66 | #include "xkbsrv.h" |
67 | |
68 | #include "picture.h" |
69 | |
70 | /* |
71 | * These paths define the way the config file search is done. The escape |
72 | * sequences are documented in parser/scan.c. |
73 | */ |
74 | #ifndef ALL_CONFIGPATH"%A," "%R," "/etc/X11/%R," "%P/etc/X11/%R," "%E," "%F," "/etc/X11/%F," "%P/etc/X11/%F," "/etc/X11/%X," "/etc/%X," "%P/etc/X11/%X.%H," "%P/etc/X11/%X," "%P/lib/X11/%X.%H," "%P/lib/X11/%X" |
75 | #define ALL_CONFIGPATH"%A," "%R," "/etc/X11/%R," "%P/etc/X11/%R," "%E," "%F," "/etc/X11/%F," "%P/etc/X11/%F," "/etc/X11/%X," "/etc/%X," "%P/etc/X11/%X.%H," "%P/etc/X11/%X," "%P/lib/X11/%X.%H," "%P/lib/X11/%X" "%A," "%R," \ |
76 | "/etc/X11/%R," "%P/etc/X11/%R," \ |
77 | "%E," "%F," \ |
78 | "/etc/X11/%F," "%P/etc/X11/%F," \ |
79 | "/etc/X11/%X," "/etc/%X," \ |
80 | "%P/etc/X11/%X.%H," \ |
81 | "%P/etc/X11/%X," \ |
82 | "%P/lib/X11/%X.%H," \ |
83 | "%P/lib/X11/%X" |
84 | #endif |
85 | #ifndef RESTRICTED_CONFIGPATH"/etc/X11/%S," "%P/etc/X11/%S," "/etc/X11/%G," "%P/etc/X11/%G," "/etc/X11/%X," "/etc/%X," "%P/etc/X11/%X.%H," "%P/etc/X11/%X," "%P/lib/X11/%X.%H," "%P/lib/X11/%X" |
86 | #define RESTRICTED_CONFIGPATH"/etc/X11/%S," "%P/etc/X11/%S," "/etc/X11/%G," "%P/etc/X11/%G," "/etc/X11/%X," "/etc/%X," "%P/etc/X11/%X.%H," "%P/etc/X11/%X," "%P/lib/X11/%X.%H," "%P/lib/X11/%X" "/etc/X11/%S," "%P/etc/X11/%S," \ |
87 | "/etc/X11/%G," "%P/etc/X11/%G," \ |
88 | "/etc/X11/%X," "/etc/%X," \ |
89 | "%P/etc/X11/%X.%H," \ |
90 | "%P/etc/X11/%X," \ |
91 | "%P/lib/X11/%X.%H," \ |
92 | "%P/lib/X11/%X" |
93 | #endif |
94 | #ifndef ALL_CONFIGDIRPATH"%A," "%R," "/etc/X11/%R," "%C/X11/%R," "/etc/X11/%X," "%C/X11/%X" |
95 | #define ALL_CONFIGDIRPATH"%A," "%R," "/etc/X11/%R," "%C/X11/%R," "/etc/X11/%X," "%C/X11/%X" "%A," "%R," \ |
96 | "/etc/X11/%R," "%C/X11/%R," \ |
97 | "/etc/X11/%X," "%C/X11/%X" |
98 | #endif |
99 | #ifndef RESTRICTED_CONFIGDIRPATH"/etc/X11/%R," "%C/X11/%R," "/etc/X11/%X," "%C/X11/%X" |
100 | #define RESTRICTED_CONFIGDIRPATH"/etc/X11/%R," "%C/X11/%R," "/etc/X11/%X," "%C/X11/%X" "/etc/X11/%R," "%C/X11/%R," \ |
101 | "/etc/X11/%X," "%C/X11/%X" |
102 | #endif |
103 | #ifndef SYS_CONFIGDIRPATH"%D/X11/%X" |
104 | #define SYS_CONFIGDIRPATH"%D/X11/%X" "%D/X11/%X" |
105 | #endif |
106 | #ifndef PROJECTROOT"/Users/jeremy/src/freedesktop/jhbuild/build" |
107 | #define PROJECTROOT"/Users/jeremy/src/freedesktop/jhbuild/build" "/usr/X11R6" |
108 | #endif |
109 | |
110 | static ModuleDefault ModuleDefaults[] = { |
111 | #ifdef GLXEXT1 |
112 | {.name = "glx",.toLoad = TRUE1,.load_opt = NULL((void*)0)}, |
113 | #endif |
114 | #ifdef __CYGWIN__ |
115 | /* load DIX modules used by drivers first */ |
116 | {.name = "fb",.toLoad = TRUE1,.load_opt = NULL((void*)0)}, |
117 | {.name = "shadow",.toLoad = TRUE1,.load_opt = NULL((void*)0)}, |
118 | #endif |
119 | {.name = NULL((void*)0),.toLoad = FALSE0,.load_opt = NULL((void*)0)} |
120 | }; |
121 | |
122 | /* Forward declarations */ |
123 | static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, |
124 | int scrnum, MessageType from, Bool auto_gpu_device); |
125 | static Bool configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor); |
126 | static Bool configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, |
127 | Bool active, Bool gpu); |
128 | static Bool configInput(InputInfoPtr pInfo, XF86ConfInputPtr conf_input, |
129 | MessageType from); |
130 | static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display); |
131 | static Bool addDefaultModes(MonPtr monitorp); |
132 | |
133 | static void configDRI(XF86ConfDRIPtr drip); |
134 | static void configExtensions(XF86ConfExtensionsPtr conf_ext); |
135 | |
136 | /* |
137 | * xf86GetPathElem -- |
138 | * Extract a single element from the font path string starting at |
139 | * pnt. The font path element will be returned, and pnt will be |
140 | * updated to point to the start of the next element, or set to |
141 | * NULL if there are no more. |
142 | */ |
143 | static char * |
144 | xf86GetPathElem(char **pnt) |
145 | { |
146 | char *p1; |
147 | |
148 | p1 = *pnt; |
149 | *pnt = index(*pnt, ','); |
150 | if (*pnt != NULL((void*)0)) { |
151 | **pnt = '\0'; |
152 | *pnt += 1; |
153 | } |
154 | return p1; |
155 | } |
156 | |
157 | /* |
158 | * xf86ValidateFontPath -- |
159 | * Validates the user-specified font path. Each element that |
160 | * begins with a '/' is checked to make sure the directory exists. |
161 | * If the directory exists, the existence of a file named 'fonts.dir' |
162 | * is checked. If either check fails, an error is printed and the |
163 | * element is removed from the font path. |
164 | */ |
165 | |
166 | #define DIR_FILE"/fonts.dir" "/fonts.dir" |
167 | static char * |
168 | xf86ValidateFontPath(char *path) |
169 | { |
170 | char *next, *tmp_path, *out_pnt, *path_elem, *p1, *dir_elem; |
171 | struct stat stat_buf; |
172 | int flag; |
173 | int dirlen; |
174 | |
175 | tmp_path = calloc(1, strlen(path) + 1); |
176 | out_pnt = tmp_path; |
177 | path_elem = NULL((void*)0); |
178 | next = path; |
179 | while (next != NULL((void*)0)) { |
180 | path_elem = xf86GetPathElem(&next); |
181 | if (*path_elem == '/') { |
182 | dir_elem = xnfcalloc(1, strlen(path_elem) + 1)XNFcallocarray((1), (strlen(path_elem) + 1)); |
183 | if ((p1 = strchr(path_elem, ':')) != 0) |
184 | dirlen = p1 - path_elem; |
185 | else |
186 | dirlen = strlen(path_elem); |
187 | strlcpy(dir_elem, path_elem, dirlen + 1)__builtin___strlcpy_chk (dir_elem, path_elem, dirlen + 1, __builtin_object_size (dir_elem, 2 > 1 ? 1 : 0)); |
188 | flag = stat(dir_elem, &stat_buf); |
189 | if (flag == 0) |
190 | if (!S_ISDIR(stat_buf.st_mode)(((stat_buf.st_mode) & 0170000) == 0040000)) |
191 | flag = -1; |
192 | if (flag != 0) { |
193 | xf86Msg(X_WARNING, "The directory \"%s\" does not exist.\n", |
194 | dir_elem); |
195 | xf86ErrorF("\tEntry deleted from font path.\n"); |
196 | free(dir_elem); |
197 | continue; |
198 | } |
199 | else { |
200 | XNFasprintf(&p1, "%s%s", dir_elem, DIR_FILE"/fonts.dir"); |
201 | flag = stat(p1, &stat_buf); |
202 | if (flag == 0) |
203 | if (!S_ISREG(stat_buf.st_mode)(((stat_buf.st_mode) & 0170000) == 0100000)) |
204 | flag = -1; |
205 | free(p1); |
206 | if (flag != 0) { |
207 | xf86Msg(X_WARNING, |
208 | "`fonts.dir' not found (or not valid) in \"%s\".\n", |
209 | dir_elem); |
210 | xf86ErrorF("\tEntry deleted from font path.\n"); |
211 | xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem); |
212 | free(dir_elem); |
213 | continue; |
214 | } |
215 | } |
216 | free(dir_elem); |
217 | } |
218 | |
219 | /* |
220 | * Either an OK directory, or a font server name. So add it to |
221 | * the path. |
222 | */ |
223 | if (out_pnt != tmp_path) |
224 | *out_pnt++ = ','; |
225 | strcat(out_pnt, path_elem)__builtin___strcat_chk (out_pnt, path_elem, __builtin_object_size (out_pnt, 2 > 1 ? 1 : 0)); |
226 | out_pnt += strlen(path_elem); |
227 | } |
228 | return tmp_path; |
229 | } |
230 | |
231 | #define FIND_SUITABLE(pointertype, listhead, ptr)do { pointertype _l, _p; for (_l = (listhead), _p = ((void*)0 ); !_p && _l; _l = (pointertype)_l->list.next) { if (!_l->match_seat || (SeatId && xf86nameCompare(_l ->match_seat, SeatId) == 0)) _p = _l; } (ptr) = _p; } while (0) \ |
232 | do { \ |
233 | pointertype _l, _p; \ |
234 | \ |
235 | for (_l = (listhead), _p = NULL((void*)0); !_p && _l; _l = (pointertype)_l->list.next) { \ |
236 | if (!_l->match_seat || (SeatId && xf86nameCompare(_l->match_seat, SeatId) == 0)) \ |
237 | _p = _l; \ |
238 | } \ |
239 | \ |
240 | (ptr) = _p; \ |
241 | } while(0) |
242 | |
243 | /* |
244 | * use the datastructure that the parser provides and pick out the parts |
245 | * that we need at this point |
246 | */ |
247 | const char ** |
248 | xf86ModulelistFromConfig(void ***optlist) |
249 | { |
250 | int count = 0, i = 0; |
251 | const char **modulearray; |
252 | |
253 | const char *ignore[] = { "GLcore", "speedo", "bitmap", "drm", |
254 | "freetype", "type1", |
255 | NULL((void*)0) |
256 | }; |
257 | void **optarray; |
258 | XF86LoadPtr modp; |
259 | Bool found; |
260 | |
261 | /* |
262 | * make sure the config file has been parsed and that we have a |
263 | * ModulePath set; if no ModulePath was given, use the default |
264 | * ModulePath |
265 | */ |
266 | if (xf86configptr == NULL((void*)0)) { |
267 | xf86Msg(X_ERROR, "Cannot access global config data structure\n"); |
268 | return NULL((void*)0); |
269 | } |
270 | |
271 | if (xf86configptr->conf_modules) { |
272 | /* Walk the disable list and let people know what we've parsed to |
273 | * not be loaded |
274 | */ |
275 | modp = xf86configptr->conf_modules->mod_disable_lst; |
276 | while (modp) { |
277 | xf86Msg(X_WARNING, |
278 | "\"%s\" will not be loaded unless you've specified it to be loaded elsewhere.\n", |
279 | modp->load_name); |
280 | modp = (XF86LoadPtr) modp->list.next; |
281 | } |
282 | /* |
283 | * Walk the default settings table. For each module listed to be |
284 | * loaded, make sure it's in the mod_load_lst. If it's not, make |
285 | * sure it's not in the mod_no_load_lst. If it's not disabled, |
286 | * append it to mod_load_lst |
287 | */ |
288 | for (i = 0; ModuleDefaults[i].name != NULL((void*)0); i++) { |
289 | if (ModuleDefaults[i].toLoad == FALSE0) { |
290 | xf86Msg(X_WARNING, |
291 | "\"%s\" is not to be loaded by default. Skipping.\n", |
292 | ModuleDefaults[i].name); |
293 | continue; |
294 | } |
295 | found = FALSE0; |
296 | modp = xf86configptr->conf_modules->mod_load_lst; |
297 | while (modp) { |
298 | if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) { |
299 | xf86Msg(X_INFO, |
300 | "\"%s\" will be loaded. This was enabled by default and also specified in the config file.\n", |
301 | ModuleDefaults[i].name); |
302 | found = TRUE1; |
303 | break; |
304 | } |
305 | modp = (XF86LoadPtr) modp->list.next; |
306 | } |
307 | if (found == FALSE0) { |
308 | modp = xf86configptr->conf_modules->mod_disable_lst; |
309 | while (modp) { |
310 | if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) { |
311 | xf86Msg(X_INFO, |
312 | "\"%s\" will be loaded even though the default is to disable it.\n", |
313 | ModuleDefaults[i].name); |
314 | found = TRUE1; |
315 | break; |
316 | } |
317 | modp = (XF86LoadPtr) modp->list.next; |
318 | } |
319 | } |
320 | if (found == FALSE0) { |
321 | XF86LoadPtr ptr = (XF86LoadPtr) xf86configptr->conf_modules; |
322 | |
323 | xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, |
324 | XF86_LOAD_MODULE0, |
325 | ModuleDefaults[i].load_opt); |
326 | xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n", |
327 | ModuleDefaults[i].name); |
328 | } |
329 | } |
330 | } |
331 | else { |
332 | xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec))XNFcallocarray((1), (sizeof(XF86ConfModuleRec))); |
333 | for (i = 0; ModuleDefaults[i].name != NULL((void*)0); i++) { |
334 | if (ModuleDefaults[i].toLoad == TRUE1) { |
335 | XF86LoadPtr ptr = (XF86LoadPtr) xf86configptr->conf_modules; |
336 | |
337 | xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, |
338 | XF86_LOAD_MODULE0, |
339 | ModuleDefaults[i].load_opt); |
340 | } |
341 | } |
342 | } |
343 | |
344 | /* |
345 | * Walk the list of modules in the "Module" section to determine how |
346 | * many we have. |
347 | */ |
348 | modp = xf86configptr->conf_modules->mod_load_lst; |
349 | while (modp) { |
350 | for (i = 0; ignore[i]; i++) { |
351 | if (strcmp(modp->load_name, ignore[i]) == 0) |
352 | modp->ignore = 1; |
353 | } |
354 | if (!modp->ignore) |
355 | count++; |
356 | modp = (XF86LoadPtr) modp->list.next; |
357 | } |
358 | |
359 | /* |
360 | * allocate the memory and walk the list again to fill in the pointers |
361 | */ |
362 | modulearray = xnfallocarray(count + 1, sizeof(char *))XNFreallocarray(((void*)0), (count + 1), (sizeof(char *))); |
363 | optarray = xnfallocarray(count + 1, sizeof(void *))XNFreallocarray(((void*)0), (count + 1), (sizeof(void *))); |
364 | count = 0; |
365 | if (xf86configptr->conf_modules) { |
366 | modp = xf86configptr->conf_modules->mod_load_lst; |
367 | while (modp) { |
368 | if (!modp->ignore) { |
369 | modulearray[count] = modp->load_name; |
370 | optarray[count] = modp->load_opt; |
371 | count++; |
372 | } |
373 | modp = (XF86LoadPtr) modp->list.next; |
374 | } |
375 | } |
376 | modulearray[count] = NULL((void*)0); |
377 | optarray[count] = NULL((void*)0); |
378 | if (optlist) |
379 | *optlist = optarray; |
380 | else |
381 | free(optarray); |
382 | return modulearray; |
383 | } |
384 | |
385 | const char ** |
386 | xf86DriverlistFromConfig(void) |
387 | { |
388 | int count = 0; |
389 | int j, k; |
390 | const char **modulearray; |
391 | screenLayoutPtr slp; |
392 | |
393 | /* |
394 | * make sure the config file has been parsed and that we have a |
395 | * ModulePath set; if no ModulePath was given, use the default |
396 | * ModulePath |
397 | */ |
398 | if (xf86configptr == NULL((void*)0)) { |
399 | xf86Msg(X_ERROR, "Cannot access global config data structure\n"); |
400 | return NULL((void*)0); |
401 | } |
402 | |
403 | /* |
404 | * Walk the list of driver lines in active "Device" sections to |
405 | * determine now many implicitly loaded modules there are. |
406 | * |
407 | */ |
408 | if (xf86ConfigLayout.screens) { |
409 | slp = xf86ConfigLayout.screens; |
410 | while (slp->screen) { |
411 | count++; |
412 | count += slp->screen->num_gpu_devices; |
413 | slp++; |
414 | } |
415 | } |
416 | |
417 | /* |
418 | * Handle the set of inactive "Device" sections. |
419 | */ |
420 | j = 0; |
421 | while (xf86ConfigLayout.inactives[j++].identifier) |
422 | count++; |
423 | |
424 | if (count == 0) |
425 | return NULL((void*)0); |
426 | |
427 | /* |
428 | * allocate the memory and walk the list again to fill in the pointers |
429 | */ |
430 | modulearray = xnfallocarray(count + 1, sizeof(char *))XNFreallocarray(((void*)0), (count + 1), (sizeof(char *))); |
431 | count = 0; |
432 | slp = xf86ConfigLayout.screens; |
433 | while (slp->screen) { |
434 | modulearray[count] = slp->screen->device->driver; |
435 | count++; |
436 | for (k = 0; k < slp->screen->num_gpu_devices; k++) { |
437 | modulearray[count] = slp->screen->gpu_devices[k]->driver; |
438 | count++; |
439 | } |
440 | slp++; |
441 | } |
442 | |
443 | j = 0; |
444 | |
445 | while (xf86ConfigLayout.inactives[j].identifier) |
446 | modulearray[count++] = xf86ConfigLayout.inactives[j++].driver; |
447 | |
448 | modulearray[count] = NULL((void*)0); |
449 | |
450 | /* Remove duplicates */ |
451 | for (count = 0; modulearray[count] != NULL((void*)0); count++) { |
452 | int i; |
453 | |
454 | for (i = 0; i < count; i++) |
455 | if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) { |
456 | modulearray[count] = ""; |
457 | break; |
458 | } |
459 | } |
460 | return modulearray; |
461 | } |
462 | |
463 | const char ** |
464 | xf86InputDriverlistFromConfig(void) |
465 | { |
466 | int count = 0; |
467 | const char **modulearray; |
468 | InputInfoPtr *idp; |
469 | |
470 | /* |
471 | * make sure the config file has been parsed and that we have a |
472 | * ModulePath set; if no ModulePath was given, use the default |
473 | * ModulePath |
474 | */ |
475 | if (xf86configptr == NULL((void*)0)) { |
476 | xf86Msg(X_ERROR, "Cannot access global config data structure\n"); |
477 | return NULL((void*)0); |
478 | } |
479 | |
480 | /* |
481 | * Walk the list of driver lines in active "InputDevice" sections to |
482 | * determine now many implicitly loaded modules there are. |
483 | */ |
484 | if (xf86ConfigLayout.inputs) { |
485 | idp = xf86ConfigLayout.inputs; |
486 | while (*idp) { |
487 | count++; |
488 | idp++; |
489 | } |
490 | } |
491 | |
492 | if (count == 0) |
493 | return NULL((void*)0); |
494 | |
495 | /* |
496 | * allocate the memory and walk the list again to fill in the pointers |
497 | */ |
498 | modulearray = xnfallocarray(count + 1, sizeof(char *))XNFreallocarray(((void*)0), (count + 1), (sizeof(char *))); |
499 | count = 0; |
500 | idp = xf86ConfigLayout.inputs; |
501 | while (idp && *idp) { |
502 | modulearray[count] = (*idp)->driver; |
503 | count++; |
504 | idp++; |
505 | } |
506 | modulearray[count] = NULL((void*)0); |
507 | |
508 | /* Remove duplicates */ |
509 | for (count = 0; modulearray[count] != NULL((void*)0); count++) { |
510 | int i; |
511 | |
512 | for (i = 0; i < count; i++) |
513 | if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) { |
514 | modulearray[count] = ""; |
515 | break; |
516 | } |
517 | } |
518 | return modulearray; |
519 | } |
520 | |
521 | static void |
522 | fixup_video_driver_list(const char **drivers) |
523 | { |
524 | static const char *fallback[5] = { "modesetting", "fbdev", "vesa", "wsfb", NULL((void*)0) }; |
525 | const char **end, **drv; |
526 | const char *x; |
527 | int i; |
528 | |
529 | /* walk to the end of the list */ |
530 | for (end = drivers; *end && **end; end++); |
531 | end--; |
532 | |
533 | /* |
534 | * for each of the fallback drivers, if we find it in the list, |
535 | * swap it with the last available non-fallback driver. |
536 | */ |
537 | for (i = 0; fallback[i]; i++) { |
538 | for (drv = drivers; drv != end; drv++) { |
539 | if (strstr(*drv, fallback[i])) { |
540 | x = *drv; |
541 | *drv = *end; |
542 | *end = x; |
543 | end--; |
544 | break; |
545 | } |
546 | } |
547 | } |
548 | } |
549 | |
550 | static const char ** |
551 | GenerateDriverlist(const char *dirname) |
552 | { |
553 | const char **ret; |
554 | const char *subdirs[] = { dirname, NULL((void*)0) }; |
555 | static const char *patlist[] = { "(.*)_drv\\.so", NULL((void*)0) }; |
556 | ret = LoaderListDirs(subdirs, patlist); |
557 | |
558 | /* fix up the probe order for video drivers */ |
559 | if (strstr(dirname, "drivers") && ret != NULL((void*)0)) |
560 | fixup_video_driver_list(ret); |
561 | |
562 | return ret; |
563 | } |
564 | |
565 | const char ** |
566 | xf86DriverlistFromCompile(void) |
567 | { |
568 | static const char **driverlist = NULL((void*)0); |
569 | |
570 | if (!driverlist) |
571 | driverlist = GenerateDriverlist("drivers"); |
572 | |
573 | return driverlist; |
574 | } |
575 | |
576 | static void |
577 | configFiles(XF86ConfFilesPtr fileconf) |
578 | { |
579 | MessageType pathFrom; |
580 | Bool must_copy; |
581 | int size, countDirs; |
582 | char *temp_path, *log_buf, *start, *end; |
583 | |
584 | /* FontPath */ |
585 | must_copy = TRUE1; |
586 | |
587 | temp_path = defaultFontPath ? (char *) defaultFontPath : (char *) ""; |
588 | if (xf86fpFlag) |
589 | pathFrom = X_CMDLINE; |
590 | else if (fileconf && fileconf->file_fontpath) { |
591 | pathFrom = X_CONFIG; |
592 | if (xf86Info.useDefaultFontPath) { |
593 | char *new_font_path; |
594 | if (asprintf(&new_font_path, "%s%s%s", fileconf->file_fontpath, |
595 | *temp_path ? "," : "", temp_path) == -1) |
596 | new_font_path = NULL((void*)0); |
597 | else |
598 | must_copy = FALSE0; |
599 | defaultFontPath = new_font_path; |
600 | } |
601 | else |
602 | defaultFontPath = fileconf->file_fontpath; |
603 | } |
604 | else |
605 | pathFrom = X_DEFAULT; |
606 | temp_path = defaultFontPath ? (char *) defaultFontPath : (char *) ""; |
Value stored to 'temp_path' is never read | |
607 | |
608 | /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */ |
609 | temp_path = must_copy ? xnfstrdup(defaultFontPath)XNFstrdup(defaultFontPath) : (char *) defaultFontPath; |
610 | defaultFontPath = xf86ValidateFontPath(temp_path); |
611 | free(temp_path); |
612 | |
613 | /* make fontpath more readable in the logfiles */ |
614 | countDirs = 1; |
615 | temp_path = (char *) defaultFontPath; |
616 | while ((temp_path = index(temp_path, ',')) != NULL((void*)0)) { |
617 | countDirs++; |
618 | temp_path++; |
619 | } |
620 | |
621 | log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1)XNFalloc((unsigned long)(strlen(defaultFontPath) + (2 * countDirs ) + 1)); |
622 | temp_path = log_buf; |
623 | start = (char *) defaultFontPath; |
624 | while ((end = index(start, ',')) != NULL((void*)0)) { |
625 | size = (end - start) + 1; |
626 | *(temp_path++) = '\t'; |
627 | strncpy(temp_path, start, size)__builtin___strncpy_chk (temp_path, start, size, __builtin_object_size (temp_path, 2 > 1 ? 1 : 0)); |
628 | temp_path += size; |
629 | *(temp_path++) = '\n'; |
630 | start += size; |
631 | } |
632 | /* copy last entry */ |
633 | *(temp_path++) = '\t'; |
634 | strcpy(temp_path, start)__builtin___strcpy_chk (temp_path, start, __builtin_object_size (temp_path, 2 > 1 ? 1 : 0)); |
635 | xf86Msg(pathFrom, "FontPath set to:\n%s\n", log_buf); |
636 | free(log_buf); |
637 | |
638 | /* ModulePath */ |
639 | |
640 | if (fileconf) { |
641 | if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) { |
642 | xf86ModulePath = fileconf->file_modulepath; |
643 | xf86ModPathFrom = X_CONFIG; |
644 | } |
645 | } |
646 | |
647 | xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath); |
648 | |
649 | if (!xf86xkbdirFlag && fileconf && fileconf->file_xkbdir) { |
650 | XkbBaseDirectory = fileconf->file_xkbdir; |
651 | xf86Msg(X_CONFIG, "XKB base directory set to \"%s\"\n", |
652 | XkbBaseDirectory); |
653 | } |
654 | #if 0 |
655 | /* LogFile */ |
656 | /* |
657 | * XXX The problem with this is that the log file is already open. |
658 | * One option might be to copy the exiting contents to the new location. |
659 | * and re-open it. The down side is that the default location would |
660 | * already have been overwritten. Another option would be to start with |
661 | * unique temporary location, then copy it once the correct name is known. |
662 | * A problem with this is what happens if the server exits before that |
663 | * happens. |
664 | */ |
665 | if (xf86LogFileFrom == X_DEFAULT && fileconf->file_logfile) { |
666 | xf86LogFile = fileconf->file_logfile; |
667 | xf86LogFileFrom = X_CONFIG; |
668 | } |
669 | #endif |
670 | |
671 | return; |
672 | } |
673 | |
674 | typedef enum { |
675 | FLAG_NOTRAPSIGNALS, |
676 | FLAG_DONTVTSWITCH, |
677 | FLAG_DONTZAP, |
678 | FLAG_DONTZOOM, |
679 | FLAG_DISABLEVIDMODE, |
680 | FLAG_ALLOWNONLOCAL, |
681 | FLAG_ALLOWMOUSEOPENFAIL, |
682 | FLAG_SAVER_BLANKTIME, |
683 | FLAG_DPMS_STANDBYTIME, |
684 | FLAG_DPMS_SUSPENDTIME, |
685 | FLAG_DPMS_OFFTIME, |
686 | FLAG_PIXMAP, |
687 | FLAG_NOPM, |
688 | FLAG_XINERAMA, |
689 | FLAG_LOG, |
690 | FLAG_RENDER_COLORMAP_MODE, |
691 | FLAG_RANDR, |
692 | FLAG_AIGLX, |
693 | FLAG_IGNORE_ABI, |
694 | FLAG_ALLOW_EMPTY_INPUT, |
695 | FLAG_USE_DEFAULT_FONT_PATH, |
696 | FLAG_AUTO_ADD_DEVICES, |
697 | FLAG_AUTO_ENABLE_DEVICES, |
698 | FLAG_GLX_VISUALS, |
699 | FLAG_DRI2, |
700 | FLAG_USE_SIGIO, |
701 | FLAG_AUTO_ADD_GPU, |
702 | FLAG_MAX_CLIENTS, |
703 | FLAG_IGLX, |
704 | } FlagValues; |
705 | |
706 | /** |
707 | * NOTE: the last value for each entry is NOT the default. It is set to TRUE |
708 | * if the parser found the option in the config file. |
709 | */ |
710 | static OptionInfoRec FlagOptions[] = { |
711 | {FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN, |
712 | {0}, FALSE0}, |
713 | {FLAG_DONTVTSWITCH, "DontVTSwitch", OPTV_BOOLEAN, |
714 | {0}, FALSE0}, |
715 | {FLAG_DONTZAP, "DontZap", OPTV_BOOLEAN, |
716 | {0}, FALSE0}, |
717 | {FLAG_DONTZOOM, "DontZoom", OPTV_BOOLEAN, |
718 | {0}, FALSE0}, |
719 | {FLAG_DISABLEVIDMODE, "DisableVidModeExtension", OPTV_BOOLEAN, |
720 | {0}, FALSE0}, |
721 | {FLAG_ALLOWNONLOCAL, "AllowNonLocalXvidtune", OPTV_BOOLEAN, |
722 | {0}, FALSE0}, |
723 | {FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN, |
724 | {0}, FALSE0}, |
725 | {FLAG_SAVER_BLANKTIME, "BlankTime", OPTV_INTEGER, |
726 | {0}, FALSE0}, |
727 | {FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER, |
728 | {0}, FALSE0}, |
729 | {FLAG_DPMS_SUSPENDTIME, "SuspendTime", OPTV_INTEGER, |
730 | {0}, FALSE0}, |
731 | {FLAG_DPMS_OFFTIME, "OffTime", OPTV_INTEGER, |
732 | {0}, FALSE0}, |
733 | {FLAG_PIXMAP, "Pixmap", OPTV_INTEGER, |
734 | {0}, FALSE0}, |
735 | {FLAG_NOPM, "NoPM", OPTV_BOOLEAN, |
736 | {0}, FALSE0}, |
737 | {FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN, |
738 | {0}, FALSE0}, |
739 | {FLAG_LOG, "Log", OPTV_STRING, |
740 | {0}, FALSE0}, |
741 | {FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING, |
742 | {0}, FALSE0}, |
743 | {FLAG_RANDR, "RandR", OPTV_BOOLEAN, |
744 | {0}, FALSE0}, |
745 | {FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN, |
746 | {0}, FALSE0}, |
747 | {FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN, |
748 | {0}, FALSE0}, |
749 | {FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN, |
750 | {0}, FALSE0}, |
751 | {FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN, |
752 | {0}, FALSE0}, |
753 | {FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN, |
754 | {0}, FALSE0}, |
755 | {FLAG_GLX_VISUALS, "GlxVisuals", OPTV_STRING, |
756 | {0}, FALSE0}, |
757 | {FLAG_DRI2, "DRI2", OPTV_BOOLEAN, |
758 | {0}, FALSE0}, |
759 | {FLAG_USE_SIGIO, "UseSIGIO", OPTV_BOOLEAN, |
760 | {0}, FALSE0}, |
761 | {FLAG_AUTO_ADD_GPU, "AutoAddGPU", OPTV_BOOLEAN, |
762 | {0}, FALSE0}, |
763 | {FLAG_MAX_CLIENTS, "MaxClients", OPTV_INTEGER, |
764 | {0}, FALSE0 }, |
765 | {FLAG_IGLX, "IndirectGLX", OPTV_BOOLEAN, |
766 | {0}, FALSE0}, |
767 | {-1, NULL((void*)0), OPTV_NONE, |
768 | {0}, FALSE0}, |
769 | }; |
770 | |
771 | static void |
772 | configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) |
773 | { |
774 | XF86OptionPtr optp, tmp; |
775 | int i; |
776 | Pix24Flags pix24 = Pix24DontCare; |
777 | Bool value; |
778 | MessageType from; |
779 | const char *s; |
780 | XkbRMLVOSet set; |
781 | const char *rules; |
782 | |
783 | /* |
784 | * Merge the ServerLayout and ServerFlags options. The former have |
785 | * precedence over the latter. |
786 | */ |
787 | optp = NULL((void*)0); |
788 | if (flagsconf && flagsconf->flg_option_lst) |
789 | optp = xf86optionListDup(flagsconf->flg_option_lst); |
790 | if (layoutopts) { |
791 | tmp = xf86optionListDup(layoutopts); |
792 | if (optp) |
793 | optp = xf86optionListMerge(optp, tmp); |
794 | else |
795 | optp = tmp; |
796 | } |
797 | |
798 | xf86ProcessOptions(-1, optp, FlagOptions); |
799 | |
800 | xf86GetOptValBool(FlagOptions, FLAG_NOTRAPSIGNALS, &xf86Info.notrapSignals); |
801 | xf86GetOptValBool(FlagOptions, FLAG_DONTVTSWITCH, &xf86Info.dontVTSwitch); |
802 | xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap); |
803 | xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom); |
804 | |
805 | xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI); |
806 | if (xf86Info.ignoreABI) { |
807 | xf86Msg(X_CONFIG, "Ignoring ABI Version\n"); |
808 | } |
809 | |
810 | if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) { |
811 | xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_DEVICES, |
812 | &xf86Info.autoAddDevices); |
813 | from = X_CONFIG; |
814 | } |
815 | else { |
816 | from = X_DEFAULT; |
817 | } |
818 | xf86Msg(from, "%sutomatically adding devices\n", |
819 | xf86Info.autoAddDevices ? "A" : "Not a"); |
820 | |
821 | if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ENABLE_DEVICES)) { |
822 | xf86GetOptValBool(FlagOptions, FLAG_AUTO_ENABLE_DEVICES, |
823 | &xf86Info.autoEnableDevices); |
824 | from = X_CONFIG; |
825 | } |
826 | else { |
827 | from = X_DEFAULT; |
828 | } |
829 | xf86Msg(from, "%sutomatically enabling devices\n", |
830 | xf86Info.autoEnableDevices ? "A" : "Not a"); |
831 | |
832 | if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_GPU)) { |
833 | xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_GPU, |
834 | &xf86Info.autoAddGPU); |
835 | from = X_CONFIG; |
836 | } |
837 | else { |
838 | from = X_DEFAULT; |
839 | } |
840 | xf86Msg(from, "%sutomatically adding GPU devices\n", |
841 | xf86Info.autoAddGPU ? "A" : "Not a"); |
842 | /* |
843 | * Set things up based on the config file information. Some of these |
844 | * settings may be overridden later when the command line options are |
845 | * checked. |
846 | */ |
847 | #ifdef XF86VIDMODE1 |
848 | if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEVIDMODE, &value)) |
849 | xf86Info.vidModeEnabled = !value; |
850 | if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWNONLOCAL, &value)) |
851 | xf86Info.vidModeAllowNonLocal = value; |
852 | #endif |
853 | |
854 | if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, &value)) |
855 | xf86Info.allowMouseOpenFail = value; |
856 | |
857 | xf86Info.pmFlag = TRUE1; |
858 | if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value)) |
859 | xf86Info.pmFlag = !value; |
860 | { |
861 | if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) { |
862 | if (!xf86NameCmp(s, "flush")) { |
863 | xf86Msg(X_CONFIG, "Flushing logfile enabled\n"); |
864 | LogSetParameter(XLOG_FLUSH, TRUE1); |
865 | } |
866 | else if (!xf86NameCmp(s, "sync")) { |
867 | xf86Msg(X_CONFIG, "Syncing logfile enabled\n"); |
868 | LogSetParameter(XLOG_FLUSH, TRUE1); |
869 | LogSetParameter(XLOG_SYNC, TRUE1); |
870 | } |
871 | else { |
872 | xf86Msg(X_WARNING, "Unknown Log option\n"); |
873 | } |
874 | } |
875 | } |
876 | |
877 | { |
878 | if ((s = xf86GetOptValString(FlagOptions, FLAG_RENDER_COLORMAP_MODE))) { |
879 | int policy = PictureParseCmapPolicy(s); |
880 | |
881 | if (policy == PictureCmapPolicyInvalid-1) |
882 | xf86Msg(X_WARNING, "Unknown colormap policy \"%s\"\n", s); |
883 | else { |
884 | xf86Msg(X_CONFIG, "Render colormap policy set to %s\n", s); |
885 | PictureCmapPolicy = policy; |
886 | } |
887 | } |
888 | } |
889 | |
890 | #ifdef RANDR1 |
891 | xf86Info.disableRandR = FALSE0; |
892 | xf86Info.randRFrom = X_DEFAULT; |
893 | if (xf86GetOptValBool(FlagOptions, FLAG_RANDR, &value)) { |
894 | xf86Info.disableRandR = !value; |
895 | xf86Info.randRFrom = X_CONFIG; |
896 | } |
897 | #endif |
898 | |
899 | xf86Info.aiglx = TRUE1; |
900 | xf86Info.aiglxFrom = X_DEFAULT; |
901 | if (xf86GetOptValBool(FlagOptions, FLAG_AIGLX, &value)) { |
902 | xf86Info.aiglx = value; |
903 | xf86Info.aiglxFrom = X_CONFIG; |
904 | } |
905 | |
906 | #ifdef GLXEXT1 |
907 | xf86Info.glxVisuals = XF86_GlxVisualsTypical; |
908 | xf86Info.glxVisualsFrom = X_DEFAULT; |
909 | if ((s = xf86GetOptValString(FlagOptions, FLAG_GLX_VISUALS))) { |
910 | if (!xf86NameCmp(s, "minimal")) { |
911 | xf86Info.glxVisuals = XF86_GlxVisualsMinimal; |
912 | } |
913 | else if (!xf86NameCmp(s, "typical")) { |
914 | xf86Info.glxVisuals = XF86_GlxVisualsTypical; |
915 | } |
916 | else if (!xf86NameCmp(s, "all")) { |
917 | xf86Info.glxVisuals = XF86_GlxVisualsAll; |
918 | } |
919 | else { |
920 | xf86Msg(X_WARNING, "Unknown GlxVisuals option\n"); |
921 | } |
922 | } |
923 | |
924 | if (xf86GetOptValBool(FlagOptions, FLAG_AIGLX, &value)) { |
925 | xf86Info.aiglx = value; |
926 | xf86Info.aiglxFrom = X_CONFIG; |
927 | } |
928 | if (xf86Info.iglxFrom != X_CMDLINE) { |
929 | if (xf86GetOptValBool(FlagOptions, FLAG_IGLX, &value)) { |
930 | enableIndirectGLX = value; |
931 | xf86Info.iglxFrom = X_CONFIG; |
932 | } |
933 | } |
934 | #endif |
935 | |
936 | /* if we're not hotplugging, force some input devices to exist */ |
937 | xf86Info.forceInputDevices = !(xf86Info.autoAddDevices && |
938 | xf86Info.autoEnableDevices); |
939 | |
940 | /* when forcing input devices, we use kbd. otherwise evdev, so use the |
941 | * evdev rules set. */ |
942 | #if defined(linux) |
943 | if (!xf86Info.forceInputDevices) |
944 | rules = "evdev"; |
945 | else |
946 | #endif |
947 | rules = "base"; |
948 | |
949 | /* Xkb default options. */ |
950 | XkbInitRules(&set, rules, "pc105", "us", NULL((void*)0), NULL((void*)0)); |
951 | XkbSetRulesDflts(&set); |
952 | XkbFreeRMLVOSet(&set, FALSE0); |
953 | |
954 | xf86Info.useDefaultFontPath = TRUE1; |
955 | if (xf86GetOptValBool(FlagOptions, FLAG_USE_DEFAULT_FONT_PATH, &value)) { |
956 | xf86Info.useDefaultFontPath = value; |
957 | } |
958 | |
959 | /* Make sure that timers don't overflow CARD32's after multiplying */ |
960 | #define MAX_TIME_IN_MIN(0x7fffffff / (1000 * 60)) (0x7fffffff / MILLI_PER_MIN(1000 * 60)) |
961 | |
962 | i = -1; |
963 | xf86GetOptValInteger(FlagOptions, FLAG_SAVER_BLANKTIME, &i); |
964 | if ((i >= 0) && (i < MAX_TIME_IN_MIN(0x7fffffff / (1000 * 60)))) |
965 | ScreenSaverTime = defaultScreenSaverTime = i * MILLI_PER_MIN(1000 * 60); |
966 | else if (i != -1) |
967 | ErrorF("BlankTime value %d outside legal range of 0 - %d minutes\n", |
968 | i, MAX_TIME_IN_MIN(0x7fffffff / (1000 * 60))); |
969 | |
970 | #ifdef DPMSExtension1 |
971 | i = -1; |
972 | xf86GetOptValInteger(FlagOptions, FLAG_DPMS_STANDBYTIME, &i); |
973 | if ((i >= 0) && (i < MAX_TIME_IN_MIN(0x7fffffff / (1000 * 60)))) |
974 | DPMSStandbyTime = i * MILLI_PER_MIN(1000 * 60); |
975 | else if (i != -1) |
976 | ErrorF("StandbyTime value %d outside legal range of 0 - %d minutes\n", |
977 | i, MAX_TIME_IN_MIN(0x7fffffff / (1000 * 60))); |
978 | i = -1; |
979 | xf86GetOptValInteger(FlagOptions, FLAG_DPMS_SUSPENDTIME, &i); |
980 | if ((i >= 0) && (i < MAX_TIME_IN_MIN(0x7fffffff / (1000 * 60)))) |
981 | DPMSSuspendTime = i * MILLI_PER_MIN(1000 * 60); |
982 | else if (i != -1) |
983 | ErrorF("SuspendTime value %d outside legal range of 0 - %d minutes\n", |
984 | i, MAX_TIME_IN_MIN(0x7fffffff / (1000 * 60))); |
985 | i = -1; |
986 | xf86GetOptValInteger(FlagOptions, FLAG_DPMS_OFFTIME, &i); |
987 | if ((i >= 0) && (i < MAX_TIME_IN_MIN(0x7fffffff / (1000 * 60)))) |
988 | DPMSOffTime = i * MILLI_PER_MIN(1000 * 60); |
989 | else if (i != -1) |
990 | ErrorF("OffTime value %d outside legal range of 0 - %d minutes\n", |
991 | i, MAX_TIME_IN_MIN(0x7fffffff / (1000 * 60))); |
992 | #endif |
993 | |
994 | i = -1; |
995 | xf86GetOptValInteger(FlagOptions, FLAG_PIXMAP, &i); |
996 | switch (i) { |
997 | case 24: |
998 | pix24 = Pix24Use24; |
999 | break; |
1000 | case 32: |
1001 | pix24 = Pix24Use32; |
1002 | break; |
1003 | case -1: |
1004 | break; |
1005 | default: |
1006 | ErrorF("Pixmap option's value (%d) must be 24 or 32\n", i); |
1007 | break; |
1008 | } |
1009 | if (xf86Pix24 != Pix24DontCare) { |
1010 | xf86Info.pixmap24 = xf86Pix24; |
1011 | xf86Info.pix24From = X_CMDLINE; |
1012 | } |
1013 | else if (pix24 != Pix24DontCare) { |
1014 | xf86Info.pixmap24 = pix24; |
1015 | xf86Info.pix24From = X_CONFIG; |
1016 | } |
1017 | else { |
1018 | xf86Info.pixmap24 = Pix24DontCare; |
1019 | xf86Info.pix24From = X_DEFAULT; |
1020 | } |
1021 | |
1022 | #ifdef PANORAMIX1 |
1023 | from = X_DEFAULT; |
1024 | if (!noPanoramiXExtension) |
1025 | from = X_CMDLINE; |
1026 | else if (xf86GetOptValBool(FlagOptions, FLAG_XINERAMA, &value)) { |
1027 | noPanoramiXExtension = !value; |
1028 | from = X_CONFIG; |
1029 | } |
1030 | if (!noPanoramiXExtension) |
1031 | xf86Msg(from, "Xinerama: enabled\n"); |
1032 | #endif |
1033 | |
1034 | #ifdef DRI2 |
1035 | xf86Info.dri2 = FALSE0; |
1036 | xf86Info.dri2From = X_DEFAULT; |
1037 | if (xf86GetOptValBool(FlagOptions, FLAG_DRI2, &value)) { |
1038 | xf86Info.dri2 = value; |
1039 | xf86Info.dri2From = X_CONFIG; |
1040 | } |
1041 | #endif |
1042 | |
1043 | from = X_DEFAULT; |
1044 | if (LimitClients != LIMITCLIENTS256) |
1045 | from = X_CMDLINE; |
1046 | i = -1; |
1047 | if (xf86GetOptValInteger(FlagOptions, FLAG_MAX_CLIENTS, &i)) { |
1048 | if (i != 64 && i != 128 && i != 256 && i != 512) |
1049 | ErrorF("MaxClients must be one of 64, 128, 256 or 512\n"); |
1050 | from = X_CONFIG; |
1051 | LimitClients = i; |
1052 | } |
1053 | xf86Msg(from, "Max clients allowed: %i, resource mask: 0x%x\n", |
1054 | LimitClients, RESOURCE_ID_MASK((1 << (29 - ResourceClientBits())) - 1)); |
1055 | } |
1056 | |
1057 | Bool |
1058 | xf86DRI2Enabled(void) |
1059 | { |
1060 | return xf86Info.dri2; |
1061 | } |
1062 | |
1063 | /** |
1064 | * Search for the pInfo in the null-terminated list given and remove (and |
1065 | * free) it if present. All other devices are moved forward. |
1066 | */ |
1067 | static void |
1068 | freeDevice(InputInfoPtr * list, InputInfoPtr pInfo) |
1069 | { |
1070 | InputInfoPtr *devs; |
1071 | |
1072 | for (devs = list; devs && *devs; devs++) { |
1073 | if (*devs == pInfo) { |
1074 | free(*devs); |
1075 | for (; devs && *devs; devs++) |
1076 | devs[0] = devs[1]; |
1077 | break; |
1078 | } |
1079 | } |
1080 | } |
1081 | |
1082 | /** |
1083 | * Append pInfo to the null-terminated list, allocating space as necessary. |
1084 | * pInfo is used as the last element. |
1085 | */ |
1086 | static InputInfoPtr * |
1087 | addDevice(InputInfoPtr * list, InputInfoPtr pInfo) |
1088 | { |
1089 | InputInfoPtr *devs; |
1090 | int count = 1; |
1091 | |
1092 | for (devs = list; devs && *devs; devs++) |
1093 | count++; |
1094 | |
1095 | list = xnfreallocarray(list, count + 1, sizeof(InputInfoPtr))XNFreallocarray((list), (count + 1), (sizeof(InputInfoPtr))); |
1096 | list[count] = NULL((void*)0); |
1097 | |
1098 | list[count - 1] = pInfo; |
1099 | return list; |
1100 | } |
1101 | |
1102 | /* |
1103 | * Locate the core input devices. These can be specified/located in |
1104 | * the following ways, in order of priority: |
1105 | * |
1106 | * 1. The InputDevices named by the -pointer and -keyboard command line |
1107 | * options. |
1108 | * 2. The "CorePointer" and "CoreKeyboard" InputDevices referred to by |
1109 | * the active ServerLayout. |
1110 | * 3. The first InputDevices marked as "CorePointer" and "CoreKeyboard". |
1111 | * 4. The first InputDevices that use 'keyboard' or 'kbd' and a valid mouse |
1112 | * driver (mouse, synaptics, evdev, vmmouse, void) |
1113 | * 5. Default devices with an empty (default) configuration. These defaults |
1114 | * will reference the 'mouse' and 'keyboard' drivers. |
1115 | */ |
1116 | |
1117 | static Bool |
1118 | checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) |
1119 | { |
1120 | InputInfoPtr corePointer = NULL((void*)0), coreKeyboard = NULL((void*)0); |
1121 | Bool foundPointer = FALSE0, foundKeyboard = FALSE0; |
1122 | const char *pointerMsg = NULL((void*)0), *keyboardMsg = NULL((void*)0); |
1123 | InputInfoPtr *devs, /* iterator */ |
1124 | indp; |
1125 | InputInfoPtr Pointer, Keyboard; |
1126 | XF86ConfInputPtr confInput; |
1127 | XF86ConfInputRec defPtr, defKbd; |
1128 | MessageType from = X_DEFAULT; |
1129 | |
1130 | const char *mousedrivers[] = { "mouse", "synaptics", "evdev", "vmmouse", |
1131 | "void", NULL((void*)0) |
1132 | }; |
1133 | |
1134 | /* |
1135 | * First check if a core pointer or core keyboard have been specified |
1136 | * in the active ServerLayout. If more than one is specified for either, |
1137 | * remove the core attribute from the later ones. |
1138 | */ |
1139 | for (devs = servlayoutp->inputs; devs && *devs; devs++) { |
1140 | indp = *devs; |
1141 | if (indp->options && |
1142 | xf86CheckBoolOption(indp->options, "CorePointer", FALSE0)) { |
1143 | if (!corePointer) { |
1144 | corePointer = indp; |
1145 | } |
1146 | } |
1147 | if (indp->options && |
1148 | xf86CheckBoolOption(indp->options, "CoreKeyboard", FALSE0)) { |
1149 | if (!coreKeyboard) { |
1150 | coreKeyboard = indp; |
1151 | } |
1152 | } |
1153 | } |
1154 | |
1155 | confInput = NULL((void*)0); |
1156 | |
1157 | /* 1. Check for the -pointer command line option. */ |
1158 | if (xf86PointerName) { |
1159 | confInput = xf86findInput(xf86PointerName, |
1160 | xf86configptr->conf_input_lst); |
1161 | if (!confInput) { |
1162 | xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n", |
1163 | xf86PointerName); |
1164 | return FALSE0; |
1165 | } |
1166 | from = X_CMDLINE; |
1167 | /* |
1168 | * If one was already specified in the ServerLayout, it needs to be |
1169 | * removed. |
1170 | */ |
1171 | if (corePointer) { |
1172 | freeDevice(servlayoutp->inputs, corePointer); |
1173 | corePointer = NULL((void*)0); |
1174 | } |
1175 | foundPointer = TRUE1; |
1176 | } |
1177 | |
1178 | /* 2. ServerLayout-specified core pointer. */ |
1179 | if (corePointer) { |
1180 | foundPointer = TRUE1; |
1181 | from = X_CONFIG; |
1182 | } |
1183 | |
1184 | /* 3. First core pointer device. */ |
1185 | if (!foundPointer && (xf86Info.forceInputDevices || implicitLayout)) { |
1186 | XF86ConfInputPtr p; |
1187 | |
1188 | for (p = xf86configptr->conf_input_lst; p; p = p->list.next) { |
1189 | if (p->inp_option_lst && |
1190 | xf86CheckBoolOption(p->inp_option_lst, "CorePointer", FALSE0)) { |
1191 | confInput = p; |
1192 | foundPointer = TRUE1; |
1193 | from = X_DEFAULT; |
1194 | pointerMsg = "first core pointer device"; |
1195 | break; |
1196 | } |
1197 | } |
1198 | } |
1199 | |
1200 | /* 4. First pointer with an allowed mouse driver. */ |
1201 | if (!foundPointer && xf86Info.forceInputDevices) { |
1202 | const char **driver = mousedrivers; |
1203 | |
1204 | confInput = xf86findInput(CONF_IMPLICIT_POINTER"Implicit Core Pointer", |
1205 | xf86configptr->conf_input_lst); |
1206 | while (*driver && !confInput) { |
1207 | confInput = xf86findInputByDriver(*driver, |
1208 | xf86configptr->conf_input_lst); |
1209 | driver++; |
1210 | } |
1211 | if (confInput) { |
1212 | foundPointer = TRUE1; |
1213 | from = X_DEFAULT; |
1214 | pointerMsg = "first mouse device"; |
1215 | } |
1216 | } |
1217 | |
1218 | /* 5. Built-in default. */ |
1219 | if (!foundPointer && xf86Info.forceInputDevices) { |
1220 | memset(&defPtr, 0, sizeof(defPtr))__builtin___memset_chk (&defPtr, 0, sizeof(defPtr), __builtin_object_size (&defPtr, 0)); |
1221 | defPtr.inp_identifier = strdup("<default pointer>"); |
1222 | defPtr.inp_driver = strdup("mouse"); |
1223 | confInput = &defPtr; |
1224 | foundPointer = TRUE1; |
1225 | from = X_DEFAULT; |
1226 | pointerMsg = "default mouse configuration"; |
1227 | } |
1228 | |
1229 | /* Add the core pointer device to the layout, and set it to Core. */ |
1230 | if (foundPointer && confInput) { |
1231 | Pointer = xf86AllocateInput(); |
1232 | if (Pointer) |
1233 | foundPointer = configInput(Pointer, confInput, from); |
1234 | if (foundPointer) { |
1235 | Pointer->options = xf86AddNewOption(Pointer->options, |
1236 | "CorePointer", "on"); |
1237 | Pointer->options = xf86AddNewOption(Pointer->options, |
1238 | "driver", |
1239 | confInput->inp_driver); |
1240 | Pointer->options = |
1241 | xf86AddNewOption(Pointer->options, "identifier", |
1242 | confInput->inp_identifier); |
1243 | servlayoutp->inputs = addDevice(servlayoutp->inputs, Pointer); |
1244 | } |
1245 | } |
1246 | |
1247 | if (!foundPointer && xf86Info.forceInputDevices) { |
1248 | /* This shouldn't happen. */ |
1249 | xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n"); |
1250 | xf86DeleteInput(Pointer, 0); |
1251 | return FALSE0; |
1252 | } |
1253 | |
1254 | confInput = NULL((void*)0); |
1255 | |
1256 | /* 1. Check for the -keyboard command line option. */ |
1257 | if (xf86KeyboardName) { |
1258 | confInput = xf86findInput(xf86KeyboardName, |
1259 | xf86configptr->conf_input_lst); |
1260 | if (!confInput) { |
1261 | xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n", |
1262 | xf86KeyboardName); |
1263 | return FALSE0; |
1264 | } |
1265 | from = X_CMDLINE; |
1266 | /* |
1267 | * If one was already specified in the ServerLayout, it needs to be |
1268 | * removed. |
1269 | */ |
1270 | if (coreKeyboard) { |
1271 | freeDevice(servlayoutp->inputs, coreKeyboard); |
1272 | coreKeyboard = NULL((void*)0); |
1273 | } |
1274 | foundKeyboard = TRUE1; |
1275 | } |
1276 | |
1277 | /* 2. ServerLayout-specified core keyboard. */ |
1278 | if (coreKeyboard) { |
1279 | foundKeyboard = TRUE1; |
1280 | from = X_CONFIG; |
1281 | } |
1282 | |
1283 | /* 3. First core keyboard device. */ |
1284 | if (!foundKeyboard && (xf86Info.forceInputDevices || implicitLayout)) { |
1285 | XF86ConfInputPtr p; |
1286 | |
1287 | for (p = xf86configptr->conf_input_lst; p; p = p->list.next) { |
1288 | if (p->inp_option_lst && |
1289 | xf86CheckBoolOption(p->inp_option_lst, "CoreKeyboard", FALSE0)) { |
1290 | confInput = p; |
1291 | foundKeyboard = TRUE1; |
1292 | from = X_DEFAULT; |
1293 | keyboardMsg = "first core keyboard device"; |
1294 | break; |
1295 | } |
1296 | } |
1297 | } |
1298 | |
1299 | /* 4. First keyboard with 'keyboard' or 'kbd' as the driver. */ |
1300 | if (!foundKeyboard && xf86Info.forceInputDevices) { |
1301 | confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD"Implicit Core Keyboard", |
1302 | xf86configptr->conf_input_lst); |
1303 | if (!confInput) { |
1304 | confInput = xf86findInputByDriver("kbd", |
1305 | xf86configptr->conf_input_lst); |
1306 | } |
1307 | if (confInput) { |
1308 | foundKeyboard = TRUE1; |
1309 | from = X_DEFAULT; |
1310 | keyboardMsg = "first keyboard device"; |
1311 | } |
1312 | } |
1313 | |
1314 | /* 5. Built-in default. */ |
1315 | if (!foundKeyboard && xf86Info.forceInputDevices) { |
1316 | memset(&defKbd, 0, sizeof(defKbd))__builtin___memset_chk (&defKbd, 0, sizeof(defKbd), __builtin_object_size (&defKbd, 0)); |
1317 | defKbd.inp_identifier = strdup("<default keyboard>"); |
1318 | defKbd.inp_driver = strdup("kbd"); |
1319 | confInput = &defKbd; |
1320 | foundKeyboard = TRUE1; |
1321 | keyboardMsg = "default keyboard configuration"; |
1322 | from = X_DEFAULT; |
1323 | } |
1324 | |
1325 | /* Add the core keyboard device to the layout, and set it to Core. */ |
1326 | if (foundKeyboard && confInput) { |
1327 | Keyboard = xf86AllocateInput(); |
1328 | if (Keyboard) |
1329 | foundKeyboard = configInput(Keyboard, confInput, from); |
1330 | if (foundKeyboard) { |
1331 | Keyboard->options = xf86AddNewOption(Keyboard->options, |
1332 | "CoreKeyboard", "on"); |
1333 | Keyboard->options = xf86AddNewOption(Keyboard->options, |
1334 | "driver", |
1335 | confInput->inp_driver); |
1336 | Keyboard->options = |
1337 | xf86AddNewOption(Keyboard->options, "identifier", |
1338 | confInput->inp_identifier); |
1339 | servlayoutp->inputs = addDevice(servlayoutp->inputs, Keyboard); |
1340 | } |
1341 | } |
1342 | |
1343 | if (!foundKeyboard && xf86Info.forceInputDevices) { |
1344 | /* This shouldn't happen. */ |
1345 | xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n"); |
1346 | xf86DeleteInput(Keyboard, 0); |
1347 | return FALSE0; |
1348 | } |
1349 | |
1350 | if (pointerMsg) { |
1351 | if (implicitLayout) |
1352 | xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n", |
1353 | pointerMsg); |
1354 | else |
1355 | xf86Msg(X_DEFAULT, "The core pointer device wasn't specified " |
1356 | "explicitly in the layout.\n" |
1357 | "\tUsing the %s.\n", pointerMsg); |
1358 | } |
1359 | |
1360 | if (keyboardMsg) { |
1361 | if (implicitLayout) |
1362 | xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n", |
1363 | keyboardMsg); |
1364 | else |
1365 | xf86Msg(X_DEFAULT, "The core keyboard device wasn't specified " |
1366 | "explicitly in the layout.\n" |
1367 | "\tUsing the %s.\n", keyboardMsg); |
1368 | } |
1369 | |
1370 | if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) { |
1371 | #if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) |
1372 | const char *config_backend; |
1373 | |
1374 | #if defined(CONFIG_HAL) |
1375 | config_backend = "HAL"; |
1376 | #elif defined(CONFIG_UDEV) |
1377 | config_backend = "udev"; |
1378 | #else |
1379 | config_backend = "wscons"; |
1380 | #endif |
1381 | xf86Msg(X_INFO, "The server relies on %s to provide the list of " |
1382 | "input devices.\n\tIf no devices become available, " |
1383 | "reconfigure %s or disable AutoAddDevices.\n", |
1384 | config_backend, config_backend); |
1385 | #else |
1386 | xf86Msg(X_WARNING, "Hotplugging requested but the server was " |
1387 | "compiled without a config backend. " |
1388 | "No input devices were configured, the server " |
1389 | "will start without any input devices.\n"); |
1390 | #endif |
1391 | } |
1392 | |
1393 | return TRUE1; |
1394 | } |
1395 | |
1396 | typedef enum { |
1397 | LAYOUT_ISOLATEDEVICE, |
1398 | LAYOUT_SINGLECARD |
1399 | } LayoutValues; |
1400 | |
1401 | static OptionInfoRec LayoutOptions[] = { |
1402 | {LAYOUT_ISOLATEDEVICE, "IsolateDevice", OPTV_STRING, |
1403 | {0}, FALSE0}, |
1404 | {LAYOUT_SINGLECARD, "SingleCard", OPTV_BOOLEAN, |
1405 | {0}, FALSE0}, |
1406 | {-1, NULL((void*)0), OPTV_NONE, |
1407 | {0}, FALSE0}, |
1408 | }; |
1409 | |
1410 | static Bool |
1411 | configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp) |
1412 | { |
1413 | XF86ConfInputrefPtr irp; |
1414 | InputInfoPtr *indp; |
1415 | int count = 0; |
1416 | |
1417 | /* |
1418 | * Count the number of input devices. |
1419 | */ |
1420 | irp = layout->lay_input_lst; |
1421 | while (irp) { |
1422 | count++; |
1423 | irp = (XF86ConfInputrefPtr) irp->list.next; |
1424 | } |
1425 | DebugF("Found %d input devices in the layout section %s\n", |
1426 | count, layout->lay_identifier); |
1427 | indp = xnfcalloc((count + 1), sizeof(InputInfoPtr))XNFcallocarray(((count + 1)), (sizeof(InputInfoPtr))); |
1428 | indp[count] = NULL((void*)0); |
1429 | irp = layout->lay_input_lst; |
1430 | count = 0; |
1431 | while (irp) { |
1432 | indp[count] = xf86AllocateInput(); |
1433 | if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) { |
1434 | do { |
1435 | free(indp[count]); |
1436 | } while (count--); |
1437 | free(indp); |
1438 | return FALSE0; |
1439 | } |
1440 | indp[count]->options = xf86OptionListMerge(indp[count]->options, |
1441 | irp->iref_option_lst); |
1442 | count++; |
1443 | irp = (XF86ConfInputrefPtr) irp->list.next; |
1444 | } |
1445 | servlayoutp->inputs = indp; |
1446 | |
1447 | return TRUE1; |
1448 | } |
1449 | |
1450 | /* |
1451 | * figure out which layout is active, which screens are used in that layout, |
1452 | * which drivers and monitors are used in these screens |
1453 | */ |
1454 | static Bool |
1455 | configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, |
1456 | char *default_layout) |
1457 | { |
1458 | XF86ConfAdjacencyPtr adjp; |
1459 | XF86ConfInactivePtr idp; |
1460 | int saved_count, count = 0; |
1461 | int scrnum; |
1462 | XF86ConfLayoutPtr l; |
1463 | MessageType from; |
1464 | screenLayoutPtr slp; |
1465 | GDevPtr gdp; |
1466 | int i = 0, j; |
1467 | |
1468 | if (!servlayoutp) |
1469 | return FALSE0; |
1470 | |
1471 | /* |
1472 | * which layout section is the active one? |
1473 | * |
1474 | * If there is a -layout command line option, use that one, otherwise |
1475 | * pick the first one. |
1476 | */ |
1477 | from = X_DEFAULT; |
1478 | if (xf86LayoutName != NULL((void*)0)) |
1479 | from = X_CMDLINE; |
1480 | else if (default_layout) { |
1481 | xf86LayoutName = default_layout; |
1482 | from = X_CONFIG; |
1483 | } |
1484 | if (xf86LayoutName != NULL((void*)0)) { |
1485 | if ((l = xf86findLayout(xf86LayoutName, conf_layout)) == NULL((void*)0)) { |
1486 | xf86Msg(X_ERROR, "No ServerLayout section called \"%s\"\n", |
1487 | xf86LayoutName); |
1488 | return FALSE0; |
1489 | } |
1490 | conf_layout = l; |
1491 | } |
1492 | xf86Msg(from, "ServerLayout \"%s\"\n", conf_layout->lay_identifier); |
1493 | adjp = conf_layout->lay_adjacency_lst; |
1494 | |
1495 | /* |
1496 | * we know that each screen is referenced exactly once on the left side |
1497 | * of a layout statement in the Layout section. So to allocate the right |
1498 | * size for the array we do a quick walk of the list to figure out how |
1499 | * many sections we have |
1500 | */ |
1501 | while (adjp) { |
1502 | count++; |
1503 | adjp = (XF86ConfAdjacencyPtr) adjp->list.next; |
1504 | } |
1505 | |
1506 | DebugF("Found %d screens in the layout section %s", |
1507 | count, conf_layout->lay_identifier); |
1508 | if (!count) /* alloc enough storage even if no screen is specified */ |
1509 | count = 1; |
1510 | |
1511 | slp = xnfcalloc((count + 1), sizeof(screenLayoutRec))XNFcallocarray(((count + 1)), (sizeof(screenLayoutRec))); |
1512 | slp[count].screen = NULL((void*)0); |
1513 | /* |
1514 | * now that we have storage, loop over the list again and fill in our |
1515 | * data structure; at this point we do not fill in the adjacency |
1516 | * information as it is not clear if we need it at all |
1517 | */ |
1518 | adjp = conf_layout->lay_adjacency_lst; |
1519 | count = 0; |
1520 | while (adjp) { |
1521 | slp[count].screen = xnfcalloc(1, sizeof(confScreenRec))XNFcallocarray((1), (sizeof(confScreenRec))); |
1522 | if (adjp->adj_scrnum < 0) |
1523 | scrnum = count; |
1524 | else |
1525 | scrnum = adjp->adj_scrnum; |
1526 | if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum, |
1527 | X_CONFIG, (scrnum == 0 && !adjp->list.next))) { |
1528 | do { |
1529 | free(slp[count].screen); |
1530 | } while (count--); |
1531 | free(slp); |
1532 | return FALSE0; |
1533 | } |
1534 | slp[count].x = adjp->adj_x; |
1535 | slp[count].y = adjp->adj_y; |
1536 | slp[count].refname = adjp->adj_refscreen; |
1537 | switch (adjp->adj_where) { |
1538 | case CONF_ADJ_OBSOLETE-1: |
1539 | slp[count].where = PosObsolete; |
1540 | slp[count].topname = adjp->adj_top_str; |
1541 | slp[count].bottomname = adjp->adj_bottom_str; |
1542 | slp[count].leftname = adjp->adj_left_str; |
1543 | slp[count].rightname = adjp->adj_right_str; |
1544 | break; |
1545 | case CONF_ADJ_ABSOLUTE0: |
1546 | slp[count].where = PosAbsolute; |
1547 | break; |
1548 | case CONF_ADJ_RIGHTOF1: |
1549 | slp[count].where = PosRightOf; |
1550 | break; |
1551 | case CONF_ADJ_LEFTOF2: |
1552 | slp[count].where = PosLeftOf; |
1553 | break; |
1554 | case CONF_ADJ_ABOVE3: |
1555 | slp[count].where = PosAbove; |
1556 | break; |
1557 | case CONF_ADJ_BELOW4: |
1558 | slp[count].where = PosBelow; |
1559 | break; |
1560 | case CONF_ADJ_RELATIVE5: |
1561 | slp[count].where = PosRelative; |
1562 | break; |
1563 | } |
1564 | count++; |
1565 | adjp = (XF86ConfAdjacencyPtr) adjp->list.next; |
1566 | } |
1567 | |
1568 | /* No screen was specified in the layout. take the first one from the |
1569 | * config file, or - if it is NULL - configScreen autogenerates one for |
1570 | * us */ |
1571 | if (!count) { |
1572 | XF86ConfScreenPtr screen; |
1573 | |
1574 | FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen)do { XF86ConfScreenPtr _l, _p; for (_l = (xf86configptr->conf_screen_lst ), _p = ((void*)0); !_p && _l; _l = (XF86ConfScreenPtr )_l->list.next) { if (!_l->match_seat || (SeatId && xf86nameCompare(_l->match_seat, SeatId) == 0)) _p = _l; } (screen) = _p; } while(0); |
1575 | slp[0].screen = xnfcalloc(1, sizeof(confScreenRec))XNFcallocarray((1), (sizeof(confScreenRec))); |
1576 | if (!configScreen(slp[0].screen, screen, |
1577 | 0, X_CONFIG, TRUE1)) { |
1578 | free(slp[0].screen); |
1579 | free(slp); |
1580 | return FALSE0; |
1581 | } |
1582 | } |
1583 | |
1584 | /* XXX Need to tie down the upper left screen. */ |
1585 | |
1586 | /* Fill in the refscreen and top/bottom/left/right values */ |
1587 | for (i = 0; i < count; i++) { |
1588 | for (j = 0; j < count; j++) { |
1589 | if (slp[i].refname && |
1590 | strcmp(slp[i].refname, slp[j].screen->id) == 0) { |
1591 | slp[i].refscreen = slp[j].screen; |
1592 | } |
1593 | if (slp[i].topname && |
1594 | strcmp(slp[i].topname, slp[j].screen->id) == 0) { |
1595 | slp[i].top = slp[j].screen; |
1596 | } |
1597 | if (slp[i].bottomname && |
1598 | strcmp(slp[i].bottomname, slp[j].screen->id) == 0) { |
1599 | slp[i].bottom = slp[j].screen; |
1600 | } |
1601 | if (slp[i].leftname && |
1602 | strcmp(slp[i].leftname, slp[j].screen->id) == 0) { |
1603 | slp[i].left = slp[j].screen; |
1604 | } |
1605 | if (slp[i].rightname && |
1606 | strcmp(slp[i].rightname, slp[j].screen->id) == 0) { |
1607 | slp[i].right = slp[j].screen; |
1608 | } |
1609 | } |
1610 | if (slp[i].where != PosObsolete |
1611 | && slp[i].where != PosAbsolute && !slp[i].refscreen) { |
1612 | xf86Msg(X_ERROR, "Screen %s doesn't exist: deleting placement\n", |
1613 | slp[i].refname); |
1614 | slp[i].where = PosAbsolute; |
1615 | slp[i].x = 0; |
1616 | slp[i].y = 0; |
1617 | } |
1618 | } |
1619 | |
1620 | if (!count) |
1621 | saved_count = 1; |
1622 | else |
1623 | saved_count = count; |
1624 | /* |
1625 | * Count the number of inactive devices. |
1626 | */ |
1627 | count = 0; |
1628 | idp = conf_layout->lay_inactive_lst; |
1629 | while (idp) { |
1630 | count++; |
1631 | idp = (XF86ConfInactivePtr) idp->list.next; |
1632 | } |
1633 | DebugF("Found %d inactive devices in the layout section %s\n", |
1634 | count, conf_layout->lay_identifier); |
1635 | gdp = xnfallocarray(count + 1, sizeof(GDevRec))XNFreallocarray(((void*)0), (count + 1), (sizeof(GDevRec))); |
1636 | gdp[count].identifier = NULL((void*)0); |
1637 | idp = conf_layout->lay_inactive_lst; |
1638 | count = 0; |
1639 | while (idp) { |
1640 | if (!configDevice(&gdp[count], idp->inactive_device, FALSE0, FALSE0)) |
1641 | goto bail; |
1642 | count++; |
1643 | idp = (XF86ConfInactivePtr) idp->list.next; |
1644 | } |
1645 | |
1646 | if (!configInputDevices(conf_layout, servlayoutp)) |
1647 | goto bail; |
1648 | |
1649 | servlayoutp->id = conf_layout->lay_identifier; |
1650 | servlayoutp->screens = slp; |
1651 | servlayoutp->inactives = gdp; |
1652 | servlayoutp->options = conf_layout->lay_option_lst; |
1653 | from = X_DEFAULT; |
1654 | |
1655 | return TRUE1; |
1656 | |
1657 | bail: |
1658 | do { |
1659 | free(slp[saved_count].screen); |
1660 | } while (saved_count--); |
1661 | free(slp); |
1662 | free(gdp); |
1663 | return FALSE0; |
1664 | } |
1665 | |
1666 | /* |
1667 | * No layout section, so find the first Screen section and set that up as |
1668 | * the only active screen. |
1669 | */ |
1670 | static Bool |
1671 | configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen, |
1672 | XF86ConfigPtr conf_ptr) |
1673 | { |
1674 | MessageType from; |
1675 | XF86ConfScreenPtr s; |
1676 | screenLayoutPtr slp; |
1677 | InputInfoPtr *indp; |
1678 | XF86ConfLayoutRec layout; |
1679 | |
1680 | if (!servlayoutp) |
1681 | return FALSE0; |
1682 | |
1683 | /* |
1684 | * which screen section is the active one? |
1685 | * |
1686 | * If there is a -screen option, use that one, otherwise use the first |
1687 | * one. |
1688 | */ |
1689 | |
1690 | from = X_CONFIG; |
1691 | if (xf86ScreenName != NULL((void*)0)) { |
1692 | if ((s = xf86findScreen(xf86ScreenName, conf_screen)) == NULL((void*)0)) { |
1693 | xf86Msg(X_ERROR, "No Screen section called \"%s\"\n", |
1694 | xf86ScreenName); |
1695 | return FALSE0; |
1696 | } |
1697 | conf_screen = s; |
1698 | from = X_CMDLINE; |
1699 | } |
1700 | |
1701 | /* We have exactly one screen */ |
1702 | |
1703 | slp = xnfcalloc(1, 2 * sizeof(screenLayoutRec))XNFcallocarray((1), (2 * sizeof(screenLayoutRec))); |
1704 | slp[0].screen = xnfcalloc(1, sizeof(confScreenRec))XNFcallocarray((1), (sizeof(confScreenRec))); |
1705 | slp[1].screen = NULL((void*)0); |
1706 | if (!configScreen(slp[0].screen, conf_screen, 0, from, TRUE1)) { |
1707 | free(slp); |
1708 | return FALSE0; |
1709 | } |
1710 | servlayoutp->id = "(implicit)"; |
1711 | servlayoutp->screens = slp; |
1712 | servlayoutp->inactives = xnfcalloc(1, sizeof(GDevRec))XNFcallocarray((1), (sizeof(GDevRec))); |
1713 | servlayoutp->options = NULL((void*)0); |
1714 | |
1715 | memset(&layout, 0, sizeof(layout))__builtin___memset_chk (&layout, 0, sizeof(layout), __builtin_object_size (&layout, 0)); |
1716 | layout.lay_identifier = servlayoutp->id; |
1717 | if (xf86layoutAddInputDevices(conf_ptr, &layout) > 0) { |
1718 | if (!configInputDevices(&layout, servlayoutp)) |
1719 | return FALSE0; |
1720 | from = X_DEFAULT; |
1721 | } |
1722 | else { |
1723 | /* Set up an empty input device list, then look for some core devices. */ |
1724 | indp = xnfalloc(sizeof(InputInfoPtr))XNFalloc((unsigned long)(sizeof(InputInfoPtr))); |
1725 | *indp = NULL((void*)0); |
1726 | servlayoutp->inputs = indp; |
1727 | } |
1728 | |
1729 | return TRUE1; |
1730 | } |
1731 | |
1732 | static Bool |
1733 | configXvAdaptor(confXvAdaptorPtr adaptor, XF86ConfVideoAdaptorPtr conf_adaptor) |
1734 | { |
1735 | int count = 0; |
1736 | XF86ConfVideoPortPtr conf_port; |
1737 | |
1738 | xf86Msg(X_CONFIG, "| |-->VideoAdaptor \"%s\"\n", |
1739 | conf_adaptor->va_identifier); |
1740 | adaptor->identifier = conf_adaptor->va_identifier; |
1741 | adaptor->options = conf_adaptor->va_option_lst; |
1742 | if (conf_adaptor->va_busid || conf_adaptor->va_driver) { |
1743 | xf86Msg(X_CONFIG, "| | Unsupported device type, skipping entry\n"); |
1744 | return FALSE0; |
1745 | } |
1746 | |
1747 | /* |
1748 | * figure out how many videoport subsections there are and fill them in |
1749 | */ |
1750 | conf_port = conf_adaptor->va_port_lst; |
1751 | while (conf_port) { |
1752 | count++; |
1753 | conf_port = (XF86ConfVideoPortPtr) conf_port->list.next; |
1754 | } |
1755 | adaptor->ports = xnfallocarray(count, sizeof(confXvPortRec))XNFreallocarray(((void*)0), (count), (sizeof(confXvPortRec))); |
1756 | adaptor->numports = count; |
1757 | count = 0; |
1758 | conf_port = conf_adaptor->va_port_lst; |
1759 | while (conf_port) { |
1760 | adaptor->ports[count].identifier = conf_port->vp_identifier; |
1761 | adaptor->ports[count].options = conf_port->vp_option_lst; |
1762 | count++; |
1763 | conf_port = (XF86ConfVideoPortPtr) conf_port->list.next; |
1764 | } |
1765 | |
1766 | return TRUE1; |
1767 | } |
1768 | |
1769 | static Bool |
1770 | configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, |
1771 | MessageType from, Bool auto_gpu_device) |
1772 | { |
1773 | int count = 0; |
1774 | XF86ConfDisplayPtr dispptr; |
1775 | XF86ConfAdaptorLinkPtr conf_adaptor; |
1776 | Bool defaultMonitor = FALSE0; |
1777 | XF86ConfScreenRec local_conf_screen; |
1778 | int i; |
1779 | |
1780 | if (!conf_screen) { |
1781 | memset(&local_conf_screen, 0, sizeof(local_conf_screen))__builtin___memset_chk (&local_conf_screen, 0, sizeof(local_conf_screen ), __builtin_object_size (&local_conf_screen, 0)); |
1782 | conf_screen = &local_conf_screen; |
1783 | conf_screen->scrn_identifier = "Default Screen Section"; |
1784 | xf86Msg(X_DEFAULT, "No screen section available. Using defaults.\n"); |
1785 | } |
1786 | |
1787 | xf86Msg(from, "|-->Screen \"%s\" (%d)\n", conf_screen->scrn_identifier, |
1788 | scrnum); |
1789 | /* |
1790 | * now we fill in the elements of the screen |
1791 | */ |
1792 | screenp->id = conf_screen->scrn_identifier; |
1793 | screenp->screennum = scrnum; |
1794 | screenp->defaultdepth = conf_screen->scrn_defaultdepth; |
1795 | screenp->defaultbpp = conf_screen->scrn_defaultbpp; |
1796 | screenp->defaultfbbpp = conf_screen->scrn_defaultfbbpp; |
1797 | screenp->monitor = xnfcalloc(1, sizeof(MonRec))XNFcallocarray((1), (sizeof(MonRec))); |
1798 | /* If no monitor is specified, create a default one. */ |
1799 | if (!conf_screen->scrn_monitor) { |
1800 | XF86ConfMonitorRec defMon; |
1801 | |
1802 | memset(&defMon, 0, sizeof(defMon))__builtin___memset_chk (&defMon, 0, sizeof(defMon), __builtin_object_size (&defMon, 0)); |
1803 | defMon.mon_identifier = "<default monitor>"; |
1804 | if (!configMonitor(screenp->monitor, &defMon)) |
1805 | return FALSE0; |
1806 | defaultMonitor = TRUE1; |
1807 | } |
1808 | else { |
1809 | if (!configMonitor(screenp->monitor, conf_screen->scrn_monitor)) |
1810 | return FALSE0; |
1811 | } |
1812 | /* Configure the device. If there isn't one configured, attach to the |
1813 | * first inactive one that we can configure. If there's none that work, |
1814 | * set it to NULL so that the section can be autoconfigured later */ |
1815 | screenp->device = xnfcalloc(1, sizeof(GDevRec))XNFcallocarray((1), (sizeof(GDevRec))); |
1816 | if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_lst)) { |
1817 | FIND_SUITABLE (XF86ConfDevicePtr, xf86configptr->conf_device_lst, conf_screen->scrn_device)do { XF86ConfDevicePtr _l, _p; for (_l = (xf86configptr->conf_device_lst ), _p = ((void*)0); !_p && _l; _l = (XF86ConfDevicePtr )_l->list.next) { if (!_l->match_seat || (SeatId && xf86nameCompare(_l->match_seat, SeatId) == 0)) _p = _l; } (conf_screen->scrn_device) = _p; } while(0); |
1818 | xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n" |
1819 | "\tUsing the first device section listed.\n", screenp->id); |
1820 | } |
1821 | if (configDevice(screenp->device, conf_screen->scrn_device, TRUE1, FALSE0)) { |
1822 | screenp->device->myScreenSection = screenp; |
1823 | } |
1824 | else { |
1825 | screenp->device = NULL((void*)0); |
1826 | } |
1827 | |
1828 | if (auto_gpu_device && conf_screen->num_gpu_devices == 0 && |
1829 | xf86configptr->conf_device_lst) { |
1830 | XF86ConfDevicePtr sdevice = xf86configptr->conf_device_lst->list.next; |
1831 | |
1832 | for (i = 0; i < MAX_GPUDEVICES4; i++) { |
1833 | if (!sdevice) |
1834 | break; |
1835 | |
1836 | FIND_SUITABLE (XF86ConfDevicePtr, sdevice, conf_screen->scrn_gpu_devices[i])do { XF86ConfDevicePtr _l, _p; for (_l = (sdevice), _p = ((void *)0); !_p && _l; _l = (XF86ConfDevicePtr)_l->list. next) { if (!_l->match_seat || (SeatId && xf86nameCompare (_l->match_seat, SeatId) == 0)) _p = _l; } (conf_screen-> scrn_gpu_devices[i]) = _p; } while(0); |
1837 | if (!conf_screen->scrn_gpu_devices[i]) |
1838 | break; |
1839 | screenp->gpu_devices[i] = xnfcalloc(1, sizeof(GDevRec))XNFcallocarray((1), (sizeof(GDevRec))); |
1840 | if (configDevice(screenp->gpu_devices[i], conf_screen->scrn_gpu_devices[i], TRUE1, TRUE1)) { |
1841 | screenp->gpu_devices[i]->myScreenSection = screenp; |
1842 | } |
1843 | sdevice = conf_screen->scrn_gpu_devices[i]->list.next; |
1844 | } |
1845 | screenp->num_gpu_devices = i; |
1846 | |
1847 | } else { |
1848 | for (i = 0; i < conf_screen->num_gpu_devices; i++) { |
1849 | screenp->gpu_devices[i] = xnfcalloc(1, sizeof(GDevRec))XNFcallocarray((1), (sizeof(GDevRec))); |
1850 | if (configDevice(screenp->gpu_devices[i], conf_screen->scrn_gpu_devices[i], TRUE1, TRUE1)) { |
1851 | screenp->gpu_devices[i]->myScreenSection = screenp; |
1852 | } |
1853 | } |
1854 | screenp->num_gpu_devices = conf_screen->num_gpu_devices; |
1855 | } |
1856 | |
1857 | screenp->options = conf_screen->scrn_option_lst; |
1858 | |
1859 | /* |
1860 | * figure out how many display subsections there are and fill them in |
1861 | */ |
1862 | dispptr = conf_screen->scrn_display_lst; |
1863 | while (dispptr) { |
1864 | count++; |
1865 | dispptr = (XF86ConfDisplayPtr) dispptr->list.next; |
1866 | } |
1867 | screenp->displays = xnfallocarray(count, sizeof(DispRec))XNFreallocarray(((void*)0), (count), (sizeof(DispRec))); |
1868 | screenp->numdisplays = count; |
1869 | |
1870 | /* Fill in the default Virtual size, if any */ |
1871 | if (conf_screen->scrn_virtualX && conf_screen->scrn_virtualY) { |
1872 | for (count = 0, dispptr = conf_screen->scrn_display_lst; |
1873 | dispptr; |
1874 | dispptr = (XF86ConfDisplayPtr) dispptr->list.next, count++) { |
1875 | screenp->displays[count].virtualX = conf_screen->scrn_virtualX; |
1876 | screenp->displays[count].virtualY = conf_screen->scrn_virtualY; |
1877 | } |
1878 | } |
1879 | |
1880 | /* Now do the per-Display Virtual sizes */ |
1881 | count = 0; |
1882 | dispptr = conf_screen->scrn_display_lst; |
1883 | while (dispptr) { |
1884 | configDisplay(&(screenp->displays[count]), dispptr); |
1885 | count++; |
1886 | dispptr = (XF86ConfDisplayPtr) dispptr->list.next; |
1887 | } |
1888 | |
1889 | /* |
1890 | * figure out how many videoadaptor references there are and fill them in |
1891 | */ |
1892 | conf_adaptor = conf_screen->scrn_adaptor_lst; |
1893 | while (conf_adaptor) { |
1894 | count++; |
1895 | conf_adaptor = (XF86ConfAdaptorLinkPtr) conf_adaptor->list.next; |
1896 | } |
1897 | screenp->xvadaptors = xnfallocarray(count, sizeof(confXvAdaptorRec))XNFreallocarray(((void*)0), (count), (sizeof(confXvAdaptorRec ))); |
1898 | screenp->numxvadaptors = 0; |
1899 | conf_adaptor = conf_screen->scrn_adaptor_lst; |
1900 | while (conf_adaptor) { |
1901 | if (configXvAdaptor(&(screenp->xvadaptors[screenp->numxvadaptors]), |
1902 | conf_adaptor->al_adaptor)) |
1903 | screenp->numxvadaptors++; |
1904 | conf_adaptor = (XF86ConfAdaptorLinkPtr) conf_adaptor->list.next; |
1905 | } |
1906 | |
1907 | if (defaultMonitor) { |
1908 | xf86Msg(X_DEFAULT, "No monitor specified for screen \"%s\".\n" |
1909 | "\tUsing a default monitor configuration.\n", screenp->id); |
1910 | } |
1911 | return TRUE1; |
1912 | } |
1913 | |
1914 | typedef enum { |
1915 | MON_REDUCEDBLANKING, |
1916 | MON_MAX_PIX_CLOCK, |
1917 | } MonitorValues; |
1918 | |
1919 | static OptionInfoRec MonitorOptions[] = { |
1920 | {MON_REDUCEDBLANKING, "ReducedBlanking", OPTV_BOOLEAN, |
1921 | {0}, FALSE0}, |
1922 | {MON_MAX_PIX_CLOCK, "MaxPixClock", OPTV_FREQ, |
1923 | {0}, FALSE0}, |
1924 | {-1, NULL((void*)0), OPTV_NONE, |
1925 | {0}, FALSE0}, |
1926 | }; |
1927 | |
1928 | static Bool |
1929 | configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor) |
1930 | { |
1931 | int count; |
1932 | DisplayModePtr mode, last = NULL((void*)0); |
1933 | XF86ConfModeLinePtr cmodep; |
1934 | XF86ConfModesPtr modes; |
1935 | XF86ConfModesLinkPtr modeslnk = conf_monitor->mon_modes_sect_lst; |
1936 | Gamma zeros = { 0.0, 0.0, 0.0 }; |
1937 | float badgamma = 0.0; |
1938 | double maxPixClock; |
1939 | |
1940 | xf86Msg(X_CONFIG, "| |-->Monitor \"%s\"\n", conf_monitor->mon_identifier); |
1941 | monitorp->id = conf_monitor->mon_identifier; |
1942 | monitorp->vendor = conf_monitor->mon_vendor; |
1943 | monitorp->model = conf_monitor->mon_modelname; |
1944 | monitorp->Modes = NULL((void*)0); |
1945 | monitorp->Last = NULL((void*)0); |
1946 | monitorp->gamma = zeros; |
1947 | monitorp->widthmm = conf_monitor->mon_width; |
1948 | monitorp->heightmm = conf_monitor->mon_height; |
1949 | monitorp->reducedblanking = FALSE0; |
1950 | monitorp->maxPixClock = 0; |
1951 | monitorp->options = conf_monitor->mon_option_lst; |
1952 | |
1953 | /* |
1954 | * fill in the monitor structure |
1955 | */ |
1956 | for (count = 0; |
1957 | count < conf_monitor->mon_n_hsync && count < MAX_HSYNC8; count++) { |
1958 | monitorp->hsync[count].hi = conf_monitor->mon_hsync[count].hi; |
1959 | monitorp->hsync[count].lo = conf_monitor->mon_hsync[count].lo; |
1960 | } |
1961 | monitorp->nHsync = count; |
1962 | for (count = 0; |
1963 | count < conf_monitor->mon_n_vrefresh && count < MAX_VREFRESH8; |
1964 | count++) { |
1965 | monitorp->vrefresh[count].hi = conf_monitor->mon_vrefresh[count].hi; |
1966 | monitorp->vrefresh[count].lo = conf_monitor->mon_vrefresh[count].lo; |
1967 | } |
1968 | monitorp->nVrefresh = count; |
1969 | |
1970 | /* |
1971 | * first we collect the mode lines from the UseModes directive |
1972 | */ |
1973 | while (modeslnk) { |
1974 | modes = xf86findModes(modeslnk->ml_modes_str, |
1975 | xf86configptr->conf_modes_lst); |
1976 | modeslnk->ml_modes = modes; |
1977 | |
1978 | /* now add the modes found in the modes |
1979 | section to the list of modes for this |
1980 | monitor unless it has been added before |
1981 | because we are reusing the same section |
1982 | for another screen */ |
1983 | if (xf86itemNotSublist((GenericListPtr) conf_monitor->mon_modeline_lst, |
1984 | (GenericListPtr) modes->mon_modeline_lst)) { |
1985 | conf_monitor->mon_modeline_lst = (XF86ConfModeLinePtr) |
1986 | xf86addListItem((GenericListPtr) conf_monitor->mon_modeline_lst, |
1987 | (GenericListPtr) modes->mon_modeline_lst); |
1988 | } |
1989 | modeslnk = modeslnk->list.next; |
1990 | } |
1991 | |
1992 | /* |
1993 | * we need to hook in the mode lines now |
1994 | * here both data structures use lists, only our internal one |
1995 | * is double linked |
1996 | */ |
1997 | cmodep = conf_monitor->mon_modeline_lst; |
1998 | while (cmodep) { |
1999 | mode = xnfcalloc(1, sizeof(DisplayModeRec))XNFcallocarray((1), (sizeof(DisplayModeRec))); |
2000 | mode->type = 0; |
2001 | mode->Clock = cmodep->ml_clock; |
2002 | mode->HDisplay = cmodep->ml_hdisplay; |
2003 | mode->HSyncStart = cmodep->ml_hsyncstart; |
2004 | mode->HSyncEnd = cmodep->ml_hsyncend; |
2005 | mode->HTotal = cmodep->ml_htotal; |
2006 | mode->VDisplay = cmodep->ml_vdisplay; |
2007 | mode->VSyncStart = cmodep->ml_vsyncstart; |
2008 | mode->VSyncEnd = cmodep->ml_vsyncend; |
2009 | mode->VTotal = cmodep->ml_vtotal; |
2010 | mode->Flags = cmodep->ml_flags; |
2011 | mode->HSkew = cmodep->ml_hskew; |
2012 | mode->VScan = cmodep->ml_vscan; |
2013 | mode->name = xnfstrdup(cmodep->ml_identifier)XNFstrdup(cmodep->ml_identifier); |
2014 | if (last) { |
2015 | mode->prev = last; |
2016 | last->next = mode; |
2017 | } |
2018 | else { |
2019 | /* |
2020 | * this is the first mode |
2021 | */ |
2022 | monitorp->Modes = mode; |
2023 | mode->prev = NULL((void*)0); |
2024 | } |
2025 | last = mode; |
2026 | cmodep = (XF86ConfModeLinePtr) cmodep->list.next; |
2027 | } |
2028 | if (last) { |
2029 | last->next = NULL((void*)0); |
2030 | } |
2031 | monitorp->Last = last; |
2032 | |
2033 | /* add the (VESA) default modes */ |
2034 | if (!addDefaultModes(monitorp)) |
2035 | return FALSE0; |
2036 | |
2037 | if (conf_monitor->mon_gamma_red > GAMMA_ZERO((1.0 / 10.0) / 100.0)) |
2038 | monitorp->gamma.red = conf_monitor->mon_gamma_red; |
2039 | if (conf_monitor->mon_gamma_green > GAMMA_ZERO((1.0 / 10.0) / 100.0)) |
2040 | monitorp->gamma.green = conf_monitor->mon_gamma_green; |
2041 | if (conf_monitor->mon_gamma_blue > GAMMA_ZERO((1.0 / 10.0) / 100.0)) |
2042 | monitorp->gamma.blue = conf_monitor->mon_gamma_blue; |
2043 | |
2044 | /* Check that the gamma values are within range */ |
2045 | if (monitorp->gamma.red > GAMMA_ZERO((1.0 / 10.0) / 100.0) && |
2046 | (monitorp->gamma.red < GAMMA_MIN(1.0 / 10.0) || monitorp->gamma.red > GAMMA_MAX10.0)) { |
2047 | badgamma = monitorp->gamma.red; |
2048 | } |
2049 | else if (monitorp->gamma.green > GAMMA_ZERO((1.0 / 10.0) / 100.0) && |
2050 | (monitorp->gamma.green < GAMMA_MIN(1.0 / 10.0) || |
2051 | monitorp->gamma.green > GAMMA_MAX10.0)) { |
2052 | badgamma = monitorp->gamma.green; |
2053 | } |
2054 | else if (monitorp->gamma.blue > GAMMA_ZERO((1.0 / 10.0) / 100.0) && |
2055 | (monitorp->gamma.blue < GAMMA_MIN(1.0 / 10.0) || |
2056 | monitorp->gamma.blue > GAMMA_MAX10.0)) { |
2057 | badgamma = monitorp->gamma.blue; |
2058 | } |
2059 | if (badgamma > GAMMA_ZERO((1.0 / 10.0) / 100.0)) { |
2060 | ErrorF("Gamma value %.f is out of range (%.2f - %.1f)\n", badgamma, |
2061 | GAMMA_MIN(1.0 / 10.0), GAMMA_MAX10.0); |
2062 | return FALSE0; |
2063 | } |
2064 | |
2065 | xf86ProcessOptions(-1, monitorp->options, MonitorOptions); |
2066 | xf86GetOptValBool(MonitorOptions, MON_REDUCEDBLANKING, |
2067 | &monitorp->reducedblanking); |
2068 | if (xf86GetOptValFreq(MonitorOptions, MON_MAX_PIX_CLOCK, OPTUNITS_KHZ, |
2069 | &maxPixClock) == TRUE1) { |
2070 | monitorp->maxPixClock = (int) maxPixClock; |
2071 | } |
2072 | |
2073 | return TRUE1; |
2074 | } |
2075 | |
2076 | static int |
2077 | lookupVisual(const char *visname) |
2078 | { |
2079 | int i; |
2080 | |
2081 | if (!visname || !*visname) |
2082 | return -1; |
2083 | |
2084 | for (i = 0; i <= DirectColor5; i++) { |
2085 | if (!xf86nameCompare(visname, xf86VisualNames[i])) |
2086 | break; |
2087 | } |
2088 | |
2089 | if (i <= DirectColor5) |
2090 | return i; |
2091 | |
2092 | return -1; |
2093 | } |
2094 | |
2095 | static Bool |
2096 | configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display) |
2097 | { |
2098 | int count = 0; |
2099 | XF86ModePtr modep; |
2100 | |
2101 | displayp->frameX0 = conf_display->disp_frameX0; |
2102 | displayp->frameY0 = conf_display->disp_frameY0; |
2103 | displayp->virtualX = conf_display->disp_virtualX; |
2104 | displayp->virtualY = conf_display->disp_virtualY; |
2105 | displayp->depth = conf_display->disp_depth; |
2106 | displayp->fbbpp = conf_display->disp_bpp; |
2107 | displayp->weight.red = conf_display->disp_weight.red; |
2108 | displayp->weight.green = conf_display->disp_weight.green; |
2109 | displayp->weight.blue = conf_display->disp_weight.blue; |
2110 | displayp->blackColour.red = conf_display->disp_black.red; |
2111 | displayp->blackColour.green = conf_display->disp_black.green; |
2112 | displayp->blackColour.blue = conf_display->disp_black.blue; |
2113 | displayp->whiteColour.red = conf_display->disp_white.red; |
2114 | displayp->whiteColour.green = conf_display->disp_white.green; |
2115 | displayp->whiteColour.blue = conf_display->disp_white.blue; |
2116 | displayp->options = conf_display->disp_option_lst; |
2117 | if (conf_display->disp_visual) { |
2118 | displayp->defaultVisual = lookupVisual(conf_display->disp_visual); |
2119 | if (displayp->defaultVisual == -1) { |
2120 | ErrorF("Invalid visual name: \"%s\"\n", conf_display->disp_visual); |
2121 | return FALSE0; |
2122 | } |
2123 | } |
2124 | else { |
2125 | displayp->defaultVisual = -1; |
2126 | } |
2127 | |
2128 | /* |
2129 | * now hook in the modes |
2130 | */ |
2131 | modep = conf_display->disp_mode_lst; |
2132 | while (modep) { |
2133 | count++; |
2134 | modep = (XF86ModePtr) modep->list.next; |
2135 | } |
2136 | displayp->modes = xnfallocarray(count + 1, sizeof(char *))XNFreallocarray(((void*)0), (count + 1), (sizeof(char *))); |
2137 | modep = conf_display->disp_mode_lst; |
2138 | count = 0; |
2139 | while (modep) { |
2140 | displayp->modes[count] = modep->mode_name; |
2141 | count++; |
2142 | modep = (XF86ModePtr) modep->list.next; |
2143 | } |
2144 | displayp->modes[count] = NULL((void*)0); |
2145 | |
2146 | return TRUE1; |
2147 | } |
2148 | |
2149 | static Bool |
2150 | configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active, Bool gpu) |
2151 | { |
2152 | int i; |
2153 | |
2154 | if (!conf_device) { |
2155 | return FALSE0; |
2156 | } |
2157 | |
2158 | if (active) { |
2159 | if (gpu) |
2160 | xf86Msg(X_CONFIG, "| |-->GPUDevice \"%s\"\n", |
2161 | conf_device->dev_identifier); |
2162 | else |
2163 | xf86Msg(X_CONFIG, "| |-->Device \"%s\"\n", |
2164 | conf_device->dev_identifier); |
2165 | } else |
2166 | xf86Msg(X_CONFIG, "|-->Inactive Device \"%s\"\n", |
2167 | conf_device->dev_identifier); |
2168 | |
2169 | devicep->identifier = conf_device->dev_identifier; |
2170 | devicep->vendor = conf_device->dev_vendor; |
2171 | devicep->board = conf_device->dev_board; |
2172 | devicep->chipset = conf_device->dev_chipset; |
2173 | devicep->ramdac = conf_device->dev_ramdac; |
2174 | devicep->driver = conf_device->dev_driver; |
2175 | devicep->active = active; |
2176 | devicep->videoRam = conf_device->dev_videoram; |
2177 | devicep->BiosBase = conf_device->dev_bios_base; |
2178 | devicep->MemBase = conf_device->dev_mem_base; |
2179 | devicep->IOBase = conf_device->dev_io_base; |
2180 | devicep->clockchip = conf_device->dev_clockchip; |
2181 | devicep->busID = conf_device->dev_busid; |
2182 | devicep->chipID = conf_device->dev_chipid; |
2183 | devicep->chipRev = conf_device->dev_chiprev; |
2184 | devicep->options = conf_device->dev_option_lst; |
2185 | devicep->irq = conf_device->dev_irq; |
2186 | devicep->screen = conf_device->dev_screen; |
2187 | |
2188 | for (i = 0; i < MAXDACSPEEDS; i++) { |
2189 | if (i < CONF_MAXDACSPEEDS4) |
2190 | devicep->dacSpeeds[i] = conf_device->dev_dacSpeeds[i]; |
2191 | else |
2192 | devicep->dacSpeeds[i] = 0; |
2193 | } |
2194 | devicep->numclocks = conf_device->dev_clocks; |
2195 | if (devicep->numclocks > MAXCLOCKS128) |
2196 | devicep->numclocks = MAXCLOCKS128; |
2197 | for (i = 0; i < devicep->numclocks; i++) { |
2198 | devicep->clock[i] = conf_device->dev_clock[i]; |
2199 | } |
2200 | devicep->claimed = FALSE0; |
2201 | |
2202 | return TRUE1; |
2203 | } |
2204 | |
2205 | static void |
2206 | configDRI(XF86ConfDRIPtr drip) |
2207 | { |
2208 | struct group *grp; |
2209 | |
2210 | xf86ConfigDRI.group = -1; |
2211 | xf86ConfigDRI.mode = 0; |
2212 | |
2213 | if (drip) { |
2214 | if (drip->dri_group_name) { |
2215 | if ((grp = getgrnam(drip->dri_group_name))) |
2216 | xf86ConfigDRI.group = grp->gr_gid; |
2217 | } |
2218 | else { |
2219 | if (drip->dri_group >= 0) |
2220 | xf86ConfigDRI.group = drip->dri_group; |
2221 | } |
2222 | xf86ConfigDRI.mode = drip->dri_mode; |
2223 | } |
2224 | } |
2225 | |
2226 | static void |
2227 | configExtensions(XF86ConfExtensionsPtr conf_ext) |
2228 | { |
2229 | XF86OptionPtr o; |
2230 | |
2231 | if (conf_ext && conf_ext->ext_option_lst) { |
2232 | for (o = conf_ext->ext_option_lst; o; o = xf86NextOption(o)) { |
2233 | char *name = xf86OptionName(o); |
2234 | char *val = xf86OptionValue(o); |
2235 | char *n; |
2236 | Bool enable = TRUE1; |
2237 | |
2238 | /* Handle "No<ExtensionName>" */ |
2239 | n = xf86NormalizeName(name); |
2240 | if (strncmp(n, "no", 2) == 0) { |
2241 | name += 2; |
2242 | enable = FALSE0; |
2243 | } |
2244 | |
2245 | if (!val || |
2246 | xf86NameCmp(val, "enable") == 0 || |
2247 | xf86NameCmp(val, "enabled") == 0 || |
2248 | xf86NameCmp(val, "on") == 0 || |
2249 | xf86NameCmp(val, "1") == 0 || |
2250 | xf86NameCmp(val, "yes") == 0 || xf86NameCmp(val, "true") == 0) { |
2251 | /* NOTHING NEEDED -- enabling is handled below */ |
2252 | } |
2253 | else if (xf86NameCmp(val, "disable") == 0 || |
2254 | xf86NameCmp(val, "disabled") == 0 || |
2255 | xf86NameCmp(val, "off") == 0 || |
2256 | xf86NameCmp(val, "0") == 0 || |
2257 | xf86NameCmp(val, "no") == 0 || |
2258 | xf86NameCmp(val, "false") == 0) { |
2259 | enable = !enable; |
2260 | } |
2261 | else { |
2262 | xf86Msg(X_WARNING, "Ignoring unrecognized value \"%s\"\n", val); |
2263 | free(n); |
2264 | continue; |
2265 | } |
2266 | |
2267 | if (EnableDisableExtension(name, enable)) { |
2268 | xf86Msg(X_CONFIG, "Extension \"%s\" is %s\n", |
2269 | name, enable ? "enabled" : "disabled"); |
2270 | } |
2271 | else { |
2272 | xf86Msg(X_WARNING, "Ignoring unrecognized extension \"%s\"\n", |
2273 | name); |
2274 | } |
2275 | free(n); |
2276 | } |
2277 | } |
2278 | } |
2279 | |
2280 | static Bool |
2281 | configInput(InputInfoPtr inputp, XF86ConfInputPtr conf_input, MessageType from) |
2282 | { |
2283 | xf86Msg(from, "|-->Input Device \"%s\"\n", conf_input->inp_identifier); |
2284 | inputp->name = conf_input->inp_identifier; |
2285 | inputp->driver = conf_input->inp_driver; |
2286 | inputp->options = conf_input->inp_option_lst; |
2287 | inputp->attrs = NULL((void*)0); |
2288 | |
2289 | return TRUE1; |
2290 | } |
2291 | |
2292 | static Bool |
2293 | modeIsPresent(DisplayModePtr mode, MonPtr monitorp) |
2294 | { |
2295 | DisplayModePtr knownmodes = monitorp->Modes; |
2296 | |
2297 | /* all I can think of is a linear search... */ |
2298 | while (knownmodes != NULL((void*)0)) { |
2299 | if (!strcmp(mode->name, knownmodes->name) && |
2300 | !(knownmodes->type & M_T_DEFAULT0x10)) |
2301 | return TRUE1; |
2302 | knownmodes = knownmodes->next; |
2303 | } |
2304 | return FALSE0; |
2305 | } |
2306 | |
2307 | static Bool |
2308 | addDefaultModes(MonPtr monitorp) |
2309 | { |
2310 | DisplayModePtr mode; |
2311 | DisplayModePtr last = monitorp->Last; |
2312 | int i = 0; |
2313 | |
2314 | for (i = 0; i < xf86NumDefaultModes; i++) { |
2315 | mode = xf86DuplicateMode(&xf86DefaultModes[i]); |
2316 | if (!modeIsPresent(mode, monitorp)) { |
2317 | monitorp->Modes = xf86ModesAdd(monitorp->Modes, mode); |
2318 | last = mode; |
2319 | } |
2320 | else { |
2321 | free(mode); |
2322 | } |
2323 | } |
2324 | monitorp->Last = last; |
2325 | |
2326 | return TRUE1; |
2327 | } |
2328 | |
2329 | static void |
2330 | checkInput(serverLayoutPtr layout, Bool implicit_layout) |
2331 | { |
2332 | checkCoreInputDevices(layout, implicit_layout); |
2333 | |
2334 | /* Unless we're forcing input devices, disable mouse/kbd devices in the |
2335 | * config. Otherwise the same physical device is added multiple times, |
2336 | * leading to duplicate events. |
2337 | */ |
2338 | if (!xf86Info.forceInputDevices && layout->inputs) { |
2339 | InputInfoPtr *dev = layout->inputs; |
2340 | BOOL warned = FALSE0; |
2341 | |
2342 | while (*dev) { |
2343 | if (strcmp((*dev)->driver, "kbd") == 0 || |
2344 | strcmp((*dev)->driver, "mouse") == 0 || |
2345 | strcmp((*dev)->driver, "vmmouse") == 0) { |
2346 | InputInfoPtr *current; |
2347 | |
2348 | if (!warned) { |
2349 | xf86Msg(X_WARNING, "Hotplugging is on, devices using " |
2350 | "drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.\n"); |
2351 | warned = TRUE1; |
2352 | } |
2353 | |
2354 | xf86Msg(X_WARNING, "Disabling %s\n", (*dev)->name); |
2355 | |
2356 | current = dev; |
2357 | free(*dev); |
2358 | *dev = NULL((void*)0); |
2359 | |
2360 | do { |
2361 | *current = *(current + 1); |
2362 | current++; |
2363 | } while (*current); |
2364 | } |
2365 | else |
2366 | dev++; |
2367 | } |
2368 | } |
2369 | } |
2370 | |
2371 | /* |
2372 | * load the config file and fill the global data structure |
2373 | */ |
2374 | ConfigStatus |
2375 | xf86HandleConfigFile(Bool autoconfig) |
2376 | { |
2377 | const char *scanptr; |
2378 | Bool singlecard = 0; |
2379 | Bool implicit_layout = FALSE0; |
2380 | XF86ConfLayoutPtr layout; |
2381 | |
2382 | if (!autoconfig) { |
2383 | char *filename, *dirname, *sysdirname; |
2384 | const char *filesearch, *dirsearch; |
2385 | MessageType filefrom = X_DEFAULT; |
2386 | MessageType dirfrom = X_DEFAULT; |
2387 | |
2388 | if (!xf86PrivsElevated()) { |
2389 | filesearch = ALL_CONFIGPATH"%A," "%R," "/etc/X11/%R," "%P/etc/X11/%R," "%E," "%F," "/etc/X11/%F," "%P/etc/X11/%F," "/etc/X11/%X," "/etc/%X," "%P/etc/X11/%X.%H," "%P/etc/X11/%X," "%P/lib/X11/%X.%H," "%P/lib/X11/%X"; |
2390 | dirsearch = ALL_CONFIGDIRPATH"%A," "%R," "/etc/X11/%R," "%C/X11/%R," "/etc/X11/%X," "%C/X11/%X"; |
2391 | } |
2392 | else { |
2393 | filesearch = RESTRICTED_CONFIGPATH"/etc/X11/%S," "%P/etc/X11/%S," "/etc/X11/%G," "%P/etc/X11/%G," "/etc/X11/%X," "/etc/%X," "%P/etc/X11/%X.%H," "%P/etc/X11/%X," "%P/lib/X11/%X.%H," "%P/lib/X11/%X"; |
2394 | dirsearch = RESTRICTED_CONFIGDIRPATH"/etc/X11/%R," "%C/X11/%R," "/etc/X11/%X," "%C/X11/%X"; |
2395 | } |
2396 | |
2397 | if (xf86ConfigFile) |
2398 | filefrom = X_CMDLINE; |
2399 | if (xf86ConfigDir) |
2400 | dirfrom = X_CMDLINE; |
2401 | |
2402 | xf86initConfigFiles(); |
2403 | sysdirname = xf86openConfigDirFiles(SYS_CONFIGDIRPATH"%D/X11/%X", NULL((void*)0), |
2404 | PROJECTROOT"/Users/jeremy/src/freedesktop/jhbuild/build"); |
2405 | dirname = xf86openConfigDirFiles(dirsearch, xf86ConfigDir, PROJECTROOT"/Users/jeremy/src/freedesktop/jhbuild/build"); |
2406 | filename = xf86openConfigFile(filesearch, xf86ConfigFile, PROJECTROOT"/Users/jeremy/src/freedesktop/jhbuild/build"); |
2407 | if (filename) { |
2408 | xf86MsgVerb(filefrom, 0, "Using config file: \"%s\"\n", filename); |
2409 | xf86ConfigFile = xnfstrdup(filename)XNFstrdup(filename); |
2410 | } |
2411 | else { |
2412 | if (xf86ConfigFile) |
2413 | xf86Msg(X_ERROR, "Unable to locate/open config file: \"%s\"\n", |
2414 | xf86ConfigFile); |
2415 | } |
2416 | if (dirname) { |
2417 | xf86MsgVerb(dirfrom, 0, "Using config directory: \"%s\"\n", |
2418 | dirname); |
2419 | xf86ConfigDir = xnfstrdup(dirname)XNFstrdup(dirname); |
2420 | } |
2421 | else { |
2422 | if (xf86ConfigDir) |
2423 | xf86Msg(X_ERROR, |
2424 | "Unable to locate/open config directory: \"%s\"\n", |
2425 | xf86ConfigDir); |
2426 | } |
2427 | if (sysdirname) |
2428 | xf86MsgVerb(X_DEFAULT, 0, "Using system config directory \"%s\"\n", |
2429 | sysdirname); |
2430 | if (!filename && !dirname && !sysdirname) |
2431 | return CONFIG_NOFILE; |
2432 | |
2433 | free(filename); |
2434 | free(dirname); |
2435 | free(sysdirname); |
2436 | } |
2437 | |
2438 | if ((xf86configptr = xf86readConfigFile()) == NULL((void*)0)) { |
2439 | xf86Msg(X_ERROR, "Problem parsing the config file\n"); |
2440 | return CONFIG_PARSE_ERROR; |
2441 | } |
2442 | xf86closeConfigFile(); |
2443 | |
2444 | /* Initialise a few things. */ |
2445 | |
2446 | /* |
2447 | * now we convert part of the information contained in the parser |
2448 | * structures into our own structures. |
2449 | * The important part here is to figure out which Screen Sections |
2450 | * in the XF86Config file are active so that we can piece together |
2451 | * the modes that we need later down the road. |
2452 | * And while we are at it, we'll decode the rest of the stuff as well |
2453 | */ |
2454 | |
2455 | /* First check if a layout section is present, and if it is valid. */ |
2456 | FIND_SUITABLE(XF86ConfLayoutPtr, xf86configptr->conf_layout_lst, layout)do { XF86ConfLayoutPtr _l, _p; for (_l = (xf86configptr->conf_layout_lst ), _p = ((void*)0); !_p && _l; _l = (XF86ConfLayoutPtr )_l->list.next) { if (!_l->match_seat || (SeatId && xf86nameCompare(_l->match_seat, SeatId) == 0)) _p = _l; } (layout) = _p; } while(0); |
2457 | if (layout == NULL((void*)0) || xf86ScreenName != NULL((void*)0)) { |
2458 | XF86ConfScreenPtr screen; |
2459 | |
2460 | if (xf86ScreenName == NULL((void*)0)) { |
2461 | xf86Msg(X_DEFAULT, |
2462 | "No Layout section. Using the first Screen section.\n"); |
2463 | } |
2464 | FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen)do { XF86ConfScreenPtr _l, _p; for (_l = (xf86configptr->conf_screen_lst ), _p = ((void*)0); !_p && _l; _l = (XF86ConfScreenPtr )_l->list.next) { if (!_l->match_seat || (SeatId && xf86nameCompare(_l->match_seat, SeatId) == 0)) _p = _l; } (screen) = _p; } while(0); |
2465 | if (!configImpliedLayout(&xf86ConfigLayout, |
2466 | screen, |
2467 | xf86configptr)) { |
2468 | xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); |
2469 | return CONFIG_PARSE_ERROR; |
2470 | } |
2471 | implicit_layout = TRUE1; |
2472 | } |
2473 | else { |
2474 | if (xf86configptr->conf_flags != NULL((void*)0)) { |
2475 | char *dfltlayout = NULL((void*)0); |
2476 | void *optlist = xf86configptr->conf_flags->flg_option_lst; |
2477 | |
2478 | if (optlist && xf86FindOption(optlist, "defaultserverlayout")) |
2479 | dfltlayout = |
2480 | xf86SetStrOption(optlist, "defaultserverlayout", NULL((void*)0)); |
2481 | if (!configLayout(&xf86ConfigLayout, layout, dfltlayout)) { |
2482 | xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); |
2483 | return CONFIG_PARSE_ERROR; |
2484 | } |
2485 | } |
2486 | else { |
2487 | if (!configLayout(&xf86ConfigLayout, layout, NULL((void*)0))) { |
2488 | xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); |
2489 | return CONFIG_PARSE_ERROR; |
2490 | } |
2491 | } |
2492 | } |
2493 | |
2494 | xf86ProcessOptions(-1, xf86ConfigLayout.options, LayoutOptions); |
2495 | #ifdef XSERVER_LIBPCIACCESS |
2496 | if ((scanptr = xf86GetOptValString(LayoutOptions, LAYOUT_ISOLATEDEVICE))) { |
2497 | ; /* IsolateDevice specified; overrides SingleCard */ |
2498 | } |
2499 | else { |
2500 | xf86GetOptValBool(LayoutOptions, LAYOUT_SINGLECARD, &singlecard); |
2501 | if (singlecard) |
2502 | scanptr = xf86ConfigLayout.screens->screen->device->busID; |
2503 | } |
2504 | if (scanptr) { |
2505 | if (strncmp(scanptr, "PCI:", 4) != 0) { |
2506 | xf86Msg(X_WARNING, "Bus types other than PCI not yet isolable.\n" |
2507 | "\tIgnoring IsolateDevice option.\n"); |
2508 | } |
2509 | else |
2510 | xf86PciIsolateDevice(scanptr); |
2511 | } |
2512 | #endif |
2513 | /* Now process everything else */ |
2514 | configServerFlags(xf86configptr->conf_flags, xf86ConfigLayout.options); |
2515 | configFiles(xf86configptr->conf_files); |
2516 | configExtensions(xf86configptr->conf_extensions); |
2517 | configDRI(xf86configptr->conf_dri); |
2518 | |
2519 | checkInput(&xf86ConfigLayout, implicit_layout); |
2520 | |
2521 | /* |
2522 | * Handle some command line options that can override some of the |
2523 | * ServerFlags settings. |
2524 | */ |
2525 | #ifdef XF86VIDMODE1 |
2526 | if (xf86VidModeDisabled) |
2527 | xf86Info.vidModeEnabled = FALSE0; |
2528 | if (xf86VidModeAllowNonLocal) |
2529 | xf86Info.vidModeAllowNonLocal = TRUE1; |
2530 | #endif |
2531 | |
2532 | if (xf86AllowMouseOpenFail) |
2533 | xf86Info.allowMouseOpenFail = TRUE1; |
2534 | |
2535 | return CONFIG_OK; |
2536 | } |
2537 | |
2538 | Bool |
2539 | xf86PathIsSafe(const char *path) |
2540 | { |
2541 | return (xf86pathIsSafe(path) != 0); |
2542 | } |