Re: [PATCH v2 15/20] drm/drv: Call drm_mode_config_create_state() by default
From: Thomas Zimmermann
Date: Tue Apr 21 2026 - 11:33:28 EST
Am 21.04.26 um 15:38 schrieb Thomas Zimmermann:
Hi
Am 20.03.26 um 17:27 schrieb Maxime Ripard:
Almost all drivers, and our documented skeleton, call
drm_mode_config_reset() prior to calling drm_dev_register() to
initialize its DRM object states.
Now that we have drm_mode_config_create_state() to create that initial
state if it doesn't exist, we can call it directly in
drm_dev_register(). That way, we know that the initial atomic state will
always be allocated without any boilerplate.
Signed-off-by: Maxime Ripard <mripard@xxxxxxxxxx>
---
drivers/gpu/drm/drm_drv.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 2915118436ce8a6640cfb0c59936031990727ed1..820106d56ab399a39cac56d98662b5ddbcae8ded 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -1097,10 +1097,14 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
ret = drm_modeset_register_all(dev);
if (ret)
goto err_unload;
+
+ ret = drm_mode_config_create_state(dev);
+ if (ret)
+ goto err_unload;
Way too late. Lets rather go through drivers and call this where they currently call drm_mode_config_reset() for initialization. This can be a single-patch mass conversion IMHO.
On a second thought, can't we modify the suspend code and leave the reset as-is for now? I'd still be interested to use reset as a means of initializing the hardware or loading state on probe. So keeping the _reset() calls in place might be helpful for that.
What's the long-term plan here?
Best regards
Thomas
Best regards
Thomas
}
drm_panic_register(dev);
drm_client_sysrq_register(dev);
DRM_INFO("Initialized %s %d.%d.%d for %s on minor %d\n",
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)