]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm: Move timestamping constants into drm_vblank_crtc
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 14 Sep 2015 19:43:43 +0000 (22:43 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 24 Sep 2015 18:14:20 +0000 (20:14 +0200)
Collect the timestamping constants alongside the rest of the relevant
stuff under drm_vblank_crtc.

We can now get rid of the 'refcrtc' parameter to
drm_calc_vbltimestamp_from_scanoutpos().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
drivers/gpu/drm/drm_irq.c
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/nouveau/nouveau_display.c
drivers/gpu/drm/radeon/radeon_kms.c
include/drm/drmP.h
include/drm/drm_crtc.h

index 22367939ebf1ad150cb3fe56a7470f0739d0dbcc..ecfa703a9e69d38afbdeb83d1dd491a6b2482572 100644 (file)
@@ -681,7 +681,7 @@ int amdgpu_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->hwmode);
+                                                    &drmcrtc->hwmode);
 }
 
 const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
index 8df413341ba78ea6f2aef944d3767f14c2d73d65..6b2fefde25a812781ed4132af653440481f982bf 100644 (file)
@@ -603,6 +603,7 @@ int drm_control(struct drm_device *dev, void *data,
 void drm_calc_timestamping_constants(struct drm_crtc *crtc,
                                     const struct drm_display_mode *mode)
 {
+       struct drm_vblank_crtc *vblank = &crtc->dev->vblank[drm_crtc_index(crtc)];
        int linedur_ns = 0, pixeldur_ns = 0, framedur_ns = 0;
        int dotclock = mode->crtc_clock;
 
@@ -628,9 +629,9 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc,
                DRM_ERROR("crtc %u: Can't calculate constants, dotclock = 0!\n",
                          crtc->base.id);
 
-       crtc->pixeldur_ns = pixeldur_ns;
-       crtc->linedur_ns  = linedur_ns;
-       crtc->framedur_ns = framedur_ns;
+       vblank->pixeldur_ns = pixeldur_ns;
+       vblank->linedur_ns  = linedur_ns;
+       vblank->framedur_ns = framedur_ns;
 
        DRM_DEBUG("crtc %u: hwmode: htotal %d, vtotal %d, vdisplay %d\n",
                  crtc->base.id, mode->crtc_htotal,
@@ -651,7 +652,6 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  * @flags: Flags to pass to driver:
  *         0 = Default,
  *         DRM_CALLED_FROM_VBLIRQ = If function is called from vbl IRQ handler
- * @refcrtc: CRTC which defines scanout timing
  * @mode: mode which defines the scanout timings
  *
  * Implements calculation of exact vblank timestamps from given drm_display_mode
@@ -692,9 +692,9 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                                          int *max_error,
                                          struct timeval *vblank_time,
                                          unsigned flags,
-                                         const struct drm_crtc *refcrtc,
                                          const struct drm_display_mode *mode)
 {
+       struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
        struct timeval tv_etime;
        ktime_t stime, etime;
        int vbl_status;
@@ -714,9 +714,9 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
        }
 
        /* Durations of frames, lines, pixels in nanoseconds. */
-       framedur_ns = refcrtc->framedur_ns;
-       linedur_ns  = refcrtc->linedur_ns;
-       pixeldur_ns = refcrtc->pixeldur_ns;
+       framedur_ns = vblank->framedur_ns;
+       linedur_ns  = vblank->linedur_ns;
+       pixeldur_ns = vblank->pixeldur_ns;
 
        /* If mode timing undefined, just return as no-op:
         * Happens during initial modesetting of a crtc.
index 5a244ab9395ba2c9f61278a1293850d5e75bc9c4..4cbc7221173888da5872edde252c432f62fbb327 100644 (file)
@@ -810,7 +810,6 @@ 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->hwmode);
 }
 
index cc6c228e11c83566d1ac1a2c59fcefa959345463..425515feef6e0108f099ca39312206c251183d3f 100644 (file)
@@ -103,6 +103,7 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,
                .base.head = nouveau_crtc(crtc)->index,
        };
        struct nouveau_display *disp = nouveau_display(crtc->dev);
+       struct drm_vblank_crtc *vblank = &crtc->dev->vblank[drm_crtc_index(crtc)];
        int ret, retry = 1;
 
        do {
@@ -116,7 +117,7 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,
                        break;
                }
 
-               if (retry) ndelay(crtc->linedur_ns);
+               if (retry) ndelay(vblank->linedur_ns);
        } while (retry--);
 
        *hpos = args.scan.hline;
@@ -155,7 +156,7 @@ nouveau_display_vblstamp(struct drm_device *dev, int head, int *max_error,
        list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
                if (nouveau_crtc(crtc)->index == head) {
                        return drm_calc_vbltimestamp_from_scanoutpos(dev,
-                                       head, max_error, time, flags, crtc,
+                                       head, max_error, time, flags,
                                        &crtc->hwmode);
                }
        }
index 4a119c255ba9709692b234c51a928d826cc22ec2..fd9da282b29c818d16cb84f7b78c8f1e4163f383 100644 (file)
@@ -841,7 +841,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->hwmode);
+                                                    &drmcrtc->hwmode);
 }
 
 #define KMS_INVALID_IOCTL(name)                                                \
index 8b5ce7c5d9bbfc33250ea8d15621cfd1d97be3f4..299886746c827fd443f1860f16a10fddf8caa490 100644 (file)
@@ -701,6 +701,9 @@ struct drm_vblank_crtc {
        u32 last_wait;                  /* Last vblank seqno waited per CRTC */
        unsigned int inmodeset;         /* Display driver is setting mode */
        unsigned int pipe;              /* crtc index */
+       int framedur_ns;                /* frame/field duration in ns */
+       int linedur_ns;                 /* line duration in ns */
+       int pixeldur_ns;                /* pixel duration in ns */
        bool enabled;                   /* so we don't call enable more than
                                           once per disable */
 };
@@ -951,7 +954,6 @@ extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                                                 unsigned int pipe, int *max_error,
                                                 struct timeval *vblank_time,
                                                 unsigned flags,
-                                                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);
index 6566f72fc505f34fc510ae6e30853ddd347d7328..683f1421a8258c5b69ffc304007ef02d53645508 100644 (file)
@@ -413,9 +413,6 @@ struct drm_crtc_funcs {
  * @funcs: CRTC control functions
  * @gamma_size: size of gamma ramp
  * @gamma_store: gamma ramp values
- * @framedur_ns: precise frame timing
- * @linedur_ns: precise line timing
- * @pixeldur_ns: precise pixel timing
  * @helper_private: mid-layer private data
  * @properties: property tracking for this CRTC
  * @state: current atomic state for this CRTC
@@ -468,9 +465,6 @@ struct drm_crtc {
        uint32_t gamma_size;
        uint16_t *gamma_store;
 
-       /* Constants needed for precise vblank and swap timestamping. */
-       int framedur_ns, linedur_ns, pixeldur_ns;
-
        /* if you are using the helper */
        const void *helper_private;