Lines Matching +full:analog +full:- +full:pass +full:- +full:through
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
534 * an analog TV output, for one of the usual analog TV modes. Where
535 * this is DRM_MODE_TV_MODE_MONOCHROME, a 625-line mode will be created.
553 enum drm_mode_analog analog; in drm_analog_tv_mode() local
564 analog = DRM_MODE_ANALOG_NTSC; in drm_analog_tv_mode()
574 analog = DRM_MODE_ANALOG_PAL; in drm_analog_tv_mode()
586 &tv_modes_parameters[analog], in drm_analog_tv_mode()
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()
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
840 * GTF feature blocks specify C and J in multiples of 0.5, so we pass them
841 * in here multiplied by two. For a C of 40, pass in 80.
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()
967 ideal_duty_cycle = GTF_C_PRIME * 1000 - in drm_gtf_mode_complex()
972 (100000 - ideal_duty_cycle); in drm_gtf_mode_complex()
979 /* Stage 1 computations are now complete; I should really pass 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
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
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
1292 if (mode->htotal == 0 || mode->vtotal == 0) in drm_mode_vrefresh()
1295 if (mode->flags & DRM_MODE_FLAG_INTERLACE) in drm_mode_vrefresh()
1297 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) in drm_mode_vrefresh()
1299 if (mode->vscan > 1) in drm_mode_vrefresh()
1300 den *= mode->vscan; in drm_mode_vrefresh()
1302 if (check_mul_overflow(mode->clock, num, &num)) in drm_mode_vrefresh()
1305 if (check_mul_overflow(mode->htotal * mode->vtotal, den, &den)) in drm_mode_vrefresh()
1313 * drm_mode_get_hv_timing - Fetches hdisplay/vdisplay for given mode
1335 * drm_mode_set_crtcinfo - set CRTC modesetting timing parameters
1341 * - The CRTC_INTERLACE_HALVE_V flag can be used to halve vertical timings of
1343 * - The CRTC_STEREO_DOUBLE flag can be used to compute the timings for
1346 * - The CRTC_NO_DBLSCAN and CRTC_NO_VSCAN flags request that adjustment *not*
1354 p->crtc_clock = p->clock; in drm_mode_set_crtcinfo()
1355 p->crtc_hdisplay = p->hdisplay; in drm_mode_set_crtcinfo()
1356 p->crtc_hsync_start = p->hsync_start; in drm_mode_set_crtcinfo()
1357 p->crtc_hsync_end = p->hsync_end; in drm_mode_set_crtcinfo()
1358 p->crtc_htotal = p->htotal; in drm_mode_set_crtcinfo()
1359 p->crtc_hskew = p->hskew; in drm_mode_set_crtcinfo()
1360 p->crtc_vdisplay = p->vdisplay; in drm_mode_set_crtcinfo()
1361 p->crtc_vsync_start = p->vsync_start; in drm_mode_set_crtcinfo()
1362 p->crtc_vsync_end = p->vsync_end; in drm_mode_set_crtcinfo()
1363 p->crtc_vtotal = p->vtotal; in drm_mode_set_crtcinfo()
1365 if (p->flags & DRM_MODE_FLAG_INTERLACE) { in drm_mode_set_crtcinfo()
1367 p->crtc_vdisplay /= 2; in drm_mode_set_crtcinfo()
1368 p->crtc_vsync_start /= 2; in drm_mode_set_crtcinfo()
1369 p->crtc_vsync_end /= 2; in drm_mode_set_crtcinfo()
1370 p->crtc_vtotal /= 2; in drm_mode_set_crtcinfo()
1375 if (p->flags & DRM_MODE_FLAG_DBLSCAN) { in drm_mode_set_crtcinfo()
1376 p->crtc_vdisplay *= 2; in drm_mode_set_crtcinfo()
1377 p->crtc_vsync_start *= 2; in drm_mode_set_crtcinfo()
1378 p->crtc_vsync_end *= 2; in drm_mode_set_crtcinfo()
1379 p->crtc_vtotal *= 2; in drm_mode_set_crtcinfo()
1384 if (p->vscan > 1) { in drm_mode_set_crtcinfo()
1385 p->crtc_vdisplay *= p->vscan; in drm_mode_set_crtcinfo()
1386 p->crtc_vsync_start *= p->vscan; in drm_mode_set_crtcinfo()
1387 p->crtc_vsync_end *= p->vscan; in drm_mode_set_crtcinfo()
1388 p->crtc_vtotal *= p->vscan; in drm_mode_set_crtcinfo()
1393 unsigned int layout = p->flags & DRM_MODE_FLAG_3D_MASK; in drm_mode_set_crtcinfo()
1397 p->crtc_clock *= 2; in drm_mode_set_crtcinfo()
1398 p->crtc_vdisplay += p->crtc_vtotal; in drm_mode_set_crtcinfo()
1399 p->crtc_vsync_start += p->crtc_vtotal; in drm_mode_set_crtcinfo()
1400 p->crtc_vsync_end += p->crtc_vtotal; in drm_mode_set_crtcinfo()
1401 p->crtc_vtotal += p->crtc_vtotal; in drm_mode_set_crtcinfo()
1406 p->crtc_vblank_start = min(p->crtc_vsync_start, p->crtc_vdisplay); in drm_mode_set_crtcinfo()
1407 p->crtc_vblank_end = max(p->crtc_vsync_end, p->crtc_vtotal); in drm_mode_set_crtcinfo()
1408 p->crtc_hblank_start = min(p->crtc_hsync_start, p->crtc_hdisplay); in drm_mode_set_crtcinfo()
1409 p->crtc_hblank_end = max(p->crtc_hsync_end, p->crtc_htotal); in drm_mode_set_crtcinfo()
1414 * drm_mode_copy - copy the mode
1423 struct list_head head = dst->head; in drm_mode_copy()
1426 dst->head = head; in drm_mode_copy()
1431 * drm_mode_init - initialize the mode from another mode
1438 * garbage in on-stack modes.
1448 * drm_mode_duplicate - allocate and duplicate an existing mode
1476 return mode1->hdisplay == mode2->hdisplay && in drm_mode_match_timings()
1477 mode1->hsync_start == mode2->hsync_start && in drm_mode_match_timings()
1478 mode1->hsync_end == mode2->hsync_end && in drm_mode_match_timings()
1479 mode1->htotal == mode2->htotal && in drm_mode_match_timings()
1480 mode1->hskew == mode2->hskew && in drm_mode_match_timings()
1481 mode1->vdisplay == mode2->vdisplay && in drm_mode_match_timings()
1482 mode1->vsync_start == mode2->vsync_start && in drm_mode_match_timings()
1483 mode1->vsync_end == mode2->vsync_end && in drm_mode_match_timings()
1484 mode1->vtotal == mode2->vtotal && in drm_mode_match_timings()
1485 mode1->vscan == mode2->vscan; in drm_mode_match_timings()
1495 if (mode1->clock && mode2->clock) in drm_mode_match_clock()
1496 return KHZ2PICOS(mode1->clock) == KHZ2PICOS(mode2->clock); in drm_mode_match_clock()
1498 return mode1->clock == mode2->clock; in drm_mode_match_clock()
1504 return (mode1->flags & ~DRM_MODE_FLAG_3D_MASK) == in drm_mode_match_flags()
1505 (mode2->flags & ~DRM_MODE_FLAG_3D_MASK); in drm_mode_match_flags()
1511 return (mode1->flags & DRM_MODE_FLAG_3D_MASK) == in drm_mode_match_3d_flags()
1512 (mode2->flags & DRM_MODE_FLAG_3D_MASK); in drm_mode_match_3d_flags()
1518 return mode1->picture_aspect_ratio == mode2->picture_aspect_ratio; in drm_mode_match_aspect_ratio()
1522 * drm_mode_match - test modes for (partial) equality
1567 * drm_mode_equal - test modes for equality
1589 * drm_mode_equal_no_clocks - test modes for equality
1610 * drm_mode_equal_no_clocks_no_stereo - test modes for equality
1632 if (mode->type & ~DRM_MODE_TYPE_ALL) in drm_mode_validate_basic()
1635 if (mode->flags & ~DRM_MODE_FLAG_ALL) in drm_mode_validate_basic()
1638 if ((mode->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX) in drm_mode_validate_basic()
1641 if (mode->clock == 0) in drm_mode_validate_basic()
1644 if (mode->hdisplay == 0 || in drm_mode_validate_basic()
1645 mode->hsync_start < mode->hdisplay || in drm_mode_validate_basic()
1646 mode->hsync_end < mode->hsync_start || in drm_mode_validate_basic()
1647 mode->htotal < mode->hsync_end) in drm_mode_validate_basic()
1650 if (mode->vdisplay == 0 || in drm_mode_validate_basic()
1651 mode->vsync_start < mode->vdisplay || in drm_mode_validate_basic()
1652 mode->vsync_end < mode->vsync_start || in drm_mode_validate_basic()
1653 mode->vtotal < mode->vsync_end) in drm_mode_validate_basic()
1660 * drm_mode_validate_driver - make sure the mode is somewhat sane
1681 if (dev->mode_config.funcs->mode_valid) in drm_mode_validate_driver()
1682 return dev->mode_config.funcs->mode_valid(dev, mode); in drm_mode_validate_driver()
1689 * drm_mode_validate_size - make sure modes adhere to size constraints
1706 if (maxX > 0 && mode->hdisplay > maxX) in drm_mode_validate_size()
1709 if (maxY > 0 && mode->vdisplay > maxY) in drm_mode_validate_size()
1717 * drm_mode_validate_ycbcr420 - add 'ycbcr420-only' modes only when allowed
1731 if (!connector->ycbcr_420_allowed && in drm_mode_validate_ycbcr420()
1732 drm_mode_is_420_only(&connector->display_info, mode)) in drm_mode_validate_ycbcr420()
1797 * drm_mode_prune_invalid - remove invalid modes from mode list
1813 if (mode->status != MODE_OK) { in drm_mode_prune_invalid()
1814 list_del(&mode->head); in drm_mode_prune_invalid()
1815 if (mode->type & DRM_MODE_TYPE_USERDEF) { in drm_mode_prune_invalid()
1816 drm_warn(dev, "User-defined mode not supported: " in drm_mode_prune_invalid()
1821 DRM_MODE_ARG(mode), drm_get_mode_status_name(mode->status)); in drm_mode_prune_invalid()
1830 * drm_mode_compare - compare modes for favorability
1849 diff = ((b->type & DRM_MODE_TYPE_PREFERRED) != 0) - in drm_mode_compare()
1850 ((a->type & DRM_MODE_TYPE_PREFERRED) != 0); in drm_mode_compare()
1853 diff = b->hdisplay * b->vdisplay - a->hdisplay * a->vdisplay; in drm_mode_compare()
1857 diff = drm_mode_vrefresh(b) - drm_mode_vrefresh(a); in drm_mode_compare()
1861 diff = b->clock - a->clock; in drm_mode_compare()
1866 * drm_mode_sort - sort mode list
1878 * drm_connector_list_update - update the mode list for the connector
1892 WARN_ON(!mutex_is_locked(&connector->dev->mode_config.mutex)); in drm_connector_list_update()
1894 list_for_each_entry_safe(pmode, pt, &connector->probed_modes, head) { in drm_connector_list_update()
1898 /* go through current modes checking for the new probed mode */ in drm_connector_list_update()
1899 list_for_each_entry(mode, &connector->modes, head) { in drm_connector_list_update()
1917 if (mode->status == MODE_STALE) { in drm_connector_list_update()
1919 } else if ((mode->type & DRM_MODE_TYPE_PREFERRED) == 0 && in drm_connector_list_update()
1920 (pmode->type & DRM_MODE_TYPE_PREFERRED) != 0) { in drm_connector_list_update()
1921 pmode->type |= mode->type; in drm_connector_list_update()
1924 mode->type |= pmode->type; in drm_connector_list_update()
1927 list_del(&pmode->head); in drm_connector_list_update()
1928 drm_mode_destroy(connector->dev, pmode); in drm_connector_list_update()
1933 list_move_tail(&pmode->head, &connector->modes); in drm_connector_list_update()
1944 if (str[0] != '-') in drm_mode_parse_cmdline_bpp()
1945 return -EINVAL; in drm_mode_parse_cmdline_bpp()
1950 return -EINVAL; in drm_mode_parse_cmdline_bpp()
1952 mode->bpp = bpp; in drm_mode_parse_cmdline_bpp()
1953 mode->bpp_specified = true; in drm_mode_parse_cmdline_bpp()
1964 return -EINVAL; in drm_mode_parse_cmdline_refresh()
1969 return -EINVAL; in drm_mode_parse_cmdline_refresh()
1971 mode->refresh = refresh; in drm_mode_parse_cmdline_refresh()
1972 mode->refresh_specified = true; in drm_mode_parse_cmdline_refresh()
1988 return -EINVAL; in drm_mode_parse_cmdline_extra()
1990 mode->interlace = true; in drm_mode_parse_cmdline_extra()
1994 return -EINVAL; in drm_mode_parse_cmdline_extra()
1996 mode->margins = true; in drm_mode_parse_cmdline_extra()
1999 if (mode->force != DRM_FORCE_UNSPECIFIED) in drm_mode_parse_cmdline_extra()
2000 return -EINVAL; in drm_mode_parse_cmdline_extra()
2002 if ((connector->connector_type != DRM_MODE_CONNECTOR_DVII) && in drm_mode_parse_cmdline_extra()
2003 (connector->connector_type != DRM_MODE_CONNECTOR_HDMIB)) in drm_mode_parse_cmdline_extra()
2004 mode->force = DRM_FORCE_ON; in drm_mode_parse_cmdline_extra()
2006 mode->force = DRM_FORCE_ON_DIGITAL; in drm_mode_parse_cmdline_extra()
2009 if (mode->force != DRM_FORCE_UNSPECIFIED) in drm_mode_parse_cmdline_extra()
2010 return -EINVAL; in drm_mode_parse_cmdline_extra()
2012 mode->force = DRM_FORCE_OFF; in drm_mode_parse_cmdline_extra()
2015 if (mode->force != DRM_FORCE_UNSPECIFIED) in drm_mode_parse_cmdline_extra()
2016 return -EINVAL; in drm_mode_parse_cmdline_extra()
2018 mode->force = DRM_FORCE_ON; in drm_mode_parse_cmdline_extra()
2021 return -EINVAL; in drm_mode_parse_cmdline_extra()
2041 return -EINVAL; in drm_mode_parse_cmdline_res_mode()
2044 return -EINVAL; in drm_mode_parse_cmdline_res_mode()
2050 return -EINVAL; in drm_mode_parse_cmdline_res_mode()
2052 remaining = length - (end_ptr - str_start); in drm_mode_parse_cmdline_res_mode()
2054 return -EINVAL; in drm_mode_parse_cmdline_res_mode()
2066 * Try to pass that to our extras parsing in drm_mode_parse_cmdline_res_mode()
2079 return -EINVAL; in drm_mode_parse_cmdline_res_mode()
2084 mode->xres = xres; in drm_mode_parse_cmdline_res_mode()
2085 mode->yres = yres; in drm_mode_parse_cmdline_res_mode()
2086 mode->cvt = cvt; in drm_mode_parse_cmdline_res_mode()
2087 mode->rb = rb; in drm_mode_parse_cmdline_res_mode()
2103 return -EINVAL; in drm_mode_parse_cmdline_int()
2110 return -EINVAL; in drm_mode_parse_cmdline_int()
2121 return -EINVAL; in drm_mode_parse_panel_orientation()
2128 if (!strncmp(value, "normal", delim - value)) in drm_mode_parse_panel_orientation()
2129 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; in drm_mode_parse_panel_orientation()
2130 else if (!strncmp(value, "upside_down", delim - value)) in drm_mode_parse_panel_orientation()
2131 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; in drm_mode_parse_panel_orientation()
2132 else if (!strncmp(value, "left_side_up", delim - value)) in drm_mode_parse_panel_orientation()
2133 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP; in drm_mode_parse_panel_orientation()
2134 else if (!strncmp(value, "right_side_up", delim - value)) in drm_mode_parse_panel_orientation()
2135 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; in drm_mode_parse_panel_orientation()
2137 return -EINVAL; in drm_mode_parse_panel_orientation()
2149 return -EINVAL; in drm_mode_parse_tv_mode()
2156 ret = drm_get_tv_mode_from_name(value, delim - value); in drm_mode_parse_tv_mode()
2160 mode->tv_mode_specified = true; in drm_mode_parse_tv_mode()
2161 mode->tv_mode = ret; in drm_mode_parse_tv_mode()
2184 if (!strncmp(option, "rotate", delim - option)) { in drm_mode_parse_cmdline_options()
2186 return -EINVAL; in drm_mode_parse_cmdline_options()
2206 return -EINVAL; in drm_mode_parse_cmdline_options()
2208 } else if (!strncmp(option, "reflect_x", delim - option)) { in drm_mode_parse_cmdline_options()
2210 } else if (!strncmp(option, "reflect_y", delim - option)) { in drm_mode_parse_cmdline_options()
2212 } else if (!strncmp(option, "margin_right", delim - option)) { in drm_mode_parse_cmdline_options()
2214 return -EINVAL; in drm_mode_parse_cmdline_options()
2216 mode->tv_margins.right = margin; in drm_mode_parse_cmdline_options()
2217 } else if (!strncmp(option, "margin_left", delim - option)) { in drm_mode_parse_cmdline_options()
2219 return -EINVAL; in drm_mode_parse_cmdline_options()
2221 mode->tv_margins.left = margin; in drm_mode_parse_cmdline_options()
2222 } else if (!strncmp(option, "margin_top", delim - option)) { in drm_mode_parse_cmdline_options()
2224 return -EINVAL; in drm_mode_parse_cmdline_options()
2226 mode->tv_margins.top = margin; in drm_mode_parse_cmdline_options()
2227 } else if (!strncmp(option, "margin_bottom", delim - option)) { in drm_mode_parse_cmdline_options()
2229 return -EINVAL; in drm_mode_parse_cmdline_options()
2231 mode->tv_margins.bottom = margin; in drm_mode_parse_cmdline_options()
2232 } else if (!strncmp(option, "panel_orientation", delim - option)) { in drm_mode_parse_cmdline_options()
2234 return -EINVAL; in drm_mode_parse_cmdline_options()
2235 } else if (!strncmp(option, "tv_mode", delim - option)) { in drm_mode_parse_cmdline_options()
2237 return -EINVAL; in drm_mode_parse_cmdline_options()
2239 return -EINVAL; in drm_mode_parse_cmdline_options()
2246 return -EINVAL; in drm_mode_parse_cmdline_options()
2253 return -EINVAL; in drm_mode_parse_cmdline_options()
2255 mode->rotation_reflection = rotation; in drm_mode_parse_cmdline_options()
2281 NAMED_MODE("NTSC-J", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_NTSC_J),
2283 NAMED_MODE("PAL-M", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_PAL_M),
2300 * If there's an equal sign in the name, the command-line in drm_mode_parse_cmdline_named_mode()
2319 ret = str_has_prefix(name, mode->name); in drm_mode_parse_cmdline_named_mode()
2323 strscpy(cmdline_mode->name, mode->name, sizeof(cmdline_mode->name)); in drm_mode_parse_cmdline_named_mode()
2324 cmdline_mode->pixel_clock = mode->pixel_clock_khz; in drm_mode_parse_cmdline_named_mode()
2325 cmdline_mode->xres = mode->xres; in drm_mode_parse_cmdline_named_mode()
2326 cmdline_mode->yres = mode->yres; in drm_mode_parse_cmdline_named_mode()
2327 cmdline_mode->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE); in drm_mode_parse_cmdline_named_mode()
2328 cmdline_mode->tv_mode = mode->tv_mode; in drm_mode_parse_cmdline_named_mode()
2329 cmdline_mode->tv_mode_specified = true; in drm_mode_parse_cmdline_named_mode()
2330 cmdline_mode->specified = true; in drm_mode_parse_cmdline_named_mode()
2335 return -EINVAL; in drm_mode_parse_cmdline_named_mode()
2339 * drm_mode_parse_command_line_for_connector - parse command line modeline for connector
2348 * force-enable, force-enable-digital and force-disable bit at the end::
2350 * <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd]
2357 * options from the command line modline like the force-enable/disable flag.
2376 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; in drm_mode_parse_command_line_for_connector()
2386 options_off = options_ptr - name; in drm_mode_parse_command_line_for_connector()
2391 bpp_ptr = strnchr(name, options_off, '-'); in drm_mode_parse_command_line_for_connector()
2393 bpp_ptr = strnchr(bpp_ptr + 1, options_off, '-'); in drm_mode_parse_command_line_for_connector()
2395 bpp_off = bpp_ptr - name; in drm_mode_parse_command_line_for_connector()
2399 refresh_off = refresh_ptr - name; in drm_mode_parse_command_line_for_connector()
2423 * an at-sign (used to specify a refresh rate) is disallowed. in drm_mode_parse_command_line_for_connector()
2429 if (!mode->specified && isdigit(name[0])) { in drm_mode_parse_command_line_for_connector()
2437 mode->specified = true; in drm_mode_parse_command_line_for_connector()
2441 if (!mode->specified) { in drm_mode_parse_command_line_for_connector()
2450 options_ptr = mode_option - 1; in drm_mode_parse_command_line_for_connector()
2460 mode->bpp_specified = true; in drm_mode_parse_command_line_for_connector()
2469 mode->refresh_specified = true; in drm_mode_parse_command_line_for_connector()
2485 len = options_ptr - extra_ptr; in drm_mode_parse_command_line_for_connector()
2515 if (strcmp(cmd->name, named_mode->name)) in drm_named_mode()
2518 if (!cmd->tv_mode_specified) in drm_named_mode()
2522 named_mode->tv_mode, in drm_named_mode()
2523 named_mode->pixel_clock_khz * 1000, in drm_named_mode()
2524 named_mode->xres, in drm_named_mode()
2525 named_mode->yres, in drm_named_mode()
2526 named_mode->flags & DRM_MODE_FLAG_INTERLACE); in drm_named_mode()
2533 * drm_mode_create_from_cmdline_mode - convert a command line modeline into a DRM display mode
2546 if (cmd->xres == 0 || cmd->yres == 0) in drm_mode_create_from_cmdline_mode()
2549 if (strlen(cmd->name)) in drm_mode_create_from_cmdline_mode()
2551 else if (cmd->cvt) in drm_mode_create_from_cmdline_mode()
2553 cmd->xres, cmd->yres, in drm_mode_create_from_cmdline_mode()
2554 cmd->refresh_specified ? cmd->refresh : 60, in drm_mode_create_from_cmdline_mode()
2555 cmd->rb, cmd->interlace, in drm_mode_create_from_cmdline_mode()
2556 cmd->margins); in drm_mode_create_from_cmdline_mode()
2559 cmd->xres, cmd->yres, in drm_mode_create_from_cmdline_mode()
2560 cmd->refresh_specified ? cmd->refresh : 60, in drm_mode_create_from_cmdline_mode()
2561 cmd->interlace, in drm_mode_create_from_cmdline_mode()
2562 cmd->margins); in drm_mode_create_from_cmdline_mode()
2566 mode->type |= DRM_MODE_TYPE_USERDEF; in drm_mode_create_from_cmdline_mode()
2568 if (cmd->xres == 1366) in drm_mode_create_from_cmdline_mode()
2576 * drm_mode_convert_to_umode - convert a drm_display_mode into a modeinfo
2586 out->clock = in->clock; in drm_mode_convert_to_umode()
2587 out->hdisplay = in->hdisplay; in drm_mode_convert_to_umode()
2588 out->hsync_start = in->hsync_start; in drm_mode_convert_to_umode()
2589 out->hsync_end = in->hsync_end; in drm_mode_convert_to_umode()
2590 out->htotal = in->htotal; in drm_mode_convert_to_umode()
2591 out->hskew = in->hskew; in drm_mode_convert_to_umode()
2592 out->vdisplay = in->vdisplay; in drm_mode_convert_to_umode()
2593 out->vsync_start = in->vsync_start; in drm_mode_convert_to_umode()
2594 out->vsync_end = in->vsync_end; in drm_mode_convert_to_umode()
2595 out->vtotal = in->vtotal; in drm_mode_convert_to_umode()
2596 out->vscan = in->vscan; in drm_mode_convert_to_umode()
2597 out->vrefresh = drm_mode_vrefresh(in); in drm_mode_convert_to_umode()
2598 out->flags = in->flags; in drm_mode_convert_to_umode()
2599 out->type = in->type; in drm_mode_convert_to_umode()
2601 switch (in->picture_aspect_ratio) { in drm_mode_convert_to_umode()
2603 out->flags |= DRM_MODE_FLAG_PIC_AR_4_3; in drm_mode_convert_to_umode()
2606 out->flags |= DRM_MODE_FLAG_PIC_AR_16_9; in drm_mode_convert_to_umode()
2609 out->flags |= DRM_MODE_FLAG_PIC_AR_64_27; in drm_mode_convert_to_umode()
2612 out->flags |= DRM_MODE_FLAG_PIC_AR_256_135; in drm_mode_convert_to_umode()
2616 in->picture_aspect_ratio); in drm_mode_convert_to_umode()
2619 out->flags |= DRM_MODE_FLAG_PIC_AR_NONE; in drm_mode_convert_to_umode()
2623 strscpy_pad(out->name, in->name, sizeof(out->name)); in drm_mode_convert_to_umode()
2627 * drm_mode_convert_umode - convert a modeinfo into a drm_display_mode
2642 if (in->clock > INT_MAX || in->vrefresh > INT_MAX) in drm_mode_convert_umode()
2643 return -ERANGE; in drm_mode_convert_umode()
2645 out->clock = in->clock; in drm_mode_convert_umode()
2646 out->hdisplay = in->hdisplay; in drm_mode_convert_umode()
2647 out->hsync_start = in->hsync_start; in drm_mode_convert_umode()
2648 out->hsync_end = in->hsync_end; in drm_mode_convert_umode()
2649 out->htotal = in->htotal; in drm_mode_convert_umode()
2650 out->hskew = in->hskew; in drm_mode_convert_umode()
2651 out->vdisplay = in->vdisplay; in drm_mode_convert_umode()
2652 out->vsync_start = in->vsync_start; in drm_mode_convert_umode()
2653 out->vsync_end = in->vsync_end; in drm_mode_convert_umode()
2654 out->vtotal = in->vtotal; in drm_mode_convert_umode()
2655 out->vscan = in->vscan; in drm_mode_convert_umode()
2656 out->flags = in->flags; in drm_mode_convert_umode()
2658 * Old xf86-video-vmware (possibly others too) used to in drm_mode_convert_umode()
2661 * useful for the kernel->userspace direction anyway. in drm_mode_convert_umode()
2663 out->type = in->type & DRM_MODE_TYPE_ALL; in drm_mode_convert_umode()
2664 strscpy_pad(out->name, in->name, sizeof(out->name)); in drm_mode_convert_umode()
2667 * as the aspect-ratio information is not stored in in drm_mode_convert_umode()
2668 * flags for kernel-mode, but in picture_aspect_ratio. in drm_mode_convert_umode()
2670 out->flags &= ~DRM_MODE_FLAG_PIC_AR_MASK; in drm_mode_convert_umode()
2672 switch (in->flags & DRM_MODE_FLAG_PIC_AR_MASK) { in drm_mode_convert_umode()
2674 out->picture_aspect_ratio = HDMI_PICTURE_ASPECT_4_3; in drm_mode_convert_umode()
2677 out->picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9; in drm_mode_convert_umode()
2680 out->picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27; in drm_mode_convert_umode()
2683 out->picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135; in drm_mode_convert_umode()
2686 out->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE; in drm_mode_convert_umode()
2689 return -EINVAL; in drm_mode_convert_umode()
2692 out->status = drm_mode_validate_driver(dev, out); in drm_mode_convert_umode()
2693 if (out->status != MODE_OK) in drm_mode_convert_umode()
2694 return -EINVAL; in drm_mode_convert_umode()
2702 * drm_mode_is_420_only - if a given videomode can be only supported in YCBCR420
2717 return test_bit(vic, display->hdmi.y420_vdb_modes); in drm_mode_is_420_only()
2722 * drm_mode_is_420_also - if a given videomode can be supported in YCBCR420
2737 return test_bit(vic, display->hdmi.y420_cmdb_modes); in drm_mode_is_420_also()
2741 * drm_mode_is_420 - if a given videomode can be supported in YCBCR420
2760 * drm_set_preferred_mode - Sets the preferred mode of a connector
2773 list_for_each_entry(mode, &connector->probed_modes, head) { in drm_set_preferred_mode()
2774 if (mode->hdisplay == hpref && in drm_set_preferred_mode()
2775 mode->vdisplay == vpref) in drm_set_preferred_mode()
2776 mode->type |= DRM_MODE_TYPE_PREFERRED; in drm_set_preferred_mode()