From: Maxime Ripard <mripard@kernel.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
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>,
Douglas Anderson <dianders@chromium.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 25/29] drm/bridge: Provide pointers to the connector and crtc in bridge state
Date: Thu, 16 Jan 2025 09:42:54 +0100 [thread overview]
Message-ID: <20250116-energetic-fine-worm-c2460a@houat> (raw)
In-Reply-To: <eaardp55onpuqxneh4q6a7tmujglp2pu7kubwisoubjbyuqbt3@zttu7txp34xx>
[-- Attachment #1: Type: text/plain, Size: 3853 bytes --]
Hi,
On Thu, Jan 16, 2025 at 03:04:19AM +0200, Dmitry Baryshkov wrote:
> On Wed, Jan 15, 2025 at 10:05:32PM +0100, Maxime Ripard wrote:
> > Now that connectors are no longer necessarily created by the bridges
> > drivers themselves but might be created by drm_bridge_connector, it's
> > pretty hard for bridge drivers to retrieve pointers to the connector and
> > CRTC they are attached to.
> >
> > Indeed, the only way to retrieve the CRTC is to follow the drm_bridge
> > encoder field, and then the drm_encoder crtc field, both of them being
> > deprecated.
> >
> > And for the connector, since we can have multiple connectors attached to
> > a CRTC, we don't really have a reliable way to get it.
> >
> > Let's provide both pointers in the drm_bridge_state structure so we
> > don't have to follow deprecated, non-atomic, pointers, and be more
> > consistent with the other KMS entities.
> >
> > Signed-off-by: Maxime Ripard <mripard@kernel.org>
> > ---
> > drivers/gpu/drm/drm_atomic_state_helper.c | 5 +++++
> > drivers/gpu/drm/drm_bridge.c | 21 +++++++++++++--------
> > include/drm/drm_atomic.h | 14 ++++++++++++++
> > 3 files changed, 32 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
> > index 519228eb109533d2596e899a57b571fa0995824f..66661dca077215b78dffca7bc1712f56d35e3918 100644
> > --- a/drivers/gpu/drm/drm_atomic_state_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_state_helper.c
> > @@ -777,10 +777,15 @@ EXPORT_SYMBOL(drm_atomic_helper_bridge_duplicate_state);
> > * that don't subclass the bridge state.
> > */
> > void drm_atomic_helper_bridge_destroy_state(struct drm_bridge *bridge,
> > struct drm_bridge_state *state)
> > {
> > + if (state->connector) {
> > + drm_connector_put(state->connector);
> > + state->connector = NULL;
> > + }
> > +
> > kfree(state);
> > }
> > EXPORT_SYMBOL(drm_atomic_helper_bridge_destroy_state);
> >
> > /**
> > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> > index c937980d6591fd98e33e37d799ebf84e7e6c5529..069c105aa59636c64caffbefcf482133b0db97d9 100644
> > --- a/drivers/gpu/drm/drm_bridge.c
> > +++ b/drivers/gpu/drm/drm_bridge.c
> > @@ -829,19 +829,24 @@ EXPORT_SYMBOL(drm_atomic_bridge_chain_enable);
> >
> > static int drm_atomic_bridge_check(struct drm_bridge *bridge,
> > struct drm_crtc_state *crtc_state,
> > struct drm_connector_state *conn_state)
> > {
> > + struct drm_bridge_state *bridge_state;
> > + int ret;
> > +
> > + bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state,
> > + bridge);
>
> It felt like an error to me to call this function for a non-atomic
> bridges, until I fully followed the code path to find that it will
> return NULL if the bridge isn't registered as a private object.
Yeah.. I wasn't too sure what to do about this one either. I think it
would be more consistent to always have a state properly filled, even if
we have !atomic drivers. It's what happens with the rest of the
framework.
But also, I have no idea what the side-effects might be.
One thing though: a driver having an atomic_check callback is not an
indication of whether it supports atomic mode-setting or not.
atomic_check is optional, so we can have atomic drivers without
atomic_check.
> BTW: if my grep-foo isn't deceiving me, we currently have 34 non-atomic
> bridges out of 90. Should we start forcebly updating them to use atomic
> interface in attempt to drop the mode_fixup() and other non-atomic
> callbacks?
Maybe? I'm not sure forcing anyone to anything really helps. sii8620 for
example is going to be a fun one, and I'd rather stay away from it :)
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
next prev parent reply other threads:[~2025-01-16 8:43 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 21:05 [PATCH 00/29] drm/bridge: Various quality of life improvements Maxime Ripard
2025-01-15 21:05 ` [PATCH 01/29] drm/atomic-helper: Fix commit_tail state variable name Maxime Ripard
2025-01-16 1:36 ` Dmitry Baryshkov
2025-01-16 11:27 ` Simona Vetter
2025-01-15 21:05 ` [PATCH 02/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_dependencies() Maxime Ripard
2025-01-15 21:05 ` [PATCH 03/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_tail() Maxime Ripard
2025-01-15 21:05 ` [PATCH 04/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_tail_rpm() Maxime Ripard
2025-01-15 21:05 ` [PATCH 05/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_modeset_disables() Maxime Ripard
2025-01-15 21:05 ` [PATCH 06/29] drm/atomic-helper: Change parameter name of disable_outputs() Maxime Ripard
2025-01-15 21:05 ` [PATCH 07/29] drm/bridge: Change parameter name of drm_atomic_bridge_chain_disable() Maxime Ripard
2025-01-15 21:05 ` [PATCH 08/29] drm/bridge: Change parameter name of drm_atomic_bridge_chain_post_disable() Maxime Ripard
2025-01-15 21:05 ` [PATCH 09/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_update_legacy_modeset_state() Maxime Ripard
2025-01-15 21:05 ` [PATCH 10/29] drm/atomic-helper: Change parameter name of crtc_set_mode() Maxime Ripard
2025-01-15 21:05 ` [PATCH 11/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_planes() Maxime Ripard
2025-01-15 21:05 ` [PATCH 12/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_modeset_enables() Maxime Ripard
2025-01-15 21:05 ` [PATCH 13/29] drm/bridge: Change parameter name of drm_atomic_bridge_chain_pre_enable() Maxime Ripard
2025-01-15 21:05 ` [PATCH 14/29] drm/bridge: Change parameter name of drm_atomic_bridge_chain_enable() Maxime Ripard
2025-01-15 21:05 ` [PATCH 15/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_writebacks() Maxime Ripard
2025-01-15 21:05 ` [PATCH 16/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_fake_vblank() Maxime Ripard
2025-01-15 21:05 ` [PATCH 17/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_hw_done() Maxime Ripard
2025-01-15 21:05 ` [PATCH 18/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_vblanks() Maxime Ripard
2025-01-15 21:05 ` [PATCH 19/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_cleanup_planes() Maxime Ripard
2025-01-15 21:05 ` [PATCH 20/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_cleanup_done() Maxime Ripard
2025-01-15 21:05 ` [PATCH 21/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_flip_done() Maxime Ripard
2025-01-15 21:05 ` [PATCH 22/29] drm/bridge: Rename atomic hooks parameters to drop old prefix Maxime Ripard
2025-01-16 11:34 ` Simona Vetter
2025-01-17 14:50 ` Maxime Ripard
2025-01-17 15:32 ` Simona Vetter
2025-01-15 21:05 ` [PATCH 23/29] drm/bridge: Provide a helper to retrieve current bridge state Maxime Ripard
2025-01-16 0:43 ` Dmitry Baryshkov
2025-01-16 8:30 ` Maxime Ripard
2025-01-16 11:35 ` Simona Vetter
2025-01-15 21:05 ` [PATCH 24/29] drm/bridge: Provide a helper to get the global state from a " Maxime Ripard
2025-01-16 11:31 ` Simona Vetter
2025-01-15 21:05 ` [PATCH 25/29] drm/bridge: Provide pointers to the connector and crtc in " Maxime Ripard
2025-01-16 1:04 ` Dmitry Baryshkov
2025-01-16 8:42 ` Maxime Ripard [this message]
2025-01-16 9:53 ` Dmitry Baryshkov
2025-01-15 21:05 ` [PATCH 26/29] drm/bridge: cdns-csi: Switch to atomic helpers Maxime Ripard
2025-01-16 1:06 ` Dmitry Baryshkov
2025-01-15 21:05 ` [PATCH 27/29] drm/bridge: tc358775: Switch to atomic commit Maxime Ripard
2025-01-16 1:06 ` Dmitry Baryshkov
2025-01-15 21:05 ` [PATCH 28/29] drm/bridge: tc358768: Convert to atomic helpers Maxime Ripard
2025-01-15 21:05 ` [PATCH 29/29] drm/bridge: ti-sn65dsi86: Use bridge_state crtc pointer Maxime Ripard
2025-01-16 1:08 ` Dmitry Baryshkov
2025-02-03 10:01 ` Maxime Ripard
2025-02-03 17:49 ` Dmitry Baryshkov
2025-02-04 8:23 ` 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=20250116-energetic-fine-worm-c2460a@houat \
--to=mripard@kernel.org \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dianders@chromium.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--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 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.