From 714277951deb9f5b22ec3789b61bb45f55c643b8 Mon Sep 17 00:00:00 2001 From: Ville Syrjälä Date: Tue, 11 Feb 2020 18:22:02 +0200 Subject: drm: Include the encoder itself in possible_clones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docs say possible_clones should always include the encoder itself. Since most drivers don't want to deal with the complexities of cloning let's allow them to set possible_clones=0 and instead we'll fix that up in the core. We can't put this special case into drm_encoder_init() because drivers will have to fill up possible_clones after adding all the relevant encoders. Otherwise they wouldn't know the proper encoder indexes to use. So we'll just do it just before registering the device. v2: Don't set the bit if possible_clones!=0 so that the validation (coming soon) will WARN (Thomas) Fix up the docs to allow possible_clones==0 (Daniel) .late_register() is too late, introduce drm_mode_config_validate() which gets called _before_ we register the char device (Daniel) Acked-by: Thomas Zimmermann Cc: Daniel Vetter Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20200211162208.16224-2-ville.syrjala@linux.intel.com Reviewed-by: Daniel Vetter --- include/drm/drm_encoder.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/drm/drm_encoder.h') diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h index 4370e039c015..34b7213bfab6 100644 --- a/include/drm/drm_encoder.h +++ b/include/drm/drm_encoder.h @@ -159,7 +159,9 @@ struct drm_encoder { * encoders can be used in a cloned configuration, they both should have * each another bits set. * - * In reality almost every driver gets this wrong. + * As an exception to the above rule if the driver doesn't implement + * any cloning it can leave @possible_clones set to 0. The core will + * automagically fix this up by setting the bit for the encoder itself. * * Note that since encoder objects can't be hotplugged the assigned indices * are stable and hence known before registering all objects. -- cgit v1.2.3