Lines Matching +full:ideal +full:- +full:factor +full:- +full:value

2  * Copyright © 1997-2003 by The XFree86 Project, Inc.
4 * Copyright © 2007-2008 Intel Corporation
6 * Copyright 2005-2006 Luc Verhaegen
53 * drm_mode_debug_printmodeline - print a mode to dmesg
65 * drm_mode_create - create a new display mode
87 * drm_mode_destroy - remove a mode
103 * drm_mode_probed_add - add a mode to a connector's probed_mode list
114 WARN_ON(!mutex_is_locked(&connector->dev->mode_config.mutex)); in drm_mode_probed_add()
116 list_add_tail(&mode->head, &connector->probed_modes); in drm_mode_probed_add()
127 * - https://web.archive.org/web/20220406232708/http://www.kolumbus.fi/pami1/video/pal_ntsc.html
128 * - https://web.archive.org/web/20220406124914/http://martin.hinner.info/vga/pal.html
129 * - https://web.archive.org/web/20220609202433/http://www.batsocks.co.uk/readme/video_timing.htm
135 #define NTSC_HBLK_DURATION_MIN_NS (NTSC_HBLK_DURATION_TYP_NS - 200)
138 #define NTSC_HACT_DURATION_TYP_NS (NTSC_LINE_DURATION_NS - NTSC_HBLK_DURATION_TYP_NS)
139 #define NTSC_HACT_DURATION_MIN_NS (NTSC_LINE_DURATION_NS - NTSC_HBLK_DURATION_MAX_NS)
140 #define NTSC_HACT_DURATION_MAX_NS (NTSC_LINE_DURATION_NS - NTSC_HBLK_DURATION_MIN_NS)
147 #define NTSC_HSLEN_DURATION_MIN_NS (NTSC_HSLEN_DURATION_TYP_NS - 100)
156 #define NTSC_HBP_DURATION_MIN_NS (NTSC_HBP_DURATION_TYP_NS - 100)
163 #define PAL_HACT_DURATION_MIN_NS (PAL_HACT_DURATION_TYP_NS - 100)
166 #define PAL_HBLK_DURATION_TYP_NS (PAL_LINE_DURATION_NS - PAL_HACT_DURATION_TYP_NS)
167 #define PAL_HBLK_DURATION_MIN_NS (PAL_LINE_DURATION_NS - PAL_HACT_DURATION_MAX_NS)
168 #define PAL_HBLK_DURATION_MAX_NS (PAL_LINE_DURATION_NS - PAL_HACT_DURATION_MIN_NS)
171 #define PAL_HFP_DURATION_MIN_NS (PAL_HFP_DURATION_TYP_NS - 100)
175 #define PAL_HSLEN_DURATION_MIN_NS (PAL_HSLEN_DURATION_TYP_NS - 200)
179 #define PAL_HBP_DURATION_MIN_NS (PAL_HBP_DURATION_TYP_NS - 200)
301 * The back porch starts with post-equalizing
349 "Generating a %ux%u%c, %u-line mode with a %lu kHz clock\n", in fill_analog_mode()
352 params->num_lines, in fill_analog_mode()
355 max_hact = params->hact_ns.max / pixel_duration_ns; in fill_analog_mode()
366 result = (u64)params->line_duration_ns * pixel_clock_hz; in fill_analog_mode()
374 (hact_duration_ns < params->hact_ns.min || in fill_analog_mode()
375 hact_duration_ns > params->hact_ns.max)) { in fill_analog_mode()
377 hact_duration_ns, params->hact_ns.min, params->hact_ns.max); in fill_analog_mode()
378 return -EINVAL; in fill_analog_mode()
381 hblk = htotal - hactive; in fill_analog_mode()
386 (hblk_duration_ns < params->hblk_ns.min || in fill_analog_mode()
387 hblk_duration_ns > params->hblk_ns.max)) { in fill_analog_mode()
389 hblk_duration_ns, params->hblk_ns.min, params->hblk_ns.max); in fill_analog_mode()
390 return -EINVAL; in fill_analog_mode()
393 hslen = DIV_ROUND_UP(params->hslen_ns.typ, pixel_duration_ns); in fill_analog_mode()
398 (hslen_duration_ns < params->hslen_ns.min || in fill_analog_mode()
399 hslen_duration_ns > params->hslen_ns.max)) { in fill_analog_mode()
401 hslen_duration_ns, params->hslen_ns.min, params->hslen_ns.max); in fill_analog_mode()
402 return -EINVAL; in fill_analog_mode()
405 porches = hblk - hslen; in fill_analog_mode()
410 (porches_duration_ns > (params->hfp_ns.max + params->hbp_ns.max) || in fill_analog_mode()
411 porches_duration_ns < (params->hfp_ns.min + params->hbp_ns.min))) { in fill_analog_mode()
414 return -EINVAL; in fill_analog_mode()
418 hfp = params->bt601_hfp; in fill_analog_mode()
420 unsigned int hfp_min = DIV_ROUND_UP(params->hfp_ns.min, in fill_analog_mode()
422 unsigned int hbp_min = DIV_ROUND_UP(params->hbp_ns.min, in fill_analog_mode()
424 int porches_rem = porches - hfp_min - hbp_min; in fill_analog_mode()
433 (hfp_duration_ns < params->hfp_ns.min || in fill_analog_mode()
434 hfp_duration_ns > params->hfp_ns.max)) { in fill_analog_mode()
436 hfp_duration_ns, params->hfp_ns.min, params->hfp_ns.max); in fill_analog_mode()
437 return -EINVAL; in fill_analog_mode()
440 hbp = porches - hfp; in fill_analog_mode()
445 (hbp_duration_ns < params->hbp_ns.min || in fill_analog_mode()
446 hbp_duration_ns > params->hbp_ns.max)) { in fill_analog_mode()
448 hbp_duration_ns, params->hbp_ns.min, params->hbp_ns.max); in fill_analog_mode()
449 return -EINVAL; in fill_analog_mode()
453 return -EINVAL; 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()
462 vfp_min = params->vfp_lines.even + params->vfp_lines.odd; in fill_analog_mode()
463 vbp_min = params->vbp_lines.even + params->vbp_lines.odd; in fill_analog_mode()
464 vslen = params->vslen_lines.even + params->vslen_lines.odd; in fill_analog_mode()
480 vfp_min = params->vfp_lines.odd; in fill_analog_mode()
481 vbp_min = params->vbp_lines.odd; in fill_analog_mode()
482 vslen = params->vslen_lines.odd; in fill_analog_mode()
487 porches = params->num_lines - vactive - vslen; in fill_analog_mode()
490 porches_rem = porches - vfp_min - vbp_min; in fill_analog_mode()
494 vbp = porches - vfp; in fill_analog_mode()
498 if (params->num_lines != vtotal) { in fill_analog_mode()
500 vtotal, params->num_lines); in fill_analog_mode()
501 return -EINVAL; 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()
510 return -EINVAL; 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()
525 * drm_analog_tv_mode - create a display mode for an analog TV
535 * this is DRM_MODE_TV_MODE_MONOCHROME, a 625-line mode will be created.
600 * drm_cvt_mode -create a modeline based on the CVT algorithm
628 /* 1) top/bottom margin size (% of height) - default: 1.8, */ in drm_cvt_mode()
630 /* 2) character cell horizontal granularity (pixels) - default 8 */ in drm_cvt_mode()
632 /* 3) Minimum vertical porch (lines) - default 3 */ in drm_cvt_mode()
634 /* 4) Minimum number of vertical back porch lines - default 6 */ in drm_cvt_mode()
665 hdisplay_rnd = hdisplay - (hdisplay % CVT_H_GRANULARITY); in drm_cvt_mode()
671 hmargin -= hmargin % CVT_H_GRANULARITY; in drm_cvt_mode()
674 drm_mode->hdisplay = hdisplay_rnd + 2 * hmargin; in drm_cvt_mode()
687 drm_mode->vdisplay = vdisplay + 2 * vmargin; in drm_cvt_mode()
716 /* 3) Nominal HSync width (% of line period) - default 8 */ in drm_cvt_mode()
722 tmp1 = HV_FACTOR * 1000000 - in drm_cvt_mode()
735 vback_porch = vsyncandback_porch - vsync; in drm_cvt_mode()
736 drm_mode->vtotal = vdisplay_rnd + 2 * vmargin + in drm_cvt_mode()
739 /* Gradient (%/kHz) - default 600 */ in drm_cvt_mode()
741 /* Offset (%) - default 40 */ in drm_cvt_mode()
743 /* Blanking time scaling factor - default 128 */ in drm_cvt_mode()
745 /* Scaling factor weighting - default 20 */ in drm_cvt_mode()
748 #define CVT_C_PRIME ((CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \ in drm_cvt_mode()
750 /* 12. Find ideal blanking duty cycle from formula */ in drm_cvt_mode()
751 hblank_percentage = CVT_C_PRIME * HV_FACTOR - CVT_M_PRIME * in drm_cvt_mode()
756 hblank = drm_mode->hdisplay * hblank_percentage / in drm_cvt_mode()
757 (100 * HV_FACTOR - hblank_percentage); in drm_cvt_mode()
758 hblank -= hblank % (2 * CVT_H_GRANULARITY); in drm_cvt_mode()
760 drm_mode->htotal = drm_mode->hdisplay + hblank; in drm_cvt_mode()
761 drm_mode->hsync_end = drm_mode->hdisplay + hblank / 2; in drm_cvt_mode()
762 drm_mode->hsync_start = drm_mode->hsync_end - in drm_cvt_mode()
763 (drm_mode->htotal * CVT_HSYNC_PERCENTAGE) / 100; in drm_cvt_mode()
764 drm_mode->hsync_start += CVT_H_GRANULARITY - in drm_cvt_mode()
765 drm_mode->hsync_start % CVT_H_GRANULARITY; in drm_cvt_mode()
767 drm_mode->vsync_start = drm_mode->vdisplay + CVT_MIN_V_PORCH; in drm_cvt_mode()
768 drm_mode->vsync_end = drm_mode->vsync_start + vsync; in drm_cvt_mode()
771 /* Minimum vertical blanking interval time (µs)- default 460 */ in drm_cvt_mode()
777 /* Fixed number of lines for vertical front porch - default 3*/ in drm_cvt_mode()
782 tmp1 = HV_FACTOR * 1000000 - in drm_cvt_mode()
792 drm_mode->vtotal = vdisplay_rnd + 2 * vmargin + vbilines; in drm_cvt_mode()
794 drm_mode->htotal = drm_mode->hdisplay + CVT_RB_H_BLANK; in drm_cvt_mode()
796 drm_mode->hsync_end = drm_mode->hdisplay + CVT_RB_H_BLANK / 2; in drm_cvt_mode()
797 drm_mode->hsync_start = drm_mode->hsync_end - CVT_RB_H_SYNC; in drm_cvt_mode()
799 drm_mode->vsync_start = drm_mode->vdisplay + CVT_RB_VFPORCH; in drm_cvt_mode()
800 drm_mode->vsync_end = drm_mode->vsync_start + vsync; in drm_cvt_mode()
803 tmp = drm_mode->htotal; /* perform intermediate calcs in u64 */ in drm_cvt_mode()
806 tmp -= drm_mode->clock % CVT_CLOCK_STEP; in drm_cvt_mode()
807 drm_mode->clock = tmp; in drm_cvt_mode()
809 /* ignore - just set the mode flag for interlaced */ in drm_cvt_mode()
811 drm_mode->vtotal *= 2; in drm_cvt_mode()
812 drm_mode->flags |= DRM_MODE_FLAG_INTERLACE; in drm_cvt_mode()
817 drm_mode->flags |= (DRM_MODE_FLAG_PHSYNC | in drm_cvt_mode()
820 drm_mode->flags |= (DRM_MODE_FLAG_PVSYNC | in drm_cvt_mode()
828 * drm_gtf_mode_complex - create the modeline based on the full GTF algorithm
852 { /* 1) top/bottom margin size (% of height) - default: 1.8, */ in drm_gtf_mode_complex()
854 /* 2) character cell horizontal granularity (pixels) - default 8 */ in drm_gtf_mode_complex()
856 /* 3) Minimum vertical porch (lines) - default 3 */ in drm_gtf_mode_complex()
865 #define GTF_C_PRIME ((((GTF_2C - GTF_2J) * GTF_K / 256) + GTF_2J) / 2) in drm_gtf_mode_complex()
928 tmp1 = (1000000 - MIN_VSYNC_PLUS_BP * vfieldrate_rqd) / 500; in drm_gtf_mode_complex()
939 vback_porch = vsync_plus_bp - V_SYNC_RQD; in drm_gtf_mode_complex()
966 /* 18.Find the ideal blanking duty cycle from blanking duty cycle */ in drm_gtf_mode_complex()
967 ideal_duty_cycle = GTF_C_PRIME * 1000 - in drm_gtf_mode_complex()
972 (100000 - ideal_duty_cycle); in drm_gtf_mode_complex()
988 hfront_porch = hblank / 2 - hsync; in drm_gtf_mode_complex()
993 drm_mode->hdisplay = hdisplay_rnd; in drm_gtf_mode_complex()
994 drm_mode->hsync_start = hdisplay_rnd + hfront_porch; in drm_gtf_mode_complex()
995 drm_mode->hsync_end = drm_mode->hsync_start + hsync; in drm_gtf_mode_complex()
996 drm_mode->htotal = total_pixels; in drm_gtf_mode_complex()
997 drm_mode->vdisplay = vdisplay_rnd; in drm_gtf_mode_complex()
998 drm_mode->vsync_start = vdisplay_rnd + vodd_front_porch_lines; in drm_gtf_mode_complex()
999 drm_mode->vsync_end = drm_mode->vsync_start + V_SYNC_RQD; in drm_gtf_mode_complex()
1000 drm_mode->vtotal = vtotal_lines; in drm_gtf_mode_complex()
1002 drm_mode->clock = pixel_freq; in drm_gtf_mode_complex()
1005 drm_mode->vtotal *= 2; in drm_gtf_mode_complex()
1006 drm_mode->flags |= DRM_MODE_FLAG_INTERLACE; in drm_gtf_mode_complex()
1011 drm_mode->flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC; in drm_gtf_mode_complex()
1013 drm_mode->flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC; in drm_gtf_mode_complex()
1020 * drm_gtf_mode - create the modeline based on the GTF algorithm
1065 * drm_display_mode_from_videomode - fill in @dmode using @vm,
1074 dmode->hdisplay = vm->hactive; in drm_display_mode_from_videomode()
1075 dmode->hsync_start = dmode->hdisplay + vm->hfront_porch; in drm_display_mode_from_videomode()
1076 dmode->hsync_end = dmode->hsync_start + vm->hsync_len; in drm_display_mode_from_videomode()
1077 dmode->htotal = dmode->hsync_end + vm->hback_porch; in drm_display_mode_from_videomode()
1079 dmode->vdisplay = vm->vactive; in drm_display_mode_from_videomode()
1080 dmode->vsync_start = dmode->vdisplay + vm->vfront_porch; in drm_display_mode_from_videomode()
1081 dmode->vsync_end = dmode->vsync_start + vm->vsync_len; in drm_display_mode_from_videomode()
1082 dmode->vtotal = dmode->vsync_end + vm->vback_porch; in drm_display_mode_from_videomode()
1084 dmode->clock = vm->pixelclock / 1000; in drm_display_mode_from_videomode()
1086 dmode->flags = 0; in drm_display_mode_from_videomode()
1087 if (vm->flags & DISPLAY_FLAGS_HSYNC_HIGH) in drm_display_mode_from_videomode()
1088 dmode->flags |= DRM_MODE_FLAG_PHSYNC; in drm_display_mode_from_videomode()
1089 else if (vm->flags & DISPLAY_FLAGS_HSYNC_LOW) in drm_display_mode_from_videomode()
1090 dmode->flags |= DRM_MODE_FLAG_NHSYNC; in drm_display_mode_from_videomode()
1091 if (vm->flags & DISPLAY_FLAGS_VSYNC_HIGH) in drm_display_mode_from_videomode()
1092 dmode->flags |= DRM_MODE_FLAG_PVSYNC; in drm_display_mode_from_videomode()
1093 else if (vm->flags & DISPLAY_FLAGS_VSYNC_LOW) in drm_display_mode_from_videomode()
1094 dmode->flags |= DRM_MODE_FLAG_NVSYNC; in drm_display_mode_from_videomode()
1095 if (vm->flags & DISPLAY_FLAGS_INTERLACED) in drm_display_mode_from_videomode()
1096 dmode->flags |= DRM_MODE_FLAG_INTERLACE; in drm_display_mode_from_videomode()
1097 if (vm->flags & DISPLAY_FLAGS_DOUBLESCAN) in drm_display_mode_from_videomode()
1098 dmode->flags |= DRM_MODE_FLAG_DBLSCAN; in drm_display_mode_from_videomode()
1099 if (vm->flags & DISPLAY_FLAGS_DOUBLECLK) in drm_display_mode_from_videomode()
1100 dmode->flags |= DRM_MODE_FLAG_DBLCLK; in drm_display_mode_from_videomode()
1106 * drm_display_mode_to_videomode - fill in @vm using @dmode,
1115 vm->hactive = dmode->hdisplay; in drm_display_mode_to_videomode()
1116 vm->hfront_porch = dmode->hsync_start - dmode->hdisplay; in drm_display_mode_to_videomode()
1117 vm->hsync_len = dmode->hsync_end - dmode->hsync_start; in drm_display_mode_to_videomode()
1118 vm->hback_porch = dmode->htotal - dmode->hsync_end; in drm_display_mode_to_videomode()
1120 vm->vactive = dmode->vdisplay; in drm_display_mode_to_videomode()
1121 vm->vfront_porch = dmode->vsync_start - dmode->vdisplay; in drm_display_mode_to_videomode()
1122 vm->vsync_len = dmode->vsync_end - dmode->vsync_start; in drm_display_mode_to_videomode()
1123 vm->vback_porch = dmode->vtotal - dmode->vsync_end; in drm_display_mode_to_videomode()
1125 vm->pixelclock = dmode->clock * 1000; in drm_display_mode_to_videomode()
1127 vm->flags = 0; in drm_display_mode_to_videomode()
1128 if (dmode->flags & DRM_MODE_FLAG_PHSYNC) in drm_display_mode_to_videomode()
1129 vm->flags |= DISPLAY_FLAGS_HSYNC_HIGH; in drm_display_mode_to_videomode()
1130 else if (dmode->flags & DRM_MODE_FLAG_NHSYNC) in drm_display_mode_to_videomode()
1131 vm->flags |= DISPLAY_FLAGS_HSYNC_LOW; in drm_display_mode_to_videomode()
1132 if (dmode->flags & DRM_MODE_FLAG_PVSYNC) in drm_display_mode_to_videomode()
1133 vm->flags |= DISPLAY_FLAGS_VSYNC_HIGH; in drm_display_mode_to_videomode()
1134 else if (dmode->flags & DRM_MODE_FLAG_NVSYNC) in drm_display_mode_to_videomode()
1135 vm->flags |= DISPLAY_FLAGS_VSYNC_LOW; in drm_display_mode_to_videomode()
1136 if (dmode->flags & DRM_MODE_FLAG_INTERLACE) in drm_display_mode_to_videomode()
1137 vm->flags |= DISPLAY_FLAGS_INTERLACED; in drm_display_mode_to_videomode()
1138 if (dmode->flags & DRM_MODE_FLAG_DBLSCAN) in drm_display_mode_to_videomode()
1139 vm->flags |= DISPLAY_FLAGS_DOUBLESCAN; in drm_display_mode_to_videomode()
1140 if (dmode->flags & DRM_MODE_FLAG_DBLCLK) in drm_display_mode_to_videomode()
1141 vm->flags |= DISPLAY_FLAGS_DOUBLECLK; in drm_display_mode_to_videomode()
1146 * drm_bus_flags_from_videomode - extract information about pixelclk and
1159 if (vm->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE) in drm_bus_flags_from_videomode()
1161 if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) in drm_bus_flags_from_videomode()
1164 if (vm->flags & DISPLAY_FLAGS_SYNC_POSEDGE) in drm_bus_flags_from_videomode()
1166 if (vm->flags & DISPLAY_FLAGS_SYNC_NEGEDGE) in drm_bus_flags_from_videomode()
1169 if (vm->flags & DISPLAY_FLAGS_DE_LOW) in drm_bus_flags_from_videomode()
1171 if (vm->flags & DISPLAY_FLAGS_DE_HIGH) in drm_bus_flags_from_videomode()
1178 * of_get_drm_display_mode - get a drm_display_mode from devicetree
1180 * @dmode: will be set to the return value
1214 * of_get_drm_panel_display_mode - get a panel-timing drm_display_mode from devicetree
1215 * @np: device_node with the panel-timing specification
1216 * @dmode: will be set to the return value
1219 * The mandatory Device Tree properties width-mm and height-mm
1233 ret = of_get_display_timing(np, "panel-timing", &timing); in of_get_drm_panel_display_mode()
1244 ret = of_property_read_u32(np, "width-mm", &width_mm); in of_get_drm_panel_display_mode()
1248 ret = of_property_read_u32(np, "height-mm", &height_mm); in of_get_drm_panel_display_mode()
1252 dmode->width_mm = width_mm; in of_get_drm_panel_display_mode()
1253 dmode->height_mm = height_mm; in of_get_drm_panel_display_mode()
1264 * drm_mode_set_name - set the name on a mode
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
1286 * value first if it is not yet set.
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
1312 * @hdisplay: hdisplay value to fill in
1313 * @vdisplay: vdisplay value to fill in
1315 * The vdisplay value will be doubled if the specified mode is a stereo mode of
1332 * drm_mode_set_crtcinfo - set CRTC modesetting timing parameters
1338 * - The CRTC_INTERLACE_HALVE_V flag can be used to halve vertical timings of
1340 * - The CRTC_STEREO_DOUBLE flag can be used to compute the timings for
1343 * - The CRTC_NO_DBLSCAN and CRTC_NO_VSCAN flags request that adjustment *not*
1351 p->crtc_clock = p->clock; in drm_mode_set_crtcinfo()
1352 p->crtc_hdisplay = p->hdisplay; in drm_mode_set_crtcinfo()
1353 p->crtc_hsync_start = p->hsync_start; in drm_mode_set_crtcinfo()
1354 p->crtc_hsync_end = p->hsync_end; in drm_mode_set_crtcinfo()
1355 p->crtc_htotal = p->htotal; in drm_mode_set_crtcinfo()
1356 p->crtc_hskew = p->hskew; in drm_mode_set_crtcinfo()
1357 p->crtc_vdisplay = p->vdisplay; in drm_mode_set_crtcinfo()
1358 p->crtc_vsync_start = p->vsync_start; in drm_mode_set_crtcinfo()
1359 p->crtc_vsync_end = p->vsync_end; in drm_mode_set_crtcinfo()
1360 p->crtc_vtotal = p->vtotal; in drm_mode_set_crtcinfo()
1362 if (p->flags & DRM_MODE_FLAG_INTERLACE) { in drm_mode_set_crtcinfo()
1364 p->crtc_vdisplay /= 2; in drm_mode_set_crtcinfo()
1365 p->crtc_vsync_start /= 2; in drm_mode_set_crtcinfo()
1366 p->crtc_vsync_end /= 2; in drm_mode_set_crtcinfo()
1367 p->crtc_vtotal /= 2; in drm_mode_set_crtcinfo()
1372 if (p->flags & DRM_MODE_FLAG_DBLSCAN) { in drm_mode_set_crtcinfo()
1373 p->crtc_vdisplay *= 2; in drm_mode_set_crtcinfo()
1374 p->crtc_vsync_start *= 2; in drm_mode_set_crtcinfo()
1375 p->crtc_vsync_end *= 2; in drm_mode_set_crtcinfo()
1376 p->crtc_vtotal *= 2; in drm_mode_set_crtcinfo()
1381 if (p->vscan > 1) { in drm_mode_set_crtcinfo()
1382 p->crtc_vdisplay *= p->vscan; in drm_mode_set_crtcinfo()
1383 p->crtc_vsync_start *= p->vscan; in drm_mode_set_crtcinfo()
1384 p->crtc_vsync_end *= p->vscan; in drm_mode_set_crtcinfo()
1385 p->crtc_vtotal *= p->vscan; in drm_mode_set_crtcinfo()
1390 unsigned int layout = p->flags & DRM_MODE_FLAG_3D_MASK; in drm_mode_set_crtcinfo()
1394 p->crtc_clock *= 2; in drm_mode_set_crtcinfo()
1395 p->crtc_vdisplay += p->crtc_vtotal; in drm_mode_set_crtcinfo()
1396 p->crtc_vsync_start += p->crtc_vtotal; in drm_mode_set_crtcinfo()
1397 p->crtc_vsync_end += p->crtc_vtotal; in drm_mode_set_crtcinfo()
1398 p->crtc_vtotal += p->crtc_vtotal; in drm_mode_set_crtcinfo()
1403 p->crtc_vblank_start = min(p->crtc_vsync_start, p->crtc_vdisplay); in drm_mode_set_crtcinfo()
1404 p->crtc_vblank_end = max(p->crtc_vsync_end, p->crtc_vtotal); in drm_mode_set_crtcinfo()
1405 p->crtc_hblank_start = min(p->crtc_hsync_start, p->crtc_hdisplay); in drm_mode_set_crtcinfo()
1406 p->crtc_hblank_end = max(p->crtc_hsync_end, p->crtc_htotal); in drm_mode_set_crtcinfo()
1411 * drm_mode_copy - copy the mode
1420 struct list_head head = dst->head; in drm_mode_copy()
1423 dst->head = head; in drm_mode_copy()
1428 * drm_mode_init - initialize the mode from another mode
1435 * garbage in on-stack modes.
1445 * drm_mode_duplicate - allocate and duplicate an existing mode
1473 return mode1->hdisplay == mode2->hdisplay && in drm_mode_match_timings()
1474 mode1->hsync_start == mode2->hsync_start && in drm_mode_match_timings()
1475 mode1->hsync_end == mode2->hsync_end && in drm_mode_match_timings()
1476 mode1->htotal == mode2->htotal && in drm_mode_match_timings()
1477 mode1->hskew == mode2->hskew && in drm_mode_match_timings()
1478 mode1->vdisplay == mode2->vdisplay && in drm_mode_match_timings()
1479 mode1->vsync_start == mode2->vsync_start && in drm_mode_match_timings()
1480 mode1->vsync_end == mode2->vsync_end && in drm_mode_match_timings()
1481 mode1->vtotal == mode2->vtotal && in drm_mode_match_timings()
1482 mode1->vscan == mode2->vscan; in drm_mode_match_timings()
1492 if (mode1->clock && mode2->clock) in drm_mode_match_clock()
1493 return KHZ2PICOS(mode1->clock) == KHZ2PICOS(mode2->clock); in drm_mode_match_clock()
1495 return mode1->clock == mode2->clock; in drm_mode_match_clock()
1501 return (mode1->flags & ~DRM_MODE_FLAG_3D_MASK) == in drm_mode_match_flags()
1502 (mode2->flags & ~DRM_MODE_FLAG_3D_MASK); in drm_mode_match_flags()
1508 return (mode1->flags & DRM_MODE_FLAG_3D_MASK) == in drm_mode_match_3d_flags()
1509 (mode2->flags & DRM_MODE_FLAG_3D_MASK); in drm_mode_match_3d_flags()
1515 return mode1->picture_aspect_ratio == mode2->picture_aspect_ratio; in drm_mode_match_aspect_ratio()
1519 * drm_mode_match - test modes for (partial) equality
1564 * drm_mode_equal - test modes for equality
1586 * drm_mode_equal_no_clocks - test modes for equality
1607 * drm_mode_equal_no_clocks_no_stereo - test modes for equality
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
1678 if (dev->mode_config.funcs->mode_valid) in drm_mode_validate_driver()
1679 return dev->mode_config.funcs->mode_valid(dev, mode); in drm_mode_validate_driver()
1686 * drm_mode_validate_size - make sure modes adhere to size constraints
1703 if (maxX > 0 && mode->hdisplay > maxX) in drm_mode_validate_size()
1706 if (maxY > 0 && mode->vdisplay > maxY) in drm_mode_validate_size()
1714 * drm_mode_validate_ycbcr420 - add 'ycbcr420-only' modes only when allowed
1728 if (!connector->ycbcr_420_allowed && in drm_mode_validate_ycbcr420()
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
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()
1818 DRM_MODE_ARG(mode), drm_get_mode_status_name(mode->status)); in drm_mode_prune_invalid()
1827 * drm_mode_compare - compare modes for favorability
1832 * Compare two modes, given by @lh_a and @lh_b, returning a value indicating
1846 diff = ((b->type & DRM_MODE_TYPE_PREFERRED) != 0) - in drm_mode_compare()
1847 ((a->type & DRM_MODE_TYPE_PREFERRED) != 0); in drm_mode_compare()
1850 diff = b->hdisplay * b->vdisplay - a->hdisplay * a->vdisplay; in drm_mode_compare()
1854 diff = drm_mode_vrefresh(b) - drm_mode_vrefresh(a); in drm_mode_compare()
1858 diff = b->clock - a->clock; in drm_mode_compare()
1863 * drm_mode_sort - sort mode list
1875 * drm_connector_list_update - update the mode list for the connector
1889 WARN_ON(!mutex_is_locked(&connector->dev->mode_config.mutex)); in drm_connector_list_update()
1891 list_for_each_entry_safe(pmode, pt, &connector->probed_modes, head) { in drm_connector_list_update()
1896 list_for_each_entry(mode, &connector->modes, head) { in drm_connector_list_update()
1914 if (mode->status == MODE_STALE) { in drm_connector_list_update()
1916 } else if ((mode->type & DRM_MODE_TYPE_PREFERRED) == 0 && in drm_connector_list_update()
1917 (pmode->type & DRM_MODE_TYPE_PREFERRED) != 0) { in drm_connector_list_update()
1918 pmode->type |= mode->type; in drm_connector_list_update()
1921 mode->type |= pmode->type; in drm_connector_list_update()
1924 list_del(&pmode->head); in drm_connector_list_update()
1925 drm_mode_destroy(connector->dev, pmode); in drm_connector_list_update()
1930 list_move_tail(&pmode->head, &connector->modes); in drm_connector_list_update()
1941 if (str[0] != '-') in drm_mode_parse_cmdline_bpp()
1942 return -EINVAL; in drm_mode_parse_cmdline_bpp()
1947 return -EINVAL; in drm_mode_parse_cmdline_bpp()
1949 mode->bpp = bpp; in drm_mode_parse_cmdline_bpp()
1950 mode->bpp_specified = true; in drm_mode_parse_cmdline_bpp()
1961 return -EINVAL; in drm_mode_parse_cmdline_refresh()
1966 return -EINVAL; in drm_mode_parse_cmdline_refresh()
1968 mode->refresh = refresh; in drm_mode_parse_cmdline_refresh()
1969 mode->refresh_specified = true; in drm_mode_parse_cmdline_refresh()
1985 return -EINVAL; in drm_mode_parse_cmdline_extra()
1987 mode->interlace = true; in drm_mode_parse_cmdline_extra()
1991 return -EINVAL; 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()
1997 return -EINVAL; in drm_mode_parse_cmdline_extra()
1999 if ((connector->connector_type != DRM_MODE_CONNECTOR_DVII) && in drm_mode_parse_cmdline_extra()
2000 (connector->connector_type != DRM_MODE_CONNECTOR_HDMIB)) 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()
2007 return -EINVAL; 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()
2013 return -EINVAL; in drm_mode_parse_cmdline_extra()
2015 mode->force = DRM_FORCE_ON; in drm_mode_parse_cmdline_extra()
2018 return -EINVAL; in drm_mode_parse_cmdline_extra()
2038 return -EINVAL; in drm_mode_parse_cmdline_res_mode()
2041 return -EINVAL; in drm_mode_parse_cmdline_res_mode()
2047 return -EINVAL; in drm_mode_parse_cmdline_res_mode()
2049 remaining = length - (end_ptr - str_start); in drm_mode_parse_cmdline_res_mode()
2051 return -EINVAL; in drm_mode_parse_cmdline_res_mode()
2076 return -EINVAL; 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()
2091 const char *value; in drm_mode_parse_cmdline_int() local
2100 return -EINVAL; in drm_mode_parse_cmdline_int()
2102 value = delim + 1; in drm_mode_parse_cmdline_int()
2103 *int_ret = simple_strtol(value, &endp, 10); in drm_mode_parse_cmdline_int()
2106 if (endp == value) in drm_mode_parse_cmdline_int()
2107 return -EINVAL; in drm_mode_parse_cmdline_int()
2115 const char *value; in drm_mode_parse_panel_orientation() local
2118 return -EINVAL; in drm_mode_parse_panel_orientation()
2120 value = delim + 1; in drm_mode_parse_panel_orientation()
2121 delim = strchr(value, ','); in drm_mode_parse_panel_orientation()
2123 delim = value + strlen(value); in drm_mode_parse_panel_orientation()
2125 if (!strncmp(value, "normal", delim - value)) in drm_mode_parse_panel_orientation()
2126 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; in drm_mode_parse_panel_orientation()
2127 else if (!strncmp(value, "upside_down", delim - value)) in drm_mode_parse_panel_orientation()
2128 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; in drm_mode_parse_panel_orientation()
2129 else if (!strncmp(value, "left_side_up", delim - value)) in drm_mode_parse_panel_orientation()
2130 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP; in drm_mode_parse_panel_orientation()
2131 else if (!strncmp(value, "right_side_up", delim - value)) in drm_mode_parse_panel_orientation()
2132 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; in drm_mode_parse_panel_orientation()
2134 return -EINVAL; in drm_mode_parse_panel_orientation()
2142 const char *value; in drm_mode_parse_tv_mode() local
2146 return -EINVAL; in drm_mode_parse_tv_mode()
2148 value = delim + 1; in drm_mode_parse_tv_mode()
2149 delim = strchr(value, ','); in drm_mode_parse_tv_mode()
2151 delim = value + strlen(value); in drm_mode_parse_tv_mode()
2153 ret = drm_get_tv_mode_from_name(value, delim - value); in drm_mode_parse_tv_mode()
2157 mode->tv_mode_specified = true; in drm_mode_parse_tv_mode()
2158 mode->tv_mode = ret; in drm_mode_parse_tv_mode()
2181 if (!strncmp(option, "rotate", delim - option)) { in drm_mode_parse_cmdline_options()
2183 return -EINVAL; in drm_mode_parse_cmdline_options()
2203 return -EINVAL; in drm_mode_parse_cmdline_options()
2205 } else if (!strncmp(option, "reflect_x", delim - option)) { in drm_mode_parse_cmdline_options()
2207 } else if (!strncmp(option, "reflect_y", delim - option)) { in drm_mode_parse_cmdline_options()
2209 } else if (!strncmp(option, "margin_right", delim - option)) { in drm_mode_parse_cmdline_options()
2211 return -EINVAL; in drm_mode_parse_cmdline_options()
2213 mode->tv_margins.right = margin; in drm_mode_parse_cmdline_options()
2214 } else if (!strncmp(option, "margin_left", delim - option)) { in drm_mode_parse_cmdline_options()
2216 return -EINVAL; in drm_mode_parse_cmdline_options()
2218 mode->tv_margins.left = margin; in drm_mode_parse_cmdline_options()
2219 } else if (!strncmp(option, "margin_top", delim - option)) { in drm_mode_parse_cmdline_options()
2221 return -EINVAL; in drm_mode_parse_cmdline_options()
2223 mode->tv_margins.top = margin; in drm_mode_parse_cmdline_options()
2224 } else if (!strncmp(option, "margin_bottom", delim - option)) { in drm_mode_parse_cmdline_options()
2226 return -EINVAL; in drm_mode_parse_cmdline_options()
2228 mode->tv_margins.bottom = margin; in drm_mode_parse_cmdline_options()
2229 } else if (!strncmp(option, "panel_orientation", delim - option)) { in drm_mode_parse_cmdline_options()
2231 return -EINVAL; in drm_mode_parse_cmdline_options()
2232 } else if (!strncmp(option, "tv_mode", delim - option)) { in drm_mode_parse_cmdline_options()
2234 return -EINVAL; in drm_mode_parse_cmdline_options()
2236 return -EINVAL; in drm_mode_parse_cmdline_options()
2243 return -EINVAL; in drm_mode_parse_cmdline_options()
2250 return -EINVAL; in drm_mode_parse_cmdline_options()
2252 mode->rotation_reflection = rotation; in drm_mode_parse_cmdline_options()
2278 NAMED_MODE("NTSC-J", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_NTSC_J),
2280 NAMED_MODE("PAL-M", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_PAL_M),
2297 * If there's an equal sign in the name, the command-line in drm_mode_parse_cmdline_named_mode()
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()
2326 cmdline_mode->tv_mode_specified = true; in drm_mode_parse_cmdline_named_mode()
2327 cmdline_mode->specified = true; in drm_mode_parse_cmdline_named_mode()
2332 return -EINVAL; in drm_mode_parse_cmdline_named_mode()
2336 * drm_mode_parse_command_line_for_connector - parse command line modeline for connector
2345 * force-enable, force-enable-digital and force-disable bit at the end::
2347 * <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd]
2354 * options from the command line modline like the force-enable/disable flag.
2373 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; in drm_mode_parse_command_line_for_connector()
2383 options_off = options_ptr - name; in drm_mode_parse_command_line_for_connector()
2388 bpp_ptr = strnchr(name, options_off, '-'); in drm_mode_parse_command_line_for_connector()
2390 bpp_ptr = strnchr(bpp_ptr + 1, options_off, '-'); in drm_mode_parse_command_line_for_connector()
2392 bpp_off = bpp_ptr - name; in drm_mode_parse_command_line_for_connector()
2396 refresh_off = refresh_ptr - name; in drm_mode_parse_command_line_for_connector()
2420 * an at-sign (used to specify a refresh rate) is disallowed. in drm_mode_parse_command_line_for_connector()
2426 if (!mode->specified && isdigit(name[0])) { 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()
2447 options_ptr = mode_option - 1; in drm_mode_parse_command_line_for_connector()
2457 mode->bpp_specified = true; in drm_mode_parse_command_line_for_connector()
2466 mode->refresh_specified = true; in drm_mode_parse_command_line_for_connector()
2482 len = options_ptr - extra_ptr; in drm_mode_parse_command_line_for_connector()
2512 if (strcmp(cmd->name, named_mode->name)) in drm_named_mode()
2515 if (!cmd->tv_mode_specified) in drm_named_mode()
2519 named_mode->tv_mode, in drm_named_mode()
2520 named_mode->pixel_clock_khz * 1000, in drm_named_mode()
2521 named_mode->xres, in drm_named_mode()
2522 named_mode->yres, in drm_named_mode()
2523 named_mode->flags & DRM_MODE_FLAG_INTERLACE); in drm_named_mode()
2530 * drm_mode_create_from_cmdline_mode - convert a command line modeline into a DRM display mode
2543 if (cmd->xres == 0 || cmd->yres == 0) in drm_mode_create_from_cmdline_mode()
2546 if (strlen(cmd->name)) in drm_mode_create_from_cmdline_mode()
2548 else if (cmd->cvt) in drm_mode_create_from_cmdline_mode()
2550 cmd->xres, cmd->yres, in drm_mode_create_from_cmdline_mode()
2551 cmd->refresh_specified ? cmd->refresh : 60, in drm_mode_create_from_cmdline_mode()
2552 cmd->rb, cmd->interlace, in drm_mode_create_from_cmdline_mode()
2553 cmd->margins); in drm_mode_create_from_cmdline_mode()
2556 cmd->xres, cmd->yres, in drm_mode_create_from_cmdline_mode()
2557 cmd->refresh_specified ? cmd->refresh : 60, in drm_mode_create_from_cmdline_mode()
2558 cmd->interlace, in drm_mode_create_from_cmdline_mode()
2559 cmd->margins); in drm_mode_create_from_cmdline_mode()
2563 mode->type |= DRM_MODE_TYPE_USERDEF; in drm_mode_create_from_cmdline_mode()
2565 if (cmd->xres == 1366) in drm_mode_create_from_cmdline_mode()
2573 * drm_mode_convert_to_umode - convert a drm_display_mode into a modeinfo
2583 out->clock = in->clock; in drm_mode_convert_to_umode()
2584 out->hdisplay = in->hdisplay; in drm_mode_convert_to_umode()
2585 out->hsync_start = in->hsync_start; in drm_mode_convert_to_umode()
2586 out->hsync_end = in->hsync_end; in drm_mode_convert_to_umode()
2587 out->htotal = in->htotal; in drm_mode_convert_to_umode()
2588 out->hskew = in->hskew; in drm_mode_convert_to_umode()
2589 out->vdisplay = in->vdisplay; in drm_mode_convert_to_umode()
2590 out->vsync_start = in->vsync_start; in drm_mode_convert_to_umode()
2591 out->vsync_end = in->vsync_end; in drm_mode_convert_to_umode()
2592 out->vtotal = in->vtotal; in drm_mode_convert_to_umode()
2593 out->vscan = in->vscan; in drm_mode_convert_to_umode()
2594 out->vrefresh = drm_mode_vrefresh(in); in drm_mode_convert_to_umode()
2595 out->flags = in->flags; in drm_mode_convert_to_umode()
2596 out->type = in->type; in drm_mode_convert_to_umode()
2598 switch (in->picture_aspect_ratio) { in drm_mode_convert_to_umode()
2600 out->flags |= DRM_MODE_FLAG_PIC_AR_4_3; in drm_mode_convert_to_umode()
2603 out->flags |= DRM_MODE_FLAG_PIC_AR_16_9; in drm_mode_convert_to_umode()
2606 out->flags |= DRM_MODE_FLAG_PIC_AR_64_27; in drm_mode_convert_to_umode()
2609 out->flags |= DRM_MODE_FLAG_PIC_AR_256_135; in drm_mode_convert_to_umode()
2613 in->picture_aspect_ratio); in drm_mode_convert_to_umode()
2616 out->flags |= DRM_MODE_FLAG_PIC_AR_NONE; in drm_mode_convert_to_umode()
2620 strscpy_pad(out->name, in->name, sizeof(out->name)); in drm_mode_convert_to_umode()
2624 * drm_mode_convert_umode - convert a modeinfo into a drm_display_mode
2639 if (in->clock > INT_MAX || in->vrefresh > INT_MAX) in drm_mode_convert_umode()
2640 return -ERANGE; in drm_mode_convert_umode()
2642 out->clock = in->clock; in drm_mode_convert_umode()
2643 out->hdisplay = in->hdisplay; in drm_mode_convert_umode()
2644 out->hsync_start = in->hsync_start; in drm_mode_convert_umode()
2645 out->hsync_end = in->hsync_end; in drm_mode_convert_umode()
2646 out->htotal = in->htotal; in drm_mode_convert_umode()
2647 out->hskew = in->hskew; in drm_mode_convert_umode()
2648 out->vdisplay = in->vdisplay; in drm_mode_convert_umode()
2649 out->vsync_start = in->vsync_start; in drm_mode_convert_umode()
2650 out->vsync_end = in->vsync_end; in drm_mode_convert_umode()
2651 out->vtotal = in->vtotal; in drm_mode_convert_umode()
2652 out->vscan = in->vscan; in drm_mode_convert_umode()
2653 out->flags = in->flags; in drm_mode_convert_umode()
2655 * Old xf86-video-vmware (possibly others too) used to in drm_mode_convert_umode()
2658 * useful for the kernel->userspace direction anyway. in drm_mode_convert_umode()
2660 out->type = in->type & DRM_MODE_TYPE_ALL; in drm_mode_convert_umode()
2661 strscpy_pad(out->name, in->name, sizeof(out->name)); in drm_mode_convert_umode()
2664 * as the aspect-ratio information is not stored in in drm_mode_convert_umode()
2665 * flags for kernel-mode, but in picture_aspect_ratio. in drm_mode_convert_umode()
2667 out->flags &= ~DRM_MODE_FLAG_PIC_AR_MASK; in drm_mode_convert_umode()
2669 switch (in->flags & DRM_MODE_FLAG_PIC_AR_MASK) { in drm_mode_convert_umode()
2671 out->picture_aspect_ratio = HDMI_PICTURE_ASPECT_4_3; in drm_mode_convert_umode()
2674 out->picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9; in drm_mode_convert_umode()
2677 out->picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27; in drm_mode_convert_umode()
2680 out->picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135; in drm_mode_convert_umode()
2683 out->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE; in drm_mode_convert_umode()
2686 return -EINVAL; in drm_mode_convert_umode()
2689 out->status = drm_mode_validate_driver(dev, out); in drm_mode_convert_umode()
2690 if (out->status != MODE_OK) in drm_mode_convert_umode()
2691 return -EINVAL; in drm_mode_convert_umode()
2699 * drm_mode_is_420_only - if a given videomode can be only supported in YCBCR420
2714 return test_bit(vic, display->hdmi.y420_vdb_modes); in drm_mode_is_420_only()
2719 * drm_mode_is_420_also - if a given videomode can be supported in YCBCR420
2734 return test_bit(vic, display->hdmi.y420_cmdb_modes); in drm_mode_is_420_also()
2738 * drm_mode_is_420 - if a given videomode can be supported in YCBCR420
2757 * drm_set_preferred_mode - Sets the preferred mode of a connector
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()