Lines Matching refs:mode

43  * drm_mode_debug_printmodeline - debug print a mode
45 * @mode: mode to print
50 * Describe @mode using DRM_DEBUG.
52 void drm_mode_debug_printmodeline(const struct drm_display_mode *mode)
56 mode->base.id, mode->name, mode->vrefresh, mode->clock,
57 mode->hdisplay, mode->hsync_start,
58 mode->hsync_end, mode->htotal,
59 mode->vdisplay, mode->vsync_start,
60 mode->vsync_end, mode->vtotal, mode->type, mode->flags);
266 /* ignore - just set the mode flag for interlaced */
271 /* Fill the mode line name */
445 /* finally, pack the results in the mode struct */
553 * This function is expensive and should only be used, if only one mode is to be
569 pr_debug("%s: got %dx%d display mode from %s\n",
579 * drm_mode_set_name - set the name on a mode
580 * @mode: name will be set in this mode
585 * Set the name of @mode to a standard format.
587 void drm_mode_set_name(struct drm_display_mode *mode)
589 bool interlaced = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
591 (void) snprintf(mode->name, DRM_DISPLAY_MODE_LEN, "%dx%d%s",
592 mode->hdisplay, mode->vdisplay,
617 * drm_mode_width - get the width of a mode
618 * @mode: mode
623 * Return @mode's width (hdisplay) value.
628 * @mode->hdisplay
630 int drm_mode_width(const struct drm_display_mode *mode)
632 return mode->hdisplay;
637 * drm_mode_height - get the height of a mode
638 * @mode: mode
643 * Return @mode's height (vdisplay) value.
648 * @mode->vdisplay
650 int drm_mode_height(const struct drm_display_mode *mode)
652 return mode->vdisplay;
655 /** drm_mode_hsync - get the hsync of a mode
656 * @mode: mode
663 int drm_mode_hsync(const struct drm_display_mode *mode)
667 if (mode->hsync)
668 return mode->hsync;
670 if (mode->htotal < 0)
673 calc_val = (mode->clock * 1000) / mode->htotal; /* hsync in Hz */
681 * drm_mode_vrefresh - get the vrefresh of a mode
682 * @mode: mode
687 * Return @mode's vrefresh rate in Hz or calculate it if necessary.
696 int drm_mode_vrefresh(const struct drm_display_mode *mode)
701 if (mode->vrefresh > 0)
702 refresh = mode->vrefresh;
703 else if (mode->htotal > 0 && mode->vtotal > 0) {
705 vtotal = mode->vtotal;
707 calc_val = (mode->clock * 1000);
708 calc_val /= mode->htotal;
711 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
713 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
715 if (mode->vscan > 1)
716 refresh /= mode->vscan;
723 * @p: mode
777 * drm_mode_copy - copy the mode
778 * @dst: mode to overwrite
779 * @src: mode to copy
784 * Copy an existing mode into another mode, preserving the object id
785 * of the destination mode.
798 * drm_mode_duplicate - allocate and duplicate an existing mode
799 * @m: mode to duplicate
804 * Just allocate a new mode, copy the existing mode into it, and return
808 const struct drm_display_mode *mode)
816 drm_mode_copy(nmode, mode);
823 * @mode1: first mode
824 * @mode2: second mode
849 * @mode1: first mode
850 * @mode2: second mode
899 struct drm_display_mode *mode;
901 list_for_each_entry(mode, struct drm_display_mode, mode_list, head) {
902 if (maxPitch > 0 && mode->hdisplay > maxPitch)
903 mode->status = MODE_BAD_WIDTH;
905 if (maxX > 0 && mode->hdisplay > maxX)
906 mode->status = MODE_VIRTUAL_X;
908 if (maxY > 0 && mode->vdisplay > maxY)
909 mode->status = MODE_VIRTUAL_Y;
924 * Some code may need to check a mode list against the clock limits of the
925 * device in question. This function walks the mode list, testing to make
926 * sure each mode falls within a given range (defined by @min and @max
927 * arrays) and sets @mode->status as needed.
934 struct drm_display_mode *mode;
937 list_for_each_entry(mode, struct drm_display_mode, mode_list, head) {
940 if (mode->clock >= min[i] && mode->clock <= max[i]) {
946 mode->status = MODE_CLOCK_RANGE;
951 * drm_mode_prune_invalid - remove invalid modes from mode list
959 * Once mode list generation is complete, a caller can use this routine to
960 * remove invalid modes from a mode list. If any of the modes have a
966 struct drm_display_mode *mode, *t;
968 list_for_each_entry_safe(mode, t, struct drm_display_mode, mode_list, head) {
969 if (mode->status != MODE_OK) {
970 list_del(&mode->head);
972 drm_mode_debug_printmodeline(mode);
973 DRM_DEBUG_KMS("Not using %s mode %d\n",
974 mode->name, mode->status);
976 drm_mode_destroy(dev, mode);
983 * @lh_a: list_head for first mode
984 * @lh_b: list_head for second mode
1019 * drm_mode_sort - sort mode list
1036 /* Pre-check the mode order
1077 * drm_mode_connector_list_update - update the mode list for the connector
1084 * to the actual mode list. It compares the probed mode against the current
1090 struct drm_display_mode *mode;
1098 /* go through current modes checking for the new probed mode */
1099 list_for_each_entry(mode, struct drm_display_mode, &connector->modes, head) {
1100 if (drm_mode_equal(pmode, mode)) {
1102 /* if equal delete the probed mode */
1103 mode->status = pmode->status;
1105 mode->type |= pmode->type;
1121 struct drm_display_mode *mode;
1124 mode = drm_cvt_mode(dev,
1130 mode = drm_gtf_mode(dev,
1135 if (!mode)
1138 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
1139 return mode;