Commit c5c0dd2e authored by Chris Wilson's avatar Chris Wilson 😣

lib/kms: Handle no connectors for igt_enable_connectors()

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's avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
parent ebf6a1dd
......@@ -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);
}
/**
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment