diff options
author | Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> | 2018-02-03 00:12:53 -0500 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2018-02-15 14:48:09 -0500 |
commit | 3b765c0b765d2cc03ef02276f1af2658a03b3ced (patch) | |
tree | 9812b0809d104ace38d1f1b0ab4a0725415e8683 /drivers/gpu/drm | |
parent | 6e8c06d291f339d6586777e4c6184fb1102c2d97 (diff) |
drm/vblank: Data type fixes for 64-bit vblank sequences.
drm_vblank_count() has an u32 type returning what is a 64-bit vblank count.
The effect of this is when drm_wait_vblank_ioctl() tries to widen the user
space requested vblank sequence using this clipped 32-bit count(when the
value is >= 2^32) as reference, the requested sequence remains a 32-bit
value and gets queued like that. However, the code that checks if the
requested sequence has passed compares this against the 64-bit vblank
count.
With drm_vblank_count() returning all bits of the vblank count, update
drm_crtc_accurate_vblank_count() so that drm_crtc_arm_vblank_event() queues
the correct sequence. Otherwise, this leads to prolonged waits for a vblank
sequence when the current count is >=2^32.
Finally, fix drm_wait_one_vblank() too.
v2: Commit message fix (Keith)
Squash commits (Rodrigo)
Fixes: 570e86963a51 ("drm: Widen vblank count to 64-bits [v3]")
Cc: Keith Packard <keithp@keithp.com>
Cc: Michel Dänzer <michel@daenzer.net>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180203051302.9974-1-dhinakaran.pandiyan@intel.com
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/drm_vblank.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index 32d9bcf5be7f..f0d3ed5f2528 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c | |||
@@ -271,7 +271,7 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe, | |||
271 | store_vblank(dev, pipe, diff, t_vblank, cur_vblank); | 271 | store_vblank(dev, pipe, diff, t_vblank, cur_vblank); |
272 | } | 272 | } |
273 | 273 | ||
274 | static u32 drm_vblank_count(struct drm_device *dev, unsigned int pipe) | 274 | static u64 drm_vblank_count(struct drm_device *dev, unsigned int pipe) |
275 | { | 275 | { |
276 | struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; | 276 | struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; |
277 | 277 | ||
@@ -292,11 +292,11 @@ static u32 drm_vblank_count(struct drm_device *dev, unsigned int pipe) | |||
292 | * This is mostly useful for hardware that can obtain the scanout position, but | 292 | * This is mostly useful for hardware that can obtain the scanout position, but |
293 | * doesn't have a hardware frame counter. | 293 | * doesn't have a hardware frame counter. |
294 | */ | 294 | */ |
295 | u32 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc) | 295 | u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc) |
296 | { | 296 | { |
297 | struct drm_device *dev = crtc->dev; | 297 | struct drm_device *dev = crtc->dev; |
298 | unsigned int pipe = drm_crtc_index(crtc); | 298 | unsigned int pipe = drm_crtc_index(crtc); |
299 | u32 vblank; | 299 | u64 vblank; |
300 | unsigned long flags; | 300 | unsigned long flags; |
301 | 301 | ||
302 | WARN_ONCE(drm_debug & DRM_UT_VBL && !dev->driver->get_vblank_timestamp, | 302 | WARN_ONCE(drm_debug & DRM_UT_VBL && !dev->driver->get_vblank_timestamp, |
@@ -1055,7 +1055,7 @@ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe) | |||
1055 | { | 1055 | { |
1056 | struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; | 1056 | struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; |
1057 | int ret; | 1057 | int ret; |
1058 | u32 last; | 1058 | u64 last; |
1059 | 1059 | ||
1060 | if (WARN_ON(pipe >= dev->num_crtcs)) | 1060 | if (WARN_ON(pipe >= dev->num_crtcs)) |
1061 | return; | 1061 | return; |