diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-12-06 10:47:10 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-12-06 14:51:14 +0100 |
commit | c1b7e722dafdbddcce2bec230e3faf8b4fe6f123 (patch) | |
tree | d65cea31d0f095f7cf2d162359a6924438d0a5f1 /lib | |
parent | 3e37eb3c6cae56bbd11016102c20a63ce58966da (diff) |
lib: add igt_pipe_crc_check
No need to duplicate this all over the place.
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_debugfs.c | 18 | ||||
-rw-r--r-- | lib/igt_debugfs.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index 1ceaf59d..139be893 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -205,6 +205,24 @@ static void pipe_crc_exit_handler(int sig) igt_pipe_crc_reset(); } +void igt_pipe_crc_check(igt_debugfs_t *debugfs) +{ + const char *cmd = "pipe A none"; + FILE *ctl; + size_t written; + int ret; + + ctl = igt_debugfs_fopen(debugfs, "i915_display_crc_ctl", "r+"); + igt_require_f(ctl, + "No display_crc_ctl found, kernel too old\n"); + written = fwrite(cmd, 1, strlen(cmd), ctl); + ret = fflush(ctl); + igt_require_f((written == strlen(cmd) && ret == 0) || errno != ENODEV, + "CRCs not supported on this platform\n"); + + fclose(ctl); +} + igt_pipe_crc_t * igt_pipe_crc_new(igt_debugfs_t *debugfs, int drm_fd, enum pipe pipe, enum intel_pipe_crc_source source) diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h index 40d9d28f..393b5767 100644 --- a/lib/igt_debugfs.h +++ b/lib/igt_debugfs.h @@ -70,6 +70,7 @@ bool igt_crc_is_null(igt_crc_t *crc); bool igt_crc_equal(igt_crc_t *a, igt_crc_t *b); char *igt_crc_to_string(igt_crc_t *crc); +void igt_pipe_crc_check(igt_debugfs_t *debugfs); igt_pipe_crc_t * igt_pipe_crc_new(igt_debugfs_t *debugfs, int drm_fd, enum pipe pipe, enum intel_pipe_crc_source source); |