diff options
-rw-r--r-- | Documentation/DocBook/drm.tmpl | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_crtc_helper.c | 66 |
2 files changed, 46 insertions, 24 deletions
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 9a4c06ddebdd..b501aa7528d1 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl | |||
@@ -2096,6 +2096,10 @@ void intel_crt_init(struct drm_device *dev) | |||
2096 | </listitem> | 2096 | </listitem> |
2097 | </itemizedlist> | 2097 | </itemizedlist> |
2098 | </sect2> | 2098 | </sect2> |
2099 | <sect2> | ||
2100 | <title>Modeset Helper Functions Reference</title> | ||
2101 | !Edrivers/gpu/drm/drm_crtc_helper.c | ||
2102 | </sect2> | ||
2099 | </sect1> | 2103 | </sect1> |
2100 | 2104 | ||
2101 | <!-- Internals: vertical blanking --> | 2105 | <!-- Internals: vertical blanking --> |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 1fe719fb32e8..7b2d378b2576 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -39,6 +39,17 @@ | |||
39 | #include <drm/drm_fb_helper.h> | 39 | #include <drm/drm_fb_helper.h> |
40 | #include <drm/drm_edid.h> | 40 | #include <drm/drm_edid.h> |
41 | 41 | ||
42 | /** | ||
43 | * drm_helper_move_panel_connectors_to_head() - move panels to the front in the | ||
44 | * connector list | ||
45 | * @dev: drm device to operate on | ||
46 | * | ||
47 | * Some userspace presumes that the first connected connector is the main | ||
48 | * display, where it's supposed to display e.g. the login screen. For | ||
49 | * laptops, this should be the main panel. Use this function to sort all | ||
50 | * (eDP/LVDS) panels to the front of the connector list, instead of | ||
51 | * painstakingly trying to initialize them in the right order. | ||
52 | */ | ||
42 | void drm_helper_move_panel_connectors_to_head(struct drm_device *dev) | 53 | void drm_helper_move_panel_connectors_to_head(struct drm_device *dev) |
43 | { | 54 | { |
44 | struct drm_connector *connector, *tmp; | 55 | struct drm_connector *connector, *tmp; |
@@ -82,22 +93,21 @@ static void drm_mode_validate_flag(struct drm_connector *connector, | |||
82 | 93 | ||
83 | /** | 94 | /** |
84 | * drm_helper_probe_single_connector_modes - get complete set of display modes | 95 | * drm_helper_probe_single_connector_modes - get complete set of display modes |
85 | * @dev: DRM device | 96 | * @connector: connector to probe |
86 | * @maxX: max width for modes | 97 | * @maxX: max width for modes |
87 | * @maxY: max height for modes | 98 | * @maxY: max height for modes |
88 | * | 99 | * |
89 | * LOCKING: | 100 | * LOCKING: |
90 | * Caller must hold mode config lock. | 101 | * Caller must hold mode config lock. |
91 | * | 102 | * |
92 | * Based on @dev's mode_config layout, scan all the connectors and try to detect | 103 | * Based on the helper callbacks implemented by @connector try to detect all |
93 | * modes on them. Modes will first be added to the connector's probed_modes | 104 | * valid modes. Modes will first be added to the connector's probed_modes list, |
94 | * list, then culled (based on validity and the @maxX, @maxY parameters) and | 105 | * then culled (based on validity and the @maxX, @maxY parameters) and put into |
95 | * put into the normal modes list. | 106 | * the normal modes list. |
96 | * | ||
97 | * Intended to be used either at bootup time or when major configuration | ||
98 | * changes have occurred. | ||
99 | * | 107 | * |
100 | * FIXME: take into account monitor limits | 108 | * Intended to be use as a generic implementation of the ->probe() @connector |
109 | * callback for drivers that use the crtc helpers for output mode filtering and | ||
110 | * detection. | ||
101 | * | 111 | * |
102 | * RETURNS: | 112 | * RETURNS: |
103 | * Number of modes found on @connector. | 113 | * Number of modes found on @connector. |
@@ -348,17 +358,24 @@ drm_crtc_prepare_encoders(struct drm_device *dev) | |||
348 | } | 358 | } |
349 | 359 | ||
350 | /** | 360 | /** |
351 | * drm_crtc_set_mode - set a mode | 361 | * drm_crtc_helper_set_mode - internal helper to set a mode |
352 | * @crtc: CRTC to program | 362 | * @crtc: CRTC to program |
353 | * @mode: mode to use | 363 | * @mode: mode to use |
354 | * @x: horizontal offset into the surface | 364 | * @x: horizontal offset into the surface |
355 | * @y: vertical offset into the surface | 365 | * @y: vertical offset into the surface |
366 | * @old_fb: old framebuffer, for cleanup | ||
356 | * | 367 | * |
357 | * LOCKING: | 368 | * LOCKING: |
358 | * Caller must hold mode config lock. | 369 | * Caller must hold mode config lock. |
359 | * | 370 | * |
360 | * Try to set @mode on @crtc. Give @crtc and its associated connectors a chance | 371 | * Try to set @mode on @crtc. Give @crtc and its associated connectors a chance |
361 | * to fixup or reject the mode prior to trying to set it. | 372 | * to fixup or reject the mode prior to trying to set it. This is an internal |
373 | * helper that drivers could e.g. use to update properties that require the | ||
374 | * entire output pipe to be disabled and re-enabled in a new configuration. For | ||
375 | * example for changing whether audio is enabled on a hdmi link or for changing | ||
376 | * panel fitter or dither attributes. It is also called by the | ||
377 | * drm_crtc_helper_set_config() helper function to drive the mode setting | ||
378 | * sequence. | ||
362 | * | 379 | * |
363 | * RETURNS: | 380 | * RETURNS: |
364 | * True if the mode was set successfully, or false otherwise. | 381 | * True if the mode was set successfully, or false otherwise. |
@@ -514,20 +531,19 @@ drm_crtc_helper_disable(struct drm_crtc *crtc) | |||
514 | 531 | ||
515 | /** | 532 | /** |
516 | * drm_crtc_helper_set_config - set a new config from userspace | 533 | * drm_crtc_helper_set_config - set a new config from userspace |
517 | * @crtc: CRTC to setup | 534 | * @set: mode set configuration |
518 | * @crtc_info: user provided configuration | ||
519 | * @new_mode: new mode to set | ||
520 | * @connector_set: set of connectors for the new config | ||
521 | * @fb: new framebuffer | ||
522 | * | 535 | * |
523 | * LOCKING: | 536 | * LOCKING: |
524 | * Caller must hold mode config lock. | 537 | * Caller must hold mode config lock. |
525 | * | 538 | * |
526 | * Setup a new configuration, provided by the user in @crtc_info, and enable | 539 | * Setup a new configuration, provided by the upper layers (either an ioctl call |
527 | * it. | 540 | * from userspace or internally e.g. from the fbdev suppport code) in @set, and |
541 | * enable it. This is the main helper functions for drivers that implement | ||
542 | * kernel mode setting with the crtc helper functions and the assorted | ||
543 | * ->prepare(), ->modeset() and ->commit() helper callbacks. | ||
528 | * | 544 | * |
529 | * RETURNS: | 545 | * RETURNS: |
530 | * Zero. (FIXME) | 546 | * Returns 0 on success, -ERRNO on failure. |
531 | */ | 547 | */ |
532 | int drm_crtc_helper_set_config(struct drm_mode_set *set) | 548 | int drm_crtc_helper_set_config(struct drm_mode_set *set) |
533 | { | 549 | { |
@@ -823,12 +839,14 @@ static int drm_helper_choose_crtc_dpms(struct drm_crtc *crtc) | |||
823 | } | 839 | } |
824 | 840 | ||
825 | /** | 841 | /** |
826 | * drm_helper_connector_dpms | 842 | * drm_helper_connector_dpms() - connector dpms helper implementation |
827 | * @connector affected connector | 843 | * @connector: affected connector |
828 | * @mode DPMS mode | 844 | * @mode: DPMS mode |
829 | * | 845 | * |
830 | * Calls the low-level connector DPMS function, then | 846 | * This is the main helper function provided by the crtc helper framework for |
831 | * calls appropriate encoder and crtc DPMS functions as well | 847 | * implementing the DPMS connector attribute. It computes the new desired DPMS |
848 | * state for all encoders and crtcs in the output mesh and calls the ->dpms() | ||
849 | * callback provided by the driver appropriately. | ||
832 | */ | 850 | */ |
833 | void drm_helper_connector_dpms(struct drm_connector *connector, int mode) | 851 | void drm_helper_connector_dpms(struct drm_connector *connector, int mode) |
834 | { | 852 | { |