There are two paths to force enable a connector, via debugfs and via sysfs. sysfs has the advantage of being a stable interface and of updating the connector after application (allowing us to not force a reprobe from userspace). Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> --- lib/igt_kms.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 4da645a..5678248 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -48,6 +48,7 @@ #include "igt_aux.h" #include "intel_chipset.h" #include "igt_debugfs.h" +#include "igt_sysfs.h" /* list of connectors that need resetting on exit */ #define MAX_CONNECTORS 32 @@ -596,9 +597,9 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector, { char *path, **tmp; const char *value; - int debugfs_fd, ret, len; drmModeConnector *temp; uint32_t devid; + int len; devid = intel_get_drm_devid(drm_fd); @@ -615,7 +616,7 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector, value = "on"; break; case FORCE_CONNECTOR_DIGITAL: - value = "digital"; + value = "on-digital"; break; case FORCE_CONNECTOR_OFF: value = "off"; @@ -623,20 +624,14 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector, default: case FORCE_CONNECTOR_UNSPECIFIED: - value = "unspecified"; + value = "detect"; break; } - igt_assert_neq(asprintf(&path, "%s-%d/force", kmstest_connector_type_str(connector->connector_type), connector->connector_type_id), + igt_assert_neq(asprintf(&path, "%s-%d/status", kmstest_connector_type_str(connector->connector_type), connector->connector_type_id), -1); - debugfs_fd = igt_debugfs_open(path, O_WRONLY | O_TRUNC); - - if (debugfs_fd == -1) { + if (!igt_sysfs_set(path, value)) return false; - } - - ret = write(debugfs_fd, value, strlen(value)); - close(debugfs_fd); for (len = 0, tmp = forced_connectors; *tmp; tmp++) { /* check the connector is not already present */ @@ -669,8 +664,7 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector, temp = drmModeGetConnector(drm_fd, connector->connector_id); drmModeFreeConnector(temp); - igt_assert(ret != -1); - return (ret == -1) ? false : true; + return true; } /** @@ -2548,9 +2542,6 @@ void igt_reset_connectors(void) /* reset the connectors stored in forced_connectors, avoiding any * functions that are not safe to call in signal handlers */ - for (tmp = forced_connectors; *tmp; tmp++) { - int fd = igt_debugfs_open(*tmp, O_WRONLY | O_TRUNC); - igt_assert(write(fd, "unspecified", 11) == 11); - close(fd); - } + for (tmp = forced_connectors; *tmp; tmp++) + igt_sysfs_set(*tmp, "detect"); } -- 2.8.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx