[PATCH] drm_modes: calculate nominal vrefresh in drm_display_mode_from_videomode

Thierry Reding thierry.reding at gmail.com
Thu Dec 3 02:22:50 PST 2015


On Thu, Dec 03, 2015 at 10:50:07AM +0100, Daniel Vetter wrote:
> On Thu, Dec 03, 2015 at 09:55:44AM +0100, Philipp Zabel wrote:
> > Use drm_mode_vrefresh to update the vrefresh field after changing the
> > modes' timings and flags.
> > 
> > Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
> > ---
> >  drivers/gpu/drm/drm_modes.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> > index cd74a09..b624be8 100644
> > --- a/drivers/gpu/drm/drm_modes.c
> > +++ b/drivers/gpu/drm/drm_modes.c
> > @@ -611,6 +611,8 @@ void drm_display_mode_from_videomode(const struct videomode *vm,
> >  		dmode->flags |= DRM_MODE_FLAG_DBLSCAN;
> >  	if (vm->flags & DISPLAY_FLAGS_DOUBLECLK)
> >  		dmode->flags |= DRM_MODE_FLAG_DBLCLK;
> > +	dmode->vrefresh = 0;
> 
> Rendundant. Or I'm blind.

Unfortunately it isn't.  drm_mode_vrefresh() is somewhat odd in that
it'll return the existing mode->vrefresh if it is > 0. I'm thinking that
perhaps it'd be useful to factor out the computation code into a
separate function, say drm_mode_calc_vrefresh(), and use that where you
really want to compute the value and at the same time use it to simplify
drm_mode_vrefresh() as well.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20151203/ac2fe455/attachment.sig>


More information about the dri-devel mailing list