xf86-video-intel: src/sna/sna_display.c src/sna/sna_present.c src/sna/xassert.h
Chris Wilson
ickle at kemper.freedesktop.org
Tue Mar 22 23:02:37 UTC 2016
src/sna/sna_display.c | 4 ++--
src/sna/sna_present.c | 12 ++++++------
src/sna/xassert.h | 21 +++++++++++++--------
3 files changed, 21 insertions(+), 16 deletions(-)
New commits:
commit f656f6afa288c63968f45d6d32c96a4cf6213117
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Mar 22 22:11:18 2016 +0000
sna/present: Report BadValue if target_msc exceeds last known msc by 1<<32
As we cannot queue a vblank further than 1<<32 into the future, nor can
we set a Timer to expire that far into the future, creating such a
vblank event is futile. Report BadValue and hope for the best.
References: https://bugs.freedesktop.org/show_bug.cgi?id=94515
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 7d2478c..ad8690e 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -479,14 +479,14 @@ uint64_t sna_crtc_record_swap(xf86CrtcPtr crtc,
assert(sna_crtc);
if (msc64(sna_crtc, seq, &msc)) {
- DBG(("%s: recording last swap on pipe=%d, frame %d [%08llx], time %d.%06d\n",
+ DBG(("%s: recording last swap on pipe=%d, frame %d [msc=%08lld], time %d.%06d\n",
__FUNCTION__, __sna_crtc_pipe(sna_crtc), seq, (long long)msc,
tv_sec, tv_usec));
sna_crtc->swap.tv_sec = tv_sec;
sna_crtc->swap.tv_usec = tv_usec;
sna_crtc->swap.msc = msc;
} else {
- DBG(("%s: swap event on pipe=%d, frame %d [%08llx], time %d.%06d\n",
+ DBG(("%s: swap event on pipe=%d, frame %d [msc=%08lld], time %d.%06d\n",
__FUNCTION__, __sna_crtc_pipe(sna_crtc), seq, (long long)msc,
tv_sec, tv_usec));
}
diff --git a/src/sna/sna_present.c b/src/sna/sna_present.c
index 7a7650e..1624063 100644
--- a/src/sna/sna_present.c
+++ b/src/sna/sna_present.c
@@ -279,10 +279,10 @@ last:
*msc = swap->msc;
}
- DBG(("%s: pipe=%d, tv=%d.%06d msc=%lld\n", __FUNCTION__,
+ DBG(("%s: pipe=%d, tv=%d.%06d seq=%d msc=%lld\n", __FUNCTION__,
sna_crtc_pipe(crtc->devPrivate),
(int)(*ust / 1000000), (int)(*ust % 1000000),
- (long long)*msc));
+ vbl.reply.sequence, (long long)*msc));
return Success;
}
@@ -313,8 +313,7 @@ sna_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
__FUNCTION__, sna_crtc_pipe(crtc->devPrivate),
(long long)event_id, (long long)msc, (long long)swap->msc));
- warn_unless((int64_t)(msc - swap->msc) >= 0);
- if ((int64_t)(msc - swap->msc) <= 0) {
+ if (warn_unless((int64_t)(msc - swap->msc) >= 0)) {
DBG(("%s: pipe=%d tv=%d.%06d msc=%lld (target=%lld), event=%lld complete\n", __FUNCTION__,
sna_crtc_pipe(crtc->devPrivate),
swap->tv_sec, swap->tv_usec,
@@ -323,7 +322,8 @@ 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;
}
- warn_unless(msc < swap->msc + (1ull<<32));
+ if (warn_unless(msc - swap->msc < 1ull<<32))
+ return BadValue;
list_for_each_entry(tmp, &sna->present.vblank_queue, link) {
if (tmp->target_msc == msc &&
@@ -372,7 +372,7 @@ sna_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
vbl.request.sequence = msc;
vbl.request.signal = (uintptr_t)MARK_PRESENT(info);
if (sna_wait_vblank(sna, &vbl, sna_crtc_pipe(info->crtc))) {
- DBG(("%s: vblank enqueue failed\n", __FUNCTION__));
+ DBG(("%s: vblank enqueue failed, faking\n", __FUNCTION__));
if (!sna_fake_vblank(info)) {
list_del(&info->link);
free(info);
diff --git a/src/sna/xassert.h b/src/sna/xassert.h
index 28796b8..e648e4b 100644
--- a/src/sna/xassert.h
+++ b/src/sna/xassert.h
@@ -44,20 +44,25 @@
FatalError("%s:%d assertion '%s' failed\n", __func__, __LINE__, #E); \
} while (0)
-#define warn_unless(E) do if (unlikely(!(E))) { \
- static int __warn_once__; \
- if (!__warn_once__) { \
- xorg_backtrace(); \
- ErrorF("%s:%d assertion '%s' failed\n", __func__, __LINE__, #E); \
- __warn_once__ = 1; \
+#define warn_unless(E) \
+({ \
+ bool fail = !(E); \
+ if (unlikely(fail)) { \
+ static int __warn_once__; \
+ if (!__warn_once__) { \
+ xorg_backtrace(); \
+ ErrorF("%s:%d assertion '%s' failed\n", __func__, __LINE__, #E); \
+ __warn_once__ = 1; \
+ } \
} \
-} while (0)
+ unlikely(fail); \
+})
#define dbg(EXPR) EXPR
#else
-#define warn_unless(E)
+#define warn_unless(E) ({ bool fail = !(E); unlikely(fail); })
#define dbg(EXPR)
#endif
More information about the xorg-commit
mailing list