Lines Matching refs:mode

54 /* First detailed mode wrong, use largest 60Hz mode */
58 /* Prefer the largest mode at 75 Hz */
68 /* use +hsync +vsync for detailed mode */
1201 * @connector: has mode list to fix up
1204 * Walk the mode list for @connector, clearing the preferred status
1205 * on existing modes and setting it anew for the right mode ala @quirks.
1230 /* Largest mode is preferred */
1246 mode_is_rb(const struct drm_display_mode *mode)
1248 return (mode->htotal - mode->hdisplay == 160) &&
1249 (mode->hsync_end - mode->hdisplay == 80) &&
1250 (mode->hsync_end - mode->hsync_start == 32) &&
1251 (mode->vsync_start - mode->vdisplay == 3);
1255 * drm_mode_find_dmt - Create a copy of a mode if present in DMT
1262 * Walk the DMT mode list looking for a match for the given parameters.
1263 * Return a newly allocated copy of the mode, or NULL if not found.
1442 * drm_mode_std - convert standard mode info (width, height, refresh) into mode
1447 * and convert them into a real mode using CVT/GTF/DMT.
1454 struct drm_display_mode *m, *mode = NULL;
1492 * If this connector already has a mode for this size and refresh
1504 mode = drm_cvt_mode(dev, 1366, 768, vrefresh_rate, 0, 0,
1506 mode->hdisplay = 1366;
1507 mode->hsync_start = mode->hsync_start - 1;
1508 mode->hsync_end = mode->hsync_end - 1;
1509 return mode;
1512 /* check whether it can be found in default mode table */
1514 mode = drm_mode_find_dmt(dev, hsize, vsize, vrefresh_rate,
1516 if (mode)
1517 return mode;
1519 mode = drm_mode_find_dmt(dev, hsize, vsize, vrefresh_rate, false);
1520 if (mode)
1521 return mode;
1528 mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0);
1536 mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0);
1537 if (!mode)
1539 if (drm_mode_hsync(mode) > drm_gtf2_hbreak(edid)) {
1540 drm_mode_destroy(dev, mode);
1541 mode = drm_gtf_mode_complex(dev, hsize, vsize,
1550 mode = drm_cvt_mode(dev, hsize, vsize, vrefresh_rate, 0, 0,
1554 return mode;
1566 drm_mode_do_interlace_quirk(struct drm_display_mode *mode,
1586 if ((mode->hdisplay == cea_interlaced[i].w) &&
1587 (mode->vdisplay == cea_interlaced[i].h / 2)) {
1588 mode->vdisplay *= 2;
1589 mode->vsync_start *= 2;
1590 mode->vsync_end *= 2;
1591 mode->vtotal *= 2;
1592 mode->vtotal |= 1;
1596 mode->flags |= DRM_MODE_FLAG_INTERLACE;
1600 * drm_mode_detailed - create a new mode from an EDID detailed timing section
1601 * @dev: DRM device (needed to create new mode)
1614 struct drm_display_mode *mode;
1630 DRM_ERROR("stereo mode not supported\n");
1645 mode = drm_cvt_mode(dev, hactive, vactive, 60, true, false, false);
1646 if (!mode)
1652 mode = drm_mode_create(dev);
1653 if (!mode)
1659 mode->clock = le16_to_cpu(timing->pixel_clock) * 10;
1661 mode->hdisplay = hactive;
1662 mode->hsync_start = mode->hdisplay + hsync_offset;
1663 mode->hsync_end = mode->hsync_start + hsync_pulse_width;
1664 mode->htotal = mode->hdisplay + hblank;
1666 mode->vdisplay = vactive;
1667 mode->vsync_start = mode->vdisplay + vsync_offset;
1668 mode->vsync_end = mode->vsync_start + vsync_pulse_width;
1669 mode->vtotal = mode->vdisplay + vblank;
1672 if (mode->hsync_end > mode->htotal)
1673 mode->htotal = mode->hsync_end + 1;
1674 if (mode->vsync_end > mode->vtotal)
1675 mode->vtotal = mode->vsync_end + 1;
1677 drm_mode_do_interlace_quirk(mode, pt);
1683 mode->flags |= (pt->misc & DRM_EDID_PT_HSYNC_POSITIVE) ?
1685 mode->flags |= (pt->misc & DRM_EDID_PT_VSYNC_POSITIVE) ?
1689 mode->width_mm = pt->width_mm_lo | (pt->width_height_mm_hi & 0xf0) << 4;
1690 mode->height_mm = pt->height_mm_lo | (pt->width_height_mm_hi & 0xf) << 8;
1693 mode->width_mm *= 10;
1694 mode->height_mm *= 10;
1698 mode->width_mm = edid->width_cm * 10;
1699 mode->height_mm = edid->height_cm * 10;
1702 mode->type = DRM_MODE_TYPE_DRIVER;
1703 drm_mode_set_name(mode);
1705 return mode;
1709 mode_in_hsync_range(const struct drm_display_mode *mode,
1720 hsync = drm_mode_hsync(mode);
1726 mode_in_vsync_range(const struct drm_display_mode *mode,
1737 vsync = drm_mode_vrefresh(mode);
1758 mode_in_range(const struct drm_display_mode *mode, struct edid *edid,
1764 if (!mode_in_hsync_range(mode, edid, t))
1767 if (!mode_in_vsync_range(mode, edid, t))
1771 if (mode->clock > max_clock)
1776 if (t[13] && mode->hdisplay > 8 * (t[13] + (256 * (t[12]&0x3))))
1779 if (mode_is_rb(mode) && !drm_monitor_supports_rb(edid))
1786 const struct drm_display_mode *mode)
1792 if (mode->hdisplay == m->hdisplay &&
1793 mode->vdisplay == m->vdisplay &&
1794 drm_mode_vrefresh(mode) == drm_mode_vrefresh(m))
1796 if (mode->hdisplay <= m->hdisplay &&
1797 mode->vdisplay <= m->vdisplay)
1825 /* fix up 1366x768 mode from 1368x768;
1828 static void fixup_mode_1366x768(struct drm_display_mode *mode)
1830 if (mode->hdisplay == 1368 && mode->vdisplay == 768) {
1831 mode->hdisplay = 1366;
1832 mode->hsync_start--;
1833 mode->hsync_end--;
1834 drm_mode_set_name(mode);
1951 struct drm_display_mode *mode;
1960 mode = drm_mode_find_dmt(connector->dev,
1965 if (mode) {
1966 drm_mode_probed_add(connector, mode);
2244 * Calculate the alternate clock for the CEA mode
2269 * drm_match_cea_mode - look for a CEA mode matching given mode
2270 * @to_match: display mode
2272 * Returns the CEA Video ID (VIC) of the mode or 0 if it isn't a CEA-861
2273 * mode.
2277 u8 mode;
2282 for (mode = 0; mode < ARRAY_SIZE(edid_cea_modes); mode++) {
2283 const struct drm_display_mode *cea_mode = (struct drm_display_mode *)&edid_cea_modes[mode];
2293 return mode + 1;
2302 struct drm_display_mode *mode, *tmp;
2314 * Go through all probed modes and create a new mode
2317 list_for_each_entry(mode, struct drm_display_mode, &connector->probed_modes, head) {
2320 u8 cea_mode_idx = drm_match_cea_mode(mode) - 1;
2334 if (mode->clock != clock1 && mode->clock != clock2)
2342 * The current mode could be either variant. Make
2343 * sure to pick the "other" clock for the new mode.
2345 if (mode->clock != clock1)
2353 list_for_each_entry_safe(mode, tmp, struct drm_display_mode, &list, head) {
2354 list_del(&mode->head);
2355 drm_mode_probed_add(connector, mode);
2366 u8 * mode, cea_mode;
2369 for (mode = db; mode < db + len; mode++) {
2370 cea_mode = (*mode & 127) - 1; /* CEA modes are numbered 1..127 */
2653 * @mode: the display mode
2656 struct drm_display_mode *mode)
2658 int i = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
2689 * @encoder: the encoder just changed display mode
2690 * @mode: the adjusted display mode
2697 struct drm_display_mode *mode)
2896 * Add the specified modes to the connector's mode list.
2918 * - preferred detailed mode
2928 * XXX order for additional mode types in extension blocks?
2953 * Add the specified modes to the connector's mode list. Only when the
2962 struct drm_display_mode *mode;
2976 * whether the mode should be added to the mode list of
2985 mode = drm_mode_duplicate(dev, ptr);
2986 if (mode) {
2987 drm_mode_probed_add(connector, mode);