diff options
-rw-r--r-- | drivers/gpu/drm/drm_atomic_helper.c | 6 | ||||
-rw-r--r-- | include/drm/drm_modeset_helper_vtables.h | 29 |
2 files changed, 34 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 20be86d89a20..99365087645b 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c | |||
@@ -886,8 +886,12 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) | |||
886 | * Each encoder has at most one connector (since we always steal | 886 | * Each encoder has at most one connector (since we always steal |
887 | * it away), so we won't call mode_set hooks twice. | 887 | * it away), so we won't call mode_set hooks twice. |
888 | */ | 888 | */ |
889 | if (funcs && funcs->mode_set) | 889 | if (funcs && funcs->atomic_mode_set) { |
890 | funcs->atomic_mode_set(encoder, new_crtc_state, | ||
891 | connector->state); | ||
892 | } else if (funcs && funcs->mode_set) { | ||
890 | funcs->mode_set(encoder, mode, adjusted_mode); | 893 | funcs->mode_set(encoder, mode, adjusted_mode); |
894 | } | ||
891 | 895 | ||
892 | drm_bridge_mode_set(encoder->bridge, mode, adjusted_mode); | 896 | drm_bridge_mode_set(encoder->bridge, mode, adjusted_mode); |
893 | } | 897 | } |
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h index b55f21857a98..686feec6b4c8 100644 --- a/include/drm/drm_modeset_helper_vtables.h +++ b/include/drm/drm_modeset_helper_vtables.h | |||
@@ -523,12 +523,41 @@ struct drm_encoder_helper_funcs { | |||
523 | * | 523 | * |
524 | * This callback is used both by the legacy CRTC helpers and the atomic | 524 | * This callback is used both by the legacy CRTC helpers and the atomic |
525 | * modeset helpers. It is optional in the atomic helpers. | 525 | * modeset helpers. It is optional in the atomic helpers. |
526 | * | ||
527 | * NOTE: | ||
528 | * | ||
529 | * If the driver uses the atomic modeset helpers and needs to inspect | ||
530 | * the connector state or connector display info during mode setting, | ||
531 | * @atomic_mode_set can be used instead. | ||
526 | */ | 532 | */ |
527 | void (*mode_set)(struct drm_encoder *encoder, | 533 | void (*mode_set)(struct drm_encoder *encoder, |
528 | struct drm_display_mode *mode, | 534 | struct drm_display_mode *mode, |
529 | struct drm_display_mode *adjusted_mode); | 535 | struct drm_display_mode *adjusted_mode); |
530 | 536 | ||
531 | /** | 537 | /** |
538 | * @atomic_mode_set: | ||
539 | * | ||
540 | * This callback is used to update the display mode of an encoder. | ||
541 | * | ||
542 | * Note that the display pipe is completely off when this function is | ||
543 | * called. Drivers which need hardware to be running before they program | ||
544 | * the new display mode (because they implement runtime PM) should not | ||
545 | * use this hook, because the helper library calls it only once and not | ||
546 | * every time the display pipeline is suspended using either DPMS or the | ||
547 | * new "ACTIVE" property. Such drivers should instead move all their | ||
548 | * encoder setup into the ->enable() callback. | ||
549 | * | ||
550 | * This callback is used by the atomic modeset helpers in place of the | ||
551 | * @mode_set callback, if set by the driver. It is optional and should | ||
552 | * be used instead of @mode_set if the driver needs to inspect the | ||
553 | * connector state or display info, since there is no direct way to | ||
554 | * go from the encoder to the current connector. | ||
555 | */ | ||
556 | void (*atomic_mode_set)(struct drm_encoder *encoder, | ||
557 | struct drm_crtc_state *crtc_state, | ||
558 | struct drm_connector_state *conn_state); | ||
559 | |||
560 | /** | ||
532 | * @get_crtc: | 561 | * @get_crtc: |
533 | * | 562 | * |
534 | * This callback is used by the legacy CRTC helpers to work around | 563 | * This callback is used by the legacy CRTC helpers to work around |