From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Reject excessive dotclocks early
Date: Mon, 03 Oct 2022 14:11:44 +0300 [thread overview]
Message-ID: <875yh1w49b.fsf@intel.com> (raw)
In-Reply-To: <20220927182455.3422-1-ville.syrjala@linux.intel.com>
On Tue, 27 Sep 2022, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Make sure modes with crazy big dotclocks are rejected early,
> so as to not cause problems for subsequent code via integer
> overflows and whatnot.
>
> These would eventually be rejected in intel_crtc_compute_pipe_mode()
> but that is now too late as we do the clock computations a bit
> earlier than that. And we don't want to just reorder the two since
> we still want to check the final computed dotclock against the
> hardware limit to make sure we didn't end up above the limit due
> to rounding/etc.
>
> Fixes: 0ff0e219d9b8 ("drm/i915: Compute clocks earlier")
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Too bad we can't really simplify and remove the check from connector
mode valid hooks. Or we could but it gets tricky with the bigjoiner 2x
stuff.
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index eb8eaeb19881..04e8fa953bc7 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -8130,6 +8130,17 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
> drm_helper_move_panel_connectors_to_head(&dev_priv->drm);
> }
>
> +static int max_dotclock(struct drm_i915_private *i915)
> +{
> + int max_dotclock = i915->max_dotclk_freq;
> +
> + /* icl+ might use bigjoiner */
> + if (DISPLAY_VER(i915) >= 11)
> + max_dotclock *= 2;
> +
> + return max_dotclock;
> +}
> +
> static enum drm_mode_status
> intel_mode_valid(struct drm_device *dev,
> const struct drm_display_mode *mode)
> @@ -8167,6 +8178,13 @@ intel_mode_valid(struct drm_device *dev,
> DRM_MODE_FLAG_CLKDIV2))
> return MODE_BAD;
>
> + /*
> + * Reject clearly excessive dotclocks early to
> + * avoid having to worry about huge integers later.
> + */
> + if (mode->clock > max_dotclock(dev_priv))
> + return MODE_CLOCK_HIGH;
> +
> /* Transcoder timing limits */
> if (DISPLAY_VER(dev_priv) >= 11) {
> hdisplay_max = 16384;
--
Jani Nikula, Intel Open Source Graphics Center
prev parent reply other threads:[~2022-10-03 11:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 18:24 [Intel-gfx] [PATCH] drm/i915: Reject excessive dotclocks early Ville Syrjala
2022-09-28 4:27 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
2022-09-28 17:34 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Reject excessive dotclocks early (rev2) Patchwork
2022-09-29 14:15 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2022-10-03 11:11 ` Jani Nikula [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=875yh1w49b.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/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.