Lines Matching defs: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 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
1295 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
1297 if (mode->vscan > 1)
1298 den *= mode->vscan;
1300 if (check_mul_overflow(mode->clock, num, &num))
1303 if (check_mul_overflow(mode->htotal * mode->vtotal, den, &den))
1311 * drm_mode_get_hv_timing - Fetches hdisplay/vdisplay for given mode
1312 * @mode: mode to query
1316 * The vdisplay value will be doubled if the specified mode is a stereo mode of
1319 void drm_mode_get_hv_timing(const struct drm_display_mode *mode,
1324 drm_mode_init(&adjusted, mode);
1334 * @p: mode
1412 * drm_mode_copy - copy the mode
1413 * @dst: mode to overwrite
1414 * @src: mode to copy
1416 * Copy an existing mode into another mode, preserving the
1417 * list head of the destination mode.
1429 * drm_mode_init - initialize the mode from another mode
1430 * @dst: mode to overwrite
1431 * @src: mode to copy
1433 * Copy an existing mode into another mode, zeroing the
1434 * list head of the destination mode. Typically used
1446 * drm_mode_duplicate - allocate and duplicate an existing mode
1447 * @dev: drm_device to allocate the duplicated mode for
1448 * @mode: mode to duplicate
1450 * Just allocate a new mode, copy the existing mode into it, and return
1454 * Pointer to duplicated mode on success, NULL on error.
1457 const struct drm_display_mode *mode)
1465 drm_mode_copy(nmode, mode);
1521 * @mode1: first mode
1522 * @mode2: second mode
1566 * @mode1: first mode
1567 * @mode2: second mode
1588 * @mode1: first mode
1589 * @mode2: second mode
1609 * @mode1: first mode
1610 * @mode2: second mode
1628 drm_mode_validate_basic(const struct drm_display_mode *mode)
1630 if (mode->type & ~DRM_MODE_TYPE_ALL)
1633 if (mode->flags & ~DRM_MODE_FLAG_ALL)
1636 if ((mode->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
1639 if (mode->clock == 0)
1642 if (mode->hdisplay == 0 ||
1643 mode->hsync_start < mode->hdisplay ||
1644 mode->hsync_end < mode->hsync_start ||
1645 mode->htotal < mode->hsync_end)
1648 if (mode->vdisplay == 0 ||
1649 mode->vsync_start < mode->vdisplay ||
1650 mode->vsync_end < mode->vsync_start ||
1651 mode->vtotal < mode->vsync_end)
1658 * drm_mode_validate_driver - make sure the mode is somewhat sane
1660 * @mode: mode to check
1662 * First do basic validation on the mode, and then allow the driver
1667 * The mode status
1671 const struct drm_display_mode *mode)
1675 status = drm_mode_validate_basic(mode);
1680 return dev->mode_config.funcs->mode_valid(dev, mode);
1688 * @mode: mode to check
1693 * limitations of the DRM device/connector. If a mode is too big its status
1698 * The mode status
1701 drm_mode_validate_size(const struct drm_display_mode *mode,
1704 if (maxX > 0 && mode->hdisplay > maxX)
1707 if (maxY > 0 && mode->vdisplay > maxY)
1716 * @mode: mode to check
1720 * only mode, when the source doesn't support it.
1723 * The mode status
1726 drm_mode_validate_ycbcr420(const struct drm_display_mode *mode,
1730 drm_mode_is_420_only(&connector->display_info, mode))
1795 * drm_mode_prune_invalid - remove invalid modes from mode list
1800 * This helper function can be used to prune a display mode list after
1802 * removed from the list, and if @verbose the status code and mode name is also
1808 struct drm_display_mode *mode, *t;
1810 list_for_each_entry_safe(mode, t, mode_list, head) {
1811 if (mode->status != MODE_OK) {
1812 list_del(&mode->head);
1813 if (mode->type & DRM_MODE_TYPE_USERDEF) {
1814 drm_warn(dev, "User-defined mode not supported: "
1815 DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
1818 drm_mode_debug_printmodeline(mode);
1819 DRM_DEBUG_KMS("Not using %s mode: %s\n",
1820 mode->name,
1821 drm_get_mode_status_name(mode->status));
1823 drm_mode_destroy(dev, mode);
1832 * @lh_a: list_head for first mode
1833 * @lh_b: list_head for second mode
1866 * drm_mode_sort - sort mode list
1878 * drm_connector_list_update - update the mode list for the connector
1882 * to the actual mode list. It compares the probed mode against the current
1895 struct drm_display_mode *mode;
1898 /* go through current modes checking for the new probed mode */
1899 list_for_each_entry(mode, &connector->modes, head) {
1900 if (!drm_mode_equal(pmode, mode))
1906 * If the old matching mode is stale (ie. left over
1915 * the mode added to the probed_modes list first.
1917 if (mode->status == MODE_STALE) {
1918 drm_mode_copy(mode, pmode);
1919 } else if ((mode->type & DRM_MODE_TYPE_PREFERRED) == 0 &&
1921 pmode->type |= mode->type;
1922 drm_mode_copy(mode, pmode);
1924 mode->type |= pmode->type;
1942 struct drm_cmdline_mode *mode)
1954 mode->bpp = bpp;
1955 mode->bpp_specified = true;
1961 struct drm_cmdline_mode *mode)
1973 mode->refresh = refresh;
1974 mode->refresh_specified = true;
1982 struct drm_cmdline_mode *mode)
1992 mode->interlace = true;
1998 mode->margins = true;
2001 if (mode->force != DRM_FORCE_UNSPECIFIED)
2006 mode->force = DRM_FORCE_ON;
2008 mode->force = DRM_FORCE_ON_DIGITAL;
2011 if (mode->force != DRM_FORCE_UNSPECIFIED)
2014 mode->force = DRM_FORCE_OFF;
2017 if (mode->force != DRM_FORCE_UNSPECIFIED)
2020 mode->force = DRM_FORCE_ON;
2033 struct drm_cmdline_mode *mode)
2077 mode);
2086 mode->xres = xres;
2087 mode->yres = yres;
2088 mode->cvt = cvt;
2089 mode->rb = rb;
2118 struct drm_cmdline_mode *mode)
2131 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL;
2133 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
2135 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP;
2137 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP;
2145 struct drm_cmdline_mode *mode)
2162 mode->tv_mode_specified = true;
2163 mode->tv_mode = ret;
2171 struct drm_cmdline_mode *mode)
2218 mode->tv_margins.right = margin;
2223 mode->tv_margins.left = margin;
2228 mode->tv_margins.top = margin;
2233 mode->tv_margins.bottom = margin;
2235 if (drm_mode_parse_panel_orientation(delim, mode))
2238 if (drm_mode_parse_tv_mode(delim, mode))
2257 mode->rotation_reflection = rotation;
2301 /* If the name starts with a digit, it's not a named mode */
2307 * contains only an option and no mode.
2312 /* The connection status extras can be set without a mode. */
2318 * We're sure we're a named mode at this point, iterate over the
2322 const struct drm_named_mode *mode = &drm_named_modes[i];
2325 ret = str_has_prefix(name, mode->name);
2329 strscpy(cmdline_mode->name, mode->name, sizeof(cmdline_mode->name));
2330 cmdline_mode->pixel_clock = mode->pixel_clock_khz;
2331 cmdline_mode->xres = mode->xres;
2332 cmdline_mode->yres = mode->yres;
2333 cmdline_mode->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
2334 cmdline_mode->tv_mode = mode->tv_mode;
2348 * @mode_option: optional per connector mode option
2350 * @mode: preallocated drm_cmdline_mode structure to fill out
2360 * Additionals options can be provided following the mode, using a comma to
2372 struct drm_cmdline_mode *mode)
2384 memset(mode, 0, sizeof(*mode));
2385 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
2426 ret = drm_mode_parse_cmdline_named_mode(name, mode_end, mode);
2431 * Having a mode that starts by a letter (and thus is named) and
2437 /* No named mode? Check for a normal mode argument, e.g. 1024x768 */
2438 if (!mode->specified && isdigit(name[0])) {
2442 mode);
2446 mode->specified = true;
2449 /* No mode? Check for freestanding extras and/or options */
2450 if (!mode->specified) {
2465 ret = drm_mode_parse_cmdline_bpp(bpp_ptr, &bpp_end_ptr, mode);
2469 mode->bpp_specified = true;
2474 &refresh_end_ptr, mode);
2478 mode->refresh_specified = true;
2499 connector, mode);
2507 connector, mode);
2545 * drm_mode_create_from_cmdline_mode - convert a command line modeline into a DRM display mode
2546 * @dev: DRM device to create the new mode for
2550 * Pointer to converted mode on success, NULL on error.
2556 struct drm_display_mode *mode;
2562 mode = drm_named_mode(dev, cmd);
2564 mode = drm_cvt_mode(dev,
2570 mode = drm_gtf_mode(dev,
2575 if (!mode)
2578 mode->type |= DRM_MODE_TYPE_USERDEF;
2581 drm_mode_fixup_1366x768(mode);
2582 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
2583 return mode;
2627 WARN(1, "Invalid aspect ratio (0%x) on mode\n",
2682 * flags for kernel-mode, but in picture_aspect_ratio.
2720 * @mode: video mode to be tested.
2723 * true if the mode can be supported in YCBCR420 format
2727 const struct drm_display_mode *mode)
2729 u8 vic = drm_match_cea_mode(mode);
2740 * @mode: video mode to be tested.
2743 * true if the mode can be support YCBCR420 format
2747 const struct drm_display_mode *mode)
2749 u8 vic = drm_match_cea_mode(mode);
2759 * @mode: video mode to be tested.
2762 * true if the mode can be supported in YCBCR420 format
2766 const struct drm_display_mode *mode)
2768 return drm_mode_is_420_only(display, mode) ||
2769 drm_mode_is_420_also(display, mode);