aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_proc.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-12-19 20:23:38 -0500
committerDave Airlie <airlied@linux.ie>2008-12-29 02:47:27 -0500
commitfede5c91c4a8a7701d205b2b84b9835ddc7d6f02 (patch)
treea80b546790a405b5a0b60e843c06b5697c0b2226 /drivers/gpu/drm/drm_proc.c
parentf51c5b6e623cc737d47f513cbb893cec914f0bd2 (diff)
drm: Add a debug node for vblank state.
Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/gpu/drm/drm_proc.c')
-rw-r--r--drivers/gpu/drm/drm_proc.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c
index 7dbaa1a19ea4..8df849f66830 100644
--- a/drivers/gpu/drm/drm_proc.c
+++ b/drivers/gpu/drm/drm_proc.c
@@ -49,6 +49,8 @@ static int drm_queues_info(char *buf, char **start, off_t offset,
49 int request, int *eof, void *data); 49 int request, int *eof, void *data);
50static int drm_bufs_info(char *buf, char **start, off_t offset, 50static int drm_bufs_info(char *buf, char **start, off_t offset,
51 int request, int *eof, void *data); 51 int request, int *eof, void *data);
52static int drm_vblank_info(char *buf, char **start, off_t offset,
53 int request, int *eof, void *data);
52static int drm_gem_name_info(char *buf, char **start, off_t offset, 54static int drm_gem_name_info(char *buf, char **start, off_t offset,
53 int request, int *eof, void *data); 55 int request, int *eof, void *data);
54static int drm_gem_object_info(char *buf, char **start, off_t offset, 56static int drm_gem_object_info(char *buf, char **start, off_t offset,
@@ -72,6 +74,7 @@ static struct drm_proc_list {
72 {"clients", drm_clients_info, 0}, 74 {"clients", drm_clients_info, 0},
73 {"queues", drm_queues_info, 0}, 75 {"queues", drm_queues_info, 0},
74 {"bufs", drm_bufs_info, 0}, 76 {"bufs", drm_bufs_info, 0},
77 {"vblank", drm_vblank_info, 0},
75 {"gem_names", drm_gem_name_info, DRIVER_GEM}, 78 {"gem_names", drm_gem_name_info, DRIVER_GEM},
76 {"gem_objects", drm_gem_object_info, DRIVER_GEM}, 79 {"gem_objects", drm_gem_object_info, DRIVER_GEM},
77#if DRM_DEBUG_CODE 80#if DRM_DEBUG_CODE
@@ -458,6 +461,66 @@ static int drm_bufs_info(char *buf, char **start, off_t offset, int request,
458} 461}
459 462
460/** 463/**
464 * Called when "/proc/dri/.../vblank" is read.
465 *
466 * \param buf output buffer.
467 * \param start start of output data.
468 * \param offset requested start offset.
469 * \param request requested number of bytes.
470 * \param eof whether there is no more data to return.
471 * \param data private data.
472 * \return number of written bytes.
473 */
474static int drm__vblank_info(char *buf, char **start, off_t offset, int request,
475 int *eof, void *data)
476{
477 struct drm_minor *minor = (struct drm_minor *) data;
478 struct drm_device *dev = minor->dev;
479 int len = 0;
480 int crtc;
481
482 if (offset > DRM_PROC_LIMIT) {
483 *eof = 1;
484 return 0;
485 }
486
487 *start = &buf[offset];
488 *eof = 0;
489
490 for (crtc = 0; crtc < dev->num_crtcs; crtc++) {
491 DRM_PROC_PRINT("CRTC %d enable: %d\n",
492 crtc, atomic_read(&dev->vblank_refcount[crtc]));
493 DRM_PROC_PRINT("CRTC %d counter: %d\n",
494 crtc, drm_vblank_count(dev, crtc));
495 DRM_PROC_PRINT("CRTC %d last wait: %d\n",
496 crtc, dev->last_vblank_wait[crtc]);
497 DRM_PROC_PRINT("CRTC %d in modeset: %d\n",
498 crtc, dev->vblank_inmodeset[crtc]);
499 }
500
501 if (len > request + offset)
502 return request;
503 *eof = 1;
504 return len - offset;
505}
506
507/**
508 * Simply calls _vblank_info() while holding the drm_device::struct_mutex lock.
509 */
510static int drm_vblank_info(char *buf, char **start, off_t offset, int request,
511 int *eof, void *data)
512{
513 struct drm_minor *minor = (struct drm_minor *) data;
514 struct drm_device *dev = minor->dev;
515 int ret;
516
517 mutex_lock(&dev->struct_mutex);
518 ret = drm__vblank_info(buf, start, offset, request, eof, data);
519 mutex_unlock(&dev->struct_mutex);
520 return ret;
521}
522
523/**
461 * Called when "/proc/dri/.../clients" is read. 524 * Called when "/proc/dri/.../clients" is read.
462 * 525 *
463 * \param buf output buffer. 526 * \param buf output buffer.