Commit b9c2c9ae authored by Jesse Barnes's avatar Jesse Barnes Committed by Dave Airlie

drm: add per-event vblank event trace points

Allows us to track each process that requests and completes events.
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent ac2874b9
...@@ -588,6 +588,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, ...@@ -588,6 +588,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
return -ENOMEM; return -ENOMEM;
e->pipe = pipe; e->pipe = pipe;
e->base.pid = current->pid;
e->event.base.type = DRM_EVENT_VBLANK; e->event.base.type = DRM_EVENT_VBLANK;
e->event.base.length = sizeof e->event; e->event.base.length = sizeof e->event;
e->event.user_data = vblwait->request.signal; e->event.user_data = vblwait->request.signal;
...@@ -615,6 +616,9 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, ...@@ -615,6 +616,9 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
DRM_DEBUG("event on vblank count %d, current %d, crtc %d\n", DRM_DEBUG("event on vblank count %d, current %d, crtc %d\n",
vblwait->request.sequence, seq, pipe); vblwait->request.sequence, seq, pipe);
trace_drm_vblank_event_queued(current->pid, pipe,
vblwait->request.sequence);
e->event.sequence = vblwait->request.sequence; e->event.sequence = vblwait->request.sequence;
if ((seq - vblwait->request.sequence) <= (1 << 23)) { if ((seq - vblwait->request.sequence) <= (1 << 23)) {
e->event.tv_sec = now.tv_sec; e->event.tv_sec = now.tv_sec;
...@@ -622,6 +626,8 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, ...@@ -622,6 +626,8 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
drm_vblank_put(dev, e->pipe); drm_vblank_put(dev, e->pipe);
list_add_tail(&e->base.link, &e->base.file_priv->event_list); list_add_tail(&e->base.link, &e->base.file_priv->event_list);
wake_up_interruptible(&e->base.file_priv->event_wait); wake_up_interruptible(&e->base.file_priv->event_wait);
trace_drm_vblank_event_delivered(current->pid, pipe,
vblwait->request.sequence);
} else { } else {
list_add_tail(&e->base.link, &dev->vblank_event_list); list_add_tail(&e->base.link, &dev->vblank_event_list);
} }
...@@ -752,6 +758,8 @@ void drm_handle_vblank_events(struct drm_device *dev, int crtc) ...@@ -752,6 +758,8 @@ void drm_handle_vblank_events(struct drm_device *dev, int crtc)
drm_vblank_put(dev, e->pipe); drm_vblank_put(dev, e->pipe);
list_move_tail(&e->base.link, &e->base.file_priv->event_list); list_move_tail(&e->base.link, &e->base.file_priv->event_list);
wake_up_interruptible(&e->base.file_priv->event_wait); wake_up_interruptible(&e->base.file_priv->event_wait);
trace_drm_vblank_event_delivered(e->base.pid, e->pipe,
e->event.sequence);
} }
spin_unlock_irqrestore(&dev->event_lock, flags); spin_unlock_irqrestore(&dev->event_lock, flags);
......
...@@ -11,22 +11,51 @@ ...@@ -11,22 +11,51 @@
#define TRACE_INCLUDE_FILE drm_trace #define TRACE_INCLUDE_FILE drm_trace
TRACE_EVENT(drm_vblank_event, TRACE_EVENT(drm_vblank_event,
TP_PROTO(int crtc, unsigned int seq),
TP_ARGS(crtc, seq),
TP_STRUCT__entry(
__field(int, crtc)
__field(unsigned int, seq)
),
TP_fast_assign(
__entry->crtc = crtc;
__entry->seq = seq;
),
TP_printk("crtc=%d, seq=%d", __entry->crtc, __entry->seq)
);
TP_PROTO(int crtc, unsigned int seq), TRACE_EVENT(drm_vblank_event_queued,
TP_PROTO(pid_t pid, int crtc, unsigned int seq),
TP_ARGS(crtc, seq), TP_ARGS(pid, crtc, seq),
TP_STRUCT__entry(
TP_STRUCT__entry( __field(pid_t, pid)
__field(int, crtc) __field(int, crtc)
__field(unsigned int, seq) __field(unsigned int, seq)
), ),
TP_fast_assign(
TP_fast_assign( __entry->pid = pid;
__entry->crtc = crtc; __entry->crtc = crtc;
__entry->seq = seq; __entry->seq = seq;
), ),
TP_printk("pid=%d, crtc=%d, seq=%d", __entry->pid, __entry->crtc, \
__entry->seq)
);
TP_printk("crtc=%d, seq=%d", __entry->crtc, __entry->seq) TRACE_EVENT(drm_vblank_event_delivered,
TP_PROTO(pid_t pid, int crtc, unsigned int seq),
TP_ARGS(pid, crtc, seq),
TP_STRUCT__entry(
__field(pid_t, pid)
__field(int, crtc)
__field(unsigned int, seq)
),
TP_fast_assign(
__entry->pid = pid;
__entry->crtc = crtc;
__entry->seq = seq;
),
TP_printk("pid=%d, crtc=%d, seq=%d", __entry->pid, __entry->crtc, \
__entry->seq)
); );
#endif /* _DRM_TRACE_H_ */ #endif /* _DRM_TRACE_H_ */
......
...@@ -403,6 +403,8 @@ struct drm_pending_event { ...@@ -403,6 +403,8 @@ struct drm_pending_event {
struct drm_event *event; struct drm_event *event;
struct list_head link; struct list_head link;
struct drm_file *file_priv; struct drm_file *file_priv;
pid_t pid; /* pid of requester, no guarantee it's valid by the time
we deliver the event, for tracing only */
void (*destroy)(struct drm_pending_event *event); void (*destroy)(struct drm_pending_event *event);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment