aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2010-07-01 19:48:09 -0400
committerDave Airlie <airlied@redhat.com>2010-07-02 00:03:24 -0400
commitb9c2c9ae882f058084e13e339925dbf8d2d20271 (patch)
tree2c3baccc55ef03477a4fc3e08473ea35931e56ec
parentac2874b980e05ed7a4ea8fed7b0a92428b51ce58 (diff)
drm: add per-event vblank event trace points
Allows us to track each process that requests and completes events. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_irq.c8
-rw-r--r--drivers/gpu/drm/drm_trace.h57
-rw-r--r--include/drm/drmP.h2
3 files changed, 53 insertions, 14 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 6d201a89441c..c2ecb3ed009f 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -588,6 +588,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
588 return -ENOMEM; 588 return -ENOMEM;
589 589
590 e->pipe = pipe; 590 e->pipe = pipe;
591 e->base.pid = current->pid;
591 e->event.base.type = DRM_EVENT_VBLANK; 592 e->event.base.type = DRM_EVENT_VBLANK;
592 e->event.base.length = sizeof e->event; 593 e->event.base.length = sizeof e->event;
593 e->event.user_data = vblwait->request.signal; 594 e->event.user_data = vblwait->request.signal;
@@ -615,6 +616,9 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
615 DRM_DEBUG("event on vblank count %d, current %d, crtc %d\n", 616 DRM_DEBUG("event on vblank count %d, current %d, crtc %d\n",
616 vblwait->request.sequence, seq, pipe); 617 vblwait->request.sequence, seq, pipe);
617 618
619 trace_drm_vblank_event_queued(current->pid, pipe,
620 vblwait->request.sequence);
621
618 e->event.sequence = vblwait->request.sequence; 622 e->event.sequence = vblwait->request.sequence;
619 if ((seq - vblwait->request.sequence) <= (1 << 23)) { 623 if ((seq - vblwait->request.sequence) <= (1 << 23)) {
620 e->event.tv_sec = now.tv_sec; 624 e->event.tv_sec = now.tv_sec;
@@ -622,6 +626,8 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
622 drm_vblank_put(dev, e->pipe); 626 drm_vblank_put(dev, e->pipe);
623 list_add_tail(&e->base.link, &e->base.file_priv->event_list); 627 list_add_tail(&e->base.link, &e->base.file_priv->event_list);
624 wake_up_interruptible(&e->base.file_priv->event_wait); 628 wake_up_interruptible(&e->base.file_priv->event_wait);
629 trace_drm_vblank_event_delivered(current->pid, pipe,
630 vblwait->request.sequence);
625 } else { 631 } else {
626 list_add_tail(&e->base.link, &dev->vblank_event_list); 632 list_add_tail(&e->base.link, &dev->vblank_event_list);
627 } 633 }
@@ -752,6 +758,8 @@ void drm_handle_vblank_events(struct drm_device *dev, int crtc)
752 drm_vblank_put(dev, e->pipe); 758 drm_vblank_put(dev, e->pipe);
753 list_move_tail(&e->base.link, &e->base.file_priv->event_list); 759 list_move_tail(&e->base.link, &e->base.file_priv->event_list);
754 wake_up_interruptible(&e->base.file_priv->event_wait); 760 wake_up_interruptible(&e->base.file_priv->event_wait);
761 trace_drm_vblank_event_delivered(e->base.pid, e->pipe,
762 e->event.sequence);
755 } 763 }
756 764
757 spin_unlock_irqrestore(&dev->event_lock, flags); 765 spin_unlock_irqrestore(&dev->event_lock, flags);
diff --git a/drivers/gpu/drm/drm_trace.h b/drivers/gpu/drm/drm_trace.h
index 8a92683f14ec..03ea964aa604 100644
--- a/drivers/gpu/drm/drm_trace.h
+++ b/drivers/gpu/drm/drm_trace.h
@@ -11,22 +11,51 @@
11#define TRACE_INCLUDE_FILE drm_trace 11#define TRACE_INCLUDE_FILE drm_trace
12 12
13TRACE_EVENT(drm_vblank_event, 13TRACE_EVENT(drm_vblank_event,
14 TP_PROTO(int crtc, unsigned int seq),
15 TP_ARGS(crtc, seq),
16 TP_STRUCT__entry(
17 __field(int, crtc)
18 __field(unsigned int, seq)
19 ),
20 TP_fast_assign(
21 __entry->crtc = crtc;
22 __entry->seq = seq;
23 ),
24 TP_printk("crtc=%d, seq=%d", __entry->crtc, __entry->seq)
25);
14 26
15 TP_PROTO(int crtc, unsigned int seq), 27TRACE_EVENT(drm_vblank_event_queued,
16 28 TP_PROTO(pid_t pid, int crtc, unsigned int seq),
17 TP_ARGS(crtc, seq), 29 TP_ARGS(pid, crtc, seq),
18 30 TP_STRUCT__entry(
19 TP_STRUCT__entry( 31 __field(pid_t, pid)
20 __field(int, crtc) 32 __field(int, crtc)
21 __field(unsigned int, seq) 33 __field(unsigned int, seq)
22 ), 34 ),
23 35 TP_fast_assign(
24 TP_fast_assign( 36 __entry->pid = pid;
25 __entry->crtc = crtc; 37 __entry->crtc = crtc;
26 __entry->seq = seq; 38 __entry->seq = seq;
27 ), 39 ),
40 TP_printk("pid=%d, crtc=%d, seq=%d", __entry->pid, __entry->crtc, \
41 __entry->seq)
42);
28 43
29 TP_printk("crtc=%d, seq=%d", __entry->crtc, __entry->seq) 44TRACE_EVENT(drm_vblank_event_delivered,
45 TP_PROTO(pid_t pid, int crtc, unsigned int seq),
46 TP_ARGS(pid, crtc, seq),
47 TP_STRUCT__entry(
48 __field(pid_t, pid)
49 __field(int, crtc)
50 __field(unsigned int, seq)
51 ),
52 TP_fast_assign(
53 __entry->pid = pid;
54 __entry->crtc = crtc;
55 __entry->seq = seq;
56 ),
57 TP_printk("pid=%d, crtc=%d, seq=%d", __entry->pid, __entry->crtc, \
58 __entry->seq)
30); 59);
31 60
32#endif /* _DRM_TRACE_H_ */ 61#endif /* _DRM_TRACE_H_ */
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index c1b987158dfa..8364a705f125 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -403,6 +403,8 @@ struct drm_pending_event {
403 struct drm_event *event; 403 struct drm_event *event;
404 struct list_head link; 404 struct list_head link;
405 struct drm_file *file_priv; 405 struct drm_file *file_priv;
406 pid_t pid; /* pid of requester, no guarantee it's valid by the time
407 we deliver the event, for tracing only */
406 void (*destroy)(struct drm_pending_event *event); 408 void (*destroy)(struct drm_pending_event *event);
407}; 409};
408 410