Lines Matching refs: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)
56 DRM_DEBUG_KMS("Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
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)
91 if (!mode)
94 kfree(mode);
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)
112 list_add_tail(&mode->head, &connector->probed_modes);
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 */
331 /* Fill the mode line name */
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 */
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",
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)
742 bool interlaced = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
744 snprintf(mode->name, DRM_DISPLAY_MODE_LEN, "%dx%d%s",
745 mode->hdisplay, mode->vdisplay,
751 * drm_mode_vrefresh - get the vrefresh of a mode
752 * @mode: mode
758 int drm_mode_vrefresh(const struct drm_display_mode *mode)
762 if (mode->htotal == 0 || mode->vtotal == 0)
765 num = mode->clock;
766 den = mode->htotal * mode->vtotal;
768 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
770 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
772 if (mode->vscan > 1)
773 den *= mode->vscan;
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,
791 struct drm_display_mode adjusted = *mode;
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)
915 drm_mode_copy(nmode, mode);
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)
1080 if (mode->type & ~DRM_MODE_TYPE_ALL)
1083 if (mode->flags & ~DRM_MODE_FLAG_ALL)
1086 if ((mode->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
1089 if (mode->clock == 0)
1092 if (mode->hdisplay == 0 ||
1093 mode->hsync_start < mode->hdisplay ||
1094 mode->hsync_end < mode->hsync_start ||
1095 mode->htotal < mode->hsync_end)
1098 if (mode->vdisplay == 0 ||
1099 mode->vsync_start < mode->vdisplay ||
1100 mode->vsync_end < mode->vsync_start ||
1101 mode->vtotal < mode->vsync_end)
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)
1125 status = drm_mode_validate_basic(mode);
1130 return dev->mode_config.funcs->mode_valid(dev, mode);
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,
1154 if (maxX > 0 && mode->hdisplay > maxX)
1157 if (maxY > 0 && mode->vdisplay > maxY)
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,
1179 u8 vic = drm_match_cea_mode(mode);
1250 * drm_mode_prune_invalid - remove invalid modes from mode list
1255 * This helper function can be used to prune a display mode list after
1257 * removed from the list, and if @verbose the status code and mode name is also
1263 struct drm_display_mode *mode, *t;
1265 list_for_each_entry_safe(mode, t, mode_list, head) {
1266 if (mode->status != MODE_OK) {
1267 list_del(&mode->head);
1269 drm_mode_debug_printmodeline(mode);
1270 DRM_DEBUG_KMS("Not using %s mode: %s\n",
1271 mode->name,
1272 drm_get_mode_status_name(mode->status));
1274 drm_mode_destroy(dev, mode);
1283 * @lh_a: list_head for first mode
1284 * @lh_b: list_head for second mode
1317 * drm_mode_sort - sort mode list
1329 * drm_connector_list_update - update the mode list for the connector
1333 * to the actual mode list. It compares the probed mode against the current
1346 struct drm_display_mode *mode;
1349 /* go through current modes checking for the new probed mode */
1350 list_for_each_entry(mode, &connector->modes, head) {
1351 if (!drm_mode_equal(pmode, mode))
1357 * If the old matching mode is stale (ie. left over
1366 * the mode added to the probed_modes list first.
1368 if (mode->status == MODE_STALE) {
1369 drm_mode_copy(mode, pmode);
1370 } else if ((mode->type & DRM_MODE_TYPE_PREFERRED) == 0 &&
1372 pmode->type |= mode->type;
1373 drm_mode_copy(mode, pmode);
1375 mode->type |= pmode->type;
1391 struct drm_cmdline_mode *mode)
1403 mode->bpp = bpp;
1404 mode->bpp_specified = true;
1410 struct drm_cmdline_mode *mode)
1422 mode->refresh = refresh;
1423 mode->refresh_specified = true;
1431 struct drm_cmdline_mode *mode)
1441 mode->interlace = true;
1447 mode->margins = true;
1450 if (mode->force != DRM_FORCE_UNSPECIFIED)
1455 mode->force = DRM_FORCE_ON;
1457 mode->force = DRM_FORCE_ON_DIGITAL;
1460 if (mode->force != DRM_FORCE_UNSPECIFIED)
1463 mode->force = DRM_FORCE_OFF;
1466 if (mode->force != DRM_FORCE_UNSPECIFIED)
1469 mode->force = DRM_FORCE_ON;
1482 struct drm_cmdline_mode *mode)
1526 mode);
1535 mode->xres = xres;
1536 mode->yres = yres;
1537 mode->cvt = cvt;
1538 mode->rb = rb;
1567 struct drm_cmdline_mode *mode)
1580 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL;
1582 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
1584 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP;
1586 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP;
1596 struct drm_cmdline_mode *mode)
1643 mode->tv_margins.right = margin;
1648 mode->tv_margins.left = margin;
1653 mode->tv_margins.top = margin;
1658 mode->tv_margins.bottom = margin;
1660 if (drm_mode_parse_panel_orientation(delim, mode))
1679 mode->rotation_reflection = rotation;
1691 * @mode_option: optional per connector mode option
1693 * @mode: preallocated drm_cmdline_mode structure to fill out
1704 * Additionals options can be provided following the mode, using a comma to
1716 struct drm_cmdline_mode *mode)
1727 memset(mode, 0, sizeof(*mode));
1728 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
1762 /* First check for a named mode */
1769 strcpy(mode->name, drm_named_modes_whitelist[i]);
1770 mode->specified = true;
1775 /* No named mode? Check for a normal mode argument, e.g. 1024x768 */
1776 if (!mode->specified && isdigit(name[0])) {
1780 mode);
1784 mode->specified = true;
1787 /* No mode? Check for freestanding extras and/or options */
1788 if (!mode->specified) {
1803 ret = drm_mode_parse_cmdline_bpp(bpp_ptr, &bpp_end_ptr, mode);
1807 mode->bpp_specified = true;
1812 &refresh_end_ptr, mode);
1816 mode->refresh_specified = true;
1837 connector, mode);
1845 connector, mode);
1855 * drm_mode_create_from_cmdline_mode - convert a command line modeline into a DRM display mode
1856 * @dev: DRM device to create the new mode for
1860 * Pointer to converted mode on success, NULL on error.
1866 struct drm_display_mode *mode;
1869 mode = drm_cvt_mode(dev,
1875 mode = drm_gtf_mode(dev,
1880 if (!mode)
1883 mode->type |= DRM_MODE_TYPE_USERDEF;
1886 drm_mode_fixup_1366x768(mode);
1887 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
1888 return mode;
1932 WARN(1, "Invalid aspect ratio (0%x) on mode\n",
1987 * flags for kernel-mode, but in picture_aspect_ratio.
2025 * @mode: video mode to be tested.
2028 * true if the mode can be supported in YCBCR420 format
2032 const struct drm_display_mode *mode)
2034 u8 vic = drm_match_cea_mode(mode);
2045 * @mode: video mode to be tested.
2048 * true if the mode can be support YCBCR420 format
2052 const struct drm_display_mode *mode)
2054 u8 vic = drm_match_cea_mode(mode);
2064 * @mode: video mode to be tested.
2067 * true if the mode can be supported in YCBCR420 format
2071 const struct drm_display_mode *mode)
2073 return drm_mode_is_420_only(display, mode) ||
2074 drm_mode_is_420_also(display, mode);