From: "Hogander, Jouni" <jouni.hogander@intel.com>
To: "ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH v2 2/2] drm/i915/psr: check drm_mode_vrefresh return value
Date: Fri, 22 Aug 2025 14:51:02 +0000 [thread overview]
Message-ID: <0f3a7f6e90f05972e058e03e00ebec84b759979f.camel@intel.com> (raw)
In-Reply-To: <aKh6zC3Tc74TcGWG@intel.com>
On Fri, 2025-08-22 at 17:12 +0300, Ville Syrjälä wrote:
> On Fri, Aug 22, 2025 at 05:07:18AM +0000, Hogander, Jouni wrote:
> > On Thu, 2025-08-21 at 16:10 +0300, Ville Syrjälä wrote:
> > > On Thu, Aug 21, 2025 at 07:59:18AM +0300, Jouni Högander wrote:
> > > > Check drm_mode_vrefresh return value sanity before using it in
> > > > intel_get_frame_time_us.
> > > >
> > > > Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> > > > ---
> > > > drivers/gpu/drm/i915/display/intel_psr.c | 9 +++++++--
> > > > 1 file changed, 7 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/display/intel_psr.c
> > > > b/drivers/gpu/drm/i915/display/intel_psr.c
> > > > index 5addde63168e..8cc2314fac6f 100644
> > > > --- a/drivers/gpu/drm/i915/display/intel_psr.c
> > > > +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> > > > @@ -1116,11 +1116,16 @@ transcoder_has_psr2(struct
> > > > intel_display
> > > > *display, enum transcoder cpu_transcode
> > > >
> > > > static u32 intel_get_frame_time_us(const struct
> > > > intel_crtc_state
> > > > *crtc_state)
> > > > {
> > > > + int vrefresh;
> > > > +
> > > > if (!crtc_state->hw.active)
> > > > return 0;
> > > >
> > > > - return DIV_ROUND_UP(1000 * 1000,
> > > > - drm_mode_vrefresh(&crtc_state-
> > > > > hw.adjusted_mode));
> > > > + vrefresh = drm_mode_vrefresh(&crtc_state-
> > > > > hw.adjusted_mode);
> > > > + if (vrefresh <= 0)
> > >
> > > How would that happen?
> >
> > There are some sanity checks in drm_mode_vrefresh returning 0. Do
> > you
> > think we should just rely on that we would not end up here with
> > such
> > broken drm mode data?
>
> If you find some way to get this far with a bogus mode then we must
> have a gap in mode valiation somewhere. drm_mode_vrefresh() itself
> must tolerate some amount of nonsense as it may be fed with garbage
> from userspace.
>
Ok, I will drop this patch. I will merge the first patch in the set.
BR,
Jouni Högander
next prev parent reply other threads:[~2025-08-22 14:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-21 4:59 [PATCH v2 1/2] drm/i915/psr: Check drm_dp_dpcd_read return value on PSR dpcd init Jouni Högander
2025-08-21 4:59 ` [PATCH v2 2/2] drm/i915/psr: check drm_mode_vrefresh return value Jouni Högander
2025-08-21 7:42 ` Jani Nikula
2025-08-21 13:10 ` Ville Syrjälä
2025-08-22 5:07 ` Hogander, Jouni
2025-08-22 14:12 ` Ville Syrjälä
2025-08-22 14:51 ` Hogander, Jouni [this message]
2025-08-21 5:49 ` ✓ CI.KUnit: success for series starting with [v2,1/2] drm/i915/psr: Check drm_dp_dpcd_read return value on PSR dpcd init Patchwork
2025-08-21 6:50 ` ✓ Xe.CI.BAT: " Patchwork
2025-08-21 7:42 ` [PATCH v2 1/2] " Jani Nikula
2025-08-25 6:22 ` Hogander, Jouni
2025-08-22 0:36 ` ✗ Xe.CI.Full: failure for series starting with [v2,1/2] " Patchwork
2025-08-25 6:11 ` Hogander, Jouni
2025-08-25 7:10 ` Saarinen, Jani
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=0f3a7f6e90f05972e058e03e00ebec84b759979f.camel@intel.com \
--to=jouni.hogander@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@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 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).