tests: use igt_debugfs where possible

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
Thomas Wood
2014-11-03 13:48:51 +00:00
parent 4f689d52e7
commit c049c39f35
6 changed files with 17 additions and 56 deletions
+2 -7
View File
@@ -52,16 +52,11 @@ int fd;
static int get_object_count(void)
{
FILE *file;
int ret, scanned;
int device = drm_get_card();
char *path;
int scanned, ret;
igt_drop_caches_set(DROP_RETIRE);
ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_gem_objects", device);
igt_assert(ret != -1);
file = fopen(path, "r");
file = igt_debugfs_fopen("i915_gem_objects", "r");
scanned = fscanf(file, "%i objects", &ret);
igt_assert(scanned == 1);
+1 -10
View File
@@ -679,20 +679,11 @@ static void stop_rings(bool stop)
static void eat_error_state(void)
{
static const char dfs_base[] = "/sys/kernel/debug/dri";
static const char dfs_entry_error[] = "i915_error_state";
static const char data[] = "";
char fname[FILENAME_MAX];
int card_index = drm_get_card();
int fd;
igt_assert(card_index != -1);
/* clear the error state */
snprintf(fname, FILENAME_MAX, "%s/%i/%s",
dfs_base, card_index, dfs_entry_error);
fd = open(fname, O_WRONLY);
fd = igt_debugfs_open(dfs_entry_error, O_WRONLY);
igt_assert(fd >= 0);
igt_assert(write(fd, data, sizeof(data)) == sizeof(data));
+3 -1
View File
@@ -50,7 +50,9 @@ typedef struct {
static void get_crc(char *crc) {
int ret;
FILE *file = fopen("/sys/kernel/debug/dri/0/i915_sink_crc_eDP1", "r");
FILE *file;
file = igt_debugfs_fopen("i915_sink_crc_eDP1", "r");
igt_require(file);
ret = fscanf(file, "%s\n", crc);
+1 -2
View File
@@ -663,8 +663,7 @@ static void setup_pc8(void)
if (!supports_pc8_plus_residencies())
return;
pc8_status_fd = open("/sys/kernel/debug/dri/0/i915_pc8_status",
O_RDONLY);
pc8_status_fd = igt_debugfs_open("i915_pc8_status", O_RDONLY);
igt_assert_f(pc8_status_fd >= 0,
"Can't open /sys/kernel/debug/dri/0/i915_pc8_status");
+1 -6
View File
@@ -216,15 +216,10 @@ static int get_object_count(void)
{
FILE *file;
int ret, scanned;
int device = drm_get_card();
char *path;
igt_drop_caches_set(DROP_RETIRE);
ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_gem_objects", device);
igt_assert(ret != -1);
file = fopen(path, "r");
file = igt_debugfs_fopen("i915_gem_objects", "r");
scanned = fscanf(file, "%i objects", &ret);
igt_assert(scanned == 1);