From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: abhinavk@codeaurora.org
Cc: aravindh@codeaurora.org, seanpaul@chromium.org,
chandanu@codeaurora.org, dri-devel@lists.freedesktop.org
Subject: Re: Question on 640x480 @ 72fps
Date: Fri, 31 Aug 2018 14:06:27 +0300 [thread overview]
Message-ID: <20180831110627.GR5565@intel.com> (raw)
In-Reply-To: <8b761109203a732857b18811fb3f0212@codeaurora.org>
On Thu, Aug 30, 2018 at 07:32:58PM -0700, abhinavk@codeaurora.org wrote:
> Hello
>
> During one of our internal tests, we ran into an issue where the
> calculated refresh rate for the mode using the drm_mode_vrefresh() API
> doesnt
> match the theoretical value due to rounding.
>
> 552 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 664,
> 553 704, 832, 0, 480, 489, 492, 520, 0,
> 554 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /*
> 640x480@72Hz */
>
>
> int drm_mode_vrefresh(const struct drm_display_mode *mode)
> {
> int refresh = 0;
>
> if (mode->vrefresh > 0)
> refresh = mode->vrefresh;
> else if (mode->htotal > 0 && mode->vtotal > 0) {
> unsigned int num, den;
>
> num = mode->clock * 1000;
> den = mode->htotal * mode->vtotal;
>
> if (mode->flags & DRM_MODE_FLAG_INTERLACE)
> num *= 2;
> if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
> den *= 2;
> if (mode->vscan > 1)
> den *= mode->vscan;
>
> refresh = DIV_ROUND_CLOSEST(num, den);
> }
> return refresh;
> }
> EXPORT_SYMBOL(drm_mode_vrefresh);
>
> As per the math of this API, the vrefresh comes up to 72.8 fps ( 31500 *
> 1000 ) / (832 * 520) .
>
> Hence this gets rounded to 73fps.
>
> However as per the spec, this mode should have the vrefresh as 72fps.
Why should anyone care if it gets rounded differently?
>
> So to satisfy that, we must round-down in this function. That might
> break other modes though.
>
> Do you have any suggestions on how to fix-up this mode ? Shall we just
> directly specify the vrefresh in the edid_est_modes[] and
> drm_dmt_modes[] static array?
>
> I can submit a PATCH based on the approach we agree on here.
>
> Thanks
>
> Abhinav
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-08-31 11:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-31 2:32 Question on 640x480 @ 72fps abhinavk
2018-08-31 11:06 ` Ville Syrjälä [this message]
2018-08-31 12:23 ` Sean Paul
2018-08-31 18:07 ` Abhinav Kumar
2018-09-03 7:45 ` Daniel Vetter
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=20180831110627.GR5565@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=abhinavk@codeaurora.org \
--cc=aravindh@codeaurora.org \
--cc=chandanu@codeaurora.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=seanpaul@chromium.org \
/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