Commit | Line | Data |
---|---|---|
a09e091a JB |
1 | /* |
2 | * | |
3 | * Copyright (c) 1997 Metro Link Incorporated | |
4 | * | |
5 | * Permission is hereby granted, free of charge, to any person obtaining a | |
6 | * copy of this software and associated documentation files (the "Software"), | |
7 | * to deal in the Software without restriction, including without limitation | |
8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
9 | * and/or sell copies of the Software, and to permit persons to whom the | |
10 | * Software is furnished to do so, subject to the following conditions: | |
11 | * | |
12 | * The above copyright notice and this permission notice shall be included in | |
13 | * all copies or substantial portions of the Software. | |
14 | * | |
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
18 | * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF | |
20 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
21 | * SOFTWARE. | |
22 | * | |
23 | * Except as contained in this notice, the name of the Metro Link shall not be | |
24 | * used in advertising or otherwise to promote the sale, use or other dealings | |
25 | * in this Software without prior written authorization from Metro Link. | |
26 | * | |
27 | */ | |
28 | /* | |
29 | * Copyright (c) 1997-2003 by The XFree86 Project, Inc. | |
30 | * | |
31 | * Permission is hereby granted, free of charge, to any person obtaining a | |
32 | * copy of this software and associated documentation files (the "Software"), | |
33 | * to deal in the Software without restriction, including without limitation | |
34 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
35 | * and/or sell copies of the Software, and to permit persons to whom the | |
36 | * Software is furnished to do so, subject to the following conditions: | |
37 | * | |
38 | * The above copyright notice and this permission notice shall be included in | |
39 | * all copies or substantial portions of the Software. | |
40 | * | |
41 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
42 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
43 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
44 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
45 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
46 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
47 | * OTHER DEALINGS IN THE SOFTWARE. | |
48 | * | |
49 | * Except as contained in this notice, the name of the copyright holder(s) | |
50 | * and author(s) shall not be used in advertising or otherwise to promote | |
51 | * the sale, use or other dealings in this Software without prior written | |
52 | * authorization from the copyright holder(s) and author(s). | |
53 | */ | |
54 | ||
55 | #ifdef HAVE_XORG_CONFIG_H | |
56 | #include <xorg-config.h> | |
57 | #endif | |
58 | ||
59 | #include "xf86Parser.h" | |
60 | #include "xf86tokens.h" | |
61 | #include "Configint.h" | |
62 | ||
63 | extern LexRec val; | |
64 | ||
65 | static xf86ConfigSymTabRec DisplayTab[] = { | |
66 | {ENDSUBSECTION, "endsubsection"}, | |
67 | {MODES, "modes"}, | |
68 | {VIEWPORT, "viewport"}, | |
69 | {VIRTUAL, "virtual"}, | |
70 | {VISUAL, "visual"}, | |
71 | {BLACK_TOK, "black"}, | |
72 | {WHITE_TOK, "white"}, | |
73 | {DEPTH, "depth"}, | |
74 | {BPP, "fbbpp"}, | |
75 | {WEIGHT, "weight"}, | |
76 | {OPTION, "option"}, | |
77 | {-1, ""}, | |
78 | }; | |
79 | ||
80 | #define CLEANUP xf86freeDisplayList | |
81 | ||
82 | static XF86ConfDisplayPtr | |
83 | xf86parseDisplaySubSection(void) | |
84 | { | |
85 | int token; | |
86 | ||
87 | parsePrologue(XF86ConfDisplayPtr, XF86ConfDisplayRec) | |
88 | ||
89 | ptr->disp_black.red = ptr->disp_black.green = ptr->disp_black.blue = -1; | |
90 | ptr->disp_white.red = ptr->disp_white.green = ptr->disp_white.blue = -1; | |
91 | ptr->disp_frameX0 = ptr->disp_frameY0 = -1; | |
92 | while ((token = xf86getToken(DisplayTab)) != ENDSUBSECTION) { | |
93 | switch (token) { | |
94 | case COMMENT: | |
95 | ptr->disp_comment = xf86addComment(ptr->disp_comment, val.str); | |
96 | break; | |
97 | case VIEWPORT: | |
98 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
99 | Error(VIEWPORT_MSG); | |
100 | ptr->disp_frameX0 = val.num; | |
101 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
102 | Error(VIEWPORT_MSG); | |
103 | ptr->disp_frameY0 = val.num; | |
104 | break; | |
105 | case VIRTUAL: | |
106 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
107 | Error(VIRTUAL_MSG); | |
108 | ptr->disp_virtualX = val.num; | |
109 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
110 | Error(VIRTUAL_MSG); | |
111 | ptr->disp_virtualY = val.num; | |
112 | break; | |
113 | case DEPTH: | |
114 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
115 | Error(NUMBER_MSG, "Display"); | |
116 | ptr->disp_depth = val.num; | |
117 | break; | |
118 | case BPP: | |
119 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
120 | Error(NUMBER_MSG, "Display"); | |
121 | ptr->disp_bpp = val.num; | |
122 | break; | |
123 | case VISUAL: | |
124 | if (xf86getSubToken(&(ptr->disp_comment)) != STRING) | |
125 | Error(QUOTE_MSG, "Display"); | |
126 | ptr->disp_visual = val.str; | |
127 | break; | |
128 | case WEIGHT: | |
129 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
130 | Error(WEIGHT_MSG); | |
131 | ptr->disp_weight.red = val.num; | |
132 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
133 | Error(WEIGHT_MSG); | |
134 | ptr->disp_weight.green = val.num; | |
135 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
136 | Error(WEIGHT_MSG); | |
137 | ptr->disp_weight.blue = val.num; | |
138 | break; | |
139 | case BLACK_TOK: | |
140 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
141 | Error(BLACK_MSG); | |
142 | ptr->disp_black.red = val.num; | |
143 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
144 | Error(BLACK_MSG); | |
145 | ptr->disp_black.green = val.num; | |
146 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
147 | Error(BLACK_MSG); | |
148 | ptr->disp_black.blue = val.num; | |
149 | break; | |
150 | case WHITE_TOK: | |
151 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
152 | Error(WHITE_MSG); | |
153 | ptr->disp_white.red = val.num; | |
154 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
155 | Error(WHITE_MSG); | |
156 | ptr->disp_white.green = val.num; | |
157 | if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER) | |
158 | Error(WHITE_MSG); | |
159 | ptr->disp_white.blue = val.num; | |
160 | break; | |
161 | case MODES: | |
162 | { | |
163 | XF86ModePtr mptr; | |
164 | ||
165 | while ((token = | |
166 | xf86getSubTokenWithTab(&(ptr->disp_comment), | |
167 | DisplayTab)) == STRING) { | |
168 | mptr = calloc(1, sizeof(XF86ModeRec)); | |
169 | mptr->mode_name = val.str; | |
170 | mptr->list.next = NULL; | |
171 | ptr->disp_mode_lst = (XF86ModePtr) | |
172 | xf86addListItem((glp) ptr->disp_mode_lst, (glp) mptr); | |
173 | } | |
174 | xf86unGetToken(token); | |
175 | } | |
176 | break; | |
177 | case OPTION: | |
178 | ptr->disp_option_lst = xf86parseOption(ptr->disp_option_lst); | |
179 | break; | |
180 | ||
181 | case EOF_TOKEN: | |
182 | Error(UNEXPECTED_EOF_MSG); | |
183 | break; | |
184 | default: | |
185 | Error(INVALID_KEYWORD_MSG, xf86tokenString()); | |
186 | break; | |
187 | } | |
188 | } | |
189 | ||
190 | #ifdef DEBUG | |
191 | printf("Display subsection parsed\n"); | |
192 | #endif | |
193 | ||
194 | return ptr; | |
195 | } | |
196 | ||
197 | #undef CLEANUP | |
198 | ||
199 | static xf86ConfigSymTabRec ScreenTab[] = { | |
200 | {ENDSECTION, "endsection"}, | |
201 | {IDENTIFIER, "identifier"}, | |
202 | {OBSDRIVER, "driver"}, | |
203 | {MDEVICE, "device"}, | |
204 | {MONITOR, "monitor"}, | |
205 | {VIDEOADAPTOR, "videoadaptor"}, | |
206 | {SCREENNO, "screenno"}, | |
207 | {SUBSECTION, "subsection"}, | |
208 | {DEFAULTDEPTH, "defaultcolordepth"}, | |
209 | {DEFAULTDEPTH, "defaultdepth"}, | |
210 | {DEFAULTBPP, "defaultbpp"}, | |
211 | {DEFAULTFBBPP, "defaultfbbpp"}, | |
212 | {VIRTUAL, "virtual"}, | |
213 | {OPTION, "option"}, | |
214 | {-1, ""}, | |
215 | }; | |
216 | ||
217 | #define CLEANUP xf86freeScreenList | |
218 | XF86ConfScreenPtr | |
219 | xf86parseScreenSection(void) | |
220 | { | |
221 | int has_ident = FALSE; | |
222 | int has_driver = FALSE; | |
223 | int token; | |
224 | ||
225 | parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec) | |
226 | ||
227 | while ((token = xf86getToken(ScreenTab)) != ENDSECTION) { | |
228 | switch (token) { | |
229 | case COMMENT: | |
230 | ptr->scrn_comment = xf86addComment(ptr->scrn_comment, val.str); | |
231 | break; | |
232 | case IDENTIFIER: | |
233 | if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) | |
234 | Error(QUOTE_MSG, "Identifier"); | |
235 | ptr->scrn_identifier = val.str; | |
236 | if (has_ident || has_driver) | |
237 | Error(ONLY_ONE_MSG, "Identifier or Driver"); | |
238 | has_ident = TRUE; | |
239 | break; | |
240 | case OBSDRIVER: | |
241 | if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) | |
242 | Error(QUOTE_MSG, "Driver"); | |
243 | ptr->scrn_obso_driver = val.str; | |
244 | if (has_ident || has_driver) | |
245 | Error(ONLY_ONE_MSG, "Identifier or Driver"); | |
246 | has_driver = TRUE; | |
247 | break; | |
248 | case DEFAULTDEPTH: | |
249 | if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) | |
250 | Error(NUMBER_MSG, "DefaultDepth"); | |
251 | ptr->scrn_defaultdepth = val.num; | |
252 | break; | |
253 | case DEFAULTBPP: | |
254 | if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) | |
255 | Error(NUMBER_MSG, "DefaultBPP"); | |
256 | ptr->scrn_defaultbpp = val.num; | |
257 | break; | |
258 | case DEFAULTFBBPP: | |
259 | if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) | |
260 | Error(NUMBER_MSG, "DefaultFbBPP"); | |
261 | ptr->scrn_defaultfbbpp = val.num; | |
262 | break; | |
263 | case MDEVICE: | |
264 | if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) | |
265 | Error(QUOTE_MSG, "Device"); | |
266 | ptr->scrn_device_str = val.str; | |
267 | break; | |
268 | case MONITOR: | |
269 | if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) | |
270 | Error(QUOTE_MSG, "Monitor"); | |
271 | ptr->scrn_monitor_str = val.str; | |
272 | break; | |
273 | case VIDEOADAPTOR: | |
274 | { | |
275 | XF86ConfAdaptorLinkPtr aptr; | |
276 | ||
277 | if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) | |
278 | Error(QUOTE_MSG, "VideoAdaptor"); | |
279 | ||
280 | /* Don't allow duplicates */ | |
281 | for (aptr = ptr->scrn_adaptor_lst; aptr; | |
282 | aptr = (XF86ConfAdaptorLinkPtr) aptr->list.next) | |
283 | if (xf86nameCompare(val.str, aptr->al_adaptor_str) == 0) | |
284 | break; | |
285 | ||
286 | if (aptr == NULL) { | |
287 | aptr = calloc(1, sizeof(XF86ConfAdaptorLinkRec)); | |
288 | aptr->list.next = NULL; | |
289 | aptr->al_adaptor_str = val.str; | |
290 | ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr) | |
291 | xf86addListItem((glp) ptr->scrn_adaptor_lst, (glp) aptr); | |
292 | } | |
293 | } | |
294 | break; | |
295 | case VIRTUAL: | |
296 | if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) | |
297 | Error(VIRTUAL_MSG); | |
298 | ptr->scrn_virtualX = val.num; | |
299 | if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER) | |
300 | Error(VIRTUAL_MSG); | |
301 | ptr->scrn_virtualY = val.num; | |
302 | break; | |
303 | case OPTION: | |
304 | ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst); | |
305 | break; | |
306 | case SUBSECTION: | |
307 | if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) | |
308 | Error(QUOTE_MSG, "SubSection"); | |
309 | { | |
310 | free(val.str); | |
311 | HANDLE_LIST(scrn_display_lst, xf86parseDisplaySubSection, | |
312 | XF86ConfDisplayPtr); | |
313 | } | |
314 | break; | |
315 | case EOF_TOKEN: | |
316 | Error(UNEXPECTED_EOF_MSG); | |
317 | break; | |
318 | default: | |
319 | Error(INVALID_KEYWORD_MSG, xf86tokenString()); | |
320 | break; | |
321 | } | |
322 | } | |
323 | ||
324 | if (!has_ident && !has_driver) | |
325 | Error(NO_IDENT_MSG); | |
326 | ||
327 | #ifdef DEBUG | |
328 | printf("Screen section parsed\n"); | |
329 | #endif | |
330 | ||
331 | return ptr; | |
332 | } | |
333 | ||
334 | void | |
335 | xf86printScreenSection(FILE * cf, XF86ConfScreenPtr ptr) | |
336 | { | |
337 | XF86ConfAdaptorLinkPtr aptr; | |
338 | XF86ConfDisplayPtr dptr; | |
339 | XF86ModePtr mptr; | |
340 | ||
341 | while (ptr) { | |
342 | fprintf(cf, "Section \"Screen\"\n"); | |
343 | if (ptr->scrn_comment) | |
344 | fprintf(cf, "%s", ptr->scrn_comment); | |
345 | if (ptr->scrn_identifier) | |
346 | fprintf(cf, "\tIdentifier \"%s\"\n", ptr->scrn_identifier); | |
347 | if (ptr->scrn_obso_driver) | |
348 | fprintf(cf, "\tDriver \"%s\"\n", ptr->scrn_obso_driver); | |
349 | if (ptr->scrn_device_str) | |
350 | fprintf(cf, "\tDevice \"%s\"\n", ptr->scrn_device_str); | |
351 | if (ptr->scrn_monitor_str) | |
352 | fprintf(cf, "\tMonitor \"%s\"\n", ptr->scrn_monitor_str); | |
353 | if (ptr->scrn_defaultdepth) | |
354 | fprintf(cf, "\tDefaultDepth %d\n", ptr->scrn_defaultdepth); | |
355 | if (ptr->scrn_defaultbpp) | |
356 | fprintf(cf, "\tDefaultBPP %d\n", ptr->scrn_defaultbpp); | |
357 | if (ptr->scrn_defaultfbbpp) | |
358 | fprintf(cf, "\tDefaultFbBPP %d\n", ptr->scrn_defaultfbbpp); | |
359 | xf86printOptionList(cf, ptr->scrn_option_lst, 1); | |
360 | for (aptr = ptr->scrn_adaptor_lst; aptr; aptr = aptr->list.next) { | |
361 | fprintf(cf, "\tVideoAdaptor \"%s\"\n", aptr->al_adaptor_str); | |
362 | } | |
363 | if (ptr->scrn_virtualX && ptr->scrn_virtualY) | |
364 | fprintf(cf, "\tVirtual %d %d\n", | |
365 | ptr->scrn_virtualX, ptr->scrn_virtualY); | |
366 | for (dptr = ptr->scrn_display_lst; dptr; dptr = dptr->list.next) { | |
367 | fprintf(cf, "\tSubSection \"Display\"\n"); | |
368 | if (dptr->disp_comment) | |
369 | fprintf(cf, "%s", dptr->disp_comment); | |
370 | if (dptr->disp_frameX0 >= 0 || dptr->disp_frameY0 >= 0) { | |
371 | fprintf(cf, "\t\tViewport %d %d\n", | |
372 | dptr->disp_frameX0, dptr->disp_frameY0); | |
373 | } | |
374 | if (dptr->disp_virtualX != 0 || dptr->disp_virtualY != 0) { | |
375 | fprintf(cf, "\t\tVirtual %d %d\n", | |
376 | dptr->disp_virtualX, dptr->disp_virtualY); | |
377 | } | |
378 | if (dptr->disp_depth) { | |
379 | fprintf(cf, "\t\tDepth %d\n", dptr->disp_depth); | |
380 | } | |
381 | if (dptr->disp_bpp) { | |
382 | fprintf(cf, "\t\tFbBPP %d\n", dptr->disp_bpp); | |
383 | } | |
384 | if (dptr->disp_visual) { | |
385 | fprintf(cf, "\t\tVisual \"%s\"\n", dptr->disp_visual); | |
386 | } | |
387 | if (dptr->disp_weight.red != 0) { | |
388 | fprintf(cf, "\t\tWeight %d %d %d\n", | |
389 | dptr->disp_weight.red, dptr->disp_weight.green, | |
390 | dptr->disp_weight.blue); | |
391 | } | |
392 | if (dptr->disp_black.red != -1) { | |
393 | fprintf(cf, "\t\tBlack 0x%04x 0x%04x 0x%04x\n", | |
394 | dptr->disp_black.red, dptr->disp_black.green, | |
395 | dptr->disp_black.blue); | |
396 | } | |
397 | if (dptr->disp_white.red != -1) { | |
398 | fprintf(cf, "\t\tWhite 0x%04x 0x%04x 0x%04x\n", | |
399 | dptr->disp_white.red, dptr->disp_white.green, | |
400 | dptr->disp_white.blue); | |
401 | } | |
402 | if (dptr->disp_mode_lst) { | |
403 | fprintf(cf, "\t\tModes "); | |
404 | } | |
405 | for (mptr = dptr->disp_mode_lst; mptr; mptr = mptr->list.next) { | |
406 | fprintf(cf, " \"%s\"", mptr->mode_name); | |
407 | } | |
408 | if (dptr->disp_mode_lst) { | |
409 | fprintf(cf, "\n"); | |
410 | } | |
411 | xf86printOptionList(cf, dptr->disp_option_lst, 2); | |
412 | fprintf(cf, "\tEndSubSection\n"); | |
413 | } | |
414 | fprintf(cf, "EndSection\n\n"); | |
415 | ptr = ptr->list.next; | |
416 | } | |
417 | ||
418 | } | |
419 | ||
420 | void | |
421 | xf86freeScreenList(XF86ConfScreenPtr ptr) | |
422 | { | |
423 | XF86ConfScreenPtr prev; | |
424 | ||
425 | while (ptr) { | |
426 | TestFree(ptr->scrn_identifier); | |
427 | TestFree(ptr->scrn_monitor_str); | |
428 | TestFree(ptr->scrn_device_str); | |
429 | TestFree(ptr->scrn_comment); | |
430 | xf86optionListFree(ptr->scrn_option_lst); | |
431 | xf86freeAdaptorLinkList(ptr->scrn_adaptor_lst); | |
432 | xf86freeDisplayList(ptr->scrn_display_lst); | |
433 | prev = ptr; | |
434 | ptr = ptr->list.next; | |
435 | free(prev); | |
436 | } | |
437 | } | |
438 | ||
439 | void | |
440 | xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr) | |
441 | { | |
442 | XF86ConfAdaptorLinkPtr prev; | |
443 | ||
444 | while (ptr) { | |
445 | TestFree(ptr->al_adaptor_str); | |
446 | prev = ptr; | |
447 | ptr = ptr->list.next; | |
448 | free(prev); | |
449 | } | |
450 | } | |
451 | ||
452 | void | |
453 | xf86freeDisplayList(XF86ConfDisplayPtr ptr) | |
454 | { | |
455 | XF86ConfDisplayPtr prev; | |
456 | ||
457 | while (ptr) { | |
458 | xf86freeModeList(ptr->disp_mode_lst); | |
459 | xf86optionListFree(ptr->disp_option_lst); | |
460 | prev = ptr; | |
461 | ptr = ptr->list.next; | |
462 | free(prev); | |
463 | } | |
464 | } | |
465 | ||
466 | void | |
467 | xf86freeModeList(XF86ModePtr ptr) | |
468 | { | |
469 | XF86ModePtr prev; | |
470 | ||
471 | while (ptr) { | |
472 | TestFree(ptr->mode_name); | |
473 | prev = ptr; | |
474 | ptr = ptr->list.next; | |
475 | free(prev); | |
476 | } | |
477 | } | |
478 | ||
479 | int | |
480 | xf86validateScreen(XF86ConfigPtr p) | |
481 | { | |
482 | XF86ConfScreenPtr screen = p->conf_screen_lst; | |
483 | XF86ConfMonitorPtr monitor; | |
484 | XF86ConfAdaptorLinkPtr adaptor; | |
485 | ||
486 | while (screen) { | |
487 | if (screen->scrn_obso_driver && !screen->scrn_identifier) | |
488 | screen->scrn_identifier = screen->scrn_obso_driver; | |
489 | ||
490 | monitor = | |
491 | xf86findMonitor(screen->scrn_monitor_str, p->conf_monitor_lst); | |
492 | if (screen->scrn_monitor_str) { | |
493 | if (monitor) { | |
494 | screen->scrn_monitor = monitor; | |
495 | if (!xf86validateMonitor(p, screen)) | |
496 | return FALSE; | |
497 | } | |
498 | } | |
499 | ||
500 | screen->scrn_device = | |
501 | xf86findDevice(screen->scrn_device_str, p->conf_device_lst); | |
502 | ||
503 | adaptor = screen->scrn_adaptor_lst; | |
504 | while (adaptor) { | |
505 | adaptor->al_adaptor = | |
506 | xf86findVideoAdaptor(adaptor->al_adaptor_str, | |
507 | p->conf_videoadaptor_lst); | |
508 | if (!adaptor->al_adaptor) { | |
509 | xf86validationError(UNDEFINED_ADAPTOR_MSG, | |
510 | adaptor->al_adaptor_str, | |
511 | screen->scrn_identifier); | |
512 | return FALSE; | |
513 | } | |
514 | else if (adaptor->al_adaptor->va_fwdref) { | |
515 | xf86validationError(ADAPTOR_REF_TWICE_MSG, | |
516 | adaptor->al_adaptor_str, | |
517 | adaptor->al_adaptor->va_fwdref); | |
518 | return FALSE; | |
519 | } | |
520 | ||
521 | adaptor->al_adaptor->va_fwdref = strdup(screen->scrn_identifier); | |
522 | adaptor = adaptor->list.next; | |
523 | } | |
524 | ||
525 | screen = screen->list.next; | |
526 | } | |
527 | ||
528 | return TRUE; | |
529 | } | |
530 | ||
531 | XF86ConfScreenPtr | |
532 | xf86findScreen(const char *ident, XF86ConfScreenPtr p) | |
533 | { | |
534 | while (p) { | |
535 | if (xf86nameCompare(ident, p->scrn_identifier) == 0) | |
536 | return p; | |
537 | ||
538 | p = p->list.next; | |
539 | } | |
540 | return NULL; | |
541 | } |