dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maxime Ripard <mripard@kernel.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	dri-devel@lists.freedesktop.org,
	Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Paul Cercueil <paul@crapouillou.net>,
	linux-mips@vger.kernel.org
Subject: Re: [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state()
Date: Tue, 9 Sep 2025 16:52:18 +0300	[thread overview]
Message-ID: <aMAxEjIJOvxmOj2D@intel.com> (raw)
In-Reply-To: <20250909-drm-no-more-existing-state-v3-37-1c7a7d960c33@kernel.org>

On Tue, Sep 09, 2025 at 01:27:56PM +0200, Maxime Ripard wrote:
> The ingenic CRTC atomic_enable() implementation will indirectly call
> drm_atomic_get_private_obj_state() through ingenic_drm_get_priv_state().
> 
> drm_atomic_get_private_obj_state() will either return the new state for
> the object in the global state if it exists, or will allocate a new one
> and add it to the global state.
> 
> atomic_enable() however isn't allowed to modify the global state. So
> what the implementation should use is the
> drm_atomic_get_new_private_obj_state() helper to get the new state for
> the CRTC, without performing an extra allocation.
> 
> The ingenic driver has a wrapper around that helper with
> ingenic_drm_get_new_priv_state(), so let's use that instead.
> 
> Reported-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
> 
> ---
> To: Paul Cercueil <paul@crapouillou.net>
> Cc: linux-mips@vger.kernel.org
> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index 05faed933e5619c796f2a4fa1906e0eaa029ac68..a1b641d63fc500dc169d0b0e22f93168c343a242 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -245,11 +245,11 @@ static void ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc,
>  {
>  	struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
>  	struct ingenic_drm_private_state *priv_state;
>  	unsigned int next_id;
>  
> -	priv_state = ingenic_drm_get_priv_state(priv, state);
> +	priv_state = ingenic_drm_get_new_priv_state(priv, state);
>  	if (WARN_ON(IS_ERR(priv_state)))

get_new_state() will never return an error pointer. It's either
a valid pointer or NULL.

To me it looks like this could potentially be NULL here as the
get_pvi_state() call is done from the plane .atomic_check()
whereas this gets called for the crtc. So if the plane is
disabled there might not be any private state included in the
commit.

Not sure how this driver/hardware is supposed to work so not
sure what the proper fix for that is...

>  		return;
>  
>  	/* Set addresses of our DMA descriptor chains */
>  	next_id = priv_state->use_palette ? HWDESC_PALETTE : 0;
> 
> -- 
> 2.50.1

-- 
Ville Syrjälä
Intel

  parent reply	other threads:[~2025-09-09 13:52 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 11:27 [PATCH v3 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 01/39] drm/atomic: Convert drm_atomic_get_connector_state() to use new connector state Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 02/39] drm/atomic: Remove unused drm_atomic_get_existing_connector_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 03/39] drm/atomic: Document __drm_connectors_state state pointer Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 04/39] drm/atomic: Convert __drm_atomic_get_current_plane_state() to modern accessor Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 05/39] drm/atomic: Convert drm_atomic_get_plane_state() to use new plane state Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 06/39] drm/vkms: Convert vkms_crtc_atomic_check() " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 07/39] drm/tilcdc: crtc: Use drm_atomic_helper_check_crtc_primary_plane() Maxime Ripard
2025-09-12  9:43   ` Jyri Sarha
2025-09-09 11:27 ` [PATCH v3 08/39] drm/atomic: Remove unused drm_atomic_get_existing_plane_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 09/39] drm/atomic: Document __drm_planes_state state pointer Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 10/39] drm/atomic: Convert drm_atomic_get_crtc_state() to use new connector state Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 11/39] drm/ingenic: ipu: Switch to drm_atomic_get_new_crtc_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 12/39] drm/arm/malidp: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 13/39] drm/armada: Drop always true condition in atomic_check Maxime Ripard
2025-09-09 13:39   ` Ville Syrjälä
2025-09-09 11:27 ` [PATCH v3 14/39] drm/armada: Switch to drm_atomic_get_new_crtc_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 15/39] drm/atmel-hlcdc: " Maxime Ripard
2025-09-16  6:52   ` Manikandan.M
2025-09-09 11:27 ` [PATCH v3 16/39] drm/exynos: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 17/39] drm/imx-dc: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 18/39] drm/imx-dcss: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 19/39] drm/imx-ipuv3: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 20/39] drm/ingenic: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 21/39] drm/kmb: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 22/39] drm/logicvc: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 23/39] drm/loongson: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 24/39] drm/mediatek: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 25/39] drm/msm/mdp5: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 26/39] drm/omap: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 27/39] drm/rockchip: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 28/39] drm/sun4i: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 29/39] drm/tegra: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 30/39] drm/tilcdc: " Maxime Ripard
2025-09-12  9:47   ` Jyri Sarha
2025-09-09 11:27 ` [PATCH v3 31/39] drm/vboxvideo: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 32/39] drm/vc4: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 33/39] drm/atomic: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 34/39] drm/framebuffer: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 35/39] drm/atomic: Remove unused drm_atomic_get_existing_crtc_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 36/39] drm/atomic: Document __drm_crtcs_state state pointer Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state() Maxime Ripard
2025-09-09 11:43   ` Paul Cercueil
2025-09-09 13:52   ` Ville Syrjälä [this message]
2025-09-09 14:45     ` Paul Cercueil
2025-09-10 11:26       ` Maxime Ripard
2025-09-10 13:14         ` Paul Cercueil
2025-09-10 12:19       ` Ville Syrjälä
2025-09-09 11:27 ` [PATCH v3 38/39] drm/atomic: Convert drm_atomic_get_private_obj_state() to use new plane state Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 39/39] drm/atomic: Document __drm_private_objs_state state pointer Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aMAxEjIJOvxmOj2D@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=paul@crapouillou.net \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox