dri-devel Archive on 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 01/14] drm: Pass the display mode to drm_calc_timestamping_constants()
Date: Tue, 29 Oct 2013 20:06:05 +0200	[thread overview]
Message-ID: <1383069978-12476-2-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1383069978-12476-1-git-send-email-ville.syrjala@linux.intel.com>

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

We don't really use hwmode anymore in i915, so eliminating its use
from the core code seems prudent. Just pass the appropriate mode
to drm_calc_timestamping_constants().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_crtc_helper.c    |  2 +-
 drivers/gpu/drm/drm_irq.c            | 17 +++++++++--------
 drivers/gpu/drm/i915/intel_display.c |  3 ++-
 include/drm/drmP.h                   |  3 ++-
 4 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index dbcd687..fce1cff 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -533,7 +533,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
 	 * are later needed by vblank and swap-completion
 	 * timestamping. They are derived from true hwmode.
 	 */
-	drm_calc_timestamping_constants(crtc);
+	drm_calc_timestamping_constants(crtc, &crtc->hwmode);
 
 	/* FIXME: add subpixel order */
 done:
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 2250724..679417d 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -445,20 +445,22 @@ int drm_control(struct drm_device *dev, void *data,
  * adjustments into account.
  *
  * @crtc drm_crtc whose timestamp constants should be updated.
+ * @mode display mode containing the scanout timings
  *
  */
-void drm_calc_timestamping_constants(struct drm_crtc *crtc)
+void drm_calc_timestamping_constants(struct drm_crtc *crtc,
+				     const struct drm_display_mode *mode)
 {
 	s64 linedur_ns = 0, pixeldur_ns = 0, framedur_ns = 0;
 	u64 dotclock;
 
 	/* Dot clock in Hz: */
-	dotclock = (u64) crtc->hwmode.clock * 1000;
+	dotclock = (u64) mode->clock * 1000;
 
 	/* Fields of interlaced scanout modes are only halve a frame duration.
 	 * Double the dotclock to get halve the frame-/line-/pixelduration.
 	 */
-	if (crtc->hwmode.flags & DRM_MODE_FLAG_INTERLACE)
+	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
 		dotclock *= 2;
 
 	/* Valid dotclock? */
@@ -469,10 +471,9 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc)
 		 * nanoseconds:
 		 */
 		pixeldur_ns = (s64) div64_u64(1000000000, dotclock);
-		linedur_ns  = (s64) div64_u64(((u64) crtc->hwmode.crtc_htotal *
+		linedur_ns  = (s64) div64_u64(((u64) mode->crtc_htotal *
 					      1000000000), dotclock);
-		frame_size = crtc->hwmode.crtc_htotal *
-				crtc->hwmode.crtc_vtotal;
+		frame_size = mode->crtc_htotal * mode->crtc_vtotal;
 		framedur_ns = (s64) div64_u64((u64) frame_size * 1000000000,
 					      dotclock);
 	} else
@@ -484,8 +485,8 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc)
 	crtc->framedur_ns = framedur_ns;
 
 	DRM_DEBUG("crtc %d: hwmode: htotal %d, vtotal %d, vdisplay %d\n",
-		  crtc->base.id, crtc->hwmode.crtc_htotal,
-		  crtc->hwmode.crtc_vtotal, crtc->hwmode.crtc_vdisplay);
+		  crtc->base.id, mode->crtc_htotal,
+		  mode->crtc_vtotal, mode->crtc_vdisplay);
 	DRM_DEBUG("crtc %d: clock %d kHz framedur %d linedur %d, pixeldur %d\n",
 		  crtc->base.id, (int) dotclock/1000, (int) framedur_ns,
 		  (int) linedur_ns, (int) pixeldur_ns);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0c2e83c..7ea20b2 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9364,7 +9364,8 @@ static int __intel_set_mode(struct drm_crtc *crtc,
 		 * are later needed by vblank and swap-completion
 		 * timestamping. They are derived from true hwmode.
 		 */
-		drm_calc_timestamping_constants(crtc);
+		drm_calc_timestamping_constants(crtc,
+						&pipe_config->adjusted_mode);
 	}
 
 	/* FIXME: add subpixel order */
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 8d4e10d..99f49ea 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1419,7 +1419,8 @@ extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 						 struct timeval *vblank_time,
 						 unsigned flags,
 						 struct drm_crtc *refcrtc);
-extern void drm_calc_timestamping_constants(struct drm_crtc *crtc);
+extern void drm_calc_timestamping_constants(struct drm_crtc *crtc,
+					    const struct drm_display_mode *mode);
 
 extern bool
 drm_mode_parse_command_line_for_connector(const char *mode_option,
-- 
1.8.1.5

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

  reply	other threads:[~2013-10-29 18:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29 18:06 [PATCH 00/14] drm: Some more vblank timestampi changes ville.syrjala
2013-10-29 18:06 ` ville.syrjala [this message]
2013-10-29 18:06 ` [PATCH 02/14] drm: Pass the display mode to drm_calc_vbltimestamp_from_scanoutpos() ville.syrjala
2013-10-29 18:06 ` [PATCH 03/14] drm/i915: Kill hwmode save/restore ville.syrjala
2013-10-29 18:06 ` [PATCH 04/14] drm/i915: Call drm_calc_timestamping_constants() earlier ville.syrjala
2013-10-29 18:06 ` [PATCH 05/14] drm: Improve drm_calc_timestamping_constants() documentation ville.syrjala
2013-10-29 18:06 ` [PATCH 06/14] drm: Simplify the math in drm_calc_timestamping_constants() ville.syrjala
2013-10-29 18:06 ` [PATCH 07/14] drm/radeon: Populate crtc_clock in radeon_atom_get_tv_timings() ville.syrjala
2013-10-29 18:06 ` [PATCH 08/14] drm: Use crtc_clock in drm_calc_timestamping_constants() ville.syrjala
2013-10-29 18:06 ` [PATCH 09/14] drm: Change {pixel,line,frame}dur_ns from s64 to int ville.syrjala
2013-10-29 18:06 ` [PATCH 10/14] drm/i915: Fix scanoutpos calculations for interlaced modes ville.syrjala
2013-10-29 18:06 ` [PATCH 11/14] drm: Fix vblank timestamping constants " ville.syrjala
2013-10-29 18:06 ` [PATCH 12/14] drm: Pass 'flags' from the caller to .get_scanout_position() ville.syrjala
2014-01-13  0:02   ` Mario Kleiner
2013-10-29 18:06 ` [PATCH 13/14] drm/radeon: Move the early vblank IRQ fixup to radeon_get_crtc_scanoutpos() ville.syrjala
2014-01-13  0:22   ` Mario Kleiner
2013-10-29 18:06 ` [PATCH 14/14] drm/i915: Add a kludge for DSL incrementing too late and ISR not working ville.syrjala
2013-11-06  3:46 ` [PATCH 00/14] drm: Some more vblank timestampi changes Dave Airlie
2013-11-29 13:36   ` Ville Syrjälä
2013-11-30 12:51     ` Mario Kleiner
2014-01-12 23:58 ` Mario Kleiner

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=1383069978-12476-2-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox