All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH 04/19] drm: Move drm_update_vblank_count()
Date: Wed,  6 Aug 2014 14:49:47 +0300	[thread overview]
Message-ID: <1407325803-6944-5-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1407325803-6944-1-git-send-email-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Move drm_update_vblank_count() to avoid forward a declaration.
No functional change.

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_irq.c | 128 +++++++++++++++++++++++-----------------------
 1 file changed, 64 insertions(+), 64 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 65d2da9..af96517 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -55,6 +55,70 @@
  */
 #define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000
 
+/**
+ * drm_update_vblank_count - update the master vblank counter
+ * @dev: DRM device
+ * @crtc: counter to update
+ *
+ * Call back into the driver to update the appropriate vblank counter
+ * (specified by @crtc).  Deal with wraparound, if it occurred, and
+ * update the last read value so we can deal with wraparound on the next
+ * call if necessary.
+ *
+ * Only necessary when going from off->on, to account for frames we
+ * didn't get an interrupt for.
+ *
+ * Note: caller must hold dev->vbl_lock since this reads & writes
+ * device vblank fields.
+ */
+static void drm_update_vblank_count(struct drm_device *dev, int crtc)
+{
+	u32 cur_vblank, diff, tslot, rc;
+	struct timeval t_vblank;
+
+	/*
+	 * Interrupts were disabled prior to this call, so deal with counter
+	 * wrap if needed.
+	 * NOTE!  It's possible we lost a full dev->max_vblank_count events
+	 * here if the register is small or we had vblank interrupts off for
+	 * a long time.
+	 *
+	 * We repeat the hardware vblank counter & timestamp query until
+	 * we get consistent results. This to prevent races between gpu
+	 * updating its hardware counter while we are retrieving the
+	 * corresponding vblank timestamp.
+	 */
+	do {
+		cur_vblank = dev->driver->get_vblank_counter(dev, crtc);
+		rc = drm_get_last_vbltimestamp(dev, crtc, &t_vblank, 0);
+	} while (cur_vblank != dev->driver->get_vblank_counter(dev, crtc));
+
+	/* Deal with counter wrap */
+	diff = cur_vblank - dev->vblank[crtc].last;
+	if (cur_vblank < dev->vblank[crtc].last) {
+		diff += dev->max_vblank_count;
+
+		DRM_DEBUG("last_vblank[%d]=0x%x, cur_vblank=0x%x => diff=0x%x\n",
+			  crtc, dev->vblank[crtc].last, cur_vblank, diff);
+	}
+
+	DRM_DEBUG("enabling vblank interrupts on crtc %d, missed %d\n",
+		  crtc, diff);
+
+	/* Reinitialize corresponding vblank timestamp if high-precision query
+	 * available. Skip this step if query unsupported or failed. Will
+	 * reinitialize delayed at next vblank interrupt in that case.
+	 */
+	if (rc) {
+		tslot = atomic_read(&dev->vblank[crtc].count) + diff;
+		vblanktimestamp(dev, crtc, tslot) = t_vblank;
+	}
+
+	smp_mb__before_atomic();
+	atomic_add(diff, &dev->vblank[crtc].count);
+	smp_mb__after_atomic();
+}
+
 /*
  * Disable vblank irq's on crtc, make sure that last vblank count
  * of hardware and corresponding consistent software vblank counter
@@ -799,70 +863,6 @@ void drm_send_vblank_event(struct drm_device *dev, int crtc,
 EXPORT_SYMBOL(drm_send_vblank_event);
 
 /**
- * drm_update_vblank_count - update the master vblank counter
- * @dev: DRM device
- * @crtc: counter to update
- *
- * Call back into the driver to update the appropriate vblank counter
- * (specified by @crtc).  Deal with wraparound, if it occurred, and
- * update the last read value so we can deal with wraparound on the next
- * call if necessary.
- *
- * Only necessary when going from off->on, to account for frames we
- * didn't get an interrupt for.
- *
- * Note: caller must hold dev->vbl_lock since this reads & writes
- * device vblank fields.
- */
-static void drm_update_vblank_count(struct drm_device *dev, int crtc)
-{
-	u32 cur_vblank, diff, tslot, rc;
-	struct timeval t_vblank;
-
-	/*
-	 * Interrupts were disabled prior to this call, so deal with counter
-	 * wrap if needed.
-	 * NOTE!  It's possible we lost a full dev->max_vblank_count events
-	 * here if the register is small or we had vblank interrupts off for
-	 * a long time.
-	 *
-	 * We repeat the hardware vblank counter & timestamp query until
-	 * we get consistent results. This to prevent races between gpu
-	 * updating its hardware counter while we are retrieving the
-	 * corresponding vblank timestamp.
-	 */
-	do {
-		cur_vblank = dev->driver->get_vblank_counter(dev, crtc);
-		rc = drm_get_last_vbltimestamp(dev, crtc, &t_vblank, 0);
-	} while (cur_vblank != dev->driver->get_vblank_counter(dev, crtc));
-
-	/* Deal with counter wrap */
-	diff = cur_vblank - dev->vblank[crtc].last;
-	if (cur_vblank < dev->vblank[crtc].last) {
-		diff += dev->max_vblank_count;
-
-		DRM_DEBUG("last_vblank[%d]=0x%x, cur_vblank=0x%x => diff=0x%x\n",
-			  crtc, dev->vblank[crtc].last, cur_vblank, diff);
-	}
-
-	DRM_DEBUG("enabling vblank interrupts on crtc %d, missed %d\n",
-		  crtc, diff);
-
-	/* Reinitialize corresponding vblank timestamp if high-precision query
-	 * available. Skip this step if query unsupported or failed. Will
-	 * reinitialize delayed at next vblank interrupt in that case.
-	 */
-	if (rc) {
-		tslot = atomic_read(&dev->vblank[crtc].count) + diff;
-		vblanktimestamp(dev, crtc, tslot) = t_vblank;
-	}
-
-	smp_mb__before_atomic();
-	atomic_add(diff, &dev->vblank[crtc].count);
-	smp_mb__after_atomic();
-}
-
-/**
  * drm_vblank_enable - enable the vblank interrupt on a CRTC
  * @dev: DRM device
  * @crtc: CRTC in question
-- 
1.8.5.5

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

  parent reply	other threads:[~2014-08-06 11:49 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06 11:49 [PATCH v2 00/19] drm: More vblank on/off work ville.syrjala
2014-08-06 11:49 ` [PATCH v2 01/19] drm: Always reject drm_vblank_get() after drm_vblank_off() ville.syrjala
2014-08-06 11:49 ` [PATCH v2 02/19] drm/i915: Warn if drm_vblank_get() still works " ville.syrjala
2014-08-06 11:49 ` [PATCH 03/19] drm: Don't clear vblank timestamps when vblank interrupt is disabled ville.syrjala
2014-08-06 11:49 ` ville.syrjala [this message]
2014-08-06 11:49 ` [PATCH 05/19] drm: Have the vblank counter account for the time between vblank irq disable and drm_vblank_off() ville.syrjala
2014-09-02 19:33   ` Mario Kleiner
2014-08-06 11:49 ` [PATCH 06/19] drm: Avoid random vblank counter jumps if the hardware counter has been reset ville.syrjala
2014-08-06 11:49 ` [PATCH v2 07/19] drm: Reduce the amount of dev->vblank[crtc] in the code ville.syrjala
2014-08-06 11:49 ` [PATCH 08/19] drm: Fix deadlock between event_lock and vbl_lock/vblank_time_lock ville.syrjala
2014-08-06 11:49 ` [PATCH 09/19] drm: Fix race between drm_vblank_off() and drm_queue_vblank_event() ville.syrjala
2014-08-06 13:23   ` Daniel Vetter
2014-08-06 13:33     ` [Intel-gfx] " Ville Syrjälä
2014-08-06 11:49 ` [PATCH v2 10/19] drm: Disable vblank interrupt immediately when drm_vblank_offdelay<0 ville.syrjala
2014-08-06 11:49 ` [PATCH v2 11/19] drm: Add dev->vblank_disable_immediate flag ville.syrjala
2014-08-06 11:49 ` [PATCH 12/19] drm/i915: Opt out of vblank disable timer on >gen2 ville.syrjala
2014-08-06 11:49 ` [PATCH v2 13/19] drm: Kick start vblank interrupts at drm_vblank_on() ville.syrjala
2014-08-06 11:49 ` [PATCH 14/19] drm: Don't update vblank timestamp when the counter didn't change ville.syrjala
2014-08-06 12:56   ` Daniel Vetter
2014-08-06 13:09     ` Daniel Vetter
2014-09-04 12:14   ` Mario Kleiner
2014-09-13 16:25   ` Mario Kleiner
2014-09-15  8:50     ` Daniel Vetter
2014-09-23 12:48       ` [Intel-gfx] " Jani Nikula
2014-09-23 13:51         ` Daniel Vetter
2014-09-23 14:15           ` Mario Kleiner
2014-08-06 11:49 ` [PATCH 15/19] drm: Update vblank->last in drm_update_vblank_count() ville.syrjala
2014-08-06 13:08   ` [Intel-gfx] " Daniel Vetter
2014-08-06 13:30     ` Ville Syrjälä
2014-08-06 14:19       ` Daniel Vetter
2014-08-06 11:49 ` [PATCH 16/19] drm: Store the vblank timestamp when adjusting the counter during disable ville.syrjala
2014-08-06 13:12   ` [Intel-gfx] " Daniel Vetter
2014-08-06 11:50 ` [PATCH 17/19] drm/i915: Clear .last vblank count before drm_vblank_off() when sanitizing crtc state ville.syrjala
2014-08-06 13:30   ` [Intel-gfx] " Daniel Vetter
2014-08-06 13:43     ` Ville Syrjälä
2014-08-06 11:50 ` [PATCH 18/19] drm/i915: Update scanline_offset only for active crtcs ville.syrjala
2014-08-06 11:50 ` [PATCH 19/19] drm: Fix confusing debug message in drm_update_vblank_count() ville.syrjala
2014-08-06 11:50 ` [PATCH igt] tests/kms_flip: Assert that vblank timestamps aren't zeroed ville.syrjala

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=1407325803-6944-5-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@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 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.