dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 10/13] drm/irq: Add drm_crtc_vblank_count_and_time()
Date: Wed, 12 Aug 2015 17:00:32 +0200	[thread overview]
Message-ID: <1439391635-29166-10-git-send-email-thierry.reding@gmail.com> (raw)
In-Reply-To: <1439391635-29166-1-git-send-email-thierry.reding@gmail.com>

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(+)

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-08-12 15:02 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 15:00 [PATCH 01/13] drm/gma500: Sanity-check pipe index Thierry Reding
2015-08-12 15:00 ` [PATCH 02/13] drm/irq: Remove negative CRTC index special-case Thierry Reding
2015-08-12 15:28   ` Daniel Vetter
2015-08-12 15:00 ` [PATCH 03/13] drm/bochs: Store correct CRTC index in events Thierry Reding
2015-08-12 15:26   ` Daniel Vetter
2015-08-12 15:00 ` [PATCH 04/13] drm/imx: Make pipe number unsigned Thierry Reding
2015-08-12 15:24   ` Daniel Vetter
2015-08-13  9:05     ` Thierry Reding
2015-08-12 15:00 ` [PATCH 05/13] drm/imx: Store correct CRTC index in events Thierry Reding
2015-08-12 15:00 ` [PATCH 06/13] drm/rockchip: " Thierry Reding
2015-08-12 15:00 ` [PATCH 07/13] drm/sti: " Thierry Reding
2015-08-12 15:26   ` Benjamin Gaignard
2015-08-13  9:06     ` Thierry Reding
2015-08-12 15:00 ` [PATCH 08/13] drm/irq: Check for valid VBLANK before dereference Thierry Reding
2015-08-12 15:40   ` Daniel Vetter
2015-08-13  9:20     ` Thierry Reding
2015-08-13 13:05       ` Daniel Vetter
2015-08-12 15:00 ` [PATCH 09/13] drm/irq: Make pipe unsigned and name consistent Thierry Reding
2015-08-12 15:32   ` Daniel Vetter
2015-10-30 18:38     ` Ilia Mirkin
2015-08-13  9:38   ` [PATCH] drm/irq: More pipe/crtc consistency cleanups Thierry Reding
2015-08-13 13:02     ` Daniel Vetter
2015-08-12 15:00 ` Thierry Reding [this message]
2015-08-12 15:35   ` [PATCH 10/13] drm/irq: Add drm_crtc_vblank_count_and_time() Daniel Vetter
2015-08-13  9:12     ` Thierry Reding
2015-08-13 13:04       ` Daniel Vetter
2015-08-12 15:00 ` [PATCH 11/13] drm/irq: Document return values more consistently Thierry Reding
2015-08-12 15:00 ` [PATCH 12/13] drm/armada: Use drm_crtc_vblank_*() API Thierry Reding
2015-08-14 13:59   ` Russell King - ARM Linux
2015-08-14 14:24     ` Thierry Reding
2015-08-12 15:00 ` [PATCH 13/13] drm/atomic: Use KMS VBLANK API Thierry Reding
2015-08-12 15:41   ` Daniel Vetter
2015-08-12 15:42   ` Daniel Vetter
2015-08-13 10:51 ` [PATCH 01/13] drm/gma500: Sanity-check pipe index Patrik Jakobsson
  -- strict thread matches above, loose matches on Subject: below --
2014-12-16 16:53 [PATCH 01/13] drm/irq: Remove negative CRTC index special-case Thierry Reding
2014-12-16 16:53 ` [PATCH 10/13] drm/irq: Add drm_crtc_vblank_count_and_time() Thierry Reding

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=1439391635-29166-10-git-send-email-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.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