Pass the fd along to igt_enable_connectors() so that it actually dtrt when there are multiple drm devices in the system. Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- lib/igt_kms.c | 13 ++++--------- lib/igt_kms.h | 2 +- tests/kms_flip.c | 2 +- tests/kms_invalid_dotclock.c | 2 +- tests/kms_pipe_crc_basic.c | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 9bf53359..d78dee58 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -3165,21 +3165,18 @@ void igt_wait_for_vblank(int drm_fd, enum pipe pipe) * An exit handler is installed to ensure connectors are reset when the test * exits. */ -void igt_enable_connectors(void) +void igt_enable_connectors(int fd) { drmModeRes *res; - int drm_fd; - drm_fd = drm_open_driver(DRIVER_ANY); - - res = drmModeGetResources(drm_fd); + res = drmModeGetResources(fd); igt_assert(res != NULL); for (int i = 0; i < res->count_connectors; i++) { drmModeConnector *c; /* Do a probe. This may be the first action after booting */ - c = drmModeGetConnector(drm_fd, res->connectors[i]); + c = drmModeGetConnector(fd, res->connectors[i]); if (!c) { igt_warn("Could not read connector %u: %m\n", res->connectors[i]); continue; @@ -3192,7 +3189,7 @@ void igt_enable_connectors(void) /* just enable VGA for now */ if (c->connector_type == DRM_MODE_CONNECTOR_VGA) { - if (!kmstest_force_connector(drm_fd, c, FORCE_CONNECTOR_ON)) + if (!kmstest_force_connector(fd, c, FORCE_CONNECTOR_ON)) igt_info("Unable to force state on %s-%d\n", kmstest_connector_type_str(c->connector_type), c->connector_type_id); @@ -3200,8 +3197,6 @@ void igt_enable_connectors(void) drmModeFreeConnector(c); } - - close(drm_fd); } /** diff --git a/lib/igt_kms.h b/lib/igt_kms.h index e5dc329b..ea1846ba 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -555,7 +555,7 @@ static inline bool igt_output_is_connected(igt_output_t *output) igt_assert_lt(0, drmModeAtomicAddProperty(req, output->config.connector->connector_id,\ output->config.atomic_props_connector[prop], value)) -void igt_enable_connectors(void); +void igt_enable_connectors(int fd); void igt_reset_connectors(void); uint32_t kmstest_get_vbl_flag(uint32_t pipe_id); diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 4ea68d4b..89962581 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -1641,7 +1641,7 @@ int main(int argc, char **argv) igt_fixture { drm_fd = drm_open_driver_master(DRIVER_ANY); - igt_enable_connectors(); + igt_enable_connectors(drm_fd); kmstest_set_vt_graphics_mode(); igt_install_exit_handler(kms_flip_exit_handler); diff --git a/tests/kms_invalid_dotclock.c b/tests/kms_invalid_dotclock.c index e6e72f52..b0942e59 100644 --- a/tests/kms_invalid_dotclock.c +++ b/tests/kms_invalid_dotclock.c @@ -131,7 +131,7 @@ igt_simple_main data.drm_fd = drm_open_driver_master(DRIVER_INTEL); igt_require_intel(data.drm_fd); - igt_enable_connectors(); + igt_enable_connectors(data.drm_fd); kmstest_set_vt_graphics_mode(); igt_display_init(&data.display, data.drm_fd); data.res = drmModeGetResources(data.drm_fd); diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c index 35adddba..bf51b4cb 100644 --- a/tests/kms_pipe_crc_basic.c +++ b/tests/kms_pipe_crc_basic.c @@ -185,7 +185,7 @@ igt_main igt_fixture { data.drm_fd = drm_open_driver_master(DRIVER_ANY); - igt_enable_connectors(); + igt_enable_connectors(data.drm_fd); kmstest_set_vt_graphics_mode(); -- 2.13.3 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx