summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Kleiner <mario.kleiner@tuebingen.mpg.de>2010-12-09 03:27:59 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-12-16 11:42:43 +0000
commit5743c223877fbff710cdd5114cff6d3ee3108309 (patch)
treebd83055a5763e949ed634d659df98c8c72d9e9bc
parent2177e6032146f4720f244e98f7c0d6df1b925784 (diff)
Check consistency of pageflip completion vblank count.
Implements a consistency check on returned vblank count values of pageflip completion. Impossible values are detected, a x-warning is logged and returned (msc,ust) values are marked invalid, so clients could perform error handling. Such a warning would indicate bugs in the pageflip completion routine of future kms drivers or the ddx and thereby aid driver debugging. Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/intel_dri.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/intel_dri.c b/src/intel_dri.c
index e3835482..a41555c0 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -629,7 +629,8 @@ I830DRI2ExchangeBuffers(DrawablePtr draw, DRI2BufferPtr front,
static Bool
I830DRI2ScheduleFlip(struct intel_screen_private *intel,
ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
- DRI2BufferPtr back, DRI2SwapEventPtr func, void *data)
+ DRI2BufferPtr back, DRI2SwapEventPtr func, void *data,
+ unsigned int target_msc)
{
I830DRI2BufferPrivatePtr back_priv;
DRI2FrameEventPtr flip_info;
@@ -646,6 +647,7 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
flip_info->type = DRI2_SWAP;
flip_info->event_complete = func;
flip_info->event_data = data;
+ flip_info->frame = target_msc;
/* Page flip the full screen buffer */
back_priv = back->driverPrivate;
@@ -712,7 +714,7 @@ void I830DRI2FrameEventHandler(unsigned int frame, unsigned int tv_sec,
I830DRI2ScheduleFlip(intel,
event->client, drawable, event->front,
event->back, event->event_complete,
- event->event_data)) {
+ event->event_data, event->frame)) {
I830DRI2ExchangeBuffers(drawable,
event->front, event->back);
break;
@@ -783,6 +785,18 @@ void I830DRI2FlipEventHandler(unsigned int frame, unsigned int tv_sec,
/* We assume our flips arrive in order, so we don't check the frame */
switch (flip->type) {
case DRI2_SWAP:
+ /* Check for too small vblank count of pageflip completion, taking wraparound
+ * into account. This usually means some defective kms pageflip completion,
+ * causing wrong (msc, ust) return values and possible visual corruption.
+ */
+ if ((frame < flip->frame) && (flip->frame - frame < 5)) {
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "%s: Pageflip completion has impossible msc %d < target_msc %d\n",
+ __func__, frame, flip->frame);
+ /* All-Zero values signal failure of timestamping to client. */
+ frame = tv_sec = tv_usec = 0;
+ }
+
DRI2SwapComplete(flip->client, drawable, frame, tv_sec, tv_usec,
DRI2_FLIP_COMPLETE, flip->event_complete,
flip->event_data);