drm: Pass the display mode to drm_calc_vbltimestamp_from_scanoutpos()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Sat, 26 Oct 2013 14:57:31 +0000 (17:57 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 20 Jan 2014 09:05:08 +0000 (11:05 +0200)
Rather than using crtc->hwmode, just pass the relevant mode to
drm_calc_vbltimestamp_from_scanoutpos(). This removes the last hwmode
usage from core drm.

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

index 3837132086f0de455b0839ef87a1df07ac7812e4..db93b07723dd24e6f2d532c4fc872b6e6d353976 100644 (file)
@@ -522,6 +522,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  *         0 = Default.
  *         DRM_CALLED_FROM_VBLIRQ = If function is called from vbl irq handler.
  * @refcrtc: drm_crtc* of crtc which defines scanout timing.
+ * @mode: mode which defines the scanout timings
  *
  * Returns negative value on error, failure or if not supported in current
  * video mode:
@@ -541,11 +542,11 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,
                                          int *max_error,
                                          struct timeval *vblank_time,
                                          unsigned flags,
-                                         struct drm_crtc *refcrtc)
+                                         const struct drm_crtc *refcrtc,
+                                         const struct drm_display_mode *mode)
 {
        ktime_t stime, etime, mono_time_offset;
        struct timeval tv_etime;
-       struct drm_display_mode *mode;
        int vbl_status, vtotal, vdisplay;
        int vpos, hpos, i;
        s64 framedur_ns, linedur_ns, pixeldur_ns, delta_ns, duration_ns;
@@ -562,7 +563,6 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,
                return -EIO;
        }
 
-       mode = &refcrtc->hwmode;
        vtotal = mode->crtc_vtotal;
        vdisplay = mode->crtc_vdisplay;
 
index 6d11e253218a7383fc84dec3913427054b302065..b6e4a762806beb6e80958bdfb8b8022a789fbc64 100644 (file)
@@ -809,7 +809,8 @@ static int i915_get_vblank_timestamp(struct drm_device *dev, int pipe,
        /* Helper routine in DRM core does all the work: */
        return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error,
                                                     vblank_time, flags,
-                                                    crtc);
+                                                    crtc,
+                                                    &to_intel_crtc(crtc)->config.adjusted_mode);
 }
 
 static bool intel_hpd_irq_event(struct drm_device *dev,
index 5bf50cec017ef73b2a12d5ea73a795a478a444e9..5444948cf01dabbb9d24029dece0acb615ac3f60 100644 (file)
@@ -712,7 +712,7 @@ int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc,
        /* Helper routine in DRM core does all the work: */
        return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error,
                                                     vblank_time, flags,
-                                                    drmcrtc);
+                                                    drmcrtc, &drmcrtc->hwmode);
 }
 
 #define KMS_INVALID_IOCTL(name)                                                \
index 46bf8ae7e302435255d12af9e1c6ae74edf3d54b..3f57c77acef839d45b8d747b5424aea93e579036 100644 (file)
@@ -1401,7 +1401,8 @@ extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                                                 int crtc, int *max_error,
                                                 struct timeval *vblank_time,
                                                 unsigned flags,
-                                                struct drm_crtc *refcrtc);
+                                                const struct drm_crtc *refcrtc,
+                                                const struct drm_display_mode *mode);
 extern void drm_calc_timestamping_constants(struct drm_crtc *crtc,
                                            const struct drm_display_mode *mode);