Lines Matching full:mode
38 * Calculates the horizontal sync rate of a mode.
41 xf86ModeHSync(const DisplayModeRec * mode) in xf86ModeHSync() argument
45 if (mode->HSync > 0.0) in xf86ModeHSync()
46 hsync = mode->HSync; in xf86ModeHSync()
47 else if (mode->HTotal > 0) in xf86ModeHSync()
48 hsync = (float) mode->Clock / (float) mode->HTotal; in xf86ModeHSync()
54 * Calculates the vertical refresh rate of a mode.
57 xf86ModeVRefresh(const DisplayModeRec * mode) in xf86ModeVRefresh() argument
61 if (mode->VRefresh > 0.0) in xf86ModeVRefresh()
62 refresh = mode->VRefresh; in xf86ModeVRefresh()
63 else if (mode->HTotal > 0 && mode->VTotal > 0) { in xf86ModeVRefresh()
64 refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal; in xf86ModeVRefresh()
65 if (mode->Flags & V_INTERLACE) in xf86ModeVRefresh()
67 if (mode->Flags & V_DBLSCAN) in xf86ModeVRefresh()
69 if (mode->VScan > 1) in xf86ModeVRefresh()
70 refresh /= (float) (mode->VScan); in xf86ModeVRefresh()
76 xf86ModeWidth(const DisplayModeRec * mode, Rotation rotation) in xf86ModeWidth() argument
81 return mode->HDisplay; in xf86ModeWidth()
84 return mode->VDisplay; in xf86ModeWidth()
91 xf86ModeHeight(const DisplayModeRec * mode, Rotation rotation) in xf86ModeHeight() argument
96 return mode->VDisplay; in xf86ModeHeight()
99 return mode->HDisplay; in xf86ModeHeight()
105 /** Calculates the memory bandwidth (in MiB/sec) of a mode. */
107 xf86ModeBandwidth(DisplayModePtr mode, int depth) in xf86ModeBandwidth() argument
112 if (!mode->HTotal || !mode->VTotal || !mode->Clock) in xf86ModeBandwidth()
115 a_active = mode->HDisplay * mode->VDisplay; in xf86ModeBandwidth()
116 a_total = mode->HTotal * mode->VTotal; in xf86ModeBandwidth()
118 pixels_per_second = active_percent * mode->Clock * 1000.0; in xf86ModeBandwidth()
123 /** Sets a default mode name of <width>x<height> on a mode. */
125 xf86SetModeDefaultName(DisplayModePtr mode) in xf86SetModeDefaultName() argument
127 Bool interlaced = ! !(mode->Flags & V_INTERLACE); in xf86SetModeDefaultName()
130 free((void *) mode->name); in xf86SetModeDefaultName()
132 XNFasprintf(&tmp, "%dx%d%s", mode->HDisplay, mode->VDisplay, in xf86SetModeDefaultName()
134 mode->name = tmp; in xf86SetModeDefaultName()
140 * Initialises the Crtc parameters for a mode. The initialisation includes
192 * Fills in a copy of mode, removing all stale pointer references.
193 * xf86ModesEqual will return true when comparing with original mode.
196 xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec *mode) in xf86SaveModeContents() argument
198 *intern = *mode; in xf86SaveModeContents()
228 * Duplicates every mode in the given list and returns a pointer to the first
229 * mode.
231 * \param modeList doubly-linked mode list
237 DisplayModePtr mode; in xf86DuplicateModes() local
239 for (mode = modeList; mode != NULL; mode = mode->next) { in xf86DuplicateModes()
242 new = xf86DuplicateMode(mode); in xf86DuplicateModes()
298 * The mode type bits are informational except for the capitalized U
307 * USERDEF, z, a configured zoom mode Ctrl+Alt+Keypad-{Plus,Minus}.
316 * BUILTIN, b, a hardware fixed CRTC mode.
321 xf86PrintModeline(int scrnIndex, DisplayModePtr mode) in xf86PrintModeline() argument
338 if (mode->type) { in xf86PrintModeline()
343 if (mode->type & tbit[i]) in xf86PrintModeline()
348 if (mode->HSkew) { in xf86PrintModeline()
349 snprintf(tmp, 256, "hskew %i", mode->HSkew); in xf86PrintModeline()
352 if (mode->VScan) { in xf86PrintModeline()
353 snprintf(tmp, 256, "vscan %i", mode->VScan); in xf86PrintModeline()
356 if (mode->Flags & V_INTERLACE) in xf86PrintModeline()
358 if (mode->Flags & V_CSYNC) in xf86PrintModeline()
360 if (mode->Flags & V_DBLSCAN) in xf86PrintModeline()
362 if (mode->Flags & V_BCAST) in xf86PrintModeline()
364 if (mode->Flags & V_PHSYNC) in xf86PrintModeline()
366 if (mode->Flags & V_NHSYNC) in xf86PrintModeline()
368 if (mode->Flags & V_PVSYNC) in xf86PrintModeline()
370 if (mode->Flags & V_NVSYNC) in xf86PrintModeline()
372 if (mode->Flags & V_PCSYNC) in xf86PrintModeline()
374 if (mode->Flags & V_NCSYNC) in xf86PrintModeline()
377 if (mode->Flags & V_CLKDIV2) in xf86PrintModeline()
383 mode->name, mode->VRefresh, mode->Clock / 1000., in xf86PrintModeline()
384 mode->HDisplay, mode->HSyncStart, mode->HSyncEnd, mode->HTotal, in xf86PrintModeline()
385 mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal, in xf86PrintModeline()
386 flags, xf86ModeHSync(mode), type); in xf86PrintModeline()
401 DisplayModePtr mode; in xf86ValidateModesFlags() local
406 for (mode = modeList; mode != NULL; mode = mode->next) { in xf86ValidateModesFlags()
407 if (mode->Flags & V_INTERLACE && !(flags & V_INTERLACE)) in xf86ValidateModesFlags()
408 mode->status = MODE_NO_INTERLACE; in xf86ValidateModesFlags()
409 if (mode->Flags & V_DBLSCAN && !(flags & V_DBLSCAN)) in xf86ValidateModesFlags()
410 mode->status = MODE_NO_DBLESCAN; in xf86ValidateModesFlags()
423 DisplayModePtr mode; in xf86ValidateModesSize() local
432 for (mode = modeList; mode != NULL; mode = mode->next) { in xf86ValidateModesSize()
433 if ((xf86ModeWidth(mode, RR_Rotate_0) > maxPitch || in xf86ValidateModesSize()
434 xf86ModeWidth(mode, RR_Rotate_0) > maxX || in xf86ValidateModesSize()
435 xf86ModeHeight(mode, RR_Rotate_0) > maxY) && in xf86ValidateModesSize()
436 (xf86ModeWidth(mode, RR_Rotate_90) > maxPitch || in xf86ValidateModesSize()
437 xf86ModeWidth(mode, RR_Rotate_90) > maxX || in xf86ValidateModesSize()
438 xf86ModeHeight(mode, RR_Rotate_90) > maxY)) { in xf86ValidateModesSize()
439 if (xf86ModeWidth(mode, RR_Rotate_0) > maxPitch || in xf86ValidateModesSize()
440 xf86ModeWidth(mode, RR_Rotate_90) > maxPitch) in xf86ValidateModesSize()
441 mode->status = MODE_BAD_WIDTH; in xf86ValidateModesSize()
443 if (xf86ModeWidth(mode, RR_Rotate_0) > maxX || in xf86ValidateModesSize()
444 xf86ModeWidth(mode, RR_Rotate_90) > maxX) in xf86ValidateModesSize()
445 mode->status = MODE_VIRTUAL_X; in xf86ValidateModesSize()
447 if (xf86ModeHeight(mode, RR_Rotate_0) > maxY || in xf86ValidateModesSize()
448 xf86ModeHeight(mode, RR_Rotate_90) > maxY) in xf86ValidateModesSize()
449 mode->status = MODE_VIRTUAL_Y; in xf86ValidateModesSize()
452 if (mode->next == modeList) in xf86ValidateModesSize()
466 DisplayModePtr mode; in xf86ValidateModesSync() local
468 for (mode = modeList; mode != NULL; mode = mode->next) { in xf86ValidateModesSync()
474 if (xf86ModeHSync(mode) >= mon->hsync[i].lo * (1 - SYNC_TOLERANCE) in xf86ValidateModesSync()
475 && xf86ModeHSync(mode) <= in xf86ValidateModesSync()
481 mode->status = MODE_HSYNC; in xf86ValidateModesSync()
485 if (xf86ModeVRefresh(mode) >= in xf86ValidateModesSync()
487 xf86ModeVRefresh(mode) <= in xf86ValidateModesSync()
493 mode->status = MODE_VSYNC; in xf86ValidateModesSync()
495 if (mode->next == modeList) in xf86ValidateModesSync()
512 DisplayModePtr mode; in xf86ValidateModesClocks() local
515 for (mode = modeList; mode != NULL; mode = mode->next) { in xf86ValidateModesClocks()
519 if (mode->Clock >= min[i] * (1 - SYNC_TOLERANCE) && in xf86ValidateModesClocks()
520 mode->Clock <= max[i] * (1 + SYNC_TOLERANCE)) { in xf86ValidateModesClocks()
526 mode->status = MODE_CLOCK_RANGE; in xf86ValidateModesClocks()
531 * If the user has specified a set of mode names to use, mark as bad any modes
534 * The user mode names specified are prefixes to names of modes, so "1024x768"
545 DisplayModePtr mode; in xf86ValidateModesUserConfig() local
550 for (mode = modeList; mode != NULL; mode = mode->next) { in xf86ValidateModesUserConfig()
555 if (strncmp(pScrn->display->modes[i], mode->name, in xf86ValidateModesUserConfig()
562 mode->status = MODE_BAD; in xf86ValidateModesUserConfig()
577 DisplayModePtr mode; in xf86ValidateModesBandwidth() local
579 for (mode = modeList; mode != NULL; mode = mode->next) { in xf86ValidateModesBandwidth()
580 if (xf86ModeBandwidth(mode, depth) > bandwidth) in xf86ValidateModesBandwidth()
581 mode->status = MODE_BANDWIDTH; in xf86ValidateModesBandwidth()
586 xf86ModeIsReduced(const DisplayModeRec * mode) in xf86ModeIsReduced() argument
588 if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) && in xf86ModeIsReduced()
589 ((mode->HTotal - mode->HDisplay) == 160) && in xf86ModeIsReduced()
590 ((mode->HSyncEnd - mode->HDisplay) == 80) && in xf86ModeIsReduced()
591 ((mode->HSyncEnd - mode->HSyncStart) == 32) && in xf86ModeIsReduced()
592 ((mode->VSyncStart - mode->VDisplay) == 3)) in xf86ModeIsReduced()
614 * \param verbose determines whether the reason for mode invalidation is
621 DisplayModePtr mode; in xf86PruneInvalidModes() local
623 for (mode = *modeList; mode != NULL;) { in xf86PruneInvalidModes()
624 DisplayModePtr next = mode->next, first = *modeList; in xf86PruneInvalidModes()
626 if (mode->status != MODE_OK) { in xf86PruneInvalidModes()
630 if (mode->type & M_T_BUILTIN) in xf86PruneInvalidModes()
632 else if (mode->type & M_T_DEFAULT) in xf86PruneInvalidModes()
635 "Not using %smode \"%s\" (%s)\n", type, mode->name, in xf86PruneInvalidModes()
636 xf86ModeStatusToString(mode->status)); in xf86PruneInvalidModes()
638 xf86DeleteMode(modeList, mode); in xf86PruneInvalidModes()
643 mode = next; in xf86PruneInvalidModes()
648 * Adds the new mode into the mode list, and returns the new list
650 * \param modes doubly-linked mode list.
659 DisplayModePtr mode = modes; in xf86ModesAdd() local
661 while (mode->next) in xf86ModesAdd()
662 mode = mode->next; in xf86ModesAdd()
664 mode->next = new; in xf86ModesAdd()
665 new->prev = mode; in xf86ModesAdd()
672 * Build a mode list from a list of config file modes
677 DisplayModePtr head = NULL, prev = NULL, mode; in xf86GetConfigModes() local
680 mode = calloc(1, sizeof(DisplayModeRec)); in xf86GetConfigModes()
681 if (!mode) in xf86GetConfigModes()
683 mode->name = xstrdup(conf_mode->ml_identifier); in xf86GetConfigModes()
684 if (!mode->name) { in xf86GetConfigModes()
685 free(mode); in xf86GetConfigModes()
688 mode->type = 0; in xf86GetConfigModes()
689 mode->Clock = conf_mode->ml_clock; in xf86GetConfigModes()
690 mode->HDisplay = conf_mode->ml_hdisplay; in xf86GetConfigModes()
691 mode->HSyncStart = conf_mode->ml_hsyncstart; in xf86GetConfigModes()
692 mode->HSyncEnd = conf_mode->ml_hsyncend; in xf86GetConfigModes()
693 mode->HTotal = conf_mode->ml_htotal; in xf86GetConfigModes()
694 mode->VDisplay = conf_mode->ml_vdisplay; in xf86GetConfigModes()
695 mode->VSyncStart = conf_mode->ml_vsyncstart; in xf86GetConfigModes()
696 mode->VSyncEnd = conf_mode->ml_vsyncend; in xf86GetConfigModes()
697 mode->VTotal = conf_mode->ml_vtotal; in xf86GetConfigModes()
698 mode->Flags = conf_mode->ml_flags; in xf86GetConfigModes()
699 mode->HSkew = conf_mode->ml_hskew; in xf86GetConfigModes()
700 mode->VScan = conf_mode->ml_vscan; in xf86GetConfigModes()
702 mode->prev = prev; in xf86GetConfigModes()
703 mode->next = NULL; in xf86GetConfigModes()
705 prev->next = mode; in xf86GetConfigModes()
707 head = mode; in xf86GetConfigModes()
708 prev = mode; in xf86GetConfigModes()
714 * Build a mode list from a monitor configuration
726 * first we collect the mode lines from the UseModes directive in xf86GetMonitorModes()
745 * Build a mode list containing all of the default modes
750 DisplayModePtr head = NULL, mode; in xf86GetDefaultModes() local
756 mode = xf86DuplicateMode(defMode); in xf86GetDefaultModes()
757 head = xf86ModesAdd(head, mode); in xf86GetDefaultModes()
763 * Walk a mode list and prune out duplicates. Will preserve the preferred
764 * mode of an otherwise-duplicate pair.
767 * (driver, default, user, etc.), otherwise, which mode gets deleted is