Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: "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>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>, "Phong LE" <ple@baylibre.com>,
	"Inki Dae" <inki.dae@samsung.com>,
	"Seung-Woo Kim" <sw0312.kim@samsung.com>,
	"Kyungmin Park" <kyungmin.park@samsung.com>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Alim Akhtar" <alim.akhtar@samsung.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Chun-Kuang Hu" <chunkuang.hu@kernel.org>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Andy Yan" <andy.yan@rock-chips.com>,
	"Alain Volmat" <alain.volmat@foss.st.com>,
	"Raphael Gallais-Pou" <rgallaispou@gmail.com>,
	"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
	"Maíra Canal" <mcanal@igalia.com>,
	"Raspberry Pi Kernel Maintenance" <kernel-list@raspberrypi.com>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-sound@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v6 09/10] drm/vc4: hdmi: stop rereading EDID in get_modes()
Date: Tue, 17 Dec 2024 18:13:27 +0100	[thread overview]
Message-ID: <20241217-curly-mauve-scallop-d84a3d@houat> (raw)
In-Reply-To: <73xdxb575n4ncmadffkwqzczoewbadq3forpvqt4vp7zfln2nq@o2wmbbbepwgg>

[-- Attachment #1: Type: text/plain, Size: 3237 bytes --]

On Sun, Dec 08, 2024 at 01:06:46PM +0200, Dmitry Baryshkov wrote:
> On Fri, Dec 06, 2024 at 03:34:52PM +0100, Maxime Ripard wrote:
> > Hi,
> > 
> > On Fri, Dec 06, 2024 at 12:16:03PM +0200, Dmitry Baryshkov wrote:
> > > The vc4_hdmi_connector_detect_ctx() via vc4_hdmi_handle_hotplug()
> > > already reads EDID and propagates it to the drm_connector. Stop
> > > rereading EDID as a part of the .get_modes() callback and just update
> > > the list of modes. This matches the behaviour of the i915 driver.
> > > 
> > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > > ---
> > >  drivers/gpu/drm/vc4/vc4_hdmi.c | 21 ---------------------
> > >  1 file changed, 21 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> > > index e5ab42f72f618b90f956482db6c9c8074c1e3bf1..3364ef90968dad3074800f02926300ffceb75c69 100644
> > > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> > > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> > > @@ -470,31 +470,10 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector,
> > >  
> > >  static int vc4_hdmi_connector_get_modes(struct drm_connector *connector)
> > >  {
> > > -	struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
> > >  	struct vc4_dev *vc4 = to_vc4_dev(connector->dev);
> > > -	const struct drm_edid *drm_edid;
> > >  	int ret = 0;
> > >  
> > > -	/*
> > > -	 * NOTE: This function should really take vc4_hdmi->mutex, but doing so
> > > -	 * results in reentrancy issues since cec_s_phys_addr() might call
> > > -	 * .adap_enable, which leads to that funtion being called with our mutex
> > > -	 * held.
> > > -	 *
> > > -	 * Concurrency isn't an issue at the moment since we don't share
> > > -	 * any state with any of the other frameworks so we can ignore
> > > -	 * the lock for now.
> > > -	 */
> > > -
> > > -	drm_edid = drm_edid_read_ddc(connector, vc4_hdmi->ddc);
> > > -	drm_edid_connector_update(connector, drm_edid);
> > > -	cec_s_phys_addr(vc4_hdmi->cec_adap,
> > > -			connector->display_info.source_physical_address, false);
> > > -	if (!drm_edid)
> > > -		return 0;
> > > -
> > >  	ret = drm_edid_connector_add_modes(connector);
> > > -	drm_edid_free(drm_edid);
> > 
> > I don't think that works though, for mostly two reasons:
> > 
> >  1) We're not sure we'll even have an hotplug interrupt if the system
> >     boots with the connector plugged in for example.
> > 
> >  2) afaik, the get_modes ioctl directly calls get_modes too.
> 
> I think both paths use .fill_modes, not get_modes.

