@@ -629,8 +629,7 @@ found:
config->encoder = encoder;
config->crtc = drmModeGetCrtc(drm_fd, resources->crtcs[i]);
config->crtc_idx = i;
- config->pipe = kmstest_get_pipe_from_crtc_id(drm_fd,
- config->crtc->crtc_id);
+ config->pipe = i;
drmModeFreeResources(resources);
@@ -1801,13 +1800,10 @@ 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;
drmModeConnector *c;
- int drm_fd;
-
- drm_fd = drm_open_driver(DRIVER_INTEL);
res = drmModeGetResources(drm_fd);
@@ -1830,7 +1826,6 @@ void igt_enable_connectors(void)
drmModeFreeConnector(c);
}
- close(drm_fd);
}
/**
@@ -270,7 +270,7 @@ void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
#define IGT_FIXED(i,f) ((i) << 16 | (f))
-void igt_enable_connectors(void);
+void igt_enable_connectors(int drm_fd);
void igt_reset_connectors(void);
#define EDID_LENGTH 128
@@ -1702,7 +1702,7 @@ int main(int argc, char **argv)
igt_fixture {
drm_fd = drm_open_driver_master(DRIVER_INTEL);
- igt_enable_connectors();
+ igt_enable_connectors(drm_fd);
kmstest_set_vt_graphics_mode();
igt_install_exit_handler(kms_flip_exit_handler);
@@ -228,7 +228,7 @@ igt_main
igt_fixture {
data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
- igt_enable_connectors();
+ igt_enable_connectors(data.drm_fd);
kmstest_set_vt_graphics_mode();
There is some miscellaneous plumbing to do if we are going to have a test that runs on all platforms. intel and exynos are the current targets. The test we are aiming to support is drm_read. There is much intel-specific code throughout the support library, so anyone attempting to make other tests platform agnostic will run into more of this type of thing. kmstest_get_connector_config() issues an intel-specific ioctl via kmstest_get_pipe_from_crtc_id() and asserts on the return. This patch removes the call to kmstest_get_pipe_from_crtc_id altogether and instead assigns the crct id according to its array index in the drmModeRes struct. This seems to be the default behavior for the drm anyway. igt_enable_connectors() reopens the drm dev node to perform its work, but it can't know which chipset to specify to the new drm_open_driver*() API. This patch modifies igt_enable_connectors() to take an already open drm fd to work on, so that the chipset is implied. igt_enable_connectors() performs generic drm work only, so it should not need to do anything chipset-specific. There could be an argument here for isolating this work on a separate fd, but I can't see how it would make a difference to the drm. Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk> --- lib/igt_kms.c | 9 ++------- lib/igt_kms.h | 2 +- tests/kms_flip.c | 2 +- tests/kms_pipe_crc_basic.c | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-)