diff mbox

[10/13] drm/irq: Add drm_crtc_vblank_count_and_time()

Message ID 1439391635-29166-10-git-send-email-thierry.reding@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thierry Reding Aug. 12, 2015, 3 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

This function is the KMS native variant of drm_vblank_count_and_time().
It takes a struct drm_crtc * instead of a struct drm_device * and an
index of the CRTC.

Eventually the goal is to access vblank data through the CRTC only so
that the per-CRTC data can be moved to struct drm_crtc.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/drm_irq.c | 23 +++++++++++++++++++++++
 include/drm/drmP.h        |  2 ++
 2 files changed, 25 insertions(+)

Comments

Daniel Vetter Aug. 12, 2015, 3:35 p.m. UTC | #1
On Wed, Aug 12, 2015 at 05:00:32PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> This function is the KMS native variant of drm_vblank_count_and_time().
> It takes a struct drm_crtc * instead of a struct drm_device * and an
> index of the CRTC.
> 
> Eventually the goal is to access vblank data through the CRTC only so
> that the per-CRTC data can be moved to struct drm_crtc.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>

We seem to not use this anywhere outside for drm_irq.c, so maybe just drop
the kerneldoc and EXPORT_SYMBOL? The actual comment starting with "Fecthes
the "cooked" vblank ..." should imo be kept.
-Daniel

> ---
>  drivers/gpu/drm/drm_irq.c | 23 +++++++++++++++++++++++
>  include/drm/drmP.h        |  2 ++
>  2 files changed, 25 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index f42459b2862d..904914d8f1f1 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -913,6 +913,8 @@ EXPORT_SYMBOL(drm_crtc_vblank_count);
>   * vblank events since the system was booted, including lost events due to
>   * modesetting activity. Returns corresponding system timestamp of the time
>   * of the vblank interval that corresponds to the current vblank counter value.
> + *
> + * This is the legacy version of drm_crtc_vblank_count_and_time().
>   */
>  u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
>  			      struct timeval *vblanktime)
> @@ -939,6 +941,27 @@ u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
>  }
>  EXPORT_SYMBOL(drm_vblank_count_and_time);
>  
> +/**
> + * drm_crtc_vblank_count_and_time - retrieve "cooked" vblank counter value
> + *     and the system timestamp corresponding to that vblank counter value
> + * @crtc: which counter to retrieve
> + * @vblanktime: Pointer to struct timeval to receive the vblank timestamp.
> + *
> + * Fetches the "cooked" vblank count value that represents the number of
> + * vblank events since the system was booted, including lost events due to
> + * modesetting activity. Returns corresponding system timestamp of the time
> + * of the vblank interval that corresponds to the current vblank counter value.
> + *
> + * This is the native KMS version of drm_vblank_count_and_time().
> + */
> +u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
> +				   struct timeval *vblanktime)
> +{
> +	return drm_vblank_count_and_time(crtc->dev, drm_crtc_index(crtc),
> +					 vblanktime);
> +}
> +EXPORT_SYMBOL(drm_crtc_vblank_count_and_time);
> +
>  static void send_vblank_event(struct drm_device *dev,
>  		struct drm_pending_vblank_event *e,
>  		unsigned long seq, struct timeval *now)
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 020afa343dff..7cd480614035 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -927,6 +927,8 @@ extern u32 drm_vblank_count(struct drm_device *dev, int pipe);
>  extern u32 drm_crtc_vblank_count(struct drm_crtc *crtc);
>  extern u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
>  				     struct timeval *vblanktime);
> +extern u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
> +					  struct timeval *vblanktime);
>  extern void drm_send_vblank_event(struct drm_device *dev, unsigned int pipe,
>  				  struct drm_pending_vblank_event *e);
>  extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
> -- 
> 2.4.5
>
Thierry Reding Aug. 13, 2015, 9:12 a.m. UTC | #2
On Wed, Aug 12, 2015 at 05:35:08PM +0200, Daniel Vetter wrote:
> On Wed, Aug 12, 2015 at 05:00:32PM +0200, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > This function is the KMS native variant of drm_vblank_count_and_time().
> > It takes a struct drm_crtc * instead of a struct drm_device * and an
> > index of the CRTC.
> > 
> > Eventually the goal is to access vblank data through the CRTC only so
> > that the per-CRTC data can be moved to struct drm_crtc.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> 
> We seem to not use this anywhere outside for drm_irq.c, so maybe just drop
> the kerneldoc and EXPORT_SYMBOL? The actual comment starting with "Fecthes
> the "cooked" vblank ..." should imo be kept.

There don't seem to be any users of this, so I guess we can ignore this
for now.

