Lines Matching refs:mode
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()
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()
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
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()
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()
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()
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()
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()
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()
1456 const struct drm_display_mode *mode) in drm_mode_duplicate() argument
1464 drm_mode_copy(nmode, mode); in drm_mode_duplicate()
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()
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()
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()
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()
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()
1814 DRM_MODE_FMT "\n", DRM_MODE_ARG(mode)); 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()
1892 struct drm_display_mode *mode; in drm_connector_list_update() local
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()