Op 02-10-18 om 17:29 schreef Chris Wilson: > Take the device fd from the caller as to which card we should try and > enable connectors for (or else we may not enable the right connectors > for the test!) and fail gracefully if there is no kms support on the > device. > > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > --- > lib/igt_kms.c | 10 +++------- > 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, 7 insertions(+), 11 deletions(-) > > diff --git a/lib/igt_kms.c b/lib/igt_kms.c > index 3894eeaff..b2cbaa114 100644 > --- a/lib/igt_kms.c > +++ b/lib/igt_kms.c > @@ -3905,15 +3905,13 @@ 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 drm_fd) > { > drmModeRes *res; > - int drm_fd; > - > - drm_fd = drm_open_driver(DRIVER_ANY); > > res = drmModeGetResources(drm_fd); > - igt_assert(res != NULL); > + if (!res) > + return; > > for (int i = 0; i < res->count_connectors; i++) { > drmModeConnector *c; > @@ -3940,8 +3938,6 @@ void igt_enable_connectors(void) > > drmModeFreeConnector(c); > } > - > - close(drm_fd); > } > > /** > diff --git a/lib/igt_kms.h b/lib/igt_kms.h > index 2d862665e..38fa944ef 100644 > --- a/lib/igt_kms.h > +++ b/lib/igt_kms.h > @@ -734,7 +734,7 @@ extern void igt_pipe_obj_replace_prop_blob(igt_pipe_t *pipe, > > void igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force); > > -void igt_enable_connectors(void); > +void igt_enable_connectors(int drm_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 f7d08a60a..44a820538 100644 > --- a/tests/kms_flip.c > +++ b/tests/kms_flip.c > @@ -1575,7 +1575,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 e7a80d884..568889a98 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_require(&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 9c9078e9b..5bc0952fc 100644 > --- a/tests/kms_pipe_crc_basic.c > +++ b/tests/kms_pipe_crc_basic.c > @@ -181,7 +181,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(); > Reviewed-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx> _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx