mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 05:10:51 +07:00
drm: Include the encoder itself in possible_clones
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 <tzimmermann@suse.de> Cc: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200211162208.16224-2-ville.syrjala@linux.intel.com Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
a212d6a557
commit
714277951d
@ -82,6 +82,7 @@ int drm_mode_setcrtc(struct drm_device *dev,
|
||||
/* drm_mode_config.c */
|
||||
int drm_modeset_register_all(struct drm_device *dev);
|
||||
void drm_modeset_unregister_all(struct drm_device *dev);
|
||||
void drm_mode_config_validate(struct drm_device *dev);
|
||||
|
||||
/* drm_modes.c */
|
||||
const char *drm_get_mode_status_name(enum drm_mode_status status);
|
||||
|
@ -946,6 +946,9 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
|
||||
struct drm_driver *driver = dev->driver;
|
||||
int ret;
|
||||
|
||||
if (!driver->load)
|
||||
drm_mode_config_validate(dev);
|
||||
|
||||
if (drm_dev_needs_global_mutex(dev))
|
||||
mutex_lock(&drm_global_mutex);
|
||||
|
||||
|
@ -532,3 +532,22 @@ void drm_mode_config_cleanup(struct drm_device *dev)
|
||||
drm_modeset_lock_fini(&dev->mode_config.connection_mutex);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_mode_config_cleanup);
|
||||
|
||||
/*
|
||||
* For some reason we want the encoder itself included in
|
||||
* possible_clones. Make life easy for drivers by allowing them
|
||||
* to leave possible_clones unset if no cloning is possible.
|
||||
*/
|
||||
static void fixup_encoder_possible_clones(struct drm_encoder *encoder)
|
||||
{
|
||||
if (encoder->possible_clones == 0)
|
||||
encoder->possible_clones = drm_encoder_mask(encoder);
|
||||
}
|
||||
|
||||
void drm_mode_config_validate(struct drm_device *dev)
|
||||
{
|
||||
struct drm_encoder *encoder;
|
||||
|
||||
drm_for_each_encoder(encoder, dev)
|
||||
fixup_encoder_possible_clones(encoder);
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user