projects/linux·commit 209e4dbc

drm/vblank: Use u32 consistently for vblank counters

209e4dbc · Daniel Vetter <[email protected]> · 2015-08-07 12:31:17 +02:00

In

commit 99264a61dfcda41d86d0960cf2d4c0fc2758a773
Author: Daniel Vetter <[email protected]>
Date:   Wed Apr 15 19:34:43 2015 +0200

    drm/vblank: Fixup and document timestamp update/read barriers

I've switched vblank->count from atomic_t to unsigned long and
accidentally created an integer comparison bug in
drm_vblank_count_and_time since vblanke->count might overflow the u32
local copy and hence the retry loop never succeed.

Fix this by consistently using u32.

Cc: Michel Dänzer <[email protected]>
Reported-by: Michel Dänzer <[email protected]>
Reviewed-by: Thierry Reding <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Commit
209e4dbc8dcdb2b1839f18fd1cf07ec7bedadf4d
Parents
047fe6e6

Changes

2 files changed · +2 −2

FileStatusAddDelContent
drivers/gpu/drm/drm_irq.cmodified+1−1View file
include/drm/drmP.hmodified+1−1View file

drivers/gpu/drm/drm_irq.c

View file
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index f9cc68f..b50fa0a 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -75,7 +75,7 @@ module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600)
module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600);
static void store_vblank(struct drm_device *dev, int crtc,
- unsigned vblank_count_inc,
+ u32 vblank_count_inc,
struct timeval *t_vblank)
{
struct drm_vblank_crtc *vblank = &dev->vblank[crtc];

include/drm/drmP.h

View file
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 48db6a5..5aa5197 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -691,7 +691,7 @@ struct drm_vblank_crtc {
struct timer_list disable_timer; /* delayed disable timer */
/* vblank counter, protected by dev->vblank_time_lock for writes */
- unsigned long count;
+ u32 count;
/* vblank timestamps, protected by dev->vblank_time_lock for writes */
struct timeval time[DRM_VBLANKTIME_RBSIZE];