drm: Pass the display mode to drm_calc_timestamping_constants()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Sat, 26 Oct 2013 14:16:30 +0000 (17:16 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 20 Jan 2014 09:04:46 +0000 (11:04 +0200)
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().

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
drivers/gpu/drm/drm_crtc_helper.c
drivers/gpu/drm/drm_irq.c
drivers/gpu/drm/i915/intel_display.c
include/drm/drmP.h

index 01361aba033b4a39888a41bc15c4a7f5e4052152..245fe4fa9c9edd5b36ca2448652020558edb3e8c 100644 (file)
@@ -536,7 +536,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:
index e7de2da57234285d8ed634d558f3ede7c5aeb12b..3837132086f0de455b0839ef87a1df07ac7812e4 100644 (file)
@@ -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 half a frame duration.
         * Double the dotclock to get half 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);
index e77d4b8856a79b999456b1d22b7b9e20f9f88b66..920fcff8818c4e3a9688e61abe7ae96f1efbd75c 100644 (file)
@@ -9693,7 +9693,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 */
index 63eab2b72ee7acb10bd0a0baf7f3c3608dee5cf5..46bf8ae7e302435255d12af9e1c6ae74edf3d54b 100644 (file)
@@ -1402,7 +1402,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,