Thierry

> > ---
> >  drivers/gpu/drm/drm_irq.c | 23 +++++++++++++++++++++++
> >  include/drm/drmP.h        |  2 ++
> >  2 files changed, 25 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> > index f42459b2862d..904914d8f1f1 100644
> > --- a/drivers/gpu/drm/drm_irq.c
> > +++ b/drivers/gpu/drm/drm_irq.c
> > @@ -913,6 +913,8 @@ EXPORT_SYMBOL(drm_crtc_vblank_count);
> >   * vblank events since the system was booted, including lost events due to
> >   * modesetting activity. Returns corresponding system timestamp of the time
> >   * of the vblank interval that corresponds to the current vblank counter value.
> > + *
> > + * This is the legacy version of drm_crtc_vblank_count_and_time().
> >   */
> >  u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
> >  			      struct timeval *vblanktime)
> > @@ -939,6 +941,27 @@ u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
> >  }
> >  EXPORT_SYMBOL(drm_vblank_count_and_time);
> >  
> > +/**
> > + * drm_crtc_vblank_count_and_time - retrieve "cooked" vblank counter value
> > + *     and the system timestamp corresponding to that vblank counter value
> > + * @crtc: which counter to retrieve
> > + * @vblanktime: Pointer to struct timeval to receive the vblank timestamp.
> > + *
> > + * Fetches the "cooked" vblank count value that represents the number of
> > + * vblank events since the system was booted, including lost events due to
> > + * modesetting activity. Returns corresponding system timestamp of the time
> > + * of the vblank interval that corresponds to the current vblank counter value.
> > + *
> > + * This is the native KMS version of drm_vblank_count_and_time().
> > + */
> > +u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
> > +				   struct timeval *vblanktime)
> > +{
> > +	return drm_vblank_count_and_time(crtc->dev, drm_crtc_index(crtc),
> > +					 vblanktime);
> > +}
> > +EXPORT_SYMBOL(drm_crtc_vblank_count_and_time);
> > +
> >  static void send_vblank_event(struct drm_device *dev,
> >  		struct drm_pending_vblank_event *e,
> >  		unsigned long seq, struct timeval *now)
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index 020afa343dff..7cd480614035 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -927,6 +927,8 @@ extern u32 drm_vblank_count(struct drm_device *dev, int pipe);
> >  extern u32 drm_crtc_vblank_count(struct drm_crtc *crtc);
> >  extern u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
> >  				     struct timeval *vblanktime);
> > +extern u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
> > +					  struct timeval *vblanktime);
> >  extern void drm_send_vblank_event(struct drm_device *dev, unsigned int pipe,
> >  				  struct drm_pending_vblank_event *e);
> >  extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
> > -- 
> > 2.4.5
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
Daniel Vetter Aug. 13, 2015, 1:04 p.m. UTC | #3
On Thu, Aug 13, 2015 at 11:12:37AM +0200, Thierry Reding wrote:
> On Wed, Aug 12, 2015 at 05:35:08PM +0200, Daniel Vetter wrote:
> > On Wed, Aug 12, 2015 at 05:00:32PM +0200, Thierry Reding wrote:
> > > From: Thierry Reding <treding@nvidia.com>
> > > 
> > > This function is the KMS native variant of drm_vblank_count_and_time().
> > > It takes a struct drm_crtc * instead of a struct drm_device * and an
> > > index of the CRTC.
> > > 
> > > Eventually the goal is to access vblank data through the CRTC only so
> > > that the per-CRTC data can be moved to struct drm_crtc.
> > > 
> > > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > 
> > We seem to not use this anywhere outside for drm_irq.c, so maybe just drop
> > the kerneldoc and EXPORT_SYMBOL? The actual comment starting with "Fecthes
> > the "cooked" vblank ..." should imo be kept.
> 
> There don't seem to be any users of this, so I guess we can ignore this
> for now.

