summaryrefslogtreecommitdiff
path: root/lib/igt_debugfs.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-11-02 13:56:33 +0100
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-11-02 13:56:33 +0100
commit76be0834849846f7d801b75fe30166047c09d9b2 (patch)
treecf1d7ae27859cd5d29f1e47efd6a8ecbc5e26e94 /lib/igt_debugfs.c
parent7aac0e88606ce453b111ce80419dc58519db05ad (diff)
lib/igt_debugfs: Use fstat instead of open for testing CRC support.
commit 8038e09be5a3ac06 ("drm/crc: Only open CRC on atomic drivers when the CRTC is active.") rejects opens on the CRC when the CRTC is not configured. Use fstat instead to check this file exists, so we don't accidentally rely on the legacy CRC path. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> #irc
Diffstat (limited to 'lib/igt_debugfs.c')
-rw-r--r--lib/igt_debugfs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 8b33b478..a7f01d0e 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -584,9 +584,15 @@ void igt_require_pipe_crc(int fd)
{
const char *cmd = "pipe A none";
int ctl, written;
+ int dir, ret;
+ struct stat stat;
+
+ dir = igt_debugfs_dir(fd);
+ igt_require_f(dir >= 0, "Could not open debugfs directory\n");
+ ret = fstatat(dir, "crtc-0/crc/control", &stat, 0);
+ close(dir);
- ctl = igt_debugfs_open(fd, "crtc-0/crc/control", O_RDONLY);
- if (ctl < 0) {
+ if (ret < 0) {
ctl = igt_debugfs_open(fd, "i915_display_crc_ctl", O_WRONLY);
igt_require_f(ctl,
"No display_crc_ctl found, kernel too old\n");
@@ -594,8 +600,8 @@ void igt_require_pipe_crc(int fd)
written = write(ctl, cmd, strlen(cmd));
igt_require_f(written < 0,
"CRCs not supported on this platform\n");
+ close(ctl);
}
- close(ctl);
}
static void igt_hpd_storm_exit_handler(int sig)