diff options
-rw-r--r-- | Documentation/DocBook/drm.tmpl | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_modes.c | 171 | ||||
-rw-r--r-- | include/drm/drm_modes.h | 8 |
3 files changed, 115 insertions, 65 deletions
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 50af3298ac1f..4268cbe6f95c 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl | |||
@@ -965,6 +965,7 @@ int max_width, max_height;</synopsis> | |||
965 | </itemizedlist> | 965 | </itemizedlist> |
966 | <sect2> | 966 | <sect2> |
967 | <title>Display Modes Function Reference</title> | 967 | <title>Display Modes Function Reference</title> |
968 | !Iinclude/drm/drm_modes.h | ||
968 | !Edrivers/gpu/drm/drm_modes.c | 969 | !Edrivers/gpu/drm/drm_modes.c |
969 | </sect2> | 970 | </sect2> |
970 | <sect2> | 971 | <sect2> |
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index cc352eed0191..8b410576fce4 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c | |||
@@ -63,9 +63,10 @@ EXPORT_SYMBOL(drm_mode_debug_printmodeline); | |||
63 | * drm_mode_create - create a new display mode | 63 | * drm_mode_create - create a new display mode |
64 | * @dev: DRM device | 64 | * @dev: DRM device |
65 | * | 65 | * |
66 | * Create a new drm_display_mode, give it an ID, and return it. | 66 | * Create a new, cleared drm_display_mode with kzalloc, allocate an ID for it |
67 | * and return it. | ||
67 | * | 68 | * |
68 | * RETURNS: | 69 | * Returns: |
69 | * Pointer to new mode on success, NULL on error. | 70 | * Pointer to new mode on success, NULL on error. |
70 | */ | 71 | */ |
71 | struct drm_display_mode *drm_mode_create(struct drm_device *dev) | 72 | struct drm_display_mode *drm_mode_create(struct drm_device *dev) |
@@ -90,7 +91,7 @@ EXPORT_SYMBOL(drm_mode_create); | |||
90 | * @dev: DRM device | 91 | * @dev: DRM device |
91 | * @mode: mode to remove | 92 | * @mode: mode to remove |
92 | * | 93 | * |
93 | * Free @mode's unique identifier, then free it. | 94 | * Release @mode's unique ID, then free it @mode structure itself using kfree. |
94 | */ | 95 | */ |
95 | void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode) | 96 | void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode) |
96 | { | 97 | { |
@@ -104,11 +105,13 @@ void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode) | |||
104 | EXPORT_SYMBOL(drm_mode_destroy); | 105 | EXPORT_SYMBOL(drm_mode_destroy); |
105 | 106 | ||
106 | /** | 107 | /** |
107 | * drm_mode_probed_add - add a mode to a connector's probed mode list | 108 | * drm_mode_probed_add - add a mode to a connector's probed_mode list |
108 | * @connector: connector the new mode | 109 | * @connector: connector the new mode |
109 | * @mode: mode data | 110 | * @mode: mode data |
110 | * | 111 | * |
111 | * Add @mode to @connector's mode list for later use. | 112 | * Add @mode to @connector's probed_mode list for later use. This list should |
113 | * then in a second step get filtered and all the modes actually supported by | ||
114 | * the hardware moved to the @connector's modes list. | ||
112 | */ | 115 | */ |
113 | void drm_mode_probed_add(struct drm_connector *connector, | 116 | void drm_mode_probed_add(struct drm_connector *connector, |
114 | struct drm_display_mode *mode) | 117 | struct drm_display_mode *mode) |
@@ -120,16 +123,14 @@ void drm_mode_probed_add(struct drm_connector *connector, | |||
120 | EXPORT_SYMBOL(drm_mode_probed_add); | 123 | EXPORT_SYMBOL(drm_mode_probed_add); |
121 | 124 | ||
122 | /** | 125 | /** |
123 | * drm_cvt_mode -create a modeline based on CVT algorithm | 126 | * drm_cvt_mode -create a modeline based on the CVT algorithm |
124 | * @dev: DRM device | 127 | * @dev: drm device |
125 | * @hdisplay: hdisplay size | 128 | * @hdisplay: hdisplay size |
126 | * @vdisplay: vdisplay size | 129 | * @vdisplay: vdisplay size |
127 | * @vrefresh : vrefresh rate | 130 | * @vrefresh: vrefresh rate |
128 | * @reduced : Whether the GTF calculation is simplified | 131 | * @reduced: whether to use reduced blanking |
129 | * @interlaced:Whether the interlace is supported | 132 | * @interlaced: whether to compute an interlaced mode |
130 | * @margins: whether to add margins or not | 133 | * @margins: whether to add margins (borders) |
131 | * | ||
132 | * return the modeline based on CVT algorithm | ||
133 | * | 134 | * |
134 | * This function is called to generate the modeline based on CVT algorithm | 135 | * This function is called to generate the modeline based on CVT algorithm |
135 | * according to the hdisplay, vdisplay, vrefresh. | 136 | * according to the hdisplay, vdisplay, vrefresh. |
@@ -139,6 +140,11 @@ EXPORT_SYMBOL(drm_mode_probed_add); | |||
139 | * | 140 | * |
140 | * And it is copied from xf86CVTmode in xserver/hw/xfree86/modes/xf86cvt.c. | 141 | * And it is copied from xf86CVTmode in xserver/hw/xfree86/modes/xf86cvt.c. |
141 | * What I have done is to translate it by using integer calculation. | 142 | * What I have done is to translate it by using integer calculation. |
143 | * | ||
144 | * Returns: | ||
145 | * The modeline based on the CVT algorithm stored in a drm_display_mode object. | ||
146 | * The display mode object is allocated with drm_mode_create(). Returns NULL | ||
147 | * when no mode could be allocated. | ||
142 | */ | 148 | */ |
143 | struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay, | 149 | struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay, |
144 | int vdisplay, int vrefresh, | 150 | int vdisplay, int vrefresh, |
@@ -338,23 +344,25 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay, | |||
338 | EXPORT_SYMBOL(drm_cvt_mode); | 344 | EXPORT_SYMBOL(drm_cvt_mode); |
339 | 345 | ||
340 | /** | 346 | /** |
341 | * drm_gtf_mode_complex - create the modeline based on full GTF algorithm | 347 | * drm_gtf_mode_complex - create the modeline based on the full GTF algorithm |
342 | * | 348 | * @dev: drm device |
343 | * @dev :drm device | 349 | * @hdisplay: hdisplay size |
344 | * @hdisplay :hdisplay size | 350 | * @vdisplay: vdisplay size |
345 | * @vdisplay :vdisplay size | 351 | * @vrefresh: vrefresh rate. |
346 | * @vrefresh :vrefresh rate. | 352 | * @interlaced: whether to compute an interlaced mode |
347 | * @interlaced :whether the interlace is supported | 353 | * @margins: desired margin (borders) size |
348 | * @margins :desired margin size | ||
349 | * @GTF_M: extended GTF formula parameters | 354 | * @GTF_M: extended GTF formula parameters |
350 | * @GTF_2C: extended GTF formula parameters | 355 | * @GTF_2C: extended GTF formula parameters |
351 | * @GTF_K: extended GTF formula parameters | 356 | * @GTF_K: extended GTF formula parameters |
352 | * @GTF_2J: extended GTF formula parameters | 357 | * @GTF_2J: extended GTF formula parameters |
353 | * | 358 | * |
354 | * return the modeline based on full GTF algorithm. | ||
355 | * | ||
356 | * GTF feature blocks specify C and J in multiples of 0.5, so we pass them | 359 | * GTF feature blocks specify C and J in multiples of 0.5, so we pass them |
357 | * in here multiplied by two. For a C of 40, pass in 80. | 360 | * in here multiplied by two. For a C of 40, pass in 80. |
361 | * | ||
362 | * Returns: | ||
363 | * The modeline based on the full GTF algorithm stored in a drm_display_mode object. | ||
364 | * The display mode object is allocated with drm_mode_create(). Returns NULL | ||
365 | * when no mode could be allocated. | ||
358 | */ | 366 | */ |
359 | struct drm_display_mode * | 367 | struct drm_display_mode * |
360 | drm_gtf_mode_complex(struct drm_device *dev, int hdisplay, int vdisplay, | 368 | drm_gtf_mode_complex(struct drm_device *dev, int hdisplay, int vdisplay, |
@@ -524,14 +532,13 @@ drm_gtf_mode_complex(struct drm_device *dev, int hdisplay, int vdisplay, | |||
524 | EXPORT_SYMBOL(drm_gtf_mode_complex); | 532 | EXPORT_SYMBOL(drm_gtf_mode_complex); |
525 | 533 | ||
526 | /** | 534 | /** |
527 | * drm_gtf_mode - create the modeline based on GTF algorithm | 535 | * drm_gtf_mode - create the modeline based on the GTF algorithm |
528 | * | 536 | * @dev: drm device |
529 | * @dev :drm device | 537 | * @hdisplay: hdisplay size |
530 | * @hdisplay :hdisplay size | 538 | * @vdisplay: vdisplay size |
531 | * @vdisplay :vdisplay size | 539 | * @vrefresh: vrefresh rate. |
532 | * @vrefresh :vrefresh rate. | 540 | * @interlaced: whether to compute an interlaced mode |
533 | * @interlaced :whether the interlace is supported | 541 | * @margins: desired margin (borders) size |
534 | * @margins :whether the margin is supported | ||
535 | * | 542 | * |
536 | * return the modeline based on GTF algorithm | 543 | * return the modeline based on GTF algorithm |
537 | * | 544 | * |
@@ -550,6 +557,11 @@ EXPORT_SYMBOL(drm_gtf_mode_complex); | |||
550 | * C = 40 | 557 | * C = 40 |
551 | * K = 128 | 558 | * K = 128 |
552 | * J = 20 | 559 | * J = 20 |
560 | * | ||
561 | * Returns: | ||
562 | * The modeline based on the GTF algorithm stored in a drm_display_mode object. | ||
563 | * The display mode object is allocated with drm_mode_create(). Returns NULL | ||
564 | * when no mode could be allocated. | ||
553 | */ | 565 | */ |
554 | struct drm_display_mode * | 566 | struct drm_display_mode * |
555 | drm_gtf_mode(struct drm_device *dev, int hdisplay, int vdisplay, int vrefresh, | 567 | drm_gtf_mode(struct drm_device *dev, int hdisplay, int vdisplay, int vrefresh, |
@@ -562,6 +574,13 @@ drm_gtf_mode(struct drm_device *dev, int hdisplay, int vdisplay, int vrefresh, | |||
562 | EXPORT_SYMBOL(drm_gtf_mode); | 574 | EXPORT_SYMBOL(drm_gtf_mode); |
563 | 575 | ||
564 | #ifdef CONFIG_VIDEOMODE_HELPERS | 576 | #ifdef CONFIG_VIDEOMODE_HELPERS |
577 | /** | ||
578 | * drm_display_mode_from_videomode - fill in @dmode using @vm, | ||
579 | * @vm: videomode structure to use as source | ||
580 | * @dmode: drm_display_mode structure to use as destination | ||
581 | * | ||
582 | * Fills out @dmode using the display mode specified in @vm. | ||
583 | */ | ||
565 | void drm_display_mode_from_videomode(const struct videomode *vm, | 584 | void drm_display_mode_from_videomode(const struct videomode *vm, |
566 | struct drm_display_mode *dmode) | 585 | struct drm_display_mode *dmode) |
567 | { | 586 | { |
@@ -606,6 +625,9 @@ EXPORT_SYMBOL_GPL(drm_display_mode_from_videomode); | |||
606 | * This function is expensive and should only be used, if only one mode is to be | 625 | * This function is expensive and should only be used, if only one mode is to be |
607 | * read from DT. To get multiple modes start with of_get_display_timings and | 626 | * read from DT. To get multiple modes start with of_get_display_timings and |
608 | * work with that instead. | 627 | * work with that instead. |
628 | * | ||
629 | * Returns: | ||
630 | * 0 on success, a negative errno code when no of videomode node was found. | ||
609 | */ | 631 | */ |
610 | int of_get_drm_display_mode(struct device_node *np, | 632 | int of_get_drm_display_mode(struct device_node *np, |
611 | struct drm_display_mode *dmode, int index) | 633 | struct drm_display_mode *dmode, int index) |
@@ -633,7 +655,8 @@ EXPORT_SYMBOL_GPL(of_get_drm_display_mode); | |||
633 | * drm_mode_set_name - set the name on a mode | 655 | * drm_mode_set_name - set the name on a mode |
634 | * @mode: name will be set in this mode | 656 | * @mode: name will be set in this mode |
635 | * | 657 | * |
636 | * Set the name of @mode to a standard format. | 658 | * Set the name of @mode to a standard format which is <hdisplay>x<vdisplay> |
659 | * with an optional 'i' suffix for interlaced modes. | ||
637 | */ | 660 | */ |
638 | void drm_mode_set_name(struct drm_display_mode *mode) | 661 | void drm_mode_set_name(struct drm_display_mode *mode) |
639 | { | 662 | { |
@@ -648,7 +671,9 @@ EXPORT_SYMBOL(drm_mode_set_name); | |||
648 | /** drm_mode_hsync - get the hsync of a mode | 671 | /** drm_mode_hsync - get the hsync of a mode |
649 | * @mode: mode | 672 | * @mode: mode |
650 | * | 673 | * |
651 | * Return @modes's hsync rate in kHz, rounded to the nearest int. | 674 | * Returns: |
675 | * @modes's hsync rate in kHz, rounded to the nearest integer. Calculates the | ||
676 | * value first if it is not yet set. | ||
652 | */ | 677 | */ |
653 | int drm_mode_hsync(const struct drm_display_mode *mode) | 678 | int drm_mode_hsync(const struct drm_display_mode *mode) |
654 | { | 679 | { |
@@ -672,14 +697,9 @@ EXPORT_SYMBOL(drm_mode_hsync); | |||
672 | * drm_mode_vrefresh - get the vrefresh of a mode | 697 | * drm_mode_vrefresh - get the vrefresh of a mode |
673 | * @mode: mode | 698 | * @mode: mode |
674 | * | 699 | * |
675 | * Return @mode's vrefresh rate in Hz or calculate it if necessary. | 700 | * Returns: |
676 | * | 701 | * @modes's vrefresh rate in Hz, rounded to the nearest integer. Calculates the |
677 | * FIXME: why is this needed? shouldn't vrefresh be set already? | 702 | * value first if it is not yet set. |
678 | * | ||
679 | * RETURNS: | ||
680 | * Vertical refresh rate. It will be the result of actual value plus 0.5. | ||
681 | * If it is 70.288, it will return 70Hz. | ||
682 | * If it is 59.6, it will return 60Hz. | ||
683 | */ | 703 | */ |
684 | int drm_mode_vrefresh(const struct drm_display_mode *mode) | 704 | int drm_mode_vrefresh(const struct drm_display_mode *mode) |
685 | { | 705 | { |
@@ -708,11 +728,11 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode) | |||
708 | EXPORT_SYMBOL(drm_mode_vrefresh); | 728 | EXPORT_SYMBOL(drm_mode_vrefresh); |
709 | 729 | ||
710 | /** | 730 | /** |
711 | * drm_mode_set_crtcinfo - set CRTC modesetting parameters | 731 | * drm_mode_set_crtcinfo - set CRTC modesetting timing parameters |
712 | * @p: mode | 732 | * @p: mode |
713 | * @adjust_flags: a combination of adjustment flags | 733 | * @adjust_flags: a combination of adjustment flags |
714 | * | 734 | * |
715 | * Setup the CRTC modesetting parameters for @p, adjusting if necessary. | 735 | * Setup the CRTC modesetting timing parameters for @p, adjusting if necessary. |
716 | * | 736 | * |
717 | * - The CRTC_INTERLACE_HALVE_V flag can be used to halve vertical timings of | 737 | * - The CRTC_INTERLACE_HALVE_V flag can be used to halve vertical timings of |
718 | * interlaced modes. | 738 | * interlaced modes. |
@@ -780,7 +800,6 @@ void drm_mode_set_crtcinfo(struct drm_display_mode *p, int adjust_flags) | |||
780 | } | 800 | } |
781 | EXPORT_SYMBOL(drm_mode_set_crtcinfo); | 801 | EXPORT_SYMBOL(drm_mode_set_crtcinfo); |
782 | 802 | ||
783 | |||
784 | /** | 803 | /** |
785 | * drm_mode_copy - copy the mode | 804 | * drm_mode_copy - copy the mode |
786 | * @dst: mode to overwrite | 805 | * @dst: mode to overwrite |
@@ -807,6 +826,9 @@ EXPORT_SYMBOL(drm_mode_copy); | |||
807 | * | 826 | * |
808 | * Just allocate a new mode, copy the existing mode into it, and return | 827 | * Just allocate a new mode, copy the existing mode into it, and return |
809 | * a pointer to it. Used to create new instances of established modes. | 828 | * a pointer to it. Used to create new instances of established modes. |
829 | * | ||
830 | * Returns: | ||
831 | * Pointer to duplicated mode on success, NULL on error. | ||
810 | */ | 832 | */ |
811 | struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, | 833 | struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, |
812 | const struct drm_display_mode *mode) | 834 | const struct drm_display_mode *mode) |
@@ -830,7 +852,7 @@ EXPORT_SYMBOL(drm_mode_duplicate); | |||
830 | * | 852 | * |
831 | * Check to see if @mode1 and @mode2 are equivalent. | 853 | * Check to see if @mode1 and @mode2 are equivalent. |
832 | * | 854 | * |
833 | * RETURNS: | 855 | * Returns: |
834 | * True if the modes are equal, false otherwise. | 856 | * True if the modes are equal, false otherwise. |
835 | */ | 857 | */ |
836 | bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2) | 858 | bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2) |
@@ -859,7 +881,7 @@ EXPORT_SYMBOL(drm_mode_equal); | |||
859 | * Check to see if @mode1 and @mode2 are equivalent, but | 881 | * Check to see if @mode1 and @mode2 are equivalent, but |
860 | * don't check the pixel clocks nor the stereo layout. | 882 | * don't check the pixel clocks nor the stereo layout. |
861 | * | 883 | * |
862 | * RETURNS: | 884 | * Returns: |
863 | * True if the modes are equal, false otherwise. | 885 | * True if the modes are equal, false otherwise. |
864 | */ | 886 | */ |
865 | bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1, | 887 | bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1, |
@@ -890,9 +912,10 @@ EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo); | |||
890 | * @maxX: maximum width | 912 | * @maxX: maximum width |
891 | * @maxY: maximum height | 913 | * @maxY: maximum height |
892 | * | 914 | * |
893 | * The DRM device (@dev) has size and pitch limits. Here we validate the | 915 | * This function is a helper which can be used to validate modes against size |
894 | * modes we probed for @dev against those limits and set their status as | 916 | * limitations of the DRM device/connector. If a mode is too big its status |
895 | * necessary. | 917 | * memeber is updated with the appropriate validation failure code. The list |
918 | * itself is not changed. | ||
896 | */ | 919 | */ |
897 | void drm_mode_validate_size(struct drm_device *dev, | 920 | void drm_mode_validate_size(struct drm_device *dev, |
898 | struct list_head *mode_list, | 921 | struct list_head *mode_list, |
@@ -916,9 +939,10 @@ EXPORT_SYMBOL(drm_mode_validate_size); | |||
916 | * @mode_list: list of modes to check | 939 | * @mode_list: list of modes to check |
917 | * @verbose: be verbose about it | 940 | * @verbose: be verbose about it |
918 | * | 941 | * |
919 | * Once mode list generation is complete, a caller can use this routine to | 942 | * This helper function can be used to prune a display mode list after |
920 | * remove invalid modes from a mode list. If any of the modes have a | 943 | * validation has been completed. All modes who's status is not MODE_OK will be |
921 | * status other than %MODE_OK, they are removed from @mode_list and freed. | 944 | * removed from the list, and if @verbose the status code and mode name is also |
945 | * printed to dmesg. | ||
922 | */ | 946 | */ |
923 | void drm_mode_prune_invalid(struct drm_device *dev, | 947 | void drm_mode_prune_invalid(struct drm_device *dev, |
924 | struct list_head *mode_list, bool verbose) | 948 | struct list_head *mode_list, bool verbose) |
@@ -948,7 +972,7 @@ EXPORT_SYMBOL(drm_mode_prune_invalid); | |||
948 | * Compare two modes, given by @lh_a and @lh_b, returning a value indicating | 972 | * Compare two modes, given by @lh_a and @lh_b, returning a value indicating |
949 | * which is better. | 973 | * which is better. |
950 | * | 974 | * |
951 | * RETURNS: | 975 | * Returns: |
952 | * Negative if @lh_a is better than @lh_b, zero if they're equivalent, or | 976 | * Negative if @lh_a is better than @lh_b, zero if they're equivalent, or |
953 | * positive if @lh_b is better than @lh_a. | 977 | * positive if @lh_b is better than @lh_a. |
954 | */ | 978 | */ |
@@ -976,9 +1000,9 @@ static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head | |||
976 | 1000 | ||
977 | /** | 1001 | /** |
978 | * drm_mode_sort - sort mode list | 1002 | * drm_mode_sort - sort mode list |
979 | * @mode_list: list to sort | 1003 | * @mode_list: list of drm_display_mode structures to sort |
980 | * | 1004 | * |
981 | * Sort @mode_list by favorability, putting good modes first. | 1005 | * Sort @mode_list by favorability, moving good modes to the head of the list. |
982 | */ | 1006 | */ |
983 | void drm_mode_sort(struct list_head *mode_list) | 1007 | void drm_mode_sort(struct list_head *mode_list) |
984 | { | 1008 | { |
@@ -992,8 +1016,10 @@ EXPORT_SYMBOL(drm_mode_sort); | |||
992 | * | 1016 | * |
993 | * This moves the modes from the @connector probed_modes list | 1017 | * This moves the modes from the @connector probed_modes list |
994 | * to the actual mode list. It compares the probed mode against the current | 1018 | * to the actual mode list. It compares the probed mode against the current |
995 | * list and only adds different modes. All modes unverified after this point | 1019 | * list and only adds different/new modes. |
996 | * will be removed by the prune invalid modes. | 1020 | * |
1021 | * This is just a helper functions doesn't validate any modes itself and also | ||
1022 | * doesn't prune any invalid modes. Callers need to do that themselves. | ||
997 | */ | 1023 | */ |
998 | void drm_mode_connector_list_update(struct drm_connector *connector) | 1024 | void drm_mode_connector_list_update(struct drm_connector *connector) |
999 | { | 1025 | { |
@@ -1028,18 +1054,25 @@ void drm_mode_connector_list_update(struct drm_connector *connector) | |||
1028 | EXPORT_SYMBOL(drm_mode_connector_list_update); | 1054 | EXPORT_SYMBOL(drm_mode_connector_list_update); |
1029 | 1055 | ||
1030 | /** | 1056 | /** |
1031 | * drm_mode_parse_command_line_for_connector - parse command line for connector | 1057 | * drm_mode_parse_command_line_for_connector - parse command line modeline for connector |
1032 | * @mode_option: per connector mode option | 1058 | * @mode_option: optional per connector mode option |
1033 | * @connector: connector to parse line for | 1059 | * @connector: connector to parse modeline for |
1034 | * @mode: preallocated mode structure to fill out | 1060 | * @mode: preallocated drm_cmdline_mode structure to fill out |
1061 | * | ||
1062 | * This parses @mode_option command line modeline for modes and options to | ||
1063 | * configure the connector. If @mode_option is NULL the default command line | ||
1064 | * modeline in fb_mode_option will be parsed instead. | ||
1035 | * | 1065 | * |
1036 | * This parses the connector specific then generic command lines for | 1066 | * This uses the same parameters as the fb modedb.c, except for an extra |
1037 | * modes and options to configure the connector. | 1067 | * force-enable, force-enable-digital and force-disable bit at the end: |
1038 | * | 1068 | * |
1039 | * This uses the same parameters as the fb modedb.c, except for extra | ||
1040 | * <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd] | 1069 | * <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd] |
1041 | * | 1070 | * |
1042 | * enable/enable Digital/disable bit at the end | 1071 | * The intermediate drm_cmdline_mode structure is required to store additional |
1072 | * options from the command line modline like the force-enabel/disable flag. | ||
1073 | * | ||
1074 | * Returns: | ||
1075 | * True if a valid modeline has been parsed, false otherwise. | ||
1043 | */ | 1076 | */ |
1044 | bool drm_mode_parse_command_line_for_connector(const char *mode_option, | 1077 | bool drm_mode_parse_command_line_for_connector(const char *mode_option, |
1045 | struct drm_connector *connector, | 1078 | struct drm_connector *connector, |
@@ -1192,6 +1225,14 @@ done: | |||
1192 | } | 1225 | } |
1193 | EXPORT_SYMBOL(drm_mode_parse_command_line_for_connector); | 1226 | EXPORT_SYMBOL(drm_mode_parse_command_line_for_connector); |
1194 | 1227 | ||
1228 | /** | ||
1229 | * drm_mode_create_from_cmdline_mode - convert a command line modeline into a DRM display mode | ||
1230 | * @dev: DRM device to create the new mode for | ||
1231 | * @cmd: input command line modeline | ||
1232 | * | ||
1233 | * Returns: | ||
1234 | * Pointer to converted mode on success, NULL on error. | ||
1235 | */ | ||
1195 | struct drm_display_mode * | 1236 | struct drm_display_mode * |
1196 | drm_mode_create_from_cmdline_mode(struct drm_device *dev, | 1237 | drm_mode_create_from_cmdline_mode(struct drm_device *dev, |
1197 | struct drm_cmdline_mode *cmd) | 1238 | struct drm_cmdline_mode *cmd) |
diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h index b3507f15d010..995c34d91ef1 100644 --- a/include/drm/drm_modes.h +++ b/include/drm/drm_modes.h | |||
@@ -162,6 +162,14 @@ struct drm_cmdline_mode { | |||
162 | enum drm_connector_force force; | 162 | enum drm_connector_force force; |
163 | }; | 163 | }; |
164 | 164 | ||
165 | /** | ||
166 | * drm_mode_is_stereo - check for stereo mode flags | ||
167 | * @mode: drm_display_mode to check | ||
168 | * | ||
169 | * Returns: | ||
170 | * True if the mode is one of the stereo modes (like side-by-side), false if | ||
171 | * not. | ||
172 | */ | ||
165 | static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode) | 173 | static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode) |
166 | { | 174 | { |
167 | return mode->flags & DRM_MODE_FLAG_3D_MASK; | 175 | return mode->flags & DRM_MODE_FLAG_3D_MASK; |