diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-03-24 18:22:20 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-03-24 18:30:50 +0000 |
commit | c186d4dda3b62b73af3caf2883a9cedfd97e3b45 (patch) | |
tree | 663b105f18e8727de04ee8aef52a36749ee286b8 /src/sna | |
parent | 4e108afe55f6b13aa946d1252ff0b828929245b3 (diff) |
sna/present: Restrict vblank.sequence range to 31bits
The kernel checks for past vblanks using an int32_t comparison, so we
can only program up to 31bits into the future (and similarly programing
a timer that large would also overflow).
References: https://bugs.freedesktop.org/show_bug.cgi?id=94685
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r-- | src/sna/sna_present.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/sna/sna_present.c b/src/sna/sna_present.c index 93c7f065..e08afe56 100644 --- a/src/sna/sna_present.c +++ b/src/sna/sna_present.c @@ -114,8 +114,10 @@ static void vblank_complete(struct sna_present_event *info, int n; if (msc < info->target_msc) { - DBG(("%s: %d too early, now %lld, expected %lld\n", - __FUNCTION__, (long long)msc, (long long)info->target_msc)); + DBG(("%s: event=%d too early, now %lld, expected %lld\n", + __FUNCTION__, + info->event_id[0], + (long long)msc, (long long)info->target_msc)); if (sna_present_queue(info, msc)) return; } @@ -247,7 +249,7 @@ static bool sna_present_queue(struct sna_present_event *info, (long long)info->target_msc, (unsigned)info->target_msc, (long long)last_msc)); - assert(info->target_msc - last_msc < 1ull<<32); + assert(info->target_msc - last_msc < 1ull<<31); VG_CLEAR(vbl); vbl.request.type = DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT; @@ -360,7 +362,7 @@ sna_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc) present_event_notify(event_id, swap_ust(swap), swap->msc); return Success; } - if (warn_unless(msc - swap->msc < 1ull<<32)) + if (warn_unless(msc - swap->msc < 1ull<<31)) return BadValue; list_for_each_entry(tmp, &sna->present.vblank_queue, link) { |