1
/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.28 2003/08/24 17:37:08 dawes Exp $ */
4
* Copyright (c) 1997 Metro Link Incorporated
6
* Permission is hereby granted, free of charge, to any person obtaining a
7
* copy of this software and associated documentation files (the "Software"),
8
* to deal in the Software without restriction, including without limitation
9
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
* and/or sell copies of the Software, and to permit persons to whom the
11
* Software is furnished to do so, subject to the following conditions:
13
* The above copyright notice and this permission notice shall be included in
14
* all copies or substantial portions of the Software.
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
* THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
21
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
* Except as contained in this notice, the name of the Metro Link shall not be
25
* used in advertising or otherwise to promote the sale, use or other dealings
26
* in this Software without prior written authorization from Metro Link.
30
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
32
* Permission is hereby granted, free of charge, to any person obtaining a
33
* copy of this software and associated documentation files (the "Software"),
34
* to deal in the Software without restriction, including without limitation
35
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
36
* and/or sell copies of the Software, and to permit persons to whom the
37
* Software is furnished to do so, subject to the following conditions:
39
* The above copyright notice and this permission notice shall be included in
40
* all copies or substantial portions of the Software.
42
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
45
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
46
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
47
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
48
* OTHER DEALINGS IN THE SOFTWARE.
50
* Except as contained in this notice, the name of the copyright holder(s)
51
* and author(s) shall not be used in advertising or otherwise to promote
52
* the sale, use or other dealings in this Software without prior written
53
* authorization from the copyright holder(s) and author(s).
57
/* View/edit this file with tab stops set to 4 */
59
#ifdef HAVE_XORG_CONFIG_H
60
#include <xorg-config.h>
63
#include "xf86Parser.h"
64
#include "xf86tokens.h"
65
#include "Configint.h"
69
static xf86ConfigSymTabRec MonitorTab[] =
71
{ENDSECTION, "endsection"},
72
{IDENTIFIER, "identifier"},
73
{VENDOR, "vendorname"},
75
{USEMODES, "usemodes"},
76
{MODELINE, "modeline"},
77
{DISPLAYSIZE, "displaysize"},
78
{HORIZSYNC, "horizsync"},
79
{VERTREFRESH, "vertrefresh"},
86
static xf86ConfigSymTabRec ModesTab[] =
88
{ENDSECTION, "endsection"},
89
{IDENTIFIER, "identifier"},
90
{MODELINE, "modeline"},
95
static xf86ConfigSymTabRec TimingTab[] =
97
{TT_INTERLACE, "interlace"},
98
{TT_PHSYNC, "+hsync"},
99
{TT_NHSYNC, "-hsync"},
100
{TT_PVSYNC, "+vsync"},
101
{TT_NVSYNC, "-vsync"},
102
{TT_CSYNC, "composite"},
103
{TT_PCSYNC, "+csync"},
104
{TT_NCSYNC, "-csync"},
105
{TT_DBLSCAN, "doublescan"},
109
{TT_CUSTOM, "CUSTOM"},
113
static xf86ConfigSymTabRec ModeTab[] =
115
{DOTCLOCK, "dotclock"},
116
{HTIMINGS, "htimings"},
117
{VTIMINGS, "vtimings"},
122
{ENDMODE, "endmode"},
126
#define CLEANUP xf86freeModeLineList
129
xf86parseModeLine (void)
132
parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec)
135
if (xf86getSubToken (&(ptr->ml_comment)) != STRING)
136
Error ("ModeLine identifier expected", NULL);
137
ptr->ml_identifier = val.str;
140
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
141
Error ("ModeLine dotclock expected", NULL);
142
ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
145
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
146
Error ("ModeLine Hdisplay expected", NULL);
147
ptr->ml_hdisplay = val.num;
150
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
151
Error ("ModeLine HSyncStart expected", NULL);
152
ptr->ml_hsyncstart = val.num;
155
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
156
Error ("ModeLine HSyncEnd expected", NULL);
157
ptr->ml_hsyncend = val.num;
160
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
161
Error ("ModeLine HTotal expected", NULL);
162
ptr->ml_htotal = val.num;
165
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
166
Error ("ModeLine Vdisplay expected", NULL);
167
ptr->ml_vdisplay = val.num;
170
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
171
Error ("ModeLine VSyncStart expected", NULL);
172
ptr->ml_vsyncstart = val.num;
175
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
176
Error ("ModeLine VSyncEnd expected", NULL);
177
ptr->ml_vsyncend = val.num;
180
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
181
Error ("ModeLine VTotal expected", NULL);
182
ptr->ml_vtotal = val.num;
184
token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab);
185
while ((token == TT_INTERLACE) || (token == TT_PHSYNC) ||
186
(token == TT_NHSYNC) || (token == TT_PVSYNC) ||
187
(token == TT_NVSYNC) || (token == TT_CSYNC) ||
188
(token == TT_PCSYNC) || (token == TT_NCSYNC) ||
189
(token == TT_DBLSCAN) || (token == TT_HSKEW) ||
190
(token == TT_VSCAN) || (token == TT_BCAST))
196
ptr->ml_flags |= XF86CONF_INTERLACE;
199
ptr->ml_flags |= XF86CONF_PHSYNC;
202
ptr->ml_flags |= XF86CONF_NHSYNC;
205
ptr->ml_flags |= XF86CONF_PVSYNC;
208
ptr->ml_flags |= XF86CONF_NVSYNC;
211
ptr->ml_flags |= XF86CONF_CSYNC;
214
ptr->ml_flags |= XF86CONF_PCSYNC;
217
ptr->ml_flags |= XF86CONF_NCSYNC;
220
ptr->ml_flags |= XF86CONF_DBLSCAN;
223
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
224
Error (NUMBER_MSG, "Hskew");
225
ptr->ml_hskew = val.num;
226
ptr->ml_flags |= XF86CONF_HSKEW;
229
ptr->ml_flags |= XF86CONF_BCAST;
232
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
233
Error (NUMBER_MSG, "Vscan");
234
ptr->ml_vscan = val.num;
235
ptr->ml_flags |= XF86CONF_VSCAN;
238
ptr->ml_flags |= XF86CONF_CUSTOM;
241
Error (UNEXPECTED_EOF_MSG, NULL);
244
Error (INVALID_KEYWORD_MSG, xf86tokenString ());
247
token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab);
249
xf86unGetToken (token);
252
printf ("ModeLine parsed\n");
258
xf86parseVerboseMode (void)
261
int had_dotclock = 0, had_htimings = 0, had_vtimings = 0;
262
parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec)
264
if (xf86getSubToken (&(ptr->ml_comment)) != STRING)
265
Error ("Mode name expected", NULL);
266
ptr->ml_identifier = val.str;
267
while ((token = xf86getToken (ModeTab)) != ENDMODE)
272
ptr->ml_comment = xf86addComment(ptr->ml_comment, val.str);
275
if ((token = xf86getSubToken (&(ptr->ml_comment))) != NUMBER)
276
Error (NUMBER_MSG, "DotClock");
277
ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
281
if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
282
ptr->ml_hdisplay = val.num;
284
Error ("Horizontal display expected", NULL);
286
if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
287
ptr->ml_hsyncstart = val.num;
289
Error ("Horizontal sync start expected", NULL);
291
if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
292
ptr->ml_hsyncend = val.num;
294
Error ("Horizontal sync end expected", NULL);
296
if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
297
ptr->ml_htotal = val.num;
299
Error ("Horizontal total expected", NULL);
303
if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
304
ptr->ml_vdisplay = val.num;
306
Error ("Vertical display expected", NULL);
308
if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
309
ptr->ml_vsyncstart = val.num;
311
Error ("Vertical sync start expected", NULL);
313
if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
314
ptr->ml_vsyncend = val.num;
316
Error ("Vertical sync end expected", NULL);
318
if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
319
ptr->ml_vtotal = val.num;
321
Error ("Vertical total expected", NULL);
325
token = xf86getSubToken (&(ptr->ml_comment));
327
Error (QUOTE_MSG, "Flags");
328
while (token == STRING)
330
token2 = xf86getStringToken (TimingTab);
334
ptr->ml_flags |= XF86CONF_INTERLACE;
337
ptr->ml_flags |= XF86CONF_PHSYNC;
340
ptr->ml_flags |= XF86CONF_NHSYNC;
343
ptr->ml_flags |= XF86CONF_PVSYNC;
346
ptr->ml_flags |= XF86CONF_NVSYNC;
349
ptr->ml_flags |= XF86CONF_CSYNC;
352
ptr->ml_flags |= XF86CONF_PCSYNC;
355
ptr->ml_flags |= XF86CONF_NCSYNC;
358
ptr->ml_flags |= XF86CONF_DBLSCAN;
361
ptr->ml_flags |= XF86CONF_CUSTOM;
364
Error (UNEXPECTED_EOF_MSG, NULL);
367
Error ("Unknown flag string", NULL);
370
token = xf86getSubToken (&(ptr->ml_comment));
372
xf86unGetToken (token);
375
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
376
Error ("Horizontal skew expected", NULL);
377
ptr->ml_flags |= XF86CONF_HSKEW;
378
ptr->ml_hskew = val.num;
381
if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
382
Error ("Vertical scan count expected", NULL);
383
ptr->ml_flags |= XF86CONF_VSCAN;
384
ptr->ml_vscan = val.num;
387
Error (UNEXPECTED_EOF_MSG, NULL);
390
Error ("Unexepcted token in verbose \"Mode\" entry\n", NULL);
394
Error ("the dotclock is missing", NULL);
396
Error ("the horizontal timings are missing", NULL);
398
Error ("the vertical timings are missing", NULL);
401
printf ("Verbose Mode parsed\n");
408
#define CLEANUP xf86freeMonitorList
411
xf86parseMonitorSection (void)
413
int has_ident = FALSE;
415
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
417
while ((token = xf86getToken (MonitorTab)) != ENDSECTION)
422
ptr->mon_comment = xf86addComment(ptr->mon_comment, val.str);
425
if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
426
Error (QUOTE_MSG, "Identifier");
427
if (has_ident == TRUE)
428
Error (MULTIPLE_MSG, "Identifier");
429
ptr->mon_identifier = val.str;
433
if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
434
Error (QUOTE_MSG, "Vendor");
435
ptr->mon_vendor = val.str;
438
if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
439
Error (QUOTE_MSG, "ModelName");
440
ptr->mon_modelname = val.str;
443
HANDLE_LIST (mon_modeline_lst, xf86parseVerboseMode,
444
XF86ConfModeLinePtr);
447
HANDLE_LIST (mon_modeline_lst, xf86parseModeLine,
448
XF86ConfModeLinePtr);
451
if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
452
Error (DISPLAYSIZE_MSG, NULL);
453
ptr->mon_width = val.realnum;
454
if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
455
Error (DISPLAYSIZE_MSG, NULL);
456
ptr->mon_height = val.realnum;
460
if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
461
Error (HORIZSYNC_MSG, NULL);
463
ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum;
464
switch (token = xf86getSubToken (&(ptr->mon_comment)))
467
ptr->mon_hsync[ptr->mon_n_hsync].hi =
468
ptr->mon_hsync[ptr->mon_n_hsync].lo;
471
if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER ||
472
(float)val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo)
473
Error (HORIZSYNC_MSG, NULL);
474
ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum;
475
if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA)
480
/* We cannot currently know if a '\n' was found,
481
* or this is a real error
483
ptr->mon_hsync[ptr->mon_n_hsync].hi =
484
ptr->mon_hsync[ptr->mon_n_hsync].lo;
488
if (ptr->mon_n_hsync >= CONF_MAX_HSYNC)
489
Error ("Sorry. Too many horizontal sync intervals.", NULL);
491
} while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER);
493
xf86unGetToken (token);
497
if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
498
Error (VERTREFRESH_MSG, NULL);
500
ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = val.realnum;
501
switch (token = xf86getSubToken (&(ptr->mon_comment)))
504
ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
505
ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
508
if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER ||
509
(float)val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo)
510
Error (VERTREFRESH_MSG, NULL);
511
ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum;
512
if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA)
514
ptr->mon_n_vrefresh++;
517
/* We cannot currently know if a '\n' was found,
518
* or this is a real error
520
ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
521
ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
522
ptr->mon_n_vrefresh++;
525
if (ptr->mon_n_vrefresh >= CONF_MAX_VREFRESH)
526
Error ("Sorry. Too many vertical refresh intervals.", NULL);
527
ptr->mon_n_vrefresh++;
528
} while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER);
530
xf86unGetToken (token);
534
if( xf86getSubToken (&(ptr->mon_comment)) != NUMBER )
536
Error (INVALID_GAMMA_MSG, NULL);
540
ptr->mon_gamma_red = ptr->mon_gamma_green =
541
ptr->mon_gamma_blue = val.realnum;
542
if( xf86getSubToken (&(ptr->mon_comment)) == NUMBER )
544
ptr->mon_gamma_green = val.realnum;
545
if( xf86getSubToken (&(ptr->mon_comment)) == NUMBER )
547
ptr->mon_gamma_blue = val.realnum;
551
Error (INVALID_GAMMA_MSG, NULL);
555
xf86unGetToken (token);
559
ptr->mon_option_lst = xf86parseOption(ptr->mon_option_lst);
563
XF86ConfModesLinkPtr mptr;
565
if ((token = xf86getSubToken (&(ptr->mon_comment))) != STRING)
566
Error (QUOTE_MSG, "UseModes");
568
/* add to the end of the list of modes sections
570
mptr = xf86confcalloc (1, sizeof (XF86ConfModesLinkRec));
571
mptr->list.next = NULL;
572
mptr->ml_modes_str = val.str;
573
mptr->ml_modes = NULL;
574
ptr->mon_modes_sect_lst = (XF86ConfModesLinkPtr)
575
xf86addListItem((GenericListPtr)ptr->mon_modes_sect_lst,
576
(GenericListPtr)mptr);
580
Error (UNEXPECTED_EOF_MSG, NULL);
583
xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
591
Error (NO_IDENT_MSG, NULL);
594
printf ("Monitor section parsed\n");
600
#define CLEANUP xf86freeModesList
603
xf86parseModesSection (void)
605
int has_ident = FALSE;
607
parsePrologue (XF86ConfModesPtr, XF86ConfModesRec)
609
while ((token = xf86getToken (ModesTab)) != ENDSECTION)
614
ptr->modes_comment = xf86addComment(ptr->modes_comment, val.str);
617
if (xf86getSubToken (&(ptr->modes_comment)) != STRING)
618
Error (QUOTE_MSG, "Identifier");
619
if (has_ident == TRUE)
620
Error (MULTIPLE_MSG, "Identifier");
621
ptr->modes_identifier = val.str;
625
HANDLE_LIST (mon_modeline_lst, xf86parseVerboseMode,
626
XF86ConfModeLinePtr);
629
HANDLE_LIST (mon_modeline_lst, xf86parseModeLine,
630
XF86ConfModeLinePtr);
633
xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
641
Error (NO_IDENT_MSG, NULL);
644
printf ("Modes section parsed\n");
652
xf86printMonitorSection (FILE * cf, XF86ConfMonitorPtr ptr)
655
XF86ConfModeLinePtr mlptr;
656
XF86ConfModesLinkPtr mptr;
660
mptr = ptr->mon_modes_sect_lst;
661
fprintf (cf, "Section \"Monitor\"\n");
662
if (ptr->mon_comment)
663
fprintf (cf, "%s", ptr->mon_comment);
664
if (ptr->mon_identifier)
665
fprintf (cf, "\tIdentifier \"%s\"\n", ptr->mon_identifier);
667
fprintf (cf, "\tVendorName \"%s\"\n", ptr->mon_vendor);
668
if (ptr->mon_modelname)
669
fprintf (cf, "\tModelName \"%s\"\n", ptr->mon_modelname);
671
fprintf (cf, "\tUseModes \"%s\"\n", mptr->ml_modes_str);
672
mptr = mptr->list.next;
675
fprintf (cf, "\tDisplaySize %d\t%d\n",
678
if ( ptr->mon_n_hsync || ptr->mon_n_vrefresh )
679
fprintf(cf," ### Comment all HorizSync and VertSync values to use DDC:\n");
680
for (i = 0; i < ptr->mon_n_hsync; i++)
682
fprintf (cf, "\tHorizSync %2.1f - %2.1f\n",
683
ptr->mon_hsync[i].lo,
684
ptr->mon_hsync[i].hi);
686
for (i = 0; i < ptr->mon_n_vrefresh; i++)
688
fprintf (cf, "\tVertRefresh %2.1f - %2.1f\n",
689
ptr->mon_vrefresh[i].lo,
690
ptr->mon_vrefresh[i].hi);
692
if (ptr->mon_gamma_red) {
693
if (ptr->mon_gamma_red == ptr->mon_gamma_green
694
&& ptr->mon_gamma_red == ptr->mon_gamma_blue)
696
fprintf (cf, "\tGamma %.4g\n",
699
fprintf (cf, "\tGamma %.4g %.4g %.4g\n",
701
ptr->mon_gamma_green,
702
ptr->mon_gamma_blue);
705
for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next)
707
fprintf (cf, "\tModeLine \"%s\" %2.1f ",
708
mlptr->ml_identifier, mlptr->ml_clock / 1000.0);
709
fprintf (cf, "%d %d %d %d %d %d %d %d",
710
mlptr->ml_hdisplay, mlptr->ml_hsyncstart,
711
mlptr->ml_hsyncend, mlptr->ml_htotal,
712
mlptr->ml_vdisplay, mlptr->ml_vsyncstart,
713
mlptr->ml_vsyncend, mlptr->ml_vtotal);
714
if (mlptr->ml_flags & XF86CONF_PHSYNC)
715
fprintf (cf, " +hsync");
716
if (mlptr->ml_flags & XF86CONF_NHSYNC)
717
fprintf (cf, " -hsync");
718
if (mlptr->ml_flags & XF86CONF_PVSYNC)
719
fprintf (cf, " +vsync");
720
if (mlptr->ml_flags & XF86CONF_NVSYNC)
721
fprintf (cf, " -vsync");
722
if (mlptr->ml_flags & XF86CONF_INTERLACE)
723
fprintf (cf, " interlace");
724
if (mlptr->ml_flags & XF86CONF_CSYNC)
725
fprintf (cf, " composite");
726
if (mlptr->ml_flags & XF86CONF_PCSYNC)
727
fprintf (cf, " +csync");
728
if (mlptr->ml_flags & XF86CONF_NCSYNC)
729
fprintf (cf, " -csync");
730
if (mlptr->ml_flags & XF86CONF_DBLSCAN)
731
fprintf (cf, " doublescan");
732
if (mlptr->ml_flags & XF86CONF_HSKEW)
733
fprintf (cf, " hskew %d", mlptr->ml_hskew);
734
if (mlptr->ml_flags & XF86CONF_BCAST)
735
fprintf (cf, " bcast");
738
xf86printOptionList(cf, ptr->mon_option_lst, 1);
739
fprintf (cf, "EndSection\n\n");
740
ptr = ptr->list.next;
745
xf86printModesSection (FILE * cf, XF86ConfModesPtr ptr)
747
XF86ConfModeLinePtr mlptr;
751
fprintf (cf, "Section \"Modes\"\n");
752
if (ptr->modes_comment)
753
fprintf (cf, "%s", ptr->modes_comment);
754
if (ptr->modes_identifier)
755
fprintf (cf, "\tIdentifier \"%s\"\n", ptr->modes_identifier);
756
for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next)
758
fprintf (cf, "\tModeLine \"%s\" %2.1f ",
759
mlptr->ml_identifier, mlptr->ml_clock / 1000.0);
760
fprintf (cf, "%d %d %d %d %d %d %d %d",
761
mlptr->ml_hdisplay, mlptr->ml_hsyncstart,
762
mlptr->ml_hsyncend, mlptr->ml_htotal,
763
mlptr->ml_vdisplay, mlptr->ml_vsyncstart,
764
mlptr->ml_vsyncend, mlptr->ml_vtotal);
765
if (mlptr->ml_flags & XF86CONF_PHSYNC)
766
fprintf (cf, " +hsync");
767
if (mlptr->ml_flags & XF86CONF_NHSYNC)
768
fprintf (cf, " -hsync");
769
if (mlptr->ml_flags & XF86CONF_PVSYNC)
770
fprintf (cf, " +vsync");
771
if (mlptr->ml_flags & XF86CONF_NVSYNC)
772
fprintf (cf, " -vsync");
773
if (mlptr->ml_flags & XF86CONF_INTERLACE)
774
fprintf (cf, " interlace");
775
if (mlptr->ml_flags & XF86CONF_CSYNC)
776
fprintf (cf, " composite");
777
if (mlptr->ml_flags & XF86CONF_PCSYNC)
778
fprintf (cf, " +csync");
779
if (mlptr->ml_flags & XF86CONF_NCSYNC)
780
fprintf (cf, " -csync");
781
if (mlptr->ml_flags & XF86CONF_DBLSCAN)
782
fprintf (cf, " doublescan");
783
if (mlptr->ml_flags & XF86CONF_HSKEW)
784
fprintf (cf, " hskew %d", mlptr->ml_hskew);
785
if (mlptr->ml_flags & XF86CONF_VSCAN)
786
fprintf (cf, " vscan %d", mlptr->ml_vscan);
787
if (mlptr->ml_flags & XF86CONF_BCAST)
788
fprintf (cf, " bcast");
789
if (mlptr->ml_comment)
790
fprintf (cf, "%s", mlptr->ml_comment);
794
fprintf (cf, "EndSection\n\n");
795
ptr = ptr->list.next;
800
xf86freeMonitorList (XF86ConfMonitorPtr ptr)
802
XF86ConfMonitorPtr prev;
806
TestFree (ptr->mon_identifier);
807
TestFree (ptr->mon_vendor);
808
TestFree (ptr->mon_modelname);
809
TestFree (ptr->mon_comment);
810
xf86optionListFree (ptr->mon_option_lst);
811
xf86freeModeLineList (ptr->mon_modeline_lst);
813
ptr = ptr->list.next;
819
xf86freeModesList (XF86ConfModesPtr ptr)
821
XF86ConfModesPtr prev;
825
TestFree (ptr->modes_identifier);
826
TestFree (ptr->modes_comment);
827
xf86freeModeLineList (ptr->mon_modeline_lst);
829
ptr = ptr->list.next;
835
xf86freeModeLineList (XF86ConfModeLinePtr ptr)
837
XF86ConfModeLinePtr prev;
840
TestFree (ptr->ml_identifier);
841
TestFree (ptr->ml_comment);
843
ptr = ptr->list.next;
849
xf86findMonitor (const char *ident, XF86ConfMonitorPtr p)
853
if (xf86nameCompare (ident, p->mon_identifier) == 0)
862
xf86findModes (const char *ident, XF86ConfModesPtr p)
866
if (xf86nameCompare (ident, p->modes_identifier) == 0)
875
xf86findModeLine (const char *ident, XF86ConfModeLinePtr p)
879
if (xf86nameCompare (ident, p->ml_identifier) == 0)
888
xf86validateMonitor (XF86ConfigPtr p, XF86ConfScreenPtr screen)
890
XF86ConfMonitorPtr monitor = screen->scrn_monitor;
891
XF86ConfModesLinkPtr modeslnk = monitor->mon_modes_sect_lst;
892
XF86ConfModesPtr modes;
895
modes = xf86findModes (modeslnk->ml_modes_str, p->conf_modes_lst);
898
xf86validationError (UNDEFINED_MODES_MSG,
899
modeslnk->ml_modes_str,
900
screen->scrn_identifier);
903
modeslnk->ml_modes = modes;
904
modeslnk = modeslnk->list.next;