From: Dave Stevenson <dave.stevenson@raspberrypi.com>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Mark Rutland <mark.rutland@arm.com>,
devicetree@vger.kernel.org, Tim Gover <tim.gover@raspberrypi.com>,
David Airlie <airlied@linux.ie>,
DRI Development <dri-devel@lists.freedesktop.org>,
Rob Herring <robh+dt@kernel.org>,
bcm-kernel-feedback-list@broadcom.com,
linux-rpi-kernel@lists.infradead.org,
Thomas Zimmermann <tzimmermann@suse.de>,
Daniel Vetter <daniel.vetter@intel.com>,
Frank Rowand <frowand.list@gmail.com>,
Phil Elwell <phil@raspberrypi.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 1/2] drm/vc4: hdmi: Make sure our clock rate is within limits
Date: Thu, 19 Nov 2020 11:19:27 +0000 [thread overview]
Message-ID: <CAPY8ntDdRkNBayrhJX+9Dvvbx8PsnMGTuGPxEPZ2-ULcZg2y=w@mail.gmail.com> (raw)
In-Reply-To: <20201029122522.1917579-1-maxime@cerno.tech>
Hi Maxime
On Thu, 29 Oct 2020 at 12:25, Maxime Ripard <maxime@cerno.tech> wrote:
>
> The HDMI controller cannot go above a certain pixel rate limit depending on
> the generations, but that limit is only enforced in mode_valid at the
> moment, which means that we won't advertise modes that exceed that limit,
> but the userspace is still free to try to setup a mode that would.
>
> Implement atomic_check to make sure we check it in that scenario too.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> ---
>
> Changes from v1:
> - Added that patch to resolve a conflict
> ---
> drivers/gpu/drm/vc4/vc4_hdmi.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index e8f99e290655..3d0338822cd2 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -760,6 +760,20 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder)
> {
> }
>
> +static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
> + struct drm_crtc_state *crtc_state,
> + struct drm_connector_state *conn_state)
> +{
> + struct drm_display_mode *mode = &crtc_state->adjusted_mode;
> + struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
> + unsigned long long pixel_rate = mode->clock * 1000;
> +
> + if (pixel_rate > vc4_hdmi->variant->max_pixel_clock)
> + return -EINVAL;
> +
> + return 0;
> +}
> +
> static enum drm_mode_status
> vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder,
> const struct drm_display_mode *mode)
> @@ -773,6 +787,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder,
> }
>
> static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs = {
> + .atomic_check = vc4_hdmi_encoder_atomic_check,
> .mode_valid = vc4_hdmi_encoder_mode_valid,
> .disable = vc4_hdmi_encoder_disable,
> .enable = vc4_hdmi_encoder_enable,
> --
> 2.26.2
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2020-11-19 11:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 12:25 [PATCH v2 1/2] drm/vc4: hdmi: Make sure our clock rate is within limits Maxime Ripard
2020-10-29 12:25 ` [PATCH v2 2/2] drm/vc4: hdmi: Block odd horizontal timings Maxime Ripard
2020-11-19 11:14 ` Dave Stevenson
2020-11-19 13:29 ` Maxime Ripard
2020-11-19 11:19 ` Dave Stevenson [this message]
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='CAPY8ntDdRkNBayrhJX+9Dvvbx8PsnMGTuGPxEPZ2-ULcZg2y=w@mail.gmail.com' \
--to=dave.stevenson@raspberrypi.com \
--cc=airlied@linux.ie \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=daniel.vetter@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=frowand.list@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=maxime@cerno.tech \
--cc=phil@raspberrypi.com \
--cc=robh+dt@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).