Lines Matching full:mode
38 * drm_mode_debug_printmodeline - debug print a mode
40 * @mode: mode to print
45 * Describe @mode using DRM_DEBUG.
47 void drm_mode_debug_printmodeline(const struct drm_display_mode *mode) in drm_mode_debug_printmodeline() argument
51 mode->base.id, mode->name, mode->vrefresh, mode->clock, in drm_mode_debug_printmodeline()
52 mode->hdisplay, mode->hsync_start, in drm_mode_debug_printmodeline()
53 mode->hsync_end, mode->htotal, in drm_mode_debug_printmodeline()
54 mode->vdisplay, mode->vsync_start, in drm_mode_debug_printmodeline()
55 mode->vsync_end, mode->vtotal, mode->type, mode->flags); in drm_mode_debug_printmodeline()
259 /* ignore - just set the mode flag for interlaced */ in drm_cvt_mode()
264 /* Fill the mode line name */ in drm_cvt_mode()
422 /* finally, pack the results in the mode struct */ in drm_gtf_mode_complex()
490 * drm_mode_set_name - set the name on a mode
491 * @mode: name will be set in this mode
496 * Set the name of @mode to a standard format.
498 void drm_mode_set_name(struct drm_display_mode *mode) in drm_mode_set_name() argument
500 bool interlaced = !!(mode->flags & DRM_MODE_FLAG_INTERLACE); in drm_mode_set_name()
502 snprintf(mode->name, DRM_DISPLAY_MODE_LEN, "%dx%d%s", in drm_mode_set_name()
503 mode->hdisplay, mode->vdisplay, in drm_mode_set_name()
530 * drm_mode_width - get the width of a mode
531 * @mode: mode
536 * Return @mode's width (hdisplay) value.
541 * @mode->hdisplay
543 int drm_mode_width(const struct drm_display_mode *mode) in drm_mode_width() argument
545 return mode->hdisplay; in drm_mode_width()
551 * drm_mode_height - get the height of a mode
552 * @mode: mode
557 * Return @mode's height (vdisplay) value.
562 * @mode->vdisplay
564 int drm_mode_height(const struct drm_display_mode *mode) in drm_mode_height() argument
566 return mode->vdisplay; in drm_mode_height()
570 /** drm_mode_hsync - get the hsync of a mode
571 * @mode: mode
578 int drm_mode_hsync(const struct drm_display_mode *mode) in drm_mode_hsync() argument
582 if (mode->hsync) in drm_mode_hsync()
583 return mode->hsync; in drm_mode_hsync()
585 if (mode->htotal < 0) in drm_mode_hsync()
588 calc_val = (mode->clock * 1000) / mode->htotal; /* hsync in Hz */ in drm_mode_hsync()
597 * drm_mode_vrefresh - get the vrefresh of a mode
598 * @mode: mode
603 * Return @mode's vrefresh rate in Hz or calculate it if necessary.
612 int drm_mode_vrefresh(const struct drm_display_mode *mode) in drm_mode_vrefresh() argument
617 if (mode->vrefresh > 0) in drm_mode_vrefresh()
618 refresh = mode->vrefresh; in drm_mode_vrefresh()
619 else if (mode->htotal > 0 && mode->vtotal > 0) { in drm_mode_vrefresh()
621 vtotal = mode->vtotal; in drm_mode_vrefresh()
623 calc_val = (mode->clock * 1000); in drm_mode_vrefresh()
624 calc_val /= mode->htotal; in drm_mode_vrefresh()
627 if (mode->flags & DRM_MODE_FLAG_INTERLACE) in drm_mode_vrefresh()
629 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) in drm_mode_vrefresh()
631 if (mode->vscan > 1) in drm_mode_vrefresh()
632 refresh /= mode->vscan; in drm_mode_vrefresh()
640 * @p: mode
695 * drm_mode_copy - copy the mode
696 * @dst: mode to overwrite
697 * @src: mode to copy
702 * Copy an existing mode into another mode, preserving the object id
703 * of the destination mode.
716 * drm_mode_duplicate - allocate and duplicate an existing mode
717 * @m: mode to duplicate
722 * Just allocate a new mode, copy the existing mode into it, and return
726 const struct drm_display_mode *mode) in drm_mode_duplicate() argument
734 drm_mode_copy(nmode, mode); in drm_mode_duplicate()
742 * @mode1: first mode
743 * @mode2: second mode
799 struct drm_display_mode *mode; in drm_mode_validate_size() local
801 list_for_each_entry(mode, mode_list, head) { in drm_mode_validate_size()
802 if (maxPitch > 0 && mode->hdisplay > maxPitch) in drm_mode_validate_size()
803 mode->status = MODE_BAD_WIDTH; in drm_mode_validate_size()
805 if (maxX > 0 && mode->hdisplay > maxX) in drm_mode_validate_size()
806 mode->status = MODE_VIRTUAL_X; in drm_mode_validate_size()
808 if (maxY > 0 && mode->vdisplay > maxY) in drm_mode_validate_size()
809 mode->status = MODE_VIRTUAL_Y; in drm_mode_validate_size()
825 * Some code may need to check a mode list against the clock limits of the
826 * device in question. This function walks the mode list, testing to make
827 * sure each mode falls within a given range (defined by @min and @max
828 * arrays) and sets @mode->status as needed.
834 struct drm_display_mode *mode; in drm_mode_validate_clocks() local
837 list_for_each_entry(mode, mode_list, head) { in drm_mode_validate_clocks()
840 if (mode->clock >= min[i] && mode->clock <= max[i]) { in drm_mode_validate_clocks()
846 mode->status = MODE_CLOCK_RANGE; in drm_mode_validate_clocks()
852 * drm_mode_prune_invalid - remove invalid modes from mode list
860 * Once mode list generation is complete, a caller can use this routine to
861 * remove invalid modes from a mode list. If any of the modes have a
867 struct drm_display_mode *mode, *t; in drm_mode_prune_invalid() local
869 list_for_each_entry_safe(mode, t, mode_list, head) { in drm_mode_prune_invalid()
870 if (mode->status != MODE_OK) { in drm_mode_prune_invalid()
871 list_del(&mode->head); in drm_mode_prune_invalid()
873 drm_mode_debug_printmodeline(mode); in drm_mode_prune_invalid()
874 DRM_DEBUG_KMS("Not using %s mode %d\n", in drm_mode_prune_invalid()
875 mode->name, mode->status); in drm_mode_prune_invalid()
877 drm_mode_destroy(dev, mode); in drm_mode_prune_invalid()
886 * @lh_a: list_head for first mode
887 * @lh_b: list_head for second mode
922 * drm_mode_sort - sort mode list
937 * drm_mode_connector_list_update - update the mode list for the connector
944 * to the actual mode list. It compares the probed mode against the current
950 struct drm_display_mode *mode; in drm_mode_connector_list_update() local
957 /* go through current modes checking for the new probed mode */ in drm_mode_connector_list_update()
958 list_for_each_entry(mode, &connector->modes, head) { in drm_mode_connector_list_update()
959 if (drm_mode_equal(pmode, mode)) { in drm_mode_connector_list_update()
961 /* if equal delete the probed mode */ in drm_mode_connector_list_update()
962 mode->status = pmode->status; in drm_mode_connector_list_update()
964 mode->type |= pmode->type; in drm_mode_connector_list_update()
980 * @mode_option - per connector mode option
993 struct drm_cmdline_mode *mode) in drm_mode_parse_command_line_for_connector() argument
1010 mode->specified = false; in drm_mode_parse_command_line_for_connector()
1104 /* catch mode that begins with digits but has no 'x' */ in drm_mode_parse_command_line_for_connector()
1110 "parse error at position %i in video mode '%s'\n", in drm_mode_parse_command_line_for_connector()
1112 mode->specified = false; in drm_mode_parse_command_line_for_connector()
1117 mode->specified = true; in drm_mode_parse_command_line_for_connector()
1118 mode->xres = xres; in drm_mode_parse_command_line_for_connector()
1119 mode->yres = yres; in drm_mode_parse_command_line_for_connector()
1123 mode->refresh_specified = true; in drm_mode_parse_command_line_for_connector()
1124 mode->refresh = refresh; in drm_mode_parse_command_line_for_connector()
1128 mode->bpp_specified = true; in drm_mode_parse_command_line_for_connector()
1129 mode->bpp = bpp; in drm_mode_parse_command_line_for_connector()
1131 mode->rb = rb; in drm_mode_parse_command_line_for_connector()
1132 mode->cvt = cvt; in drm_mode_parse_command_line_for_connector()
1133 mode->interlace = interlace; in drm_mode_parse_command_line_for_connector()
1134 mode->margins = margins; in drm_mode_parse_command_line_for_connector()
1135 mode->force = force; in drm_mode_parse_command_line_for_connector()
1145 struct drm_display_mode *mode; in drm_mode_create_from_cmdline_mode() local
1148 mode = drm_cvt_mode(dev, in drm_mode_create_from_cmdline_mode()
1154 mode = drm_gtf_mode(dev, in drm_mode_create_from_cmdline_mode()
1159 if (!mode) in drm_mode_create_from_cmdline_mode()
1162 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); in drm_mode_create_from_cmdline_mode()
1163 return mode; in drm_mode_create_from_cmdline_mode()