LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Chris Clayton <chris2553@googlemail.com>
Cc: linux-kernel@vger.kernel.org, Chris Wilson <chris@chris-wilson.co.uk>
Subject: [PATCH] drm/i915: Increase the amount of defense before computing vblank timestamps
Date: Sat, 22 Jan 2011 10:11:39 +0000	[thread overview]
Message-ID: <1295691099-14276-1-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <:201101220935.03623.chris2553@googlemail.com>

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---

Chris, does this help?

If you can convert the address to a line number that would pinpoint the
NULL pointer exactly. Though judging by the address and position of the
dereference a NULL crtc looks most likely.
-Chris

---
 drivers/gpu/drm/i915/i915_irq.c |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index f0c87bd..d999d00 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -274,24 +274,34 @@ int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,
 	return ret;
 }
 
-int i915_get_vblank_timestamp(struct drm_device *dev, int crtc,
+int i915_get_vblank_timestamp(struct drm_device *dev, int pipe,
 			      int *max_error,
 			      struct timeval *vblank_time,
 			      unsigned flags)
 {
-	struct drm_crtc *drmcrtc;
+	struct drm_crtc *crtc;
 
-	if (crtc < 0 || crtc >= dev->num_crtcs) {
-		DRM_ERROR("Invalid crtc %d\n", crtc);
+	if (pipe < 0 || pipe >= dev->num_crtcs) {
+		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return -EINVAL;
 	}
 
 	/* Get drm_crtc to timestamp: */
-	drmcrtc = intel_get_crtc_for_pipe(dev, crtc);
+	crtc = intel_get_crtc_for_pipe(dev, pipe);
+	if (crtc == NULL) {
+		DRM_ERROR("Invalid crtc %d\n", pipe);
+		return -EINVAL;
+	}
+
+	if (!crtc->enabled) {
+		DRM_DEBUG_KMS("crtc %d is disabled\n", pipe);
+		return -EBUSY;
+	}
 
 	/* Helper routine in DRM core does all the work: */
-	return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error,
-						     vblank_time, flags, drmcrtc);
+	return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error,
+						     vblank_time, flags,
+						     crtc);
 }
 
 /*
-- 
1.7.2.3


       reply	other threads:[~2011-01-22 10:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <:201101220935.03623.chris2553@googlemail.com>
2011-01-22 10:11 ` Chris Wilson [this message]
2011-01-22 11:18   ` Chris Clayton
2011-01-22 18:01     ` Chris Wilson
2011-01-23  8:56       ` Chris Clayton
2011-01-23  9:32         ` Chris Clayton
2011-01-23 10:50           ` [PATCH] drm/i915: Disable high-precision vblank timestamping for UMS Chris Wilson
2011-01-23 11:28             ` Chris Clayton
2011-01-23 12:44               ` Chris Wilson
2011-01-23 12:55                 ` Chris Clayton
2011-01-23 13:06               ` [PATCH] drm/i915: Handle the no-interrupts case for UMS by polling Chris Wilson
2011-01-23 15:38                 ` Chris Clayton
2011-01-23 15:59                   ` Chris Wilson
2011-02-10 19:58                     ` Chris Clayton
2011-02-10 20:37                       ` Chris Wilson
2011-01-23 10:52           ` [PATCH] drm/i915: Increase the amount of defense before computing vblank timestamps Chris Wilson

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=1295691099-14276-1-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=chris2553@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] drm/i915: Increase the amount of defense before computing vblank timestamps' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).