* [PATCH] drm_modes: calculate nominal vrefresh in drm_display_mode_from_videomode @ 2015-12-03 8:55 Philipp Zabel 2015-12-03 9:50 ` Daniel Vetter 0 siblings, 1 reply; 5+ messages in thread From: Philipp Zabel @ 2015-12-03 8:55 UTC (permalink / raw) To: David Airlie; +Cc: kernel, dri-devel Use drm_mode_vrefresh to update the vrefresh field after changing the modes' timings and flags. Signed-off-by: Philipp Zabel <p.zabel@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; + dmode->vrefresh = drm_mode_vrefresh(dmode); drm_mode_set_name(dmode); } EXPORT_SYMBOL_GPL(drm_display_mode_from_videomode); -- 2.6.2 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] drm_modes: calculate nominal vrefresh in drm_display_mode_from_videomode 2015-12-03 8:55 [PATCH] drm_modes: calculate nominal vrefresh in drm_display_mode_from_videomode Philipp Zabel @ 2015-12-03 9:50 ` Daniel Vetter 2015-12-03 10:22 ` Thierry Reding 0 siblings, 1 reply; 5+ messages in thread From: Daniel Vetter @ 2015-12-03 9:50 UTC (permalink / raw) To: Philipp Zabel; +Cc: dri-devel, kernel 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@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. -Daniel > + dmode->vrefresh = drm_mode_vrefresh(dmode); > drm_mode_set_name(dmode); > } > EXPORT_SYMBOL_GPL(drm_display_mode_from_videomode); > -- > 2.6.2 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm_modes: calculate nominal vrefresh in drm_display_mode_from_videomode 2015-12-03 9:50 ` Daniel Vetter @ 2015-12-03 10:22 ` Thierry Reding 2015-12-03 11:09 ` Philipp Zabel 0 siblings, 1 reply; 5+ messages in thread From: Thierry Reding @ 2015-12-03 10:22 UTC (permalink / raw) To: Daniel Vetter; +Cc: kernel, dri-devel [-- Attachment #1.1: Type: text/plain, Size: 1276 bytes --] 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@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 [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] [-- Attachment #2: Type: text/plain, Size: 159 bytes --] _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm_modes: calculate nominal vrefresh in drm_display_mode_from_videomode 2015-12-03 10:22 ` Thierry Reding @ 2015-12-03 11:09 ` Philipp Zabel 2015-12-04 7:57 ` Daniel Vetter 0 siblings, 1 reply; 5+ messages in thread From: Philipp Zabel @ 2015-12-03 11:09 UTC (permalink / raw) To: Thierry Reding; +Cc: kernel, dri-devel Am Donnerstag, den 03.12.2015, 11:22 +0100 schrieb Thierry Reding: > 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@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. I don't understand the intention behind the drm_mode_vrefresh (and drm_mode_hsync) functions, but replacing all instances of mode->vrefresh = drm_mode_vrefresh(mode) with something that always calculates the vrefresh sounds like a good idea to me. regards Philipp _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm_modes: calculate nominal vrefresh in drm_display_mode_from_videomode 2015-12-03 11:09 ` Philipp Zabel @ 2015-12-04 7:57 ` Daniel Vetter 0 siblings, 0 replies; 5+ messages in thread From: Daniel Vetter @ 2015-12-04 7:57 UTC (permalink / raw) To: Philipp Zabel; +Cc: kernel, dri-devel On Thu, Dec 03, 2015 at 12:09:24PM +0100, Philipp Zabel wrote: > Am Donnerstag, den 03.12.2015, 11:22 +0100 schrieb Thierry Reding: > > 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@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. > > I don't understand the intention behind the drm_mode_vrefresh (and > drm_mode_hsync) functions, but replacing all instances of > > mode->vrefresh = drm_mode_vrefresh(mode) > > with something that always calculates the vrefresh sounds like a good > idea to me. Premature micro-optimization to avoid recomputing hrefresh/vrefresh all the time I think. I'd drop this, and then redo your patch on top to also drop the = 0 assignment. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-04 7:57 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-12-03 8:55 [PATCH] drm_modes: calculate nominal vrefresh in drm_display_mode_from_videomode Philipp Zabel 2015-12-03 9:50 ` Daniel Vetter 2015-12-03 10:22 ` Thierry Reding 2015-12-03 11:09 ` Philipp Zabel 2015-12-04 7:57 ` Daniel Vetter
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.