Lines Matching full:mode

49  * drm_mode_debug_printmodeline - print a mode to dmesg
50 * @mode: mode to print
52 * Describe @mode using DRM_DEBUG.
54 void drm_mode_debug_printmodeline(const struct drm_display_mode *mode) in drm_mode_debug_printmodeline() argument
56 DRM_DEBUG_KMS("Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode)); in drm_mode_debug_printmodeline()
61 * drm_mode_create - create a new display mode
68 * Pointer to new mode on success, NULL on error.
83 * drm_mode_destroy - remove a mode
85 * @mode: mode to remove
87 * Release @mode's unique ID, then free it @mode structure itself using kfree.
89 void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode) in drm_mode_destroy() argument
91 if (!mode) in drm_mode_destroy()
94 kfree(mode); in drm_mode_destroy()
99 * drm_mode_probed_add - add a mode to a connector's probed_mode list
100 * @connector: connector the new mode
101 * @mode: mode data
103 * Add @mode to @connector's probed_mode list for later use. This list should
108 struct drm_display_mode *mode) in drm_mode_probed_add() argument
112 list_add_tail(&mode->head, &connector->probed_modes); in drm_mode_probed_add()
123 * @interlaced: whether to compute an interlaced mode
137 * The display mode object is allocated with drm_mode_create(). Returns NULL
138 * when no mode could be allocated.
326 /* ignore - just set the mode flag for interlaced */ in drm_cvt_mode()
331 /* Fill the mode line name */ in drm_cvt_mode()
350 * @interlaced: whether to compute an interlaced mode
362 * The display mode object is allocated with drm_mode_create(). Returns NULL
363 * when no mode could be allocated.
509 /* finally, pack the results in the mode struct */ in drm_gtf_mode_complex()
542 * @interlaced: whether to compute an interlaced mode
567 * The display mode object is allocated with drm_mode_create(). Returns NULL
568 * when no mode could be allocated.
586 * Fills out @dmode using the display mode specified in @vm.
627 * Fills out @vm using the display mode specified in @dmode.
701 * This function is expensive and should only be used, if only one mode is to be
723 pr_debug("%pOF: got %dx%d display mode\n", in of_get_drm_display_mode()
734 * drm_mode_set_name - set the name on a mode
735 * @mode: name will be set in this mode
737 * Set the name of @mode to a standard format which is <hdisplay>x<vdisplay>
740 void drm_mode_set_name(struct drm_display_mode *mode) in drm_mode_set_name() argument
742 bool interlaced = !!(mode->flags & DRM_MODE_FLAG_INTERLACE); in drm_mode_set_name()
744 snprintf(mode->name, DRM_DISPLAY_MODE_LEN, "%dx%d%s", in drm_mode_set_name()
745 mode->hdisplay, mode->vdisplay, in drm_mode_set_name()
751 * drm_mode_vrefresh - get the vrefresh of a mode
752 * @mode: mode
758 int drm_mode_vrefresh(const struct drm_display_mode *mode) in drm_mode_vrefresh() argument
762 if (mode->htotal == 0 || mode->vtotal == 0) in drm_mode_vrefresh()
765 num = mode->clock; in drm_mode_vrefresh()
766 den = mode->htotal * mode->vtotal; in drm_mode_vrefresh()
768 if (mode->flags & DRM_MODE_FLAG_INTERLACE) in drm_mode_vrefresh()
770 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) in drm_mode_vrefresh()
772 if (mode->vscan > 1) in drm_mode_vrefresh()
773 den *= mode->vscan; in drm_mode_vrefresh()
780 * drm_mode_get_hv_timing - Fetches hdisplay/vdisplay for given mode
781 * @mode: mode to query
785 * The vdisplay value will be doubled if the specified mode is a stereo mode of
788 void drm_mode_get_hv_timing(const struct drm_display_mode *mode, in drm_mode_get_hv_timing() argument
791 struct drm_display_mode adjusted = *mode; in drm_mode_get_hv_timing()
801 * @p: mode
879 * drm_mode_copy - copy the mode
880 * @dst: mode to overwrite
881 * @src: mode to copy
883 * Copy an existing mode into another mode, preserving the object id and
884 * list head of the destination mode.
896 * drm_mode_duplicate - allocate and duplicate an existing mode
897 * @dev: drm_device to allocate the duplicated mode for
898 * @mode: mode to duplicate
900 * Just allocate a new mode, copy the existing mode into it, and return
904 * Pointer to duplicated mode on success, NULL on error.
907 const struct drm_display_mode *mode) in drm_mode_duplicate() argument
915 drm_mode_copy(nmode, mode); in drm_mode_duplicate()
971 * @mode1: first mode
972 * @mode2: second mode
1016 * @mode1: first mode
1017 * @mode2: second mode
1038 * @mode1: first mode
1039 * @mode2: second mode
1059 * @mode1: first mode
1060 * @mode2: second mode
1078 drm_mode_validate_basic(const struct drm_display_mode *mode) in drm_mode_validate_basic() argument
1080 if (mode->type & ~DRM_MODE_TYPE_ALL) in drm_mode_validate_basic()
1083 if (mode->flags & ~DRM_MODE_FLAG_ALL) in drm_mode_validate_basic()
1086 if ((mode->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX) in drm_mode_validate_basic()
1089 if (mode->clock == 0) in drm_mode_validate_basic()
1092 if (mode->hdisplay == 0 || in drm_mode_validate_basic()
1093 mode->hsync_start < mode->hdisplay || in drm_mode_validate_basic()
1094 mode->hsync_end < mode->hsync_start || in drm_mode_validate_basic()
1095 mode->htotal < mode->hsync_end) in drm_mode_validate_basic()
1098 if (mode->vdisplay == 0 || in drm_mode_validate_basic()
1099 mode->vsync_start < mode->vdisplay || in drm_mode_validate_basic()
1100 mode->vsync_end < mode->vsync_start || in drm_mode_validate_basic()
1101 mode->vtotal < mode->vsync_end) in drm_mode_validate_basic()
1108 * drm_mode_validate_driver - make sure the mode is somewhat sane
1110 * @mode: mode to check
1112 * First do basic validation on the mode, and then allow the driver
1117 * The mode status
1121 const struct drm_display_mode *mode) in drm_mode_validate_driver() argument
1125 status = drm_mode_validate_basic(mode); in drm_mode_validate_driver()
1130 return dev->mode_config.funcs->mode_valid(dev, mode); in drm_mode_validate_driver()
1138 * @mode: mode to check
1143 * limitations of the DRM device/connector. If a mode is too big its status
1148 * The mode status
1151 drm_mode_validate_size(const struct drm_display_mode *mode, in drm_mode_validate_size() argument
1154 if (maxX > 0 && mode->hdisplay > maxX) in drm_mode_validate_size()
1157 if (maxY > 0 && mode->vdisplay > maxY) in drm_mode_validate_size()
1166 * @mode: mode to check
1170 * only mode, when the source doesn't support it.
1173 * The mode status
1176 drm_mode_validate_ycbcr420(const struct drm_display_mode *mode, in drm_mode_validate_ycbcr420() argument
1180 drm_mode_is_420_only(&connector->display_info, mode)) in drm_mode_validate_ycbcr420()
1245 * drm_mode_prune_invalid - remove invalid modes from mode list
1250 * This helper function can be used to prune a display mode list after
1252 * removed from the list, and if @verbose the status code and mode name is also
1258 struct drm_display_mode *mode, *t; in drm_mode_prune_invalid() local
1260 list_for_each_entry_safe(mode, t, mode_list, head) { in drm_mode_prune_invalid()
1261 if (mode->status != MODE_OK) { in drm_mode_prune_invalid()
1262 list_del(&mode->head); in drm_mode_prune_invalid()
1264 drm_mode_debug_printmodeline(mode); in drm_mode_prune_invalid()
1265 DRM_DEBUG_KMS("Not using %s mode: %s\n", in drm_mode_prune_invalid()
1266 mode->name, in drm_mode_prune_invalid()
1267 drm_get_mode_status_name(mode->status)); in drm_mode_prune_invalid()
1269 drm_mode_destroy(dev, mode); in drm_mode_prune_invalid()
1278 * @lh_a: list_head for first mode
1279 * @lh_b: list_head for second mode
1312 * drm_mode_sort - sort mode list
1324 * drm_connector_list_update - update the mode list for the connector
1328 * to the actual mode list. It compares the probed mode against the current
1341 struct drm_display_mode *mode; in drm_connector_list_update() local
1344 /* go through current modes checking for the new probed mode */ in drm_connector_list_update()
1345 list_for_each_entry(mode, &connector->modes, head) { in drm_connector_list_update()
1346 if (!drm_mode_equal(pmode, mode)) in drm_connector_list_update()
1352 * If the old matching mode is stale (ie. left over in drm_connector_list_update()
1361 * the mode added to the probed_modes list first. in drm_connector_list_update()
1363 if (mode->status == MODE_STALE) { in drm_connector_list_update()
1364 drm_mode_copy(mode, pmode); in drm_connector_list_update()
1365 } else if ((mode->type & DRM_MODE_TYPE_PREFERRED) == 0 && in drm_connector_list_update()
1367 pmode->type |= mode->type; in drm_connector_list_update()
1368 drm_mode_copy(mode, pmode); in drm_connector_list_update()
1370 mode->type |= pmode->type; in drm_connector_list_update()
1386 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_bpp() argument
1398 mode->bpp = bpp; in drm_mode_parse_cmdline_bpp()
1399 mode->bpp_specified = true; in drm_mode_parse_cmdline_bpp()
1405 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_refresh() argument
1417 mode->refresh = refresh; in drm_mode_parse_cmdline_refresh()
1418 mode->refresh_specified = true; in drm_mode_parse_cmdline_refresh()
1426 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_extra() argument
1436 mode->interlace = true; in drm_mode_parse_cmdline_extra()
1442 mode->margins = true; in drm_mode_parse_cmdline_extra()
1445 if (mode->force != DRM_FORCE_UNSPECIFIED) in drm_mode_parse_cmdline_extra()
1450 mode->force = DRM_FORCE_ON; in drm_mode_parse_cmdline_extra()
1452 mode->force = DRM_FORCE_ON_DIGITAL; in drm_mode_parse_cmdline_extra()
1455 if (mode->force != DRM_FORCE_UNSPECIFIED) in drm_mode_parse_cmdline_extra()
1458 mode->force = DRM_FORCE_OFF; in drm_mode_parse_cmdline_extra()
1461 if (mode->force != DRM_FORCE_UNSPECIFIED) in drm_mode_parse_cmdline_extra()
1464 mode->force = DRM_FORCE_ON; in drm_mode_parse_cmdline_extra()
1477 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_res_mode() argument
1521 mode); in drm_mode_parse_cmdline_res_mode()
1530 mode->xres = xres; in drm_mode_parse_cmdline_res_mode()
1531 mode->yres = yres; in drm_mode_parse_cmdline_res_mode()
1532 mode->cvt = cvt; in drm_mode_parse_cmdline_res_mode()
1533 mode->rb = rb; in drm_mode_parse_cmdline_res_mode()
1562 struct drm_cmdline_mode *mode) in drm_mode_parse_panel_orientation() argument
1575 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; in drm_mode_parse_panel_orientation()
1577 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; in drm_mode_parse_panel_orientation()
1579 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP; in drm_mode_parse_panel_orientation()
1581 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; in drm_mode_parse_panel_orientation()
1591 struct drm_cmdline_mode *mode) in drm_mode_parse_cmdline_options() argument
1638 mode->tv_margins.right = margin; in drm_mode_parse_cmdline_options()
1643 mode->tv_margins.left = margin; in drm_mode_parse_cmdline_options()
1648 mode->tv_margins.top = margin; in drm_mode_parse_cmdline_options()
1653 mode->tv_margins.bottom = margin; in drm_mode_parse_cmdline_options()
1655 if (drm_mode_parse_panel_orientation(delim, mode)) in drm_mode_parse_cmdline_options()
1674 mode->rotation_reflection = rotation; in drm_mode_parse_cmdline_options()
1686 * @mode_option: optional per connector mode option
1688 * @mode: preallocated drm_cmdline_mode structure to fill out
1699 * Additionals options can be provided following the mode, using a comma to
1711 struct drm_cmdline_mode *mode) in drm_mode_parse_command_line_for_connector() argument
1722 memset(mode, 0, sizeof(*mode)); in drm_mode_parse_command_line_for_connector()
1723 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; in drm_mode_parse_command_line_for_connector()
1757 /* First check for a named mode */ in drm_mode_parse_command_line_for_connector()
1764 strcpy(mode->name, drm_named_modes_whitelist[i]); in drm_mode_parse_command_line_for_connector()
1765 mode->specified = true; in drm_mode_parse_command_line_for_connector()
1770 /* No named mode? Check for a normal mode argument, e.g. 1024x768 */ in drm_mode_parse_command_line_for_connector()
1771 if (!mode->specified && isdigit(name[0])) { in drm_mode_parse_command_line_for_connector()
1775 mode); in drm_mode_parse_command_line_for_connector()
1779 mode->specified = true; in drm_mode_parse_command_line_for_connector()
1782 /* No mode? Check for freestanding extras and/or options */ in drm_mode_parse_command_line_for_connector()
1783 if (!mode->specified) { in drm_mode_parse_command_line_for_connector()
1798 ret = drm_mode_parse_cmdline_bpp(bpp_ptr, &bpp_end_ptr, mode); in drm_mode_parse_command_line_for_connector()
1802 mode->bpp_specified = true; in drm_mode_parse_command_line_for_connector()
1807 &refresh_end_ptr, mode); in drm_mode_parse_command_line_for_connector()
1811 mode->refresh_specified = true; in drm_mode_parse_command_line_for_connector()
1832 connector, mode); in drm_mode_parse_command_line_for_connector()
1840 connector, mode); in drm_mode_parse_command_line_for_connector()
1850 * drm_mode_create_from_cmdline_mode - convert a command line modeline into a DRM display mode
1851 * @dev: DRM device to create the new mode for
1855 * Pointer to converted mode on success, NULL on error.
1861 struct drm_display_mode *mode; in drm_mode_create_from_cmdline_mode() local
1867 mode = drm_cvt_mode(dev, in drm_mode_create_from_cmdline_mode()
1873 mode = drm_gtf_mode(dev, in drm_mode_create_from_cmdline_mode()
1878 if (!mode) in drm_mode_create_from_cmdline_mode()
1881 mode->type |= DRM_MODE_TYPE_USERDEF; in drm_mode_create_from_cmdline_mode()
1884 drm_mode_fixup_1366x768(mode); in drm_mode_create_from_cmdline_mode()
1885 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); in drm_mode_create_from_cmdline_mode()
1886 return mode; in drm_mode_create_from_cmdline_mode()
1930 WARN(1, "Invalid aspect ratio (0%x) on mode\n", in drm_mode_convert_to_umode()
1985 * flags for kernel-mode, but in picture_aspect_ratio. in drm_mode_convert_umode()
2023 * @mode: video mode to be tested.
2026 * true if the mode can be supported in YCBCR420 format
2030 const struct drm_display_mode *mode) in drm_mode_is_420_only() argument
2032 u8 vic = drm_match_cea_mode(mode); in drm_mode_is_420_only()
2043 * @mode: video mode to be tested.
2046 * true if the mode can be support YCBCR420 format
2050 const struct drm_display_mode *mode) in drm_mode_is_420_also() argument
2052 u8 vic = drm_match_cea_mode(mode); in drm_mode_is_420_also()
2062 * @mode: video mode to be tested.
2065 * true if the mode can be supported in YCBCR420 format
2069 const struct drm_display_mode *mode) in drm_mode_is_420() argument
2071 return drm_mode_is_420_only(display, mode) || in drm_mode_is_420()
2072 drm_mode_is_420_also(display, mode); in drm_mode_is_420()