Lines Matching full: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) in drm_mode_debug_printmodeline() argument
60 DRM_DEBUG_KMS("Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode)); in drm_mode_debug_printmodeline()
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) in drm_mode_destroy() argument
95 if (!mode) in drm_mode_destroy()
98 kfree(mode); in drm_mode_destroy()
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) in drm_mode_probed_add() argument
116 list_add_tail(&mode->head, &connector->probed_modes); in drm_mode_probed_add()
326 struct drm_display_mode *mode, in fill_analog_mode() argument
349 "Generating a %ux%u%c, %u-line mode with a %lu kHz clock\n", in fill_analog_mode()
357 drm_dbg_kms(dev, "Trying to generate a BT.601 mode. Disabling checks.\n"); in fill_analog_mode()
455 mode->clock = pixel_clock_hz / 1000; in fill_analog_mode()
456 mode->hdisplay = hactive; in fill_analog_mode()
457 mode->hsync_start = mode->hdisplay + hfp; in fill_analog_mode()
458 mode->hsync_end = mode->hsync_start + hslen; in fill_analog_mode()
459 mode->htotal = mode->hsync_end + hbp; in fill_analog_mode()
474 * Moreover, if we want to create a progressive mode for in fill_analog_mode()
504 mode->vdisplay = vactive; in fill_analog_mode()
505 mode->vsync_start = mode->vdisplay + vfp; in fill_analog_mode()
506 mode->vsync_end = mode->vsync_start + vslen; in fill_analog_mode()
507 mode->vtotal = mode->vsync_end + vbp; in fill_analog_mode()
509 if (mode->vtotal != params->num_lines) in fill_analog_mode()
512 mode->type = DRM_MODE_TYPE_DRIVER; in fill_analog_mode()
513 mode->flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC; in fill_analog_mode()
515 mode->flags |= DRM_MODE_FLAG_INTERLACE; in fill_analog_mode()
517 drm_mode_set_name(mode); in fill_analog_mode()
519 drm_dbg_kms(dev, "Generated mode " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode)); in fill_analog_mode()
525 * drm_analog_tv_mode - create a display mode for an analog TV
527 * @tv_mode: TV Mode standard to create a mode for. See DRM_MODE_TV_MODE_*.
531 * @interlace: whether to compute an interlaced mode
535 * this is DRM_MODE_TV_MODE_MONOCHROME, a 625-line mode will be created.
542 * A pointer to the mode, allocated with drm_mode_create(). Returns NULL
552 struct drm_display_mode *mode; in drm_analog_tv_mode() local
581 mode = drm_mode_create(dev); in drm_analog_tv_mode()
582 if (!mode) in drm_analog_tv_mode()
585 ret = fill_analog_mode(dev, mode, in drm_analog_tv_mode()
591 return mode; in drm_analog_tv_mode()
594 drm_mode_destroy(dev, mode); in drm_analog_tv_mode()
606 * @interlaced: whether to compute an interlaced mode
620 * The display mode object is allocated with drm_mode_create(). Returns NULL
621 * when no mode could be allocated.
809 /* ignore - just set the mode flag for interlaced */ in drm_cvt_mode()
814 /* Fill the mode line name */ in drm_cvt_mode()
833 * @interlaced: whether to compute an interlaced mode
845 * The display mode object is allocated with drm_mode_create(). Returns NULL
846 * when no mode could be allocated.
992 /* finally, pack the results in the mode struct */ in drm_gtf_mode_complex()
1025 * @interlaced: whether to compute an interlaced mode
1050 * The display mode object is allocated with drm_mode_create(). Returns NULL
1051 * when no mode could be allocated.
1069 * Fills out @dmode using the display mode specified in @vm.
1110 * Fills out @vm using the display mode specified in @dmode.
1184 * This function is expensive and should only be used, if only one mode is to be
1206 pr_debug("%pOF: got %dx%d display mode: " DRM_MODE_FMT "\n", in of_get_drm_display_mode()
1220 * are read and set on the display mode.
1264 * drm_mode_set_name - set the name on a mode
1265 * @mode: name will be set in this mode
1267 * Set the name of @mode to a standard format which is <hdisplay>x<vdisplay>
1270 void drm_mode_set_name(struct drm_display_mode *mode) in drm_mode_set_name() argument
1272 bool interlaced = !!(mode->flags & DRM_MODE_FLAG_INTERLACE); in drm_mode_set_name()
1274 snprintf(mode->name, DRM_DISPLAY_MODE_LEN, "%dx%d%s", in drm_mode_set_name()
1275 mode->hdisplay, mode->vdisplay, in drm_mode_set_name()
1281 * drm_mode_vrefresh - get the vrefresh of a mode
1282 * @mode: mode
1287 int drm_mode_vrefresh(const struct drm_display_mode *mode) in drm_mode_vrefresh() argument
1291 if (mode->htotal == 0 || mode->vtotal == 0) in drm_mode_vrefresh()
1294 if (mode->flags & DRM_MODE_FLAG_INTERLACE) in drm_mode_vrefresh()
1296 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) in drm_mode_vrefresh()
1298 if (mode->vscan > 1) in drm_mode_vrefresh()
1299 den *= mode->vscan; in drm_mode_vrefresh()
1301 if (check_mul_overflow(mode->clock, num, &num)) in drm_mode_vrefresh()
1304 if (check_mul_overflow(mode->htotal * mode->vtotal, den, &den)) in drm_mode_vrefresh()
1312 * drm_mode_get_hv_timing - Fetches hdisplay/vdisplay for given mode
1313 * @mode: mode to query
1317 * The vdisplay value will be doubled if the specified mode is a stereo mode of
1320 void drm_mode_get_hv_timing(const struct drm_display_mode *mode, in drm_mode_get_hv_timing() argument
1325 drm_mode_init(&adjusted, mode); in drm_mode_get_hv_timing()
1335 * @p: mode
1413 * drm_mode_copy - copy the mode
1414 * @dst: mode to overwrite
1415 * @src: mode to copy
1417 * Copy an existing mode into another mode, preserving the
1418 * list head of the destination mode.
1430 * drm_mode_init - initialize the mode from another mode
1431 * @dst: mode to overwrite
1432 * @src: mode to copy
1434 * Copy an existing mode into another mode, zeroing the
1435 * list head of the destination mode. Typically used
1447 * drm_mode_duplicate - allocate and duplicate an existing mode
1448 * @dev: drm_device to allocate the duplicated mode for
1449 * @mode: mode to duplicate
1451 * Just allocate a new mode, copy the existing mode into it, and return
1455 * Pointer to duplicated mode on success, NULL on error.
1458 const struct drm_display_mode *mode) in drm_mode_duplicate() argument
1466 drm_mode_copy(nmode, mode); in drm_mode_duplicate()
1522 * @mode1: first mode
1523 * @mode2: second mode
1567 * @mode1: first mode
1568 * @mode2: second mode
1589 * @mode1: first mode
1590 * @mode2: second mode
1610 * @mode1: first mode
1611 * @mode2: second mode
1629 drm_mode_validate_basic(const struct drm_display_mode *mode) in drm_mode_validate_basic() argument
1631 if (mode->type & ~DRM_MODE_TYPE_ALL) in drm_mode_validate_basic()
1634 if (mode->flags & ~DRM_MODE_FLAG_ALL) in drm_mode_validate_basic()
1637 if ((mode->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX) in drm_mode_validate_basic()
1640 if (mode->clock == 0) in drm_mode_validate_basic()
1643 if (mode->hdisplay == 0 || in drm_mode_validate_basic()
1644 mode->hsync_start < mode->hdisplay || in drm_mode_validate_basic()
1645 mode->hsync_end < mode->hsync_start || in drm_mode_validate_basic()
1646 mode->htotal < mode->hsync_end) in drm_mode_validate_basic()
1649 if (mode->vdisplay == 0 || in drm_mode_validate_basic()
1650 mode->vsync_start < mode->vdisplay || in drm_mode_validate_basic()
1651 mode->vsync_end < mode->vsync_start || in drm_mode_validate_basic()
1652 mode->vtotal < mode->vsync_end) in drm_mode_validate_basic()
1659 * drm_mode_validate_driver - make sure the mode is somewhat sane
1661 * @mode: mode to check
1663 * First do basic validation on the mode, and then allow the driver
1668 * The mode status
1672 const struct drm_display_mode *mode) in drm_mode_validate_driver() argument
1676 status = drm_mode_validate_basic(mode); in drm_mode_validate_driver()
1681 return dev->mode_config.funcs->mode_valid(dev, mode); in drm_mode_validate_driver()
1689 * @mode: mode to check
1694 * limitations of the DRM device/connector. If a mode is too big its status
1699 * The mode status
1702 drm_mode_validate_size(const struct drm_display_mode *mode, in drm_mode_validate_size() argument
1705 if (maxX > 0 && mode->hdisplay > maxX) in drm_mode_validate_size()
1708 if (maxY > 0 && mode->vdisplay > maxY) in drm_mode_validate_size()
1717 * @mode: mode to check
1721 * only mode, when the source doesn't support it.
1724 * The mode status
1727 drm_mode_validate_ycbcr420(const struct drm_display_mode *mode, in drm_mode_validate_ycbcr420() argument
1731 drm_mode_is_420_only(&connector->display_info, mode)) in drm_mode_validate_ycbcr420()
1796 * drm_mode_prune_invalid - remove invalid modes from mode list
1801 * This helper function can be used to prune a display mode list after
1803 * removed from the list, and if @verbose the status code and mode name is also
1809 struct drm_display_mode *mode, *t; in drm_mode_prune_invalid() local
1811 list_for_each_entry_safe(mode, t, mode_list, head) { in drm_mode_prune_invalid()
1812 if (mode->status != MODE_OK) { in drm_mode_prune_invalid()
1813 list_del(&mode->head); in drm_mode_prune_invalid()
1814 if (mode->type & DRM_MODE_TYPE_USERDEF) { in drm_mode_prune_invalid()
1815 drm_warn(dev, "User-defined mode not supported: " in drm_mode_prune_invalid()
1816 DRM_MODE_FMT "\n", DRM_MODE_ARG(mode)); in drm_mode_prune_invalid()
1819 drm_dbg_kms(dev, "Rejected mode: " DRM_MODE_FMT " (%s)\n", in drm_mode_prune_invalid()
1820 DRM_MODE_ARG(mode), drm_get_mode_status_name(mode->status)); in drm_mode_prune_invalid()
1822 drm_mode_destroy(dev, mode); in drm_mode_prune_invalid()
1831 * @lh_a: list_head for first mode
1832 * @lh_b: list_head for second mode
1865 * drm_mode_sort - sort mode list
1877 * drm_connector_list_update - update the mode list for the connector
1881 * to the actual mode list. It compares the probed mode against the current
1894 struct drm_display_mode *mode; in drm_connector_list_update() local
1897 /* go through current modes checking for the new probed mode */ in drm_connector_list_update()
1898 list_for_each_entry(mode, &connector->modes, head) { in drm_connector_list_update()
1899 if (!drm_mode_equal(pmode, mode)) in drm_connector_list_update()
1905 * If the old matching mode is stale (ie. left over in drm_connector_list_update()
1914 * the mode added to the probed_modes list first. in drm_connector_list_update()
1916 if (mode->status == MODE_STALE) { in drm_connector_list_update()
1917 drm_mode_copy(mode, pmode); in drm_connector_list_update()
1918 } else if ((mode->type & DRM_MODE_TYPE_PREFERRED) == 0 && in drm_connector_list_update()
1920 pmode->type |= mode->type; in drm_connector_list_update()
1921 drm_mode_copy(mode, pmode); in drm_connector_list_update()
1923 mode->type |= pmode->type; in drm_connector_list_update()
1939 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_bpp() argument
1951 mode->bpp = bpp; in drm_mode_parse_cmdline_bpp()
1952 mode->bpp_specified = true; in drm_mode_parse_cmdline_bpp()
1958 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_refresh() argument
1970 mode->refresh = refresh; in drm_mode_parse_cmdline_refresh()
1971 mode->refresh_specified = true; in drm_mode_parse_cmdline_refresh()
1979 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_extra() argument
1989 mode->interlace = true; in drm_mode_parse_cmdline_extra()
1995 mode->margins = true; in drm_mode_parse_cmdline_extra()
1998 if (mode->force != DRM_FORCE_UNSPECIFIED) in drm_mode_parse_cmdline_extra()
2003 mode->force = DRM_FORCE_ON; in drm_mode_parse_cmdline_extra()
2005 mode->force = DRM_FORCE_ON_DIGITAL; in drm_mode_parse_cmdline_extra()
2008 if (mode->force != DRM_FORCE_UNSPECIFIED) in drm_mode_parse_cmdline_extra()
2011 mode->force = DRM_FORCE_OFF; in drm_mode_parse_cmdline_extra()
2014 if (mode->force != DRM_FORCE_UNSPECIFIED) in drm_mode_parse_cmdline_extra()
2017 mode->force = DRM_FORCE_ON; in drm_mode_parse_cmdline_extra()
2030 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_res_mode() argument
2074 mode); in drm_mode_parse_cmdline_res_mode()
2083 mode->xres = xres; in drm_mode_parse_cmdline_res_mode()
2084 mode->yres = yres; in drm_mode_parse_cmdline_res_mode()
2085 mode->cvt = cvt; in drm_mode_parse_cmdline_res_mode()
2086 mode->rb = rb; in drm_mode_parse_cmdline_res_mode()
2115 struct drm_cmdline_mode *mode) in drm_mode_parse_panel_orientation() argument
2128 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; in drm_mode_parse_panel_orientation()
2130 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; in drm_mode_parse_panel_orientation()
2132 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP; in drm_mode_parse_panel_orientation()
2134 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; in drm_mode_parse_panel_orientation()
2142 struct drm_cmdline_mode *mode) in drm_mode_parse_tv_mode() argument
2159 mode->tv_mode_specified = true; in drm_mode_parse_tv_mode()
2160 mode->tv_mode = ret; in drm_mode_parse_tv_mode()
2168 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_options() argument
2215 mode->tv_margins.right = margin; in drm_mode_parse_cmdline_options()
2220 mode->tv_margins.left = margin; in drm_mode_parse_cmdline_options()
2225 mode->tv_margins.top = margin; in drm_mode_parse_cmdline_options()
2230 mode->tv_margins.bottom = margin; in drm_mode_parse_cmdline_options()
2232 if (drm_mode_parse_panel_orientation(delim, mode)) in drm_mode_parse_cmdline_options()
2235 if (drm_mode_parse_tv_mode(delim, mode)) in drm_mode_parse_cmdline_options()
2254 mode->rotation_reflection = rotation; in drm_mode_parse_cmdline_options()
2294 /* If the name starts with a digit, it's not a named mode */ in drm_mode_parse_cmdline_named_mode()
2300 * contains only an option and no mode. in drm_mode_parse_cmdline_named_mode()
2305 /* The connection status extras can be set without a mode. */ in drm_mode_parse_cmdline_named_mode()
2311 * We're sure we're a named mode at this point, iterate over the in drm_mode_parse_cmdline_named_mode()
2315 const struct drm_named_mode *mode = &drm_named_modes[i]; in drm_mode_parse_cmdline_named_mode() local
2318 ret = str_has_prefix(name, mode->name); in drm_mode_parse_cmdline_named_mode()
2322 strscpy(cmdline_mode->name, mode->name, sizeof(cmdline_mode->name)); in drm_mode_parse_cmdline_named_mode()
2323 cmdline_mode->pixel_clock = mode->pixel_clock_khz; in drm_mode_parse_cmdline_named_mode()
2324 cmdline_mode->xres = mode->xres; in drm_mode_parse_cmdline_named_mode()
2325 cmdline_mode->yres = mode->yres; in drm_mode_parse_cmdline_named_mode()
2326 cmdline_mode->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE); in drm_mode_parse_cmdline_named_mode()
2327 cmdline_mode->tv_mode = mode->tv_mode; in drm_mode_parse_cmdline_named_mode()
2339 * @mode_option: optional per connector mode option
2341 * @mode: preallocated drm_cmdline_mode structure to fill out
2351 * Additionals options can be provided following the mode, using a comma to
2363 struct drm_cmdline_mode *mode) in drm_mode_parse_command_line_for_connector() argument
2374 memset(mode, 0, sizeof(*mode)); in drm_mode_parse_command_line_for_connector()
2375 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; in drm_mode_parse_command_line_for_connector()
2416 ret = drm_mode_parse_cmdline_named_mode(name, mode_end, mode); in drm_mode_parse_command_line_for_connector()
2421 * Having a mode that starts by a letter (and thus is named) and in drm_mode_parse_command_line_for_connector()
2427 /* No named mode? Check for a normal mode argument, e.g. 1024x768 */ in drm_mode_parse_command_line_for_connector()
2428 if (!mode->specified && isdigit(name[0])) { in drm_mode_parse_command_line_for_connector()
2432 mode); in drm_mode_parse_command_line_for_connector()
2436 mode->specified = true; in drm_mode_parse_command_line_for_connector()
2439 /* No mode? Check for freestanding extras and/or options */ in drm_mode_parse_command_line_for_connector()
2440 if (!mode->specified) { in drm_mode_parse_command_line_for_connector()
2455 ret = drm_mode_parse_cmdline_bpp(bpp_ptr, &bpp_end_ptr, mode); in drm_mode_parse_command_line_for_connector()
2459 mode->bpp_specified = true; in drm_mode_parse_command_line_for_connector()
2464 &refresh_end_ptr, mode); in drm_mode_parse_command_line_for_connector()
2468 mode->refresh_specified = true; in drm_mode_parse_command_line_for_connector()
2489 connector, mode); in drm_mode_parse_command_line_for_connector()
2497 connector, mode); in drm_mode_parse_command_line_for_connector()
2532 * drm_mode_create_from_cmdline_mode - convert a command line modeline into a DRM display mode
2533 * @dev: DRM device to create the new mode for
2537 * Pointer to converted mode on success, NULL on error.
2543 struct drm_display_mode *mode; in drm_mode_create_from_cmdline_mode() local
2549 mode = drm_named_mode(dev, cmd); in drm_mode_create_from_cmdline_mode()
2551 mode = drm_cvt_mode(dev, in drm_mode_create_from_cmdline_mode()
2557 mode = drm_gtf_mode(dev, in drm_mode_create_from_cmdline_mode()
2562 if (!mode) in drm_mode_create_from_cmdline_mode()
2565 mode->type |= DRM_MODE_TYPE_USERDEF; in drm_mode_create_from_cmdline_mode()
2568 drm_mode_fixup_1366x768(mode); in drm_mode_create_from_cmdline_mode()
2569 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); in drm_mode_create_from_cmdline_mode()
2570 return mode; in drm_mode_create_from_cmdline_mode()
2614 WARN(1, "Invalid aspect ratio (0%x) on mode\n", in drm_mode_convert_to_umode()
2667 * flags for kernel-mode, but in picture_aspect_ratio. in drm_mode_convert_umode()
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) in drm_mode_is_420_only() argument
2714 u8 vic = drm_match_cea_mode(mode); in drm_mode_is_420_only()
2725 * @mode: video mode to be tested.
2728 * true if the mode can be support YCBCR420 format
2732 const struct drm_display_mode *mode) in drm_mode_is_420_also() argument
2734 u8 vic = drm_match_cea_mode(mode); in drm_mode_is_420_also()
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) in drm_mode_is_420() argument
2753 return drm_mode_is_420_only(display, mode) || in drm_mode_is_420()
2754 drm_mode_is_420_also(display, mode); in drm_mode_is_420()
2759 * drm_set_preferred_mode - Sets the preferred mode of a connector
2760 * @connector: connector whose mode list should be processed
2761 * @hpref: horizontal resolution of preferred mode
2762 * @vpref: vertical resolution of preferred mode
2764 * Marks a mode as preferred if it matches the resolution specified by @hpref
2770 struct drm_display_mode *mode; in drm_set_preferred_mode() local
2772 list_for_each_entry(mode, &connector->probed_modes, head) { in drm_set_preferred_mode()
2773 if (mode->hdisplay == hpref && in drm_set_preferred_mode()
2774 mode->vdisplay == vpref) in drm_set_preferred_mode()
2775 mode->type |= DRM_MODE_TYPE_PREFERRED; in drm_set_preferred_mode()