[PATCH v2 15/20] drm/drv: Call drm_mode_config_create_state() by default

Maxime Ripard mripard at kernel.org
Fri Apr 24 01:44:35 PDT 2026


Hi,

On Tue, Apr 21, 2026 at 03:38:16PM +0200, Thomas Zimmermann wrote:
> 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 at kernel.org>
> > ---
> >   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.

Yeah... I think that was Ville's main objection too.

> Lets rather go through drivers and call this where they currently call
> drm_mode_config_reset() for initialization.

I was really hoping to remove the boilerplate from drivers, but I don't
really see a good place for it then. drm_mode_config_init() could be
another candidate, but it looks weird to put it there too.

I'll drop that then.

> This can be a single-patch mass conversion IMHO.

I'm not really sure? For it to work we'd need to convert these drivers
objects from reset to atomic_create_state too. I absolutely want to do
it next, but I don't think it will be as trivial as a sed call, and it
would probably be best done by driver to allow reverts if we screw up.

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20260424/fbb2983f/attachment-0001.sig>


More information about the linux-arm-kernel mailing list