From: Maxime Ripard <mripard@kernel.org>
To: Luca Ceresoli <luca.ceresoli@bootlin.com>
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>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
dri-devel <dri-devel-bounces@lists.freedesktop.org>
Subject: Re: [PATCH v2 05/16] drm/bridge: Switch private_obj initialization to atomic_create_state
Date: Mon, 8 Dec 2025 16:43:14 +0100 [thread overview]
Message-ID: <20251208-impossible-successful-ibex-5bceac@houat> (raw)
In-Reply-To: <DDNUOE1ZNUKS.GD10B3113L1T@bootlin.com>
[-- Attachment #1: Type: text/plain, Size: 2913 bytes --]
On Tue, Oct 21, 2025 at 10:17:13AM +0200, Luca Ceresoli wrote:
> Hello Maxime,
>
> On Tue Oct 14, 2025 at 11:31 AM CEST, Maxime Ripard wrote:
> > The bridge implementation relies on a drm_private_obj, that is
> > initialized by allocating and initializing a state, and then passing it
> > to drm_private_obj_init.
> >
> > Since we're gradually moving away from that pattern to the more
> > established one relying on a atomic_create_state implementation, let's
> > migrate this instance to the new pattern.
> >
> > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > Signed-off-by: Maxime Ripard <mripard@kernel.org>
> > ---
> >
> > Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> > Cc: Neil Armstrong <neil.armstrong@linaro.org>
> > Cc: Robert Foss <rfoss@kernel.org>
> > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> > Cc: Jonas Karlman <jonas@kwiboo.se>
> > Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
> > ---
> > drivers/gpu/drm/drm_bridge.c | 33 ++++++++++++++++++---------------
> > 1 file changed, 18 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> > index 630b5e6594e0affad9ba48791207c7b403da5db8..f0db891863428ee65625a6a3ed38f63ec802595e 100644
> > --- a/drivers/gpu/drm/drm_bridge.c
> > +++ b/drivers/gpu/drm/drm_bridge.c
> > @@ -394,11 +394,27 @@ drm_bridge_atomic_destroy_priv_state(struct drm_private_obj *obj,
> > struct drm_bridge *bridge = drm_priv_to_bridge(obj);
> >
> > bridge->funcs->atomic_destroy_state(bridge, state);
> > }
> >
> > +static struct drm_private_state *
> > +drm_bridge_atomic_create_priv_state(struct drm_private_obj *obj)
> > +{
> > + struct drm_bridge *bridge = drm_priv_to_bridge(obj);
> > + struct drm_bridge_state *state;
> > +
> > + state = bridge->funcs->atomic_reset(bridge);
> > + if (IS_ERR(state))
> > + return ERR_PTR(-ENOMEM);
>
> This is slightly changing the behaviour, assuming that every error is
> -ENOMEM, while in the current implementation any error code is just
> propagated. I searched all .atomic_reset callbacks and apparently none can
> return any other error, so this would not introduce a bug with current
> drivers. However the atomic_reset docs say any ERR_PTR can be returned,
> thus a future driver would be allowed to return another error value, even
> thoug it's unlikely. The drm_bridge.c core having no control over what
> other drivers do, I wonder whether we should just return ERR_PTR(state)
> here, and keep the check on the drm_atomic_private_obj_init() return value
> below.
>
> I have no strong position about which direction is best however. Maybe
> changing the docs to say "Return: only -ENOMEM", and add here a
> WARN_ON(IS_ERR(state) && ERR_PTR(state) != -ENOMEM)?
No, it's a good catch, we should totally return state and not ignore it.
Thanks!
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
next prev parent reply other threads:[~2025-12-08 15:43 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 9:31 [PATCH v2 00/16] drm/atomic: Allocate drm_private_state through a callback Maxime Ripard
2025-10-14 9:31 ` [PATCH v2 01/16] drm/atomic: Add dev pointer to drm_private_obj Maxime Ripard
2025-10-21 8:16 ` Luca Ceresoli
2025-12-08 15:37 ` (subset) " Maxime Ripard
2025-10-14 9:31 ` [PATCH v2 02/16] drm/atomic: Make drm_atomic_private_obj_init fallible Maxime Ripard
2025-10-14 9:31 ` [PATCH v2 03/16] drm/atomic: Add new atomic_create_state callback to drm_private_obj Maxime Ripard
2025-10-14 22:49 ` Dmitry Baryshkov
2025-10-15 0:17 ` Dmitry Baryshkov
2025-10-21 8:17 ` Luca Ceresoli
2025-12-08 15:48 ` Maxime Ripard
2025-10-14 9:31 ` [PATCH v2 04/16] drm/atomic-helper: Add private_obj atomic_create_state helper Maxime Ripard
2025-10-15 0:16 ` Dmitry Baryshkov
2025-10-14 9:31 ` [PATCH v2 05/16] drm/bridge: Switch private_obj initialization to atomic_create_state Maxime Ripard
2025-10-21 8:17 ` Luca Ceresoli
2025-12-08 15:43 ` Maxime Ripard [this message]
2025-10-14 9:31 ` [PATCH v2 06/16] drm/dp_mst: " Maxime Ripard
2025-10-14 9:31 ` [PATCH v2 07/16] drm/dp_tunnel: " Maxime Ripard
2025-10-14 9:31 ` [PATCH v2 08/16] drm/amdgpu: " Maxime Ripard
2025-10-14 9:31 ` [PATCH v2 09/16] drm/arm: komeda: " Maxime Ripard
2025-10-14 9:31 ` [PATCH v2 10/16] drm/ingenic: " Maxime Ripard
2025-10-14 9:31 ` [PATCH v2 11/16] drm/msm: mdp5: " Maxime Ripard
2025-10-15 0:52 ` Dmitry Baryshkov
2025-10-14 9:31 ` [PATCH v2 12/16] drm/msm: dpu1: " Maxime Ripard
2025-10-15 0:52 ` Dmitry Baryshkov
2025-10-14 9:31 ` [PATCH v2 13/16] drm/omapdrm: " Maxime Ripard
2025-10-14 9:31 ` [PATCH v2 14/16] drm/tegra: " Maxime Ripard
2025-10-14 9:31 ` [PATCH v2 15/16] drm/vc4: " Maxime Ripard
2025-10-14 9:32 ` [PATCH v2 16/16] drm/atomic: Remove state argument to drm_atomic_private_obj_init 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=20251208-impossible-successful-ibex-5bceac@houat \
--to=mripard@kernel.org \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel-bounces@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=luca.ceresoli@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--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