The standard fill_modes helper calls get_modes.

> And fill_modes explicitly calls .detect / .detect_ctx. It would be
> nice if somebody can verify the change on the acual hw. But as I
> wrote, i915 driver does exactly the same: the EDID is read / updated
> in .detect_ctx(), while .get_modes() only performs
> drm_edid_connector_add_modes(). Okay, there is one significant
> difference which we should probably patch out: the .force() is also
> implemented to update EDID in the forced case. I should probably do
> the same for the drivers being handled in this patchset.

Ack. Worst case scenario we can fix it later on.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

  parent reply	other threads:[~2024-12-17 17:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-06 10:15 [PATCH v6 00/10] drm: add DRM HDMI Codec framework Dmitry Baryshkov
2024-12-06 10:15 ` [PATCH v6 01/10] ASoC: hdmi-codec: pass data to get_dai_id too Dmitry Baryshkov
2024-12-06 10:15 ` [PATCH v6 02/10] ASoC: hdmi-codec: move no_capture_mute to struct hdmi_codec_pdata Dmitry Baryshkov
2024-12-06 10:15 ` [PATCH v6 03/10] drm/connector: implement generic HDMI codec helpers Dmitry Baryshkov
2024-12-16 17:04   ` Maxime Ripard
2024-12-16 17:47     ` Dmitry Baryshkov
2024-12-17  7:43       ` Maxime Ripard
2024-12-17 12:31         ` Dmitry Baryshkov
2024-12-06 10:15 ` [PATCH v6 04/10] drm/bridge: connector: add support for HDMI codec framework Dmitry Baryshkov
2024-12-16 17:14   ` Maxime Ripard
2024-12-16 17:49     ` Dmitry Baryshkov
2024-12-06 10:15 ` [PATCH v6 05/10] drm/bridge: lt9611: switch to using the DRM " Dmitry Baryshkov
2024-12-16 17:15   ` Maxime Ripard
2024-12-06 10:16 ` [PATCH v6 06/10] drm/display/hdmi: implement hotplug functions Dmitry Baryshkov
2024-12-16 17:20   ` Maxime Ripard
2024-12-16 17:55     ` Dmitry Baryshkov
2024-12-06 10:16 ` [PATCH v6 07/10] drm/bridge_connector: hook drm_atomic_helper_connector_hdmi_hotplug_edid() Dmitry Baryshkov
2024-12-06 10:16 ` [PATCH v6 08/10] drm/vc4: hdmi: switch to using generic HDMI Codec infrastructure Dmitry Baryshkov
2024-12-06 10:16 ` [PATCH v6 09/10] drm/vc4: hdmi: stop rereading EDID in get_modes() Dmitry Baryshkov
2024-12-06 14:34   ` Maxime Ripard
2024-12-08 11:06     ` Dmitry Baryshkov
2024-12-16 11:26       ` Dmitry Baryshkov
2024-12-17 17:13       ` Maxime Ripard [this message]
2024-12-06 10:16 ` [PATCH v6 10/10] drm/vc4: hdmi: use drm_atomic_helper_connector_hdmi_hotplug_edid() Dmitry Baryshkov

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=20241217-curly-mauve-scallop-d84a3d@houat \
    --to=mripard@kernel.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=alain.volmat@foss.st.com \
    --cc=alim.akhtar@samsung.com \
    --cc=andrzej.hajda@intel.com \
    --cc=andy.yan@rock-chips.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=broonie@kernel.org \
    --cc=chunkuang.hu@kernel.org \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=inki.dae@samsung.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=kernel-list@raspberrypi.com \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mcanal@igalia.com \
    --cc=neil.armstrong@linaro.org \
    --cc=p.zabel@pengutronix.de \
    --cc=perex@perex.cz \
    --cc=ple@baylibre.com \
    --cc=rfoss@kernel.org \
    --cc=rgallaispou@gmail.com \
    --cc=simona@ffwll.ch \
    --cc=sw0312.kim@samsung.com \
    --cc=tiwai@suse.com \
    --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