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
1288 int drm_mode_vrefresh(const struct drm_display_mode *mode) in drm_mode_vrefresh() argument
1292 if (mode->htotal == 0 || mode->vtotal == 0) in drm_mode_vrefresh()
1295 num = mode->clock; in drm_mode_vrefresh()
1296 den = mode->htotal * mode->vtotal; in drm_mode_vrefresh()
1298 if (mode->flags & DRM_MODE_FLAG_INTERLACE) in drm_mode_vrefresh()
1300 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) in drm_mode_vrefresh()
1302 if (mode->vscan > 1) in drm_mode_vrefresh()
1303 den *= mode->vscan; in drm_mode_vrefresh()
1310 * drm_mode_get_hv_timing - Fetches hdisplay/vdisplay for given mode
1311 * @mode: mode to query
1315 * The vdisplay value will be doubled if the specified mode is a stereo mode of
1318 void drm_mode_get_hv_timing(const struct drm_display_mode *mode, in drm_mode_get_hv_timing() argument
1323 drm_mode_init(&adjusted, mode); in drm_mode_get_hv_timing()
1333 * @p: mode
1411 * drm_mode_copy - copy the mode
1412 * @dst: mode to overwrite
1413 * @src: mode to copy
1415 * Copy an existing mode into another mode, preserving the
1416 * list head of the destination mode.
1428 * drm_mode_init - initialize the mode from another mode
1429 * @dst: mode to overwrite
1430 * @src: mode to copy
1432 * Copy an existing mode into another mode, zeroing the
1433 * list head of the destination mode. Typically used
1445 * drm_mode_duplicate - allocate and duplicate an existing mode
1446 * @dev: drm_device to allocate the duplicated mode for
1447 * @mode: mode to duplicate
1449 * Just allocate a new mode, copy the existing mode into it, and return
1453 * Pointer to duplicated mode on success, NULL on error.
1456 const struct drm_display_mode *mode) in drm_mode_duplicate() argument
1464 drm_mode_copy(nmode, mode); in drm_mode_duplicate()
1520 * @mode1: first mode
1521 * @mode2: second mode
1565 * @mode1: first mode
1566 * @mode2: second mode
1587 * @mode1: first mode
1588 * @mode2: second mode
1608 * @mode1: first mode
1609 * @mode2: second mode
1627 drm_mode_validate_basic(const struct drm_display_mode *mode) in drm_mode_validate_basic() argument
1629 if (mode->type & ~DRM_MODE_TYPE_ALL) in drm_mode_validate_basic()
1632 if (mode->flags & ~DRM_MODE_FLAG_ALL) in drm_mode_validate_basic()
1635 if ((mode->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX) in drm_mode_validate_basic()
1638 if (mode->clock == 0) in drm_mode_validate_basic()
1641 if (mode->hdisplay == 0 || in drm_mode_validate_basic()
1642 mode->hsync_start < mode->hdisplay || in drm_mode_validate_basic()
1643 mode->hsync_end < mode->hsync_start || in drm_mode_validate_basic()
1644 mode->htotal < mode->hsync_end) in drm_mode_validate_basic()
1647 if (mode->vdisplay == 0 || in drm_mode_validate_basic()
1648 mode->vsync_start < mode->vdisplay || in drm_mode_validate_basic()
1649 mode->vsync_end < mode->vsync_start || in drm_mode_validate_basic()
1650 mode->vtotal < mode->vsync_end) in drm_mode_validate_basic()
1657 * drm_mode_validate_driver - make sure the mode is somewhat sane
1659 * @mode: mode to check
1661 * First do basic validation on the mode, and then allow the driver
1666 * The mode status
1670 const struct drm_display_mode *mode) in drm_mode_validate_driver() argument
1674 status = drm_mode_validate_basic(mode); in drm_mode_validate_driver()
1679 return dev->mode_config.funcs->mode_valid(dev, mode); in drm_mode_validate_driver()
1687 * @mode: mode to check
1692 * limitations of the DRM device/connector. If a mode is too big its status
1697 * The mode status
1700 drm_mode_validate_size(const struct drm_display_mode *mode, in drm_mode_validate_size() argument
1703 if (maxX > 0 && mode->hdisplay > maxX) in drm_mode_validate_size()
1706 if (maxY > 0 && mode->vdisplay > maxY) in drm_mode_validate_size()
1715 * @mode: mode to check
1719 * only mode, when the source doesn't support it.
1722 * The mode status
1725 drm_mode_validate_ycbcr420(const struct drm_display_mode *mode, in drm_mode_validate_ycbcr420() argument
1729 drm_mode_is_420_only(&connector->display_info, mode)) in drm_mode_validate_ycbcr420()
1794 * drm_mode_prune_invalid - remove invalid modes from mode list
1799 * This helper function can be used to prune a display mode list after
1801 * removed from the list, and if @verbose the status code and mode name is also
1807 struct drm_display_mode *mode, *t; in drm_mode_prune_invalid() local
1809 list_for_each_entry_safe(mode, t, mode_list, head) { in drm_mode_prune_invalid()
1810 if (mode->status != MODE_OK) { in drm_mode_prune_invalid()
1811 list_del(&mode->head); in drm_mode_prune_invalid()
1812 if (mode->type & DRM_MODE_TYPE_USERDEF) { in drm_mode_prune_invalid()
1813 drm_warn(dev, "User-defined mode not supported: " in drm_mode_prune_invalid()
1814 DRM_MODE_FMT "\n", DRM_MODE_ARG(mode)); in drm_mode_prune_invalid()
1817 drm_dbg_kms(dev, "Rejected mode: " DRM_MODE_FMT " (%s)\n", in drm_mode_prune_invalid()
1818 DRM_MODE_ARG(mode), drm_get_mode_status_name(mode->status)); in drm_mode_prune_invalid()
1820 drm_mode_destroy(dev, mode); in drm_mode_prune_invalid()
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; in drm_connector_list_update() local
1895 /* go through current modes checking for the new probed mode */ in drm_connector_list_update()
1896 list_for_each_entry(mode, &connector->modes, head) { in drm_connector_list_update()
1897 if (!drm_mode_equal(pmode, mode)) in drm_connector_list_update()
1903 * If the old matching mode is stale (ie. left over in drm_connector_list_update()
1912 * the mode added to the probed_modes list first. in drm_connector_list_update()
1914 if (mode->status == MODE_STALE) { in drm_connector_list_update()
1915 drm_mode_copy(mode, pmode); in drm_connector_list_update()
1916 } else if ((mode->type & DRM_MODE_TYPE_PREFERRED) == 0 && in drm_connector_list_update()
1918 pmode->type |= mode->type; in drm_connector_list_update()
1919 drm_mode_copy(mode, pmode); in drm_connector_list_update()
1921 mode->type |= pmode->type; in drm_connector_list_update()
1937 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_bpp() argument
1949 mode->bpp = bpp; in drm_mode_parse_cmdline_bpp()
1950 mode->bpp_specified = true; in drm_mode_parse_cmdline_bpp()
1956 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_refresh() argument
1968 mode->refresh = refresh; in drm_mode_parse_cmdline_refresh()
1969 mode->refresh_specified = true; in drm_mode_parse_cmdline_refresh()
1977 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_extra() argument
1987 mode->interlace = true; in drm_mode_parse_cmdline_extra()
1993 mode->margins = true; in drm_mode_parse_cmdline_extra()
1996 if (mode->force != DRM_FORCE_UNSPECIFIED) in drm_mode_parse_cmdline_extra()
2001 mode->force = DRM_FORCE_ON; in drm_mode_parse_cmdline_extra()
2003 mode->force = DRM_FORCE_ON_DIGITAL; in drm_mode_parse_cmdline_extra()
2006 if (mode->force != DRM_FORCE_UNSPECIFIED) in drm_mode_parse_cmdline_extra()
2009 mode->force = DRM_FORCE_OFF; in drm_mode_parse_cmdline_extra()
2012 if (mode->force != DRM_FORCE_UNSPECIFIED) in drm_mode_parse_cmdline_extra()
2015 mode->force = DRM_FORCE_ON; in drm_mode_parse_cmdline_extra()
2028 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_res_mode() argument
2072 mode); in drm_mode_parse_cmdline_res_mode()
2081 mode->xres = xres; in drm_mode_parse_cmdline_res_mode()
2082 mode->yres = yres; in drm_mode_parse_cmdline_res_mode()
2083 mode->cvt = cvt; in drm_mode_parse_cmdline_res_mode()
2084 mode->rb = rb; in drm_mode_parse_cmdline_res_mode()
2113 struct drm_cmdline_mode *mode) in drm_mode_parse_panel_orientation() argument
2126 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; in drm_mode_parse_panel_orientation()
2128 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; in drm_mode_parse_panel_orientation()
2130 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP; in drm_mode_parse_panel_orientation()
2132 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; in drm_mode_parse_panel_orientation()
2140 struct drm_cmdline_mode *mode) in drm_mode_parse_tv_mode() argument
2157 mode->tv_mode_specified = true; in drm_mode_parse_tv_mode()
2158 mode->tv_mode = ret; in drm_mode_parse_tv_mode()
2166 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_options() argument
2213 mode->tv_margins.right = margin; in drm_mode_parse_cmdline_options()
2218 mode->tv_margins.left = margin; in drm_mode_parse_cmdline_options()
2223 mode->tv_margins.top = margin; in drm_mode_parse_cmdline_options()
2228 mode->tv_margins.bottom = margin; in drm_mode_parse_cmdline_options()
2230 if (drm_mode_parse_panel_orientation(delim, mode)) in drm_mode_parse_cmdline_options()
2233 if (drm_mode_parse_tv_mode(delim, mode)) in drm_mode_parse_cmdline_options()
2252 mode->rotation_reflection = rotation; in drm_mode_parse_cmdline_options()
2292 /* If the name starts with a digit, it's not a named mode */ in drm_mode_parse_cmdline_named_mode()
2298 * contains only an option and no mode. in drm_mode_parse_cmdline_named_mode()
2303 /* The connection status extras can be set without a mode. */ in drm_mode_parse_cmdline_named_mode()
2309 * We're sure we're a named mode at this point, iterate over the in drm_mode_parse_cmdline_named_mode()
2313 const struct drm_named_mode *mode = &drm_named_modes[i]; in drm_mode_parse_cmdline_named_mode() local
2316 ret = str_has_prefix(name, mode->name); in drm_mode_parse_cmdline_named_mode()
2320 strscpy(cmdline_mode->name, mode->name, sizeof(cmdline_mode->name)); in drm_mode_parse_cmdline_named_mode()
2321 cmdline_mode->pixel_clock = mode->pixel_clock_khz; in drm_mode_parse_cmdline_named_mode()
2322 cmdline_mode->xres = mode->xres; in drm_mode_parse_cmdline_named_mode()
2323 cmdline_mode->yres = mode->yres; in drm_mode_parse_cmdline_named_mode()
2324 cmdline_mode->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE); in drm_mode_parse_cmdline_named_mode()
2325 cmdline_mode->tv_mode = mode->tv_mode; in drm_mode_parse_cmdline_named_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) in drm_mode_parse_command_line_for_connector() argument
2372 memset(mode, 0, sizeof(*mode)); in drm_mode_parse_command_line_for_connector()
2373 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; in drm_mode_parse_command_line_for_connector()
2414 ret = drm_mode_parse_cmdline_named_mode(name, mode_end, mode); in drm_mode_parse_command_line_for_connector()
2419 * Having a mode that starts by a letter (and thus is named) and in drm_mode_parse_command_line_for_connector()
2425 /* No named mode? Check for a normal mode argument, e.g. 1024x768 */ in drm_mode_parse_command_line_for_connector()
2426 if (!mode->specified && isdigit(name[0])) { in drm_mode_parse_command_line_for_connector()
2430 mode); in drm_mode_parse_command_line_for_connector()
2434 mode->specified = true; in drm_mode_parse_command_line_for_connector()
2437 /* No mode? Check for freestanding extras and/or options */ in drm_mode_parse_command_line_for_connector()
2438 if (!mode->specified) { in drm_mode_parse_command_line_for_connector()
2453 ret = drm_mode_parse_cmdline_bpp(bpp_ptr, &bpp_end_ptr, mode); in drm_mode_parse_command_line_for_connector()
2457 mode->bpp_specified = true; in drm_mode_parse_command_line_for_connector()
2462 &refresh_end_ptr, mode); in drm_mode_parse_command_line_for_connector()
2466 mode->refresh_specified = true; in drm_mode_parse_command_line_for_connector()
2487 connector, mode); in drm_mode_parse_command_line_for_connector()
2495 connector, mode); in drm_mode_parse_command_line_for_connector()
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; in drm_mode_create_from_cmdline_mode() local
2547 mode = drm_named_mode(dev, cmd); in drm_mode_create_from_cmdline_mode()
2549 mode = drm_cvt_mode(dev, in drm_mode_create_from_cmdline_mode()
2555 mode = drm_gtf_mode(dev, in drm_mode_create_from_cmdline_mode()
2560 if (!mode) in drm_mode_create_from_cmdline_mode()
2563 mode->type |= DRM_MODE_TYPE_USERDEF; in drm_mode_create_from_cmdline_mode()
2566 drm_mode_fixup_1366x768(mode); in drm_mode_create_from_cmdline_mode()
2567 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); in drm_mode_create_from_cmdline_mode()
2568 return mode; in drm_mode_create_from_cmdline_mode()
2612 WARN(1, "Invalid aspect ratio (0%x) on mode\n", in drm_mode_convert_to_umode()
2665 * flags for kernel-mode, but in picture_aspect_ratio. in drm_mode_convert_umode()
2703 * @mode: video mode to be tested.
2706 * true if the mode can be supported in YCBCR420 format
2710 const struct drm_display_mode *mode) in drm_mode_is_420_only() argument
2712 u8 vic = drm_match_cea_mode(mode); in drm_mode_is_420_only()
2723 * @mode: video mode to be tested.
2726 * true if the mode can be support YCBCR420 format
2730 const struct drm_display_mode *mode) in drm_mode_is_420_also() argument
2732 u8 vic = drm_match_cea_mode(mode); in drm_mode_is_420_also()
2742 * @mode: video mode to be tested.
2745 * true if the mode can be supported in YCBCR420 format
2749 const struct drm_display_mode *mode) in drm_mode_is_420() argument
2751 return drm_mode_is_420_only(display, mode) || in drm_mode_is_420()
2752 drm_mode_is_420_also(display, mode); in drm_mode_is_420()
2757 * drm_set_preferred_mode - Sets the preferred mode of a connector
2758 * @connector: connector whose mode list should be processed
2759 * @hpref: horizontal resolution of preferred mode
2760 * @vpref: vertical resolution of preferred mode
2762 * Marks a mode as preferred if it matches the resolution specified by @hpref
2768 struct drm_display_mode *mode; in drm_set_preferred_mode() local
2770 list_for_each_entry(mode, &connector->probed_modes, head) { in drm_set_preferred_mode()
2771 if (mode->hdisplay == hpref && in drm_set_preferred_mode()
2772 mode->vdisplay == vpref) in drm_set_preferred_mode()
2773 mode->type |= DRM_MODE_TYPE_PREFERRED; in drm_set_preferred_mode()