Lines Matching refs:mode
39 * Calculates the horizontal sync rate of a mode.
42 xf86ModeHSync(const DisplayModeRec * mode)
46 if (mode->HSync > 0.0)
47 hsync = mode->HSync;
48 else if (mode->HTotal > 0)
49 hsync = (float) mode->Clock / (float) mode->HTotal;
55 * Calculates the vertical refresh rate of a mode.
58 xf86ModeVRefresh(const DisplayModeRec * mode)
62 if (mode->VRefresh > 0.0)
63 refresh = mode->VRefresh;
64 else if (mode->HTotal > 0 && mode->VTotal > 0) {
65 refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal;
66 if (mode->Flags & V_INTERLACE)
68 if (mode->Flags & V_DBLSCAN)
70 if (mode->VScan > 1)
71 refresh /= (float) (mode->VScan);
77 xf86ModeWidth(const DisplayModeRec * mode, Rotation rotation)
82 return mode->HDisplay;
85 return mode->VDisplay;
92 xf86ModeHeight(const DisplayModeRec * mode, Rotation rotation)
97 return mode->VDisplay;
100 return mode->HDisplay;
106 /** Calculates the memory bandwidth (in MiB/sec) of a mode. */
108 xf86ModeBandwidth(DisplayModePtr mode, int depth)
113 if (!mode->HTotal || !mode->VTotal || !mode->Clock)
116 a_active = mode->HDisplay * mode->VDisplay;
117 a_total = mode->HTotal * mode->VTotal;
119 pixels_per_second = active_percent * mode->Clock * 1000.0;
124 /** Sets a default mode name of <width>x<height> on a mode. */
126 xf86SetModeDefaultName(DisplayModePtr mode)
128 Bool interlaced = ! !(mode->Flags & V_INTERLACE);
131 free((void *) mode->name);
133 XNFasprintf(&tmp, "%dx%d%s", mode->HDisplay, mode->VDisplay,
135 mode->name = tmp;
141 * Initialises the Crtc parameters for a mode. The initialisation includes
193 * Fills in a copy of mode, removing all stale pointer references.
194 * xf86ModesEqual will return true when comparing with original mode.
197 xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec *mode)
199 *intern = *mode;
229 * Duplicates every mode in the given list and returns a pointer to the first
230 * mode.
232 * \param modeList doubly-linked mode list
238 DisplayModePtr mode;
240 for (mode = modeList; mode != NULL; mode = mode->next) {
243 new = xf86DuplicateMode(mode);
299 * The mode type bits are informational except for the capitalized U
308 * USERDEF, z, a configured zoom mode Ctrl+Alt+Keypad-{Plus,Minus}.
317 * BUILTIN, b, a hardware fixed CRTC mode.
322 xf86PrintModeline(int scrnIndex, DisplayModePtr mode)
339 if (mode->type) {
344 if (mode->type & tbit[i])
349 if (mode->HSkew) {
350 snprintf(tmp, 256, "hskew %i", mode->HSkew);
353 if (mode->VScan) {
354 snprintf(tmp, 256, "vscan %i", mode->VScan);
357 if (mode->Flags & V_INTERLACE)
359 if (mode->Flags & V_CSYNC)
361 if (mode->Flags & V_DBLSCAN)
363 if (mode->Flags & V_BCAST)
365 if (mode->Flags & V_PHSYNC)
367 if (mode->Flags & V_NHSYNC)
369 if (mode->Flags & V_PVSYNC)
371 if (mode->Flags & V_NVSYNC)
373 if (mode->Flags & V_PCSYNC)
375 if (mode->Flags & V_NCSYNC)
378 if (mode->Flags & V_CLKDIV2)
384 mode->name, mode->VRefresh, mode->Clock / 1000.,
385 mode->HDisplay, mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
386 mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal,
387 flags, xf86ModeHSync(mode), type);
402 DisplayModePtr mode;
407 for (mode = modeList; mode != NULL; mode = mode->next) {
408 if (mode->Flags & V_INTERLACE && !(flags & V_INTERLACE))
409 mode->status = MODE_NO_INTERLACE;
410 if (mode->Flags & V_DBLSCAN && !(flags & V_DBLSCAN))
411 mode->status = MODE_NO_DBLESCAN;
424 DisplayModePtr mode;
433 for (mode = modeList; mode != NULL; mode = mode->next) {
434 if ((xf86ModeWidth(mode, RR_Rotate_0) > maxPitch ||
435 xf86ModeWidth(mode, RR_Rotate_0) > maxX ||
436 xf86ModeHeight(mode, RR_Rotate_0) > maxY) &&
437 (xf86ModeWidth(mode, RR_Rotate_90) > maxPitch ||
438 xf86ModeWidth(mode, RR_Rotate_90) > maxX ||
439 xf86ModeHeight(mode, RR_Rotate_90) > maxY)) {
440 if (xf86ModeWidth(mode, RR_Rotate_0) > maxPitch ||
441 xf86ModeWidth(mode, RR_Rotate_90) > maxPitch)
442 mode->status = MODE_BAD_WIDTH;
444 if (xf86ModeWidth(mode, RR_Rotate_0) > maxX ||
445 xf86ModeWidth(mode, RR_Rotate_90) > maxX)
446 mode->status = MODE_VIRTUAL_X;
448 if (xf86ModeHeight(mode, RR_Rotate_0) > maxY ||
449 xf86ModeHeight(mode, RR_Rotate_90) > maxY)
450 mode->status = MODE_VIRTUAL_Y;
453 if (mode->next == modeList)
467 DisplayModePtr mode;
469 for (mode = modeList; mode != NULL; mode = mode->next) {
475 if (xf86ModeHSync(mode) >= mon->hsync[i].lo * (1 - SYNC_TOLERANCE)
476 && xf86ModeHSync(mode) <=
482 mode->status = MODE_HSYNC;
486 if (xf86ModeVRefresh(mode) >=
488 xf86ModeVRefresh(mode) <=
494 mode->status = MODE_VSYNC;
496 if (mode->next == modeList)
513 DisplayModePtr mode;
516 for (mode = modeList; mode != NULL; mode = mode->next) {
520 if (mode->Clock >= min[i] * (1 - SYNC_TOLERANCE) &&
521 mode->Clock <= max[i] * (1 + SYNC_TOLERANCE)) {
527 mode->status = MODE_CLOCK_RANGE;
532 * If the user has specified a set of mode names to use, mark as bad any modes
535 * The user mode names specified are prefixes to names of modes, so "1024x768"
546 DisplayModePtr mode;
551 for (mode = modeList; mode != NULL; mode = mode->next) {
556 if (strncmp(pScrn->display->modes[i], mode->name,
563 mode->status = MODE_BAD;
578 DisplayModePtr mode;
580 for (mode = modeList; mode != NULL; mode = mode->next) {
581 if (xf86ModeBandwidth(mode, depth) > bandwidth)
582 mode->status = MODE_BANDWIDTH;
587 xf86ModeIsReduced(const DisplayModeRec * mode)
589 if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) &&
590 ((mode->HTotal - mode->HDisplay) == 160) &&
591 ((mode->HSyncEnd - mode->HDisplay) == 80) &&
592 ((mode->HSyncEnd - mode->HSyncStart) == 32) &&
593 ((mode->VSyncStart - mode->VDisplay) == 3))
615 * \param verbose determines whether the reason for mode invalidation is
622 DisplayModePtr mode;
624 for (mode = *modeList; mode != NULL;) {
625 DisplayModePtr next = mode->next, first = *modeList;
627 if (mode->status != MODE_OK) {
631 if (mode->type & M_T_BUILTIN)
633 else if (mode->type & M_T_DEFAULT)
636 "Not using %smode \"%s\" (%s)\n", type, mode->name,
637 xf86ModeStatusToString(mode->status));
639 xf86DeleteMode(modeList, mode);
644 mode = next;
649 * Adds the new mode into the mode list, and returns the new list
651 * \param modes doubly-linked mode list.
660 DisplayModePtr mode = modes;
662 while (mode->next)
663 mode = mode->next;
665 mode->next = new;
666 new->prev = mode;
673 * Build a mode list from a list of config file modes
678 DisplayModePtr head = NULL, prev = NULL, mode;
681 mode = calloc(1, sizeof(DisplayModeRec));
682 if (!mode)
684 mode->name = xstrdup(conf_mode->ml_identifier);
685 if (!mode->name) {
686 free(mode);
689 mode->type = 0;
690 mode->Clock = conf_mode->ml_clock;
691 mode->HDisplay = conf_mode->ml_hdisplay;
692 mode->HSyncStart = conf_mode->ml_hsyncstart;
693 mode->HSyncEnd = conf_mode->ml_hsyncend;
694 mode->HTotal = conf_mode->ml_htotal;
695 mode->VDisplay = conf_mode->ml_vdisplay;
696 mode->VSyncStart = conf_mode->ml_vsyncstart;
697 mode->VSyncEnd = conf_mode->ml_vsyncend;
698 mode->VTotal = conf_mode->ml_vtotal;
699 mode->Flags = conf_mode->ml_flags;
700 mode->HSkew = conf_mode->ml_hskew;
701 mode->VScan = conf_mode->ml_vscan;
703 mode->prev = prev;
704 mode->next = NULL;
706 prev->next = mode;
708 head = mode;
709 prev = mode;
715 * Build a mode list from a monitor configuration
727 * first we collect the mode lines from the UseModes directive
746 * Build a mode list containing all of the default modes
751 DisplayModePtr head = NULL, mode;
757 mode = xf86DuplicateMode(defMode);
758 head = xf86ModesAdd(head, mode);
764 * Walk a mode list and prune out duplicates. Will preserve the preferred
765 * mode of an otherwise-duplicate pair.
768 * (driver, default, user, etc.), otherwise, which mode gets deleted is
798 * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.