From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF916FF885A for ; Mon, 4 May 2026 18:02:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4C09A10E7E6; Mon, 4 May 2026 18:02:21 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="YnqgFdgF"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 524C910E7DF; Mon, 4 May 2026 18:02:19 +0000 (UTC) Received: from killaraus.ideasonboard.com (2001-14ba-703d-e500--2a1.rev.dnainternet.fi [IPv6:2001:14ba:703d:e500::2a1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C62019C; Mon, 4 May 2026 20:02:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1777917736; bh=7jbSAljiTPkKqJTgG1DeBRsKb/Ln1LpocLciBKuNSuk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YnqgFdgFttmuLffMS5TgsyuM48yEk6z0WoekgzM5bIw4g9Ra0fU/7U45WjE+yVhSy d6kAAxIvIcoDVvQBfJkBTFx3CVUaiSLn65JuM9fJ+Ygg2KptlJeif7Yy3cl/sq8Gw2 f8wz50w+ANWkaFoTopxUc54KjrvsE//tdjt5G6a8= Date: Mon, 4 May 2026 21:02:16 +0300 From: Laurent Pinchart To: Maxime Ripard Cc: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Jonathan Corbet , Shuah Khan , Dmitry Baryshkov , Jyri Sarha , Tomi Valkeinen , Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , Simon Ser , Harry Wentland , Melissa Wen , Sebastian Wick , Alex Hung , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Chen-Yu Tsai , Samuel Holland , Dave Stevenson , =?utf-8?B?TWHDrXJh?= Canal , Raspberry Pi Kernel Maintenance , dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Stone , intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: Re: [PATCH v3 17/20] drm/drv: Switch skeleton to drm_mode_config_create_initial_state() Message-ID: <20260504180216.GU1344263@killaraus.ideasonboard.com> References: <20260424-drm-mode-config-init-v3-0-8b68d9db0d8b@kernel.org> <20260424-drm-mode-config-init-v3-17-8b68d9db0d8b@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260424-drm-mode-config-init-v3-17-8b68d9db0d8b@kernel.org> X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Fri, Apr 24, 2026 at 12:18:57PM +0200, Maxime Ripard wrote: > The driver skeleton currently recommends calling > drm_mode_config_reset() at probe time to create the initial state. > > Now that drm_mode_config_create_initial_state() exists to handle > initial state allocation without hardware side effects, update the > skeleton to recommend it instead. > > Signed-off-by: Maxime Ripard > --- > drivers/gpu/drm/drm_drv.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c > index 985c283cf59f..f537556b06a8 100644 > --- a/drivers/gpu/drm/drm_drv.c > +++ b/drivers/gpu/drm/drm_drv.c > @@ -340,11 +340,13 @@ void drm_minor_release(struct drm_minor *minor) > * > * // Further setup, display pipeline etc > * > * platform_set_drvdata(pdev, drm); > * > - * drm_mode_config_reset(drm); > + * ret = drm_mode_config_create_initial_state(drm); > + * if (ret) > + * return ret; There's one point I'm still not sure to understand properly. The skeleton example (and the tidss driver, which you convert to the new API in this series) both call drm_mode_config_helper_resume(). This in turn calls drm_atomic_helper_resume(), and drm_mode_config_reset(). For drivers that implement .atomic_create_state() instead of .reset() (such as tidss, after its conversion in this series), drm_mode_config_reset() will call the drm_mode_config_*_create_state() helpers, which allocate and initialize a new state (through .atomic_create_state()), and store that new state in the object's ->state field. Won't this leak the state previously stored there ? > * > * ret = drm_dev_register(drm); > * if (ret) > * return ret; > * -- Regards, Laurent Pinchart