⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xf86modes.c

📁 显驱动 Intel英特尔G45G43G41G35G33G31G965Q963Q965GM965系列显卡最新X.Org驱动2.4.0版For Linux
💻 C
📖 第 1 页 / 共 2 页
字号:
			    int flags){    DisplayModePtr mode;    for (mode = modeList; mode != NULL; mode = mode->next) {	if (mode->Flags & V_INTERLACE && !(flags & V_INTERLACE))	    mode->status = MODE_NO_INTERLACE;	if (mode->Flags & V_DBLSCAN && !(flags & V_DBLSCAN))	    mode->status = MODE_NO_DBLESCAN;    }}/** * Marks as bad any modes extending beyond the given max X, Y, or pitch. * * \param modeList doubly-linked or circular list of modes. * * This is not in xf86Modes.c, but would be part of the proposed new API. */_X_EXPORT voidxf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,			  int maxX, int maxY, int maxPitch){    DisplayModePtr mode;    for (mode = modeList; mode != NULL; mode = mode->next) {	if (maxPitch > 0 && mode->HDisplay > maxPitch)	    mode->status = MODE_BAD_WIDTH;	if (maxX > 0 && mode->HDisplay > maxX)	    mode->status = MODE_VIRTUAL_X;	if (maxY > 0 && mode->VDisplay > maxY)	    mode->status = MODE_VIRTUAL_Y;	if (mode->next == modeList)	    break;    }}/** * Marks as bad any modes that aren't supported by the given monitor's * hsync and vrefresh ranges. * * \param modeList doubly-linked or circular list of modes. * * This is not in xf86Modes.c, but would be part of the proposed new API. */_X_EXPORT voidxf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,			  MonPtr mon){    DisplayModePtr mode;    for (mode = modeList; mode != NULL; mode = mode->next) {	Bool bad;	int i;	bad = TRUE;	for (i = 0; i < mon->nHsync; i++) {	    if (xf86ModeHSync(mode) >= mon->hsync[i].lo &&		xf86ModeHSync(mode) <= mon->hsync[i].hi)	    {		bad = FALSE;	    }	}	if (bad)	    mode->status = MODE_HSYNC;	bad = TRUE;	for (i = 0; i < mon->nVrefresh; i++) {	    if (xf86ModeVRefresh(mode) >= mon->vrefresh[i].lo &&		xf86ModeVRefresh(mode) <= mon->vrefresh[i].hi)	    {		bad = FALSE;	    }	}	if (bad)	    mode->status = MODE_VSYNC;	if (mode->next == modeList)	    break;    }}/** * Marks as bad any modes extending beyond outside of the given clock ranges. * * \param modeList doubly-linked or circular list of modes. * \param min pointer to minimums of clock ranges * \param max pointer to maximums of clock ranges * \param n_ranges number of ranges. * * This is not in xf86Modes.c, but would be part of the proposed new API. */_X_EXPORT voidxf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,			    int *min, int *max, int n_ranges){    DisplayModePtr mode;    int i;    for (mode = modeList; mode != NULL; mode = mode->next) {	Bool good = FALSE;	for (i = 0; i < n_ranges; i++) {	    if (mode->Clock >= min[i] && mode->Clock <= max[i]) {		good = TRUE;		break;	    }	}	if (!good)	    mode->status = MODE_CLOCK_RANGE;    }}/** * If the user has specified a set of mode names to use, mark as bad any modes * not listed. * * The user mode names specified are prefixes to names of modes, so "1024x768" * will match modes named "1024x768", "1024x768x75", "1024x768-good", but * "1024x768x75" would only match "1024x768x75" from that list. * * MODE_BAD is used as the rejection flag, for lack of a better flag. * * \param modeList doubly-linked or circular list of modes. * * This is not in xf86Modes.c, but would be part of the proposed new API. */_X_EXPORT voidxf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList){    DisplayModePtr mode;    if (pScrn->display->modes[0] == NULL)	return;    for (mode = modeList; mode != NULL; mode = mode->next) {	int i;	Bool good = FALSE;	for (i = 0; pScrn->display->modes[i] != NULL; i++) {	    if (strncmp(pScrn->display->modes[i], mode->name,			strlen(pScrn->display->modes[i])) == 0) {		good = TRUE;		break;	    }	}	if (!good)	    mode->status = MODE_BAD;    }}/** * Frees any modes from the list with a status other than MODE_OK. * * \param modeList pointer to a doubly-linked or circular list of modes. * \param verbose determines whether the reason for mode invalidation is *	  printed. * * This is not in xf86Modes.c, but would be part of the proposed new API. */_X_EXPORT voidxf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,			  Bool verbose){    DisplayModePtr mode;    for (mode = *modeList; mode != NULL;) {	DisplayModePtr next = mode->next, first = *modeList;	if (mode->status != MODE_OK) {	    if (verbose) {		char *type = "";		if (mode->type & M_T_BUILTIN)		    type = "built-in ";		else if (mode->type & M_T_DEFAULT)		    type = "default ";		xf86DrvMsg(pScrn->scrnIndex, X_INFO,			   "Not using %smode \"%s\" (%s)\n", type, mode->name,			   xf86ModeStatusToString(mode->status));	    }	    xf86DeleteMode(modeList, mode);	}	if (next == first)	    break;	mode = next;    }}/** * Adds the new mode into the mode list, and returns the new list * * \param modes doubly-linked mode list. */_X_EXPORT DisplayModePtrxf86ModesAdd(DisplayModePtr modes, DisplayModePtr new){    if (modes == NULL)	return new;    if (new) {	DisplayModePtr mode = modes;	while (mode->next)	    mode = mode->next;	mode->next = new;	new->prev = mode;    }    return modes;}/** * Build a mode list from a list of config file modes */static DisplayModePtrxf86GetConfigModes (XF86ConfModeLinePtr conf_mode){    DisplayModePtr  head = NULL, prev = NULL, mode;        for (; conf_mode; conf_mode = (XF86ConfModeLinePtr) conf_mode->list.next)    {        mode = xcalloc(1, sizeof(DisplayModeRec));	if (!mode)	    continue;        mode->name       = xstrdup(conf_mode->ml_identifier);	if (!mode->name)	{	    xfree (mode);	    continue;	}	mode->type       = 0;        mode->Clock      = conf_mode->ml_clock;        mode->HDisplay   = conf_mode->ml_hdisplay;        mode->HSyncStart = conf_mode->ml_hsyncstart;        mode->HSyncEnd   = conf_mode->ml_hsyncend;        mode->HTotal     = conf_mode->ml_htotal;        mode->VDisplay   = conf_mode->ml_vdisplay;        mode->VSyncStart = conf_mode->ml_vsyncstart;        mode->VSyncEnd   = conf_mode->ml_vsyncend;        mode->VTotal     = conf_mode->ml_vtotal;        mode->Flags      = conf_mode->ml_flags;        mode->HSkew      = conf_mode->ml_hskew;        mode->VScan      = conf_mode->ml_vscan;        mode->prev = prev;	mode->next = NULL;	if (prev)	    prev->next = mode;	else	    head = mode;	prev = mode;    }    return head;}/** * Build a mode list from a monitor configuration */_X_EXPORT DisplayModePtrxf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor){    DisplayModePtr	    modes = NULL;    XF86ConfModesLinkPtr    modes_link;        if (!conf_monitor)	return NULL;    /*     * first we collect the mode lines from the UseModes directive     */    for (modes_link = conf_monitor->mon_modes_sect_lst; 	 modes_link; 	 modes_link = modes_link->list.next)    {	/* If this modes link hasn't been resolved, go look it up now */	if (!modes_link->ml_modes)	    modes_link->ml_modes = xf86findModes (modes_link->ml_modes_str, 						  xf86configptr->conf_modes_lst);	if (modes_link->ml_modes)	    modes = xf86ModesAdd (modes,				  xf86GetConfigModes (modes_link->ml_modes->mon_modeline_lst));    }    return xf86ModesAdd (modes,			 xf86GetConfigModes (conf_monitor->mon_modeline_lst));}/** * Build a mode list containing all of the default modes */_X_EXPORT DisplayModePtrxf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed){    DisplayModePtr  head = NULL, prev = NULL, mode;    int		    i;    for (i = 0; xf86DefaultModes[i].name != NULL; i++)    {	DisplayModePtr	defMode = &xf86DefaultModes[i];		if (!interlaceAllowed && (defMode->Flags & V_INTERLACE))	    continue;	if (!doubleScanAllowed && (defMode->Flags & V_DBLSCAN))	    continue;	mode = xalloc(sizeof(DisplayModeRec));	if (!mode)	    continue;        memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec));        mode->name = xstrdup(xf86DefaultModes[i].name);        if (!mode->name)	{	    xfree (mode);	    continue;	}        mode->prev = prev;	mode->next = NULL;	if (prev)	    prev->next = mode;	else	    head = mode;	prev = mode;    }    return head;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -