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>
This commit is contained in:
Daniel Vetter
2013-12-06 10:47:10 +01:00
parent 3e37eb3c6c
commit c1b7e722da
5 changed files with 30 additions and 46 deletions
+18
View File
@@ -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)
+1
View File
@@ -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);