Skip to content

Commit

Permalink
drm/vblank: Use u32 consistently for vblank counters
Browse files Browse the repository at this point in the history
In

commit 99264a6
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
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 <michel@daenzer.net>
Reported-by: Michel Dänzer <michel@daenzer.net>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
  • Loading branch information
Daniel Vetter committed Aug 7, 2015
1 parent 047fe6e commit 209e4db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion include/drm/drmP.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down

0 comments on commit 209e4db

Please sign in to comment.