Lines Matching refs:mode

53  * drm_mode_debug_printmodeline - print a mode to dmesg
54 * @mode: mode to print
56 * Describe @mode using DRM_DEBUG.
58 void drm_mode_debug_printmodeline(const struct drm_display_mode *mode)
60 DRM_DEBUG_KMS("Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
65 * drm_mode_create - create a new display mode
72 * Pointer to new mode on success, NULL on error.
87 * drm_mode_destroy - remove a mode
89 * @mode: mode to remove
91 * Release @mode's unique ID, then free it @mode structure itself using kfree.
93 void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode)
95 if (!mode)
98 kfree(mode);
103 * drm_mode_probed_add - add a mode to a connector's probed_mode list
104 * @connector: connector the new mode
105 * @mode: mode data
107 * Add @mode to @connector's probed_mode list for later use. This list should
112 struct drm_display_mode *mode)
116 list_add_tail(&mode->head, &connector->probed_modes);
326 struct drm_display_mode *mode,
349 "Generating a %ux%u%c, %u-line mode with a %lu kHz clock\n",
357 drm_dbg_kms(dev, "Trying to generate a BT.601 mode. Disabling checks.\n");
454 mode->clock = pixel_clock_hz / 1000;
455 mode->hdisplay = hactive;
456 mode->hsync_start = mode->hdisplay + hfp;
457 mode->hsync_end = mode->hsync_start + hslen;
458 mode->htotal = mode->hsync_end + hbp;
473 * Moreover, if we want to create a progressive mode for
503 mode->vdisplay = vactive;
504 mode->vsync_start = mode->vdisplay + vfp;
505 mode->vsync_end = mode->vsync_start + vslen;
506 mode->vtotal = mode->vsync_end + vbp;
508 if (mode->vtotal != params->num_lines)
511 mode->type = DRM_MODE_TYPE_DRIVER;
512 mode->flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC;
514 mode->flags |= DRM_MODE_FLAG_INTERLACE;
516 drm_mode_set_name(mode);
518 drm_dbg_kms(dev, "Generated mode " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
524 * drm_analog_tv_mode - create a display mode for an analog TV
526 * @tv_mode: TV Mode standard to create a mode for. See DRM_MODE_TV_MODE_*.
530 * @interlace: whether to compute an interlaced mode
533 * an analog TV output, for one of the usual analog TV mode.
541 * A pointer to the mode, allocated with drm_mode_create(). Returns NULL
551 struct drm_display_mode *mode;
578 mode = drm_mode_create(dev);
579 if (!mode)
582 ret = fill_analog_mode(dev, mode,
588 return mode;
591 drm_mode_destroy(dev, mode);
603 * @interlaced: whether to compute an interlaced mode
617 * The display mode object is allocated with drm_mode_create(). Returns NULL
618 * when no mode could be allocated.
806 /* ignore - just set the mode flag for interlaced */
811 /* Fill the mode line name */
830 * @interlaced: whether to compute an interlaced mode
842 * The display mode object is allocated with drm_mode_create(). Returns NULL
843 * when no mode could be allocated.
989 /* finally, pack the results in the mode struct */
1022 * @interlaced: whether to compute an interlaced mode
1047 * The display mode object is allocated with drm_mode_create(). Returns NULL
1048 * when no mode could be allocated.
1066 * Fills out @dmode using the display mode specified in @vm.
1107 * Fills out @vm using the display mode specified in @dmode.
1181 * This function is expensive and should only be used, if only one mode is to be
1203 pr_debug("%pOF: got %dx%d display mode\n",
1218 * are read and set on the display mode.
1262 * drm_mode_set_name - set the name on a mode
1263 * @mode: name will be set in this mode
1265 * Set the name of @mode to a standard format which is <hdisplay>x<vdisplay>
1268 void drm_mode_set_name(struct drm_display_mode *mode)
1270 bool interlaced = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
1272 snprintf(mode->name, DRM_DISPLAY_MODE_LEN, "%dx%d%s",
1273 mode->hdisplay, mode->vdisplay,
1279 * drm_mode_vrefresh - get the vrefresh of a mode
1280 * @mode: mode
1286 int drm_mode_vrefresh(const struct drm_display_mode *mode)
1290 if (mode->htotal == 0 || mode->vtotal == 0)
1293 num = mode->clock;
1294 den = mode->htotal * mode->vtotal;
1296 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
1298 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
1300 if (mode->vscan > 1)
1301 den *= mode->vscan;
1308 * drm_mode_get_hv_timing - Fetches hdisplay/vdisplay for given mode
1309 * @mode: mode to query
1313 * The vdisplay value will be doubled if the specified mode is a stereo mode of
1316 void drm_mode_get_hv_timing(const struct drm_display_mode *mode,
1321 drm_mode_init(&adjusted, mode);
1331 * @p: mode
1409 * drm_mode_copy - copy the mode
1410 * @dst: mode to overwrite
1411 * @src: mode to copy
1413 * Copy an existing mode into another mode, preserving the
1414 * list head of the destination mode.
1426 * drm_mode_init - initialize the mode from another mode
1427 * @dst: mode to overwrite
1428 * @src: mode to copy
1430 * Copy an existing mode into another mode, zeroing the
1431 * list head of the destination mode. Typically used
1443 * drm_mode_duplicate - allocate and duplicate an existing mode
1444 * @dev: drm_device to allocate the duplicated mode for
1445 * @mode: mode to duplicate
1447 * Just allocate a new mode, copy the existing mode into it, and return
1451 * Pointer to duplicated mode on success, NULL on error.
1454 const struct drm_display_mode *mode)
1462 drm_mode_copy(nmode, mode);
1518 * @mode1: first mode
1519 * @mode2: second mode
1563 * @mode1: first mode
1564 * @mode2: second mode
1585 * @mode1: first mode
1586 * @mode2: second mode
1606 * @mode1: first mode
1607 * @mode2: second mode
1625 drm_mode_validate_basic(const struct drm_display_mode *mode)
1627 if (mode->type & ~DRM_MODE_TYPE_ALL)
1630 if (mode->flags & ~DRM_MODE_FLAG_ALL)
1633 if ((mode->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
1636 if (mode->clock == 0)
1639 if (mode->hdisplay == 0 ||
1640 mode->hsync_start < mode->hdisplay ||
1641 mode->hsync_end < mode->hsync_start ||
1642 mode->htotal < mode->hsync_end)
1645 if (mode->vdisplay == 0 ||
1646 mode->vsync_start < mode->vdisplay ||
1647 mode->vsync_end < mode->vsync_start ||
1648 mode->vtotal < mode->vsync_end)
1655 * drm_mode_validate_driver - make sure the mode is somewhat sane
1657 * @mode: mode to check
1659 * First do basic validation on the mode, and then allow the driver
1664 * The mode status
1668 const struct drm_display_mode *mode)
1672 status = drm_mode_validate_basic(mode);
1677 return dev->mode_config.funcs->mode_valid(dev, mode);
1685 * @mode: mode to check
1690 * limitations of the DRM device/connector. If a mode is too big its status
1695 * The mode status
1698 drm_mode_validate_size(const struct drm_display_mode *mode,
1701 if (maxX > 0 && mode->hdisplay > maxX)
1704 if (maxY > 0 && mode->vdisplay > maxY)
1713 * @mode: mode to check
1717 * only mode, when the source doesn't support it.
1720 * The mode status
1723 drm_mode_validate_ycbcr420(const struct drm_display_mode *mode,
1727 drm_mode_is_420_only(&connector->display_info, mode))
1792 * drm_mode_prune_invalid - remove invalid modes from mode list
1797 * This helper function can be used to prune a display mode list after
1799 * removed from the list, and if @verbose the status code and mode name is also
1805 struct drm_display_mode *mode, *t;
1807 list_for_each_entry_safe(mode, t, mode_list, head) {
1808 if (mode->status != MODE_OK) {
1809 list_del(&mode->head);
1810 if (mode->type & DRM_MODE_TYPE_USERDEF) {
1811 drm_warn(dev, "User-defined mode not supported: "
1812 DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
1815 drm_mode_debug_printmodeline(mode);
1816 DRM_DEBUG_KMS("Not using %s mode: %s\n",
1817 mode->name,
1818 drm_get_mode_status_name(mode->status));
1820 drm_mode_destroy(dev, mode);
1829 * @lh_a: list_head for first mode
1830 * @lh_b: list_head for second mode
1863 * drm_mode_sort - sort mode list
1875 * drm_connector_list_update - update the mode list for the connector
1879 * to the actual mode list. It compares the probed mode against the current
1892 struct drm_display_mode *mode;
1895 /* go through current modes checking for the new probed mode */
1896 list_for_each_entry(mode, &connector->modes, head) {
1897 if (!drm_mode_equal(pmode, mode))
1903 * If the old matching mode is stale (ie. left over
1912 * the mode added to the probed_modes list first.
1914 if (mode->status == MODE_STALE) {
1915 drm_mode_copy(mode, pmode);
1916 } else if ((mode->type & DRM_MODE_TYPE_PREFERRED) == 0 &&
1918 pmode->type |= mode->type;
1919 drm_mode_copy(mode, pmode);
1921 mode->type |= pmode->type;
1937 struct drm_cmdline_mode *mode)
1949 mode->bpp = bpp;
1950 mode->bpp_specified = true;
1956 struct drm_cmdline_mode *mode)
1968 mode->refresh = refresh;
1969 mode->refresh_specified = true;
1977 struct drm_cmdline_mode *mode)
1987 mode->interlace = true;
1993 mode->margins = true;
1996 if (mode->force != DRM_FORCE_UNSPECIFIED)
2001 mode->force = DRM_FORCE_ON;
2003 mode->force = DRM_FORCE_ON_DIGITAL;
2006 if (mode->force != DRM_FORCE_UNSPECIFIED)
2009 mode->force = DRM_FORCE_OFF;
2012 if (mode->force != DRM_FORCE_UNSPECIFIED)
2015 mode->force = DRM_FORCE_ON;
2028 struct drm_cmdline_mode *mode)
2072 mode);
2081 mode->xres = xres;
2082 mode->yres = yres;
2083 mode->cvt = cvt;
2084 mode->rb = rb;
2113 struct drm_cmdline_mode *mode)
2126 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL;
2128 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
2130 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP;
2132 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP;
2140 struct drm_cmdline_mode *mode)
2157 mode->tv_mode_specified = true;
2158 mode->tv_mode = ret;
2166 struct drm_cmdline_mode *mode)
2213 mode->tv_margins.right = margin;
2218 mode->tv_margins.left = margin;
2223 mode->tv_margins.top = margin;
2228 mode->tv_margins.bottom = margin;
2230 if (drm_mode_parse_panel_orientation(delim, mode))
2233 if (drm_mode_parse_tv_mode(delim, mode))
2252 mode->rotation_reflection = rotation;
2292 /* If the name starts with a digit, it's not a named mode */
2298 * contains only an option and no mode.
2303 /* The connection status extras can be set without a mode. */
2309 * We're sure we're a named mode at this point, iterate over the
2313 const struct drm_named_mode *mode = &drm_named_modes[i];
2316 ret = str_has_prefix(name, mode->name);
2320 strscpy(cmdline_mode->name, mode->name, sizeof(cmdline_mode->name));
2321 cmdline_mode->pixel_clock = mode->pixel_clock_khz;
2322 cmdline_mode->xres = mode->xres;
2323 cmdline_mode->yres = mode->yres;
2324 cmdline_mode->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
2325 cmdline_mode->tv_mode = mode->tv_mode;
2337 * @mode_option: optional per connector mode option
2339 * @mode: preallocated drm_cmdline_mode structure to fill out
2349 * Additionals options can be provided following the mode, using a comma to
2361 struct drm_cmdline_mode *mode)
2372 memset(mode, 0, sizeof(*mode));
2373 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
2414 ret = drm_mode_parse_cmdline_named_mode(name, mode_end, mode);
2419 * Having a mode that starts by a letter (and thus is named) and
2425 /* No named mode? Check for a normal mode argument, e.g. 1024x768 */
2426 if (!mode->specified && isdigit(name[0])) {
2430 mode);
2434 mode->specified = true;
2437 /* No mode? Check for freestanding extras and/or options */
2438 if (!mode->specified) {
2453 ret = drm_mode_parse_cmdline_bpp(bpp_ptr, &bpp_end_ptr, mode);
2457 mode->bpp_specified = true;
2462 &refresh_end_ptr, mode);
2466 mode->refresh_specified = true;
2487 connector, mode);
2495 connector, mode);
2530 * drm_mode_create_from_cmdline_mode - convert a command line modeline into a DRM display mode
2531 * @dev: DRM device to create the new mode for
2535 * Pointer to converted mode on success, NULL on error.
2541 struct drm_display_mode *mode;
2547 mode = drm_named_mode(dev, cmd);
2549 mode = drm_cvt_mode(dev,
2555 mode = drm_gtf_mode(dev,
2560 if (!mode)
2563 mode->type |= DRM_MODE_TYPE_USERDEF;
2566 drm_mode_fixup_1366x768(mode);
2567 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
2568 return mode;
2612 WARN(1, "Invalid aspect ratio (0%x) on mode\n",
2667 * flags for kernel-mode, but in picture_aspect_ratio.
2705 * @mode: video mode to be tested.
2708 * true if the mode can be supported in YCBCR420 format
2712 const struct drm_display_mode *mode)
2714 u8 vic = drm_match_cea_mode(mode);
2725 * @mode: video mode to be tested.
2728 * true if the mode can be support YCBCR420 format
2732 const struct drm_display_mode *mode)
2734 u8 vic = drm_match_cea_mode(mode);
2744 * @mode: video mode to be tested.
2747 * true if the mode can be supported in YCBCR420 format
2751 const struct drm_display_mode *mode)
2753 return drm_mode_is_420_only(display, mode) ||
2754 drm_mode_is_420_also(display, mode);