drm: Add a drm_drv_enabled() helper function
Subsystems (2)
PATCH RESEND 4/5 drm: Add a drm_drv_enabled() helper function
DRM drivers can use this to determine whether they can be enabled or not.
For now it's just a wrapper around drm_modeset_disabled() but having the indirection level will allow to add other conditions besides "nomodeset".
---
drivers/gpu/drm/drm_drv.c | 21 +++++++++++++++++++++ include/drm/drm_drv.h | 1 + 2 files changed, 22 insertions(+)
drivers/gpu/drm/drm_drv.c +21 -0
@@ -975,6 +975,27 @@ int drm_dev_set_unique(struct drm_device *dev, const char *name) }EXPORT_SYMBOL (drm_dev_set_unique); +/** +* drm_drv_enabled - Checks if a DRM driver can be enabled +* @driver: DRM driver to check +* +* Checks whether a DRM driver can be enabled or not. This may be the case +* if the "nomodeset" kernel command line parameter is used. +* +* Returns: +* True if the DRM driver is enabled and false otherwise. +*/ +bool drm_drv_enabled (const struct drm_driver *driver) +{ +if (drm_modeset_disabled ()) { +DRM_INFO ("%s driver is disabled\n" , driver->name); +return false; + } + +return true; +} +EXPORT_SYMBOL (drm_drv_enabled); +/* * DRM Core * The DRM core module initializes all global DRM objects and makes them
include/drm/drm_drv.h +1 -0
@@ -598,5 +598,6 @@ static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)int drm_dev_set_unique (struct drm_device *dev,const char *name); +bool drm_drv_enabled (const struct drm_driver *driver);#endif
Signature · 1 line
2.33.1
Quoted 7 lines · Javier Martinez Canillas
DRM drivers can use this to determine whether they can be enabled or not.
For now it's just a wrapper around
drm_modeset_disabled()but having the indirection level will allow to add other conditions besides "nomodeset".Suggested-by Thomas Zimmermann <[email protected]>Signed-off-by Javier Martinez Canillas <[email protected]>
Can't see i915 trivially using this due to the drm_driver parameter. Please let's not merge helpers like this without actual users.
BR,
Jani.
Quoted 49 lines
---
drivers/gpu/drm/drm_drv.c | 21 +++++++++++++++++++++ include/drm/drm_drv.h | 1 + 2 files changed, 22 insertions(+)drivers/gpu/drm/drm_drv.c +21
-0@@ -975,6 +975,27 @@ int drm_dev_set_unique(struct drm_device *dev, const char *name) }EXPORT_SYMBOL (drm_dev_set_unique); +/** +* drm_drv_enabled - Checks if a DRM driver can be enabled +* @driver: DRM driver to check +* +* Checks whether a DRM driver can be enabled or not. This may be the case +* if the "nomodeset" kernel command line parameter is used. +* +* Returns: +* True if the DRM driver is enabled and false otherwise. +*/ +bool drm_drv_enabled (const struct drm_driver *driver) +{ +if (drm_modeset_disabled ()) { +DRM_INFO ("%s driver is disabled\n" , driver->name); +return false; + } + +return true; +} +EXPORT_SYMBOL (drm_drv_enabled); +/* * DRM Core * The DRM core module initializes all global DRM objects and makes them include/drm/drm_drv.h +1
-0@@ -598,5 +598,6 @@ static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)int drm_dev_set_unique (struct drm_device *dev,const char *name); +bool drm_drv_enabled (const struct drm_driver *driver);#endif
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Thomas Zimmermann
maintainerHi
Am 03.11.21 um 14:41 schrieb Jani Nikula:
Quoted 6 lines · Javier Martinez Canillas
Quoted 5 lines
DRM drivers can use this to determine whether they can be enabled or not.
For now it's just a wrapper around
drm_modeset_disabled()but having the indirection level will allow to add other conditions besides "nomodeset".
Quoted 6 lines
Quoted 2 lines
Suggested-by Thomas Zimmermann <[email protected]>Signed-off-by Javier Martinez Canillas <[email protected]>Can't see i915 trivially using this due to the
drm_driverparameter. Please let's not merge helpers like this without actual users.
Can you explain?
This would be called on the top of the PCI probe function. The parameter would allow to decide on a per-driver base (e.g., to ignore generic drivers).
Best regards
Thomas
Quoted 55 lines
BR,
Jani.Quoted 49 lines
---
drivers/gpu/drm/drm_drv.c | 21 +++++++++++++++++++++ include/drm/drm_drv.h | 1 + 2 files changed, 22 insertions(+)drivers/gpu/drm/drm_drv.c +21
-0@@ -975,6 +975,27 @@ int drm_dev_set_unique(struct drm_device *dev, const char *name) }EXPORT_SYMBOL (drm_dev_set_unique); +/** +* drm_drv_enabled - Checks if a DRM driver can be enabled +* @driver: DRM driver to check +* +* Checks whether a DRM driver can be enabled or not. This may be the case +* if the "nomodeset" kernel command line parameter is used. +* +* Returns: +* True if the DRM driver is enabled and false otherwise. +*/ +bool drm_drv_enabled (const struct drm_driver *driver) +{ +if (drm_modeset_disabled ()) { +DRM_INFO ("%s driver is disabled\n" , driver->name); +return false; + } + +return true; +} +EXPORT_SYMBOL (drm_drv_enabled); +/* * DRM Core * The DRM core module initializes all global DRM objects and makes them include/drm/drm_drv.h +1
-0@@ -598,5 +598,6 @@ static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)int drm_dev_set_unique (struct drm_device *dev,const char *name); +bool drm_drv_enabled (const struct drm_driver *driver);#endif
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Quoted 16 lines · Thomas Zimmermann
Hi
Am 03.11.21 um 14:41 schrieb Jani Nikula:
Quoted 6 lines · Javier Martinez Canillas
Quoted 5 lines
DRM drivers can use this to determine whether they can be enabled or not.
For now it's just a wrapper around
drm_modeset_disabled()but having the indirection level will allow to add other conditions besides "nomodeset".Quoted 6 lines
Quoted 2 lines
Suggested-by Thomas Zimmermann <[email protected]>Signed-off-by Javier Martinez Canillas <[email protected]>Can't see i915 trivially using this due to the
drm_driverparameter. Please let's not merge helpers like this without actual users.
Quoted 5 lines
Can you explain?
This would be called on the top of the PCI probe function. The parameter would allow to decide on a per-driver base (e.g., to ignore generic drivers).
Where and how exactly? This is why we need to see the patch using the function. A patch is worth a thousand words. ;)
See current vgacon_text_force() usage in i915/i915_module.c. It happens way before anything related to pci or drm driver. Why bother with the complicated setup and teardown of stuff if you can bail out earlier?
BR,
Jani.
Quoted 59 lines
Best regards
ThomasQuoted 55 lines
BR,
Jani.Quoted 49 lines
---
drivers/gpu/drm/drm_drv.c | 21 +++++++++++++++++++++ include/drm/drm_drv.h | 1 + 2 files changed, 22 insertions(+)drivers/gpu/drm/drm_drv.c +21
-0@@ -975,6 +975,27 @@ int drm_dev_set_unique(struct drm_device *dev, const char *name) }EXPORT_SYMBOL (drm_dev_set_unique); +/** +* drm_drv_enabled - Checks if a DRM driver can be enabled +* @driver: DRM driver to check +* +* Checks whether a DRM driver can be enabled or not. This may be the case +* if the "nomodeset" kernel command line parameter is used. +* +* Returns: +* True if the DRM driver is enabled and false otherwise. +*/ +bool drm_drv_enabled (const struct drm_driver *driver) +{ +if (drm_modeset_disabled ()) { +DRM_INFO ("%s driver is disabled\n" , driver->name); +return false; + } + +return true; +} +EXPORT_SYMBOL (drm_drv_enabled); +/* * DRM Core * The DRM core module initializes all global DRM objects and makes them include/drm/drm_drv.h +1
-0@@ -598,5 +598,6 @@ static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)int drm_dev_set_unique (struct drm_device *dev,const char *name); +bool drm_drv_enabled (const struct drm_driver *driver);#endif
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Hello Jani,
Quoted 17 lines · Jani Nikula
Quoted 16 lines · Thomas Zimmermann
Hi
Am 03.11.21 um 14:41 schrieb Jani Nikula:
Quoted 12 lines · Javier Martinez Canillas
Quoted 7 lines
DRM drivers can use this to determine whether they can be enabled or not.
For now it's just a wrapper around
drm_modeset_disabled()but having the indirection level will allow to add other conditions besides "nomodeset".Suggested-by Thomas Zimmermann <[email protected]>Signed-off-by Javier Martinez Canillas <[email protected]>Can't see i915 trivially using this due to the
drm_driverparameter. Please let's not merge helpers like this without actual users.
Quoted 9 lines
Quoted 5 lines
Can you explain?
This would be called on the top of the PCI probe function. The parameter would allow to decide on a per-driver base (e.g., to ignore generic drivers).
Where and how exactly? This is why we need to see the patch using the function. A patch is worth a thousand words. ;)
Thomas suggested to squash patches #4 and #5 so I'll do that when posting v2.
Quoted 4 lines
See current
vgacon_text_force()usage ini915/i915_module.c. It happens way before anything related to pci or drm driver. Why bother with the complicated setup and teardown of stuff if you can bail out earlier?
Yes, most drivers use vgacon_text_force() in their module init callback.
The ones that do in their probe function are drivers that don't have a module init/exit but just use the module_platform_driver() macro.
I won't modify that and will keep the bail in the same place that the drivers already do. I hope to have time and post a new revision today.
Quoted 4 lines
BR,
Jani.
Best regards,
Signature · 3 lines
Javier Martinez Canillas Linux Engineering Red Hat