]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/drm/drm_vblank.h
ptp: fix the race between the release of ptp_clock and cdev
[mirror_ubuntu-bionic-kernel.git] / include / drm / drm_vblank.h
index 848b463a0af516ebd9894cf7917cff8eeb2cde9e..e8204d4edc881634ed045ab254d76b7bf2cc88ed 100644 (file)
@@ -112,6 +112,26 @@ struct drm_vblank_crtc {
         * @last: Protected by &drm_device.vbl_lock, used for wraparound handling.
         */
        u32 last;
+       /**
+        * @max_vblank_count:
+        *
+        * Maximum value of the vblank registers for this crtc. This value +1
+        * will result in a wrap-around of the vblank register. It is used
+        * by the vblank core to handle wrap-arounds.
+        *
+        * If set to zero the vblank core will try to guess the elapsed vblanks
+        * between times when the vblank interrupt is disabled through
+        * high-precision timestamps. That approach is suffering from small
+        * races and imprecision over longer time periods, hence exposing a
+        * hardware vblank counter is always recommended.
+        *
+        * This is the runtime configurable per-crtc maximum set through
+        * drm_crtc_set_max_vblank_count(). If this is used the driver
+        * must leave the device wide &drm_device.max_vblank_count at zero.
+        *
+        * If non-zero, &drm_crtc_funcs.get_vblank_counter must be set.
+        */
+       u32 max_vblank_count;
        /**
         * @inmodeset: Tracks whether the vblank is disabled due to a modeset.
         * For legacy driver bit 2 additionally tracks whether an additional
@@ -179,7 +199,7 @@ void drm_crtc_wait_one_vblank(struct drm_crtc *crtc);
 void drm_crtc_vblank_off(struct drm_crtc *crtc);
 void drm_crtc_vblank_reset(struct drm_crtc *crtc);
 void drm_crtc_vblank_on(struct drm_crtc *crtc);
-u32 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc);
+u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc);
 
 bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                                           unsigned int pipe, int *max_error,
@@ -188,4 +208,6 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 void drm_calc_timestamping_constants(struct drm_crtc *crtc,
                                     const struct drm_display_mode *mode);
 wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc);
+void drm_crtc_set_max_vblank_count(struct drm_crtc *crtc,
+                                  u32 max_vblank_count);
 #endif