2015-09-16 13:10:19 -06:00
|
|
|
/*
|
|
|
|
*
|
2006-11-26 11:13:41 -07:00
|
|
|
* Copyright (c) 1997 Metro Link Incorporated
|
2015-09-16 13:10:19 -06:00
|
|
|
*
|
2006-11-26 11:13:41 -07:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
2015-09-16 13:10:19 -06:00
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
2006-11-26 11:13:41 -07:00
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2015-09-16 13:10:19 -06:00
|
|
|
*
|
2006-11-26 11:13:41 -07:00
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
2015-09-16 13:10:19 -06:00
|
|
|
*
|
2006-11-26 11:13:41 -07:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
2015-09-16 13:10:19 -06:00
|
|
|
*
|
2006-11-26 11:13:41 -07:00
|
|
|
* Except as contained in this notice, the name of the Metro Link shall not be
|
|
|
|
* used in advertising or otherwise to promote the sale, use or other dealings
|
|
|
|
* in this Software without prior written authorization from Metro Link.
|
2015-09-16 13:10:19 -06:00
|
|
|
*
|
2006-11-26 11:13:41 -07:00
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the name of the copyright holder(s)
|
|
|
|
* and author(s) shall not be used in advertising or otherwise to promote
|
|
|
|
* the sale, use or other dealings in this Software without prior written
|
|
|
|
* authorization from the copyright holder(s) and author(s).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_XORG_CONFIG_H
|
|
|
|
#include <xorg-config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "xf86Parser.h"
|
|
|
|
#include "xf86tokens.h"
|
|
|
|
#include "Configint.h"
|
|
|
|
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static xf86ConfigSymTabRec DisplayTab[] = {
|
|
|
|
{ENDSUBSECTION, "endsubsection"},
|
|
|
|
{MODES, "modes"},
|
|
|
|
{VIEWPORT, "viewport"},
|
|
|
|
{VIRTUAL, "virtual"},
|
|
|
|
{VISUAL, "visual"},
|
|
|
|
{BLACK_TOK, "black"},
|
|
|
|
{WHITE_TOK, "white"},
|
|
|
|
{DEPTH, "depth"},
|
|
|
|
{BPP, "fbbpp"},
|
|
|
|
{WEIGHT, "weight"},
|
|
|
|
{OPTION, "option"},
|
|
|
|
{-1, ""},
|
2006-11-26 11:13:41 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define CLEANUP xf86freeDisplayList
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
static XF86ConfDisplayPtr
|
2012-06-10 07:21:05 -06:00
|
|
|
xf86parseDisplaySubSection(void)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
int token;
|
|
|
|
|
|
|
|
parsePrologue(XF86ConfDisplayPtr, XF86ConfDisplayRec)
|
|
|
|
|
|
|
|
ptr->disp_black.red = ptr->disp_black.green = ptr->disp_black.blue = -1;
|
|
|
|
ptr->disp_white.red = ptr->disp_white.green = ptr->disp_white.blue = -1;
|
|
|
|
ptr->disp_frameX0 = ptr->disp_frameY0 = -1;
|
|
|
|
while ((token = xf86getToken(DisplayTab)) != ENDSUBSECTION) {
|
|
|
|
switch (token) {
|
|
|
|
case COMMENT:
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_comment = xf86addComment(ptr->disp_comment, xf86_lex_val.str);
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case VIEWPORT:
|
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(VIEWPORT_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_frameX0 = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(VIEWPORT_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_frameY0 = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case VIRTUAL:
|
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(VIRTUAL_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_virtualX = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(VIRTUAL_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_virtualY = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case DEPTH:
|
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(NUMBER_MSG, "Display");
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_depth = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case BPP:
|
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(NUMBER_MSG, "Display");
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_bpp = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case VISUAL:
|
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != STRING)
|
|
|
|
Error(QUOTE_MSG, "Display");
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_visual = xf86_lex_val.str;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case WEIGHT:
|
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(WEIGHT_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_weight.red = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(WEIGHT_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_weight.green = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(WEIGHT_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_weight.blue = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case BLACK_TOK:
|
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(BLACK_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_black.red = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(BLACK_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_black.green = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(BLACK_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_black.blue = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case WHITE_TOK:
|
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(WHITE_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_white.red = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(WHITE_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_white.green = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
|
|
|
|
Error(WHITE_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->disp_white.blue = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case MODES:
|
|
|
|
{
|
|
|
|
XF86ModePtr mptr;
|
|
|
|
|
|
|
|
while ((token =
|
|
|
|
xf86getSubTokenWithTab(&(ptr->disp_comment),
|
|
|
|
DisplayTab)) == STRING) {
|
|
|
|
mptr = calloc(1, sizeof(XF86ModeRec));
|
2014-09-27 11:52:59 -06:00
|
|
|
mptr->mode_name = xf86_lex_val.str;
|
2012-06-10 07:21:05 -06:00
|
|
|
mptr->list.next = NULL;
|
|
|
|
ptr->disp_mode_lst = (XF86ModePtr)
|
|
|
|
xf86addListItem((glp) ptr->disp_mode_lst, (glp) mptr);
|
|
|
|
}
|
|
|
|
xf86unGetToken(token);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPTION:
|
|
|
|
ptr->disp_option_lst = xf86parseOption(ptr->disp_option_lst);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EOF_TOKEN:
|
|
|
|
Error(UNEXPECTED_EOF_MSG);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Error(INVALID_KEYWORD_MSG, xf86tokenString());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2012-06-10 07:21:05 -06:00
|
|
|
printf("Display subsection parsed\n");
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return ptr;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#undef CLEANUP
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static xf86ConfigSymTabRec ScreenTab[] = {
|
|
|
|
{ENDSECTION, "endsection"},
|
|
|
|
{IDENTIFIER, "identifier"},
|
2014-09-27 11:52:59 -06:00
|
|
|
{MATCHSEAT, "matchseat"},
|
2012-06-10 07:21:05 -06:00
|
|
|
{OBSDRIVER, "driver"},
|
|
|
|
{MDEVICE, "device"},
|
|
|
|
{MONITOR, "monitor"},
|
|
|
|
{VIDEOADAPTOR, "videoadaptor"},
|
|
|
|
{SCREENNO, "screenno"},
|
|
|
|
{SUBSECTION, "subsection"},
|
|
|
|
{DEFAULTDEPTH, "defaultcolordepth"},
|
|
|
|
{DEFAULTDEPTH, "defaultdepth"},
|
|
|
|
{DEFAULTBPP, "defaultbpp"},
|
|
|
|
{DEFAULTFBBPP, "defaultfbbpp"},
|
|
|
|
{VIRTUAL, "virtual"},
|
|
|
|
{OPTION, "option"},
|
|
|
|
{-1, ""},
|
2006-11-26 11:13:41 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define CLEANUP xf86freeScreenList
|
|
|
|
XF86ConfScreenPtr
|
2012-06-10 07:21:05 -06:00
|
|
|
xf86parseScreenSection(void)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
int has_ident = FALSE;
|
|
|
|
int has_driver = FALSE;
|
|
|
|
int token;
|
|
|
|
|
|
|
|
parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec)
|
|
|
|
|
|
|
|
while ((token = xf86getToken(ScreenTab)) != ENDSECTION) {
|
|
|
|
switch (token) {
|
|
|
|
case COMMENT:
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->scrn_comment = xf86addComment(ptr->scrn_comment, xf86_lex_val.str);
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case IDENTIFIER:
|
|
|
|
if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
|
|
|
|
Error(QUOTE_MSG, "Identifier");
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->scrn_identifier = xf86_lex_val.str;
|
2012-06-10 07:21:05 -06:00
|
|
|
if (has_ident || has_driver)
|
|
|
|
Error(ONLY_ONE_MSG, "Identifier or Driver");
|
|
|
|
has_ident = TRUE;
|
|
|
|
break;
|
2014-09-27 11:52:59 -06:00
|
|
|
case MATCHSEAT:
|
|
|
|
if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
|
|
|
|
Error(QUOTE_MSG, "MatchSeat");
|
|
|
|
ptr->match_seat = xf86_lex_val.str;
|
|
|
|
break;
|
2012-06-10 07:21:05 -06:00
|
|
|
case OBSDRIVER:
|
|
|
|
if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
|
|
|
|
Error(QUOTE_MSG, "Driver");
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->scrn_obso_driver = xf86_lex_val.str;
|
2012-06-10 07:21:05 -06:00
|
|
|
if (has_ident || has_driver)
|
|
|
|
Error(ONLY_ONE_MSG, "Identifier or Driver");
|
|
|
|
has_driver = TRUE;
|
|
|
|
break;
|
|
|
|
case DEFAULTDEPTH:
|
|
|
|
if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
|
|
|
|
Error(NUMBER_MSG, "DefaultDepth");
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->scrn_defaultdepth = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case DEFAULTBPP:
|
|
|
|
if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
|
|
|
|
Error(NUMBER_MSG, "DefaultBPP");
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->scrn_defaultbpp = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case DEFAULTFBBPP:
|
|
|
|
if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
|
|
|
|
Error(NUMBER_MSG, "DefaultFbBPP");
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->scrn_defaultfbbpp = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case MDEVICE:
|
|
|
|
if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
|
|
|
|
Error(QUOTE_MSG, "Device");
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->scrn_device_str = xf86_lex_val.str;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case MONITOR:
|
|
|
|
if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
|
|
|
|
Error(QUOTE_MSG, "Monitor");
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->scrn_monitor_str = xf86_lex_val.str;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case VIDEOADAPTOR:
|
|
|
|
{
|
|
|
|
XF86ConfAdaptorLinkPtr aptr;
|
|
|
|
|
|
|
|
if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
|
|
|
|
Error(QUOTE_MSG, "VideoAdaptor");
|
|
|
|
|
|
|
|
/* Don't allow duplicates */
|
|
|
|
for (aptr = ptr->scrn_adaptor_lst; aptr;
|
|
|
|
aptr = (XF86ConfAdaptorLinkPtr) aptr->list.next)
|
2014-09-27 11:52:59 -06:00
|
|
|
if (xf86nameCompare(xf86_lex_val.str, aptr->al_adaptor_str) == 0)
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (aptr == NULL) {
|
|
|
|
aptr = calloc(1, sizeof(XF86ConfAdaptorLinkRec));
|
|
|
|
aptr->list.next = NULL;
|
2014-09-27 11:52:59 -06:00
|
|
|
aptr->al_adaptor_str = xf86_lex_val.str;
|
2012-06-10 07:21:05 -06:00
|
|
|
ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr)
|
|
|
|
xf86addListItem((glp) ptr->scrn_adaptor_lst, (glp) aptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VIRTUAL:
|
|
|
|
if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
|
|
|
|
Error(VIRTUAL_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->scrn_virtualX = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
|
|
|
|
Error(VIRTUAL_MSG);
|
2014-09-27 11:52:59 -06:00
|
|
|
ptr->scrn_virtualY = xf86_lex_val.num;
|
2012-06-10 07:21:05 -06:00
|
|
|
break;
|
|
|
|
case OPTION:
|
|
|
|
ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst);
|
|
|
|
break;
|
|
|
|
case SUBSECTION:
|
|
|
|
if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
|
|
|
|
Error(QUOTE_MSG, "SubSection");
|
|
|
|
{
|
2014-09-27 11:52:59 -06:00
|
|
|
free(xf86_lex_val.str);
|
2012-06-10 07:21:05 -06:00
|
|
|
HANDLE_LIST(scrn_display_lst, xf86parseDisplaySubSection,
|
|
|
|
XF86ConfDisplayPtr);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EOF_TOKEN:
|
|
|
|
Error(UNEXPECTED_EOF_MSG);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Error(INVALID_KEYWORD_MSG, xf86tokenString());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!has_ident && !has_driver)
|
|
|
|
Error(NO_IDENT_MSG);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2012-06-10 07:21:05 -06:00
|
|
|
printf("Screen section parsed\n");
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return ptr;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-06-10 07:21:05 -06:00
|
|
|
xf86printScreenSection(FILE * cf, XF86ConfScreenPtr ptr)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
XF86ConfAdaptorLinkPtr aptr;
|
|
|
|
XF86ConfDisplayPtr dptr;
|
|
|
|
XF86ModePtr mptr;
|
|
|
|
|
|
|
|
while (ptr) {
|
|
|
|
fprintf(cf, "Section \"Screen\"\n");
|
|
|
|
if (ptr->scrn_comment)
|
|
|
|
fprintf(cf, "%s", ptr->scrn_comment);
|
|
|
|
if (ptr->scrn_identifier)
|
|
|
|
fprintf(cf, "\tIdentifier \"%s\"\n", ptr->scrn_identifier);
|
|
|
|
if (ptr->scrn_obso_driver)
|
|
|
|
fprintf(cf, "\tDriver \"%s\"\n", ptr->scrn_obso_driver);
|
|
|
|
if (ptr->scrn_device_str)
|
|
|
|
fprintf(cf, "\tDevice \"%s\"\n", ptr->scrn_device_str);
|
|
|
|
if (ptr->scrn_monitor_str)
|
|
|
|
fprintf(cf, "\tMonitor \"%s\"\n", ptr->scrn_monitor_str);
|
|
|
|
if (ptr->scrn_defaultdepth)
|
|
|
|
fprintf(cf, "\tDefaultDepth %d\n", ptr->scrn_defaultdepth);
|
|
|
|
if (ptr->scrn_defaultbpp)
|
|
|
|
fprintf(cf, "\tDefaultBPP %d\n", ptr->scrn_defaultbpp);
|
|
|
|
if (ptr->scrn_defaultfbbpp)
|
|
|
|
fprintf(cf, "\tDefaultFbBPP %d\n", ptr->scrn_defaultfbbpp);
|
|
|
|
xf86printOptionList(cf, ptr->scrn_option_lst, 1);
|
|
|
|
for (aptr = ptr->scrn_adaptor_lst; aptr; aptr = aptr->list.next) {
|
|
|
|
fprintf(cf, "\tVideoAdaptor \"%s\"\n", aptr->al_adaptor_str);
|
|
|
|
}
|
|
|
|
if (ptr->scrn_virtualX && ptr->scrn_virtualY)
|
|
|
|
fprintf(cf, "\tVirtual %d %d\n",
|
|
|
|
ptr->scrn_virtualX, ptr->scrn_virtualY);
|
|
|
|
for (dptr = ptr->scrn_display_lst; dptr; dptr = dptr->list.next) {
|
|
|
|
fprintf(cf, "\tSubSection \"Display\"\n");
|
|
|
|
if (dptr->disp_comment)
|
|
|
|
fprintf(cf, "%s", dptr->disp_comment);
|
|
|
|
if (dptr->disp_frameX0 >= 0 || dptr->disp_frameY0 >= 0) {
|
|
|
|
fprintf(cf, "\t\tViewport %d %d\n",
|
|
|
|
dptr->disp_frameX0, dptr->disp_frameY0);
|
|
|
|
}
|
|
|
|
if (dptr->disp_virtualX != 0 || dptr->disp_virtualY != 0) {
|
|
|
|
fprintf(cf, "\t\tVirtual %d %d\n",
|
|
|
|
dptr->disp_virtualX, dptr->disp_virtualY);
|
|
|
|
}
|
|
|
|
if (dptr->disp_depth) {
|
|
|
|
fprintf(cf, "\t\tDepth %d\n", dptr->disp_depth);
|
|
|
|
}
|
|
|
|
if (dptr->disp_bpp) {
|
|
|
|
fprintf(cf, "\t\tFbBPP %d\n", dptr->disp_bpp);
|
|
|
|
}
|
|
|
|
if (dptr->disp_visual) {
|
|
|
|
fprintf(cf, "\t\tVisual \"%s\"\n", dptr->disp_visual);
|
|
|
|
}
|
|
|
|
if (dptr->disp_weight.red != 0) {
|
|
|
|
fprintf(cf, "\t\tWeight %d %d %d\n",
|
|
|
|
dptr->disp_weight.red, dptr->disp_weight.green,
|
|
|
|
dptr->disp_weight.blue);
|
|
|
|
}
|
|
|
|
if (dptr->disp_black.red != -1) {
|
|
|
|
fprintf(cf, "\t\tBlack 0x%04x 0x%04x 0x%04x\n",
|
|
|
|
dptr->disp_black.red, dptr->disp_black.green,
|
|
|
|
dptr->disp_black.blue);
|
|
|
|
}
|
|
|
|
if (dptr->disp_white.red != -1) {
|
|
|
|
fprintf(cf, "\t\tWhite 0x%04x 0x%04x 0x%04x\n",
|
|
|
|
dptr->disp_white.red, dptr->disp_white.green,
|
|
|
|
dptr->disp_white.blue);
|
|
|
|
}
|
|
|
|
if (dptr->disp_mode_lst) {
|
|
|
|
fprintf(cf, "\t\tModes ");
|
|
|
|
}
|
|
|
|
for (mptr = dptr->disp_mode_lst; mptr; mptr = mptr->list.next) {
|
|
|
|
fprintf(cf, " \"%s\"", mptr->mode_name);
|
|
|
|
}
|
|
|
|
if (dptr->disp_mode_lst) {
|
|
|
|
fprintf(cf, "\n");
|
|
|
|
}
|
|
|
|
xf86printOptionList(cf, dptr->disp_option_lst, 2);
|
|
|
|
fprintf(cf, "\tEndSubSection\n");
|
|
|
|
}
|
|
|
|
fprintf(cf, "EndSection\n\n");
|
|
|
|
ptr = ptr->list.next;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-06-10 07:21:05 -06:00
|
|
|
xf86freeScreenList(XF86ConfScreenPtr ptr)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
XF86ConfScreenPtr prev;
|
|
|
|
|
|
|
|
while (ptr) {
|
|
|
|
TestFree(ptr->scrn_identifier);
|
|
|
|
TestFree(ptr->scrn_monitor_str);
|
|
|
|
TestFree(ptr->scrn_device_str);
|
|
|
|
TestFree(ptr->scrn_comment);
|
|
|
|
xf86optionListFree(ptr->scrn_option_lst);
|
|
|
|
xf86freeAdaptorLinkList(ptr->scrn_adaptor_lst);
|
|
|
|
xf86freeDisplayList(ptr->scrn_display_lst);
|
|
|
|
prev = ptr;
|
|
|
|
ptr = ptr->list.next;
|
|
|
|
free(prev);
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-06-10 07:21:05 -06:00
|
|
|
xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
XF86ConfAdaptorLinkPtr prev;
|
|
|
|
|
|
|
|
while (ptr) {
|
|
|
|
TestFree(ptr->al_adaptor_str);
|
|
|
|
prev = ptr;
|
|
|
|
ptr = ptr->list.next;
|
|
|
|
free(prev);
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-06-10 07:21:05 -06:00
|
|
|
xf86freeDisplayList(XF86ConfDisplayPtr ptr)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
XF86ConfDisplayPtr prev;
|
|
|
|
|
|
|
|
while (ptr) {
|
|
|
|
xf86freeModeList(ptr->disp_mode_lst);
|
|
|
|
xf86optionListFree(ptr->disp_option_lst);
|
|
|
|
prev = ptr;
|
|
|
|
ptr = ptr->list.next;
|
|
|
|
free(prev);
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-06-10 07:21:05 -06:00
|
|
|
xf86freeModeList(XF86ModePtr ptr)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
XF86ModePtr prev;
|
|
|
|
|
|
|
|
while (ptr) {
|
|
|
|
TestFree(ptr->mode_name);
|
|
|
|
prev = ptr;
|
|
|
|
ptr = ptr->list.next;
|
|
|
|
free(prev);
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
xf86validateScreen(XF86ConfigPtr p)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
XF86ConfScreenPtr screen = p->conf_screen_lst;
|
|
|
|
XF86ConfMonitorPtr monitor;
|
|
|
|
XF86ConfAdaptorLinkPtr adaptor;
|
|
|
|
|
|
|
|
while (screen) {
|
|
|
|
if (screen->scrn_obso_driver && !screen->scrn_identifier)
|
|
|
|
screen->scrn_identifier = screen->scrn_obso_driver;
|
|
|
|
|
|
|
|
monitor =
|
|
|
|
xf86findMonitor(screen->scrn_monitor_str, p->conf_monitor_lst);
|
|
|
|
if (screen->scrn_monitor_str) {
|
|
|
|
if (monitor) {
|
|
|
|
screen->scrn_monitor = monitor;
|
|
|
|
if (!xf86validateMonitor(p, screen))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
screen->scrn_device =
|
|
|
|
xf86findDevice(screen->scrn_device_str, p->conf_device_lst);
|
|
|
|
|
|
|
|
adaptor = screen->scrn_adaptor_lst;
|
|
|
|
while (adaptor) {
|
|
|
|
adaptor->al_adaptor =
|
|
|
|
xf86findVideoAdaptor(adaptor->al_adaptor_str,
|
|
|
|
p->conf_videoadaptor_lst);
|
|
|
|
if (!adaptor->al_adaptor) {
|
|
|
|
xf86validationError(UNDEFINED_ADAPTOR_MSG,
|
|
|
|
adaptor->al_adaptor_str,
|
|
|
|
screen->scrn_identifier);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (adaptor->al_adaptor->va_fwdref) {
|
|
|
|
xf86validationError(ADAPTOR_REF_TWICE_MSG,
|
|
|
|
adaptor->al_adaptor_str,
|
|
|
|
adaptor->al_adaptor->va_fwdref);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
adaptor->al_adaptor->va_fwdref = strdup(screen->scrn_identifier);
|
|
|
|
adaptor = adaptor->list.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
screen = screen->list.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
XF86ConfScreenPtr
|
2012-06-10 07:21:05 -06:00
|
|
|
xf86findScreen(const char *ident, XF86ConfScreenPtr p)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
while (p) {
|
|
|
|
if (xf86nameCompare(ident, p->scrn_identifier) == 0)
|
|
|
|
return p;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
p = p->list.next;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|