static igt_pipe_crc_t * pipe_crc_new(enum pipe pipe, enum intel_pipe_crc_source source, int flags) { igt_pipe_crc_t *pipe_crc; char buf[128]; igt_install_exit_handler(pipe_crc_exit_handler); pipe_crc = calloc(1, sizeof(struct _igt_pipe_crc)); pipe_crc->ctl_fd = igt_debugfs_open("i915_display_crc_ctl", O_WRONLY); igt_assert(pipe_crc->ctl_fd != -1); sprintf(buf, "i915_pipe_%s_crc", kmstest_pipe_name(pipe)); pipe_crc->crc_fd = igt_debugfs_open(buf, flags); igt_assert(pipe_crc->crc_fd != -1); pipe_crc->line_len = PIPE_CRC_LINE_LEN; pipe_crc->buffer_len = PIPE_CRC_BUFFER_LEN; pipe_crc->pipe = pipe; pipe_crc->source = source; pipe_crc->flags = flags; return pipe_crc; }
static void igt_pipe_crc_reset(void) { int fd; fd = igt_debugfs_open("i915_display_crc_ctl", O_WRONLY); igt_pipe_crc_pipe_off(fd, PIPE_A); igt_pipe_crc_pipe_off(fd, PIPE_B); igt_pipe_crc_pipe_off(fd, PIPE_C); close(fd); }
static bool i915_wedged_set(void) { int fd, ret; igt_debug("Triggering GPU reset\n"); fd = igt_debugfs_open("i915_wedged", O_RDWR); igt_require(fd >= 0); ret = write(fd, "1\n", 2) == 2; close(fd); return ret; }
/** * igt_drop_caches_set: * @val: bitmask for DROP_* values * * This calls the debugfs interface the drm/i915 GEM driver exposes to drop or * evict certain classes of gem buffer objects. */ void igt_drop_caches_set(uint64_t val) { int fd; char data[19]; size_t nbytes; sprintf(data, "0x%" PRIx64, val); fd = igt_debugfs_open("i915_gem_drop_caches", O_WRONLY); igt_assert(fd >= 0); do { nbytes = write(fd, data, strlen(data) + 1); } while (nbytes == -1 && (errno == EINTR || errno == EAGAIN)); igt_assert(nbytes == strlen(data) + 1); close(fd); }