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 v4 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state()
Date: Wed, 17 Sep 2025 19:11:57 +0300 [thread overview]
Message-ID: <aMrdzcrx42OR_0KV@intel.com> (raw)
In-Reply-To: <20250917-drm-no-more-existing-state-v4-37-5d4b9889c3c8@kernel.org>
On Wed, Sep 17, 2025 at 04:46:18PM +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.
>
> We still need to make sure the private state will be part of the global
> state by the time atomic_enable runs, so we still need to call
> ingenic_drm_get_priv_state() in atomic_check. We can then call
> ingenic_drm_get_new_priv_state() in atomic_enable, which is a wrapper
> around drm_atomic_get_new_private_obj_state().
>
> 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>
Seems fine by me.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> To: Paul Cercueil <paul@crapouillou.net>
> Cc: linux-mips@vger.kernel.org
> ---
> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index 05faed933e5619c796f2a4fa1906e0eaa029ac68..d3213fbf22be14b177fc1b7100c5b721d5f17924 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -245,12 +245,12 @@ 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);
> - if (WARN_ON(IS_ERR(priv_state)))
> + priv_state = ingenic_drm_get_new_priv_state(priv, state);
> + if (WARN_ON(!priv_state))
> return;
>
> /* Set addresses of our DMA descriptor chains */
> next_id = priv_state->use_palette ? HWDESC_PALETTE : 0;
> regmap_write(priv->map, JZ_REG_LCD_DA0, dma_hwdesc_addr(priv, next_id));
> @@ -338,17 +338,23 @@ static int ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc,
> {
> struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
> crtc);
> struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
> struct drm_plane_state *f1_state, *f0_state, *ipu_state = NULL;
> + struct ingenic_drm_private_state *priv_state;
>
> if (crtc_state->gamma_lut &&
> drm_color_lut_size(crtc_state->gamma_lut) != ARRAY_SIZE(priv->dma_hwdescs->palette)) {
> dev_dbg(priv->dev, "Invalid palette size\n");
> return -EINVAL;
> }
>
> + /* We will need the state in atomic_enable, so let's make sure it's part of the state */
> + priv_state = ingenic_drm_get_priv_state(priv, state);
> + if (IS_ERR(priv_state))
> + return PTR_ERR(priv_state);
> +
> if (drm_atomic_crtc_needs_modeset(crtc_state) && priv->soc_info->has_osd) {
> f1_state = drm_atomic_get_plane_state(crtc_state->state,
> &priv->f1);
> if (IS_ERR(f1_state))
> return PTR_ERR(f1_state);
>
> --
> 2.50.1
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2025-09-17 16:12 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-17 14:45 [PATCH v4 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
2025-09-17 14:45 ` Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 01/39] drm/atomic: Convert drm_atomic_get_connector_state() to use new connector state Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 02/39] drm/atomic: Remove unused drm_atomic_get_existing_connector_state() Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 03/39] drm/atomic: Document __drm_connectors_state state pointer Maxime Ripard
2025-09-18 3:14 ` Liu Ying
2025-09-17 14:45 ` [PATCH v4 04/39] drm/atomic: Convert __drm_atomic_get_current_plane_state() to modern accessor Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 05/39] drm/atomic: Convert drm_atomic_get_plane_state() to use new plane state Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 06/39] drm/vkms: Convert vkms_crtc_atomic_check() " Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 07/39] drm/tilcdc: crtc: Use drm_atomic_helper_check_crtc_primary_plane() Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 08/39] drm/atomic: Remove unused drm_atomic_get_existing_plane_state() Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 09/39] drm/atomic: Document __drm_planes_state state pointer Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 10/39] drm/atomic: Convert drm_atomic_get_crtc_state() to use new connector state Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 11/39] drm/ingenic: ipu: Switch to drm_atomic_get_new_crtc_state() Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 12/39] drm/arm/malidp: " Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 13/39] drm/armada: Drop always true condition in atomic_check Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 14/39] drm/armada: Switch to drm_atomic_get_new_crtc_state() Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 15/39] drm/atmel-hlcdc: " Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 16/39] drm/exynos: " Maxime Ripard
2025-09-17 14:45 ` [PATCH v4 17/39] drm/imx-dc: " Maxime Ripard
2025-09-18 2:47 ` Liu Ying
2025-09-17 14:45 ` [PATCH v4 18/39] drm/imx-dcss: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 19/39] drm/imx-ipuv3: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 20/39] drm/ingenic: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 21/39] drm/kmb: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 22/39] drm/logicvc: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 23/39] drm/loongson: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 24/39] drm/mediatek: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 25/39] drm/msm/mdp5: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 26/39] drm/omap: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 27/39] drm/rockchip: " Maxime Ripard
2025-09-17 14:46 ` Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 28/39] drm/sun4i: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 29/39] drm/tegra: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 30/39] drm/tilcdc: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 31/39] drm/vboxvideo: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 32/39] drm/vc4: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 33/39] drm/atomic: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 34/39] drm/framebuffer: " Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 35/39] drm/atomic: Remove unused drm_atomic_get_existing_crtc_state() Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 36/39] drm/atomic: Document __drm_crtcs_state state pointer Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state() Maxime Ripard
2025-09-17 16:11 ` Ville Syrjälä [this message]
2025-09-17 14:46 ` [PATCH v4 38/39] drm/atomic: Convert drm_atomic_get_private_obj_state() to use new plane state Maxime Ripard
2025-09-17 14:46 ` [PATCH v4 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=aMrdzcrx42OR_0KV@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.