Skip to content

Commit 2e2b96e

Browse files
committed
drm: Update docs for legacy kms state
Point at the equivalent atomic state and explain that atomic drivers shouldn't really depend upon legacy state. Motivated by questions from Manasi about how this all is supposed to work. Cc: Manasi Navare <[email protected]> Reviewed-by: Manasi Navare <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 7146938 commit 2e2b96e

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

drivers/gpu/drm/drm_atomic_helper.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,12 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
907907
*
908908
* Drivers can use this for building their own atomic commit if they don't have
909909
* a pure helper-based modeset implementation.
910+
*
911+
* Since these updates are not synchronized with lockings, only code paths
912+
* called from &drm_mode_config_helper_funcs.atomic_commit_tail can look at the
913+
* legacy state filled out by this helper. Defacto this means this helper and
914+
* the legacy state pointers are only really useful for transitioning an
915+
* existing driver to the atomic world.
910916
*/
911917
void
912918
drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,

include/drm/drm_connector.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,6 @@ struct drm_cmdline_mode {
699699
* @force: a DRM_FORCE_<foo> state for forced mode sets
700700
* @override_edid: has the EDID been overwritten through debugfs for testing?
701701
* @encoder_ids: valid encoders for this connector
702-
* @encoder: encoder driving this connector, if any
703702
* @eld: EDID-like data, if present
704703
* @latency_present: AV delay info from ELD, if found
705704
* @video_latency: video latency info from ELD, if found
@@ -869,7 +868,13 @@ struct drm_connector {
869868

870869
#define DRM_CONNECTOR_MAX_ENCODER 3
871870
uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
872-
struct drm_encoder *encoder; /* currently active encoder */
871+
/**
872+
* @encoder: Currently bound encoder driving this connector, if any.
873+
* Only really meaningful for non-atomic drivers. Atomic drivers should
874+
* instead look at &drm_connector_state.best_encoder, and in case they
875+
* need the CRTC driving this output, &drm_connector_state.crtc.
876+
*/
877+
struct drm_encoder *encoder;
873878

874879
#define MAX_ELD_BYTES 128
875880
/* EDID bits */

include/drm/drm_encoder.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ struct drm_encoder_funcs {
8888
* @head: list management
8989
* @base: base KMS object
9090
* @name: human readable name, can be overwritten by the driver
91-
* @crtc: currently bound CRTC
9291
* @bridge: bridge associated to the encoder
9392
* @funcs: control functions
9493
* @helper_private: mid-layer private data
@@ -166,6 +165,11 @@ struct drm_encoder {
166165
*/
167166
uint32_t possible_clones;
168167

168+
/**
169+
* @crtc: Currently bound CRTC, only really meaningful for non-atomic
170+
* drivers. Atomic drivers should instead check
171+
* &drm_connector_state.crtc.
172+
*/
169173
struct drm_crtc *crtc;
170174
struct drm_bridge *bridge;
171175
const struct drm_encoder_funcs *funcs;

include/drm/drm_plane.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,6 @@ enum drm_plane_type {
474474
* @format_types: array of formats supported by this plane
475475
* @format_count: number of formats supported
476476
* @format_default: driver hasn't supplied supported formats for the plane
477-
* @crtc: currently bound CRTC
478-
* @fb: currently bound fb
479477
* @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by
480478
* drm_mode_set_config_internal() to implement correct refcounting.
481479
* @funcs: helper functions
@@ -512,7 +510,17 @@ struct drm_plane {
512510
uint64_t *modifiers;
513511
unsigned int modifier_count;
514512

513+
/**
514+
* @crtc: Currently bound CRTC, only really meaningful for non-atomic
515+
* drivers. Atomic drivers should instead check &drm_plane_state.crtc.
516+
*/
515517
struct drm_crtc *crtc;
518+
519+
/**
520+
* @fb: Currently bound framebuffer, only really meaningful for
521+
* non-atomic drivers. Atomic drivers should instead check
522+
* &drm_plane_state.fb.
523+
*/
516524
struct drm_framebuffer *fb;
517525

518526
struct drm_framebuffer *old_fb;

0 commit comments

Comments
 (0)