From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Daniel Vetter <daniel@ffwll.ch>, Emma Anholt <emma@anholt.net>,
Dom Cobley <dom@raspberrypi.com>,
Tim Gover <tim.gover@raspberrypi.com>,
Dave Stevenson <dave.stevenson@raspberrypi.com>,
David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org,
Jonathan Hunter <jonathanh@nvidia.com>,
Thierry Reding <thierry.reding@gmail.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
linux-tegra@vger.kernel.org,
Daniel Vetter <daniel.vetter@intel.com>,
Phil Elwell <phil@raspberrypi.com>
Subject: Re: [PATCH 02/13] drm/connector: Add helper to check if a mode requires scrambling
Date: Mon, 8 Nov 2021 19:55:00 +0200 [thread overview]
Message-ID: <YYlkdHzW4ir07Gtk@intel.com> (raw)
In-Reply-To: <20211108155834.6zz236ll75bxwcrk@gilmour>
On Mon, Nov 08, 2021 at 04:58:34PM +0100, Maxime Ripard wrote:
> On Fri, Nov 05, 2021 at 08:14:04PM +0200, Ville Syrjälä wrote:
> > On Fri, Nov 05, 2021 at 07:02:30PM +0100, Daniel Vetter wrote:
> > > On Thu, Nov 04, 2021 at 05:37:21PM +0200, Ville Syrjälä wrote:
> > > > On Tue, Nov 02, 2021 at 03:59:33PM +0100, Maxime Ripard wrote:
> > > > > --- a/include/drm/drm_modes.h
> > > > > +++ b/include/drm/drm_modes.h
> > > > > @@ -424,6 +424,21 @@ static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode)
> > > > > return mode->flags & DRM_MODE_FLAG_3D_MASK;
> > > > > }
> > > > >
> > > > > +/**
> > > > > + * drm_mode_hdmi_requires_scrambling - Checks if a mode requires HDMI Scrambling
> > > > > + * @mode: DRM display mode
> > > > > + *
> > > > > + * Checks if a given display mode requires the scrambling to be enabled.
> > > > > + *
> > > > > + * Returns:
> > > > > + * A boolean stating whether it's required or not.
> > > > > + */
> > > > > +static inline bool
> > > > > +drm_mode_hdmi_requires_scrambling(const struct drm_display_mode *mode)
> > > > > +{
> > > > > + return mode->clock > DRM_HDMI_14_MAX_TMDS_CLK_KHZ;
> > > > > +}
> > > >
> > > > That's only correct for 8bpc. The actual limit is on the TMDS clock (or
> > > > rather TMDS character rate as HDMI 2.0 calls it due to the 1/1 vs. 1/4
> > > > magic for the actually transmitted TMDS clock).
> > >
> > > Yeah we might need to add the bus format for the cable here too, to make
> > > this complete.
> >
> > I don't think we have a usable thing for that on the drm level, so
> > would need to invent something. Oh, and the mode->clock vs.
> > mode->crtc_clock funny business also limits the usability of this
> > approach. So probably just easiest to pass in the the driver calculated
> > TMDS clock instead.
>
> If we look at all (I think?) the existing users of scrambling in KMS as
> of 5.15, only i915 seems to use crtc_clock (which, in retrospect, seems
> to be the right thing to do), and only i915 and dw-hdmi use an output
> format, i915 rolling its own, and dw-hdmi using the mbus formats.
>
> I think using the mbus format here makes the most sense: i915 already is
> rolling a whole bunch of other code, and we use the mbus defines for the
> bridge format enumeration as well which is probably going to have some
> interaction.
>
> I'm not quite sure what to do next though. The whole point of that
> series is to streamline as much as possible the scrambling and TMDS
> ratio setup to avoid the duplication we already have in the drivers that
> support it, every one using the mostly-the-same-but-slightly-different
> logic to configure it.
>
> The mode is fortunately stored in generic structures so it's easy to
> make that decision. Having to take into account the output format
> however makes it mandatory to move the bus format in the
> drm_connector_state(?) structure too.
I think involving state objects and the like is just going to make
it harder to share code between all drivers, if that is the goal.
Just a few tiny helpers I think is what would allow the broadest
reuse. I guess you could build additional midlayer on top of those
for some drivers if you wish.
As for the bus_format stuff, that looks at the same time overkill,
and insufficiently documented. I guess its main purpose is to exactly
defines how some digtal bus works, which makes sense when you're
chaining a bunch of random chips together. But looks overly complicated
to me for defining what to output from a HDMI encoder. Looking at the
defines I wouldn't even know what to use for HDMI actually. All we
really want is RGB 4:4:4 vs. YCbCr 4:4:4 vs. YCbCr 4:2:2 vs. YCbCr 4:2:0.
Beyond that level of detail we don't care how each bit gets transferred
etc. Hence enum intel_output_format in i915.
--
Ville Syrjälä
Intel
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Emma Anholt <emma@anholt.net>,
Tim Gover <tim.gover@raspberrypi.com>,
Dave Stevenson <dave.stevenson@raspberrypi.com>,
David Airlie <airlied@linux.ie>,
Thomas Zimmermann <tzimmermann@suse.de>,
dri-devel@lists.freedesktop.org,
Jonathan Hunter <jonathanh@nvidia.com>,
Thierry Reding <thierry.reding@gmail.com>,
linux-tegra@vger.kernel.org,
Daniel Vetter <daniel.vetter@intel.com>,
Phil Elwell <phil@raspberrypi.com>,
Dom Cobley <dom@raspberrypi.com>
Subject: Re: [PATCH 02/13] drm/connector: Add helper to check if a mode requires scrambling
Date: Mon, 8 Nov 2021 19:55:00 +0200 [thread overview]
Message-ID: <YYlkdHzW4ir07Gtk@intel.com> (raw)
In-Reply-To: <20211108155834.6zz236ll75bxwcrk@gilmour>
On Mon, Nov 08, 2021 at 04:58:34PM +0100, Maxime Ripard wrote:
> On Fri, Nov 05, 2021 at 08:14:04PM +0200, Ville Syrjälä wrote:
> > On Fri, Nov 05, 2021 at 07:02:30PM +0100, Daniel Vetter wrote:
> > > On Thu, Nov 04, 2021 at 05:37:21PM +0200, Ville Syrjälä wrote:
> > > > On Tue, Nov 02, 2021 at 03:59:33PM +0100, Maxime Ripard wrote:
> > > > > --- a/include/drm/drm_modes.h
> > > > > +++ b/include/drm/drm_modes.h
> > > > > @@ -424,6 +424,21 @@ static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode)
> > > > > return mode->flags & DRM_MODE_FLAG_3D_MASK;
> > > > > }
> > > > >
> > > > > +/**
> > > > > + * drm_mode_hdmi_requires_scrambling - Checks if a mode requires HDMI Scrambling
> > > > > + * @mode: DRM display mode
> > > > > + *
> > > > > + * Checks if a given display mode requires the scrambling to be enabled.
> > > > > + *
> > > > > + * Returns:
> > > > > + * A boolean stating whether it's required or not.
> > > > > + */
> > > > > +static inline bool
> > > > > +drm_mode_hdmi_requires_scrambling(const struct drm_display_mode *mode)
> > > > > +{
> > > > > + return mode->clock > DRM_HDMI_14_MAX_TMDS_CLK_KHZ;
> > > > > +}
> > > >
> > > > That's only correct for 8bpc. The actual limit is on the TMDS clock (or
> > > > rather TMDS character rate as HDMI 2.0 calls it due to the 1/1 vs. 1/4
> > > > magic for the actually transmitted TMDS clock).
> > >
> > > Yeah we might need to add the bus format for the cable here too, to make
> > > this complete.
> >
> > I don't think we have a usable thing for that on the drm level, so
> > would need to invent something. Oh, and the mode->clock vs.
> > mode->crtc_clock funny business also limits the usability of this
> > approach. So probably just easiest to pass in the the driver calculated
> > TMDS clock instead.
>
> If we look at all (I think?) the existing users of scrambling in KMS as
> of 5.15, only i915 seems to use crtc_clock (which, in retrospect, seems
> to be the right thing to do), and only i915 and dw-hdmi use an output
> format, i915 rolling its own, and dw-hdmi using the mbus formats.
>
> I think using the mbus format here makes the most sense: i915 already is
> rolling a whole bunch of other code, and we use the mbus defines for the
> bridge format enumeration as well which is probably going to have some
> interaction.
>
> I'm not quite sure what to do next though. The whole point of that
> series is to streamline as much as possible the scrambling and TMDS
> ratio setup to avoid the duplication we already have in the drivers that
> support it, every one using the mostly-the-same-but-slightly-different
> logic to configure it.
>
> The mode is fortunately stored in generic structures so it's easy to
> make that decision. Having to take into account the output format
> however makes it mandatory to move the bus format in the
> drm_connector_state(?) structure too.
I think involving state objects and the like is just going to make
it harder to share code between all drivers, if that is the goal.
Just a few tiny helpers I think is what would allow the broadest
reuse. I guess you could build additional midlayer on top of those
for some drivers if you wish.
As for the bus_format stuff, that looks at the same time overkill,
and insufficiently documented. I guess its main purpose is to exactly
defines how some digtal bus works, which makes sense when you're
chaining a bunch of random chips together. But looks overly complicated
to me for defining what to output from a HDMI encoder. Looking at the
defines I wouldn't even know what to use for HDMI actually. All we
really want is RGB 4:4:4 vs. YCbCr 4:4:4 vs. YCbCr 4:2:2 vs. YCbCr 4:2:0.
Beyond that level of detail we don't care how each bit gets transferred
etc. Hence enum intel_output_format in i915.
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2021-11-08 17:57 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-02 14:59 [PATCH 00/13] drm: Add generic helpers for HDMI scrambling Maxime Ripard
2021-11-02 14:59 ` [PATCH 01/13] drm/connector: Add define for HDMI 1.4 Maximum Pixel Rate Maxime Ripard
2021-11-02 14:59 ` Maxime Ripard
2021-11-02 14:59 ` Maxime Ripard
2021-11-02 14:59 ` Maxime Ripard
2021-11-02 14:59 ` Maxime Ripard
2021-11-02 14:59 ` [Intel-gfx] " Maxime Ripard
2021-11-02 17:50 ` Alex Deucher
2021-11-02 17:50 ` Alex Deucher
2021-11-02 17:50 ` Alex Deucher
2021-11-02 17:50 ` Alex Deucher
2021-11-02 17:50 ` Alex Deucher
2021-11-02 17:50 ` [Intel-gfx] " Alex Deucher
2021-11-03 9:08 ` Neil Armstrong
2021-11-03 9:08 ` Neil Armstrong
2021-11-03 9:08 ` Neil Armstrong
2021-11-03 9:08 ` Neil Armstrong
2021-11-03 9:08 ` Neil Armstrong
2021-11-03 9:08 ` [Intel-gfx] " Neil Armstrong
2021-11-03 11:02 ` Ville Syrjälä
2021-11-03 11:02 ` Ville Syrjälä
2021-11-03 11:02 ` Ville Syrjälä
2021-11-03 11:02 ` Ville Syrjälä
2021-11-03 11:02 ` Ville Syrjälä
2021-11-03 11:02 ` [Intel-gfx] " Ville Syrjälä
2021-11-03 18:05 ` Ville Syrjälä
2021-11-03 18:05 ` Ville Syrjälä
2021-11-03 18:05 ` Ville Syrjälä
2021-11-03 18:05 ` Ville Syrjälä
2021-11-03 18:05 ` [Intel-gfx] " Ville Syrjälä
2021-11-04 8:48 ` Maxime Ripard
2021-11-04 8:48 ` Maxime Ripard
2021-11-04 8:48 ` Maxime Ripard
2021-11-04 8:48 ` Maxime Ripard
2021-11-04 8:48 ` [Intel-gfx] " Maxime Ripard
2021-11-04 15:41 ` Ville Syrjälä
2021-11-04 15:41 ` Ville Syrjälä
2021-11-04 15:41 ` Ville Syrjälä
2021-11-04 15:41 ` Ville Syrjälä
2021-11-04 15:41 ` [Intel-gfx] " Ville Syrjälä
2021-11-08 14:59 ` Maxime Ripard
2021-11-08 14:59 ` Maxime Ripard
2021-11-08 14:59 ` Maxime Ripard
2021-11-08 14:59 ` Maxime Ripard
2021-11-08 14:59 ` [Intel-gfx] " Maxime Ripard
2021-11-02 14:59 ` [PATCH 02/13] drm/connector: Add helper to check if a mode requires scrambling Maxime Ripard
2021-11-02 14:59 ` Maxime Ripard
2021-11-04 15:37 ` Ville Syrjälä
2021-11-04 15:37 ` Ville Syrjälä
2021-11-05 18:02 ` Daniel Vetter
2021-11-05 18:02 ` Daniel Vetter
2021-11-05 18:14 ` Ville Syrjälä
2021-11-05 18:14 ` Ville Syrjälä
2021-11-08 15:58 ` Maxime Ripard
2021-11-08 15:58 ` Maxime Ripard
2021-11-08 16:03 ` Daniel Vetter
2021-11-08 16:03 ` Daniel Vetter
2021-11-08 17:55 ` Ville Syrjälä [this message]
2021-11-08 17:55 ` Ville Syrjälä
2021-11-15 12:15 ` Maxime Ripard
2021-11-15 12:15 ` Maxime Ripard
2021-11-17 10:01 ` Maxime Ripard
2021-11-17 10:01 ` Maxime Ripard
2021-11-02 14:59 ` [PATCH 03/13] drm/atomic: Add HDMI scrambler state helper Maxime Ripard
2021-11-02 14:59 ` [PATCH 04/13] drm/atomic: Add HDMI reset link helper Maxime Ripard
2021-11-02 14:59 ` [PATCH 05/13] drm/scdc: Document hotplug gotchas Maxime Ripard
2021-11-02 14:59 ` [PATCH 06/13] drm/vc4: hdmi: Remove unused argument in vc4_hdmi_supports_scrambling Maxime Ripard
2021-11-02 14:59 ` [PATCH 07/13] drm/vc4: hdmi: Remove mutex in detect Maxime Ripard
2021-11-02 14:59 ` [PATCH 08/13] drm/vc4: hdmi: Remove HDMI flag from encoder Maxime Ripard
2021-11-02 14:59 ` [PATCH 09/13] drm/vc4: hdmi: Simplify the hotplug handling Maxime Ripard
2021-11-02 14:59 ` [PATCH 10/13] drm/vc4: hdmi: Simplify the connector state retrieval Maxime Ripard
2021-11-02 14:59 ` [PATCH 11/13] drm/vc4: hdmi: Switch to detect_ctx Maxime Ripard
2021-11-02 14:59 ` [PATCH 12/13] drm/vc4: hdmi: Leverage new SCDC atomic_check Maxime Ripard
2021-11-02 14:59 ` [PATCH 13/13] drm/vc4: hdmi: Reset link on hotplug 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=YYlkdHzW4ir07Gtk@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=airlied@linux.ie \
--cc=daniel.vetter@intel.com \
--cc=daniel@ffwll.ch \
--cc=dave.stevenson@raspberrypi.com \
--cc=dom@raspberrypi.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=emma@anholt.net \
--cc=jonathanh@nvidia.com \
--cc=linux-tegra@vger.kernel.org \
--cc=maxime@cerno.tech \
--cc=phil@raspberrypi.com \
--cc=thierry.reding@gmail.com \
--cc=tim.gover@raspberrypi.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 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.