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 BC5FDCA0FFE for ; Tue, 2 Sep 2025 14:28:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0FA9C10E753; Tue, 2 Sep 2025 14:28:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="YZCs+V7+"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD7AC10E753 for ; Tue, 2 Sep 2025 14:27:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1756823279; x=1788359279; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=SgoVGE0nvwzHp4yiQ79SeUmtMRue7DoGWu8+GcPVz6Y=; b=YZCs+V7+CuTnWfGPa1uFhgGMHFjCvIhlcKTDNycDS9WMllOb3vUeVp1/ CkzNLLNe2c4kZjgBP2nN5OzdL+Upc8yWBb3kBu/V8x0uUMA+d78CHo8zF o+ZuCFgxOReB+vfv8Iuc3DvDc5waN5MbiYmksnh8Gq9yzh3Vd30ZQaMsg 3a7thlpJfWEElGaRrEUVy34RVxDjdd+r4MGN9YUTB/tFAE4ZUfNBVRBGQ IW0zqTBOeSP139i25DnwEioYhMcDuJ4lfhY9HjIAWu+uiWiFOcyPqLb93 DrP2FZEs6JSBI5w5D47e/m06DNemrSvBc3CXDUYLK2j466g3a5sM/o1ll w==; X-CSE-ConnectionGUID: qCB91wwdSgu5M6+pw/+YMw== X-CSE-MsgGUID: 89lVeUm0TZivinVZJSjglQ== X-IronPort-AV: E=McAfee;i="6800,10657,11541"; a="70480819" X-IronPort-AV: E=Sophos;i="6.18,230,1751266800"; d="scan'208";a="70480819" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2025 07:27:59 -0700 X-CSE-ConnectionGUID: fatX4FH7Tx66qXDZpCTUgQ== X-CSE-MsgGUID: RLHLx8mvSp+cm653lO8tug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,230,1751266800"; d="scan'208";a="176601919" Received: from fpallare-mobl4.ger.corp.intel.com (HELO stinkbox) ([10.245.245.118]) by orviesa005.jf.intel.com with SMTP; 02 Sep 2025 07:27:55 -0700 Received: by stinkbox (sSMTP sendmail emulation); Tue, 02 Sep 2025 17:27:54 +0300 Date: Tue, 2 Sep 2025 17:27:54 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Dmitry Baryshkov Cc: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org Subject: Re: [PATCH v2 36/37] drm/atomic: Convert drm_atomic_get_private_obj_state() to use new plane state Message-ID: References: <20250902-drm-no-more-existing-state-v2-0-de98fc5f6d66@kernel.org> <20250902-drm-no-more-existing-state-v2-36-de98fc5f6d66@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Patchwork-Hint: comment X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Sep 02, 2025 at 05:17:24PM +0300, Dmitry Baryshkov wrote: > On Tue, Sep 02, 2025 at 05:14:51PM +0300, Ville Syrjälä wrote: > > On Tue, Sep 02, 2025 at 04:25:12PM +0300, Dmitry Baryshkov wrote: > > > On Tue, Sep 02, 2025 at 11:35:35AM +0200, Maxime Ripard wrote: > > > > The drm_atomic_get_private_obj_state() function tries to find if a > > > > private_obj had already been allocated and was part of the given > > > > drm_atomic_state. If one is found, it returns the existing state > > > > pointer. > > > > > > > > At the point in time where drm_atomic_get_private_obj_state() can be > > > > called (ie, during atomic_check), the existing state is the new state > > > > and we can thus replace the hand-crafted logic by a call to > > > > drm_atomic_get_new_private_obj_state(). > > > > > > > > > This function is being used in e.g. this call stack: > > > ingenic_drm_crtc_atomic_enable -> ingenic_drm_get_priv_state -> > > > drm_atomic_get_private_obj_state(). Please correct me if I'm wrong, > > > doesn't it happen already after the state switch? > > > > Looks like it should just use the get_new_state() there. > > > > Hmm, I wonder if we should make the get_state() functions warn > > (and maybe return NULL) if they get called after the state has > > been swapped? > > Might be. > > Note: I just quickly git grepped the function and stumbled upon the > first questionable use. There might be uther users which call it after > swapping the state. I tried to have a quick look at all the callers and didn't spot other obviously wrong uses, but I can't guarantee that I didn't miss some by accident. > > > > > > > > > > > > > > Signed-off-by: Maxime Ripard > > > > --- > > > > drivers/gpu/drm/drm_atomic.c | 8 ++++---- > > > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > > > > > > > -- > > > With best wishes > > > Dmitry > > > > -- > > Ville Syrjälä > > Intel > > -- > With best wishes > Dmitry -- Ville Syrjälä Intel