I mean removing the kerneldoc /** marker plus EXPORT_SYMBOL for the
drm_vblank_count_and_time function and marking it static. Instead of this
patch here, not changing this patch here.
-Daniel

> 
> Thierry
> 
> > > ---
> > >  drivers/gpu/drm/drm_irq.c | 23 +++++++++++++++++++++++
> > >  include/drm/drmP.h        |  2 ++
> > >  2 files changed, 25 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> > > index f42459b2862d..904914d8f1f1 100644
> > > --- a/drivers/gpu/drm/drm_irq.c
> > > +++ b/drivers/gpu/drm/drm_irq.c
> > > @@ -913,6 +913,8 @@ EXPORT_SYMBOL(drm_crtc_vblank_count);
> > >   * vblank events since the system was booted, including lost events due to
> > >   * modesetting activity. Returns corresponding system timestamp of the time
> > >   * of the vblank interval that corresponds to the current vblank counter value.
> > > + *
> > > + * This is the legacy version of drm_crtc_vblank_count_and_time().
> > >   */
> > >  u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
> > >  			      struct timeval *vblanktime)
> > > @@ -939,6 +941,27 @@ u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
> > >  }
> > >  EXPORT_SYMBOL(drm_vblank_count_and_time);
> > >  
> > > +/**
> > > + * drm_crtc_vblank_count_and_time - retrieve "cooked" vblank counter value
> > > + *     and the system timestamp corresponding to that vblank counter value
> > > + * @crtc: which counter to retrieve
> > > + * @vblanktime: Pointer to struct timeval to receive the vblank timestamp.
> > > + *
> > > + * Fetches the "cooked" vblank count value that represents the number of
> > > + * vblank events since the system was booted, including lost events due to
> > > + * modesetting activity. Returns corresponding system timestamp of the time
> > > + * of the vblank interval that corresponds to the current vblank counter value.
> > > + *
> > > + * This is the native KMS version of drm_vblank_count_and_time().
> > > + */
> > > +u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
> > > +				   struct timeval *vblanktime)
> > > +{
> > > +	return drm_vblank_count_and_time(crtc->dev, drm_crtc_index(crtc),
> > > +					 vblanktime);
> > > +}
> > > +EXPORT_SYMBOL(drm_crtc_vblank_count_and_time);
> > > +
> > >  static void send_vblank_event(struct drm_device *dev,
> > >  		struct drm_pending_vblank_event *e,
> > >  		unsigned long seq, struct timeval *now)
> > > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > > index 020afa343dff..7cd480614035 100644
> > > --- a/include/drm/drmP.h
> > > +++ b/include/drm/drmP.h
> > > @@ -927,6 +927,8 @@ extern u32 drm_vblank_count(struct drm_device *dev, int pipe);
> > >  extern u32 drm_crtc_vblank_count(struct drm_crtc *crtc);
> > >  extern u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
> > >  				     struct timeval *vblanktime);
> > > +extern u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
> > > +					  struct timeval *vblanktime);
> > >  extern void drm_send_vblank_event(struct drm_device *dev, unsigned int pipe,
> > >  				  struct drm_pending_vblank_event *e);
> > >  extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
> > > -- 
> > > 2.4.5
> > > 
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index f42459b2862d..904914d8f1f1 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -913,6 +913,8 @@  EXPORT_SYMBOL(drm_crtc_vblank_count);
  * vblank events since the system was booted, including lost events due to
  * modesetting activity. Returns corresponding system timestamp of the time
  * of the vblank interval that corresponds to the current vblank counter value.
+ *
+ * This is the legacy version of drm_crtc_vblank_count_and_time().
  */
 u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
 			      struct timeval *vblanktime)
@@ -939,6 +941,27 @@  u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
 }
 EXPORT_SYMBOL(drm_vblank_count_and_time);
 
+/**
+ * drm_crtc_vblank_count_and_time - retrieve "cooked" vblank counter value
+ *     and the system timestamp corresponding to that vblank counter value
+ * @crtc: which counter to retrieve
+ * @vblanktime: Pointer to struct timeval to receive the vblank timestamp.
+ *
+ * Fetches the "cooked" vblank count value that represents the number of
+ * vblank events since the system was booted, including lost events due to
+ * modesetting activity. Returns corresponding system timestamp of the time
+ * of the vblank interval that corresponds to the current vblank counter value.
+ *
+ * This is the native KMS version of drm_vblank_count_and_time().
+ */
+u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
+				   struct timeval *vblanktime)
+{
+	return drm_vblank_count_and_time(crtc->dev, drm_crtc_index(crtc),
+					 vblanktime);
+}
+EXPORT_SYMBOL(drm_crtc_vblank_count_and_time);
+
 static void send_vblank_event(struct drm_device *dev,
 		struct drm_pending_vblank_event *e,
 		unsigned long seq, struct timeval *now)
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 020afa343dff..7cd480614035 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -927,6 +927,8 @@  extern u32 drm_vblank_count(struct drm_device *dev, int pipe);
 extern u32 drm_crtc_vblank_count(struct drm_crtc *crtc);
 extern u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
 				     struct timeval *vblanktime);
+extern u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
+					  struct timeval *vblanktime);
 extern void drm_send_vblank_event(struct drm_device *dev, unsigned int pipe,
 				  struct drm_pending_vblank_event *e);
 extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc,