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@xxxxxxxxxxxxxxx> --- 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(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 7e956b4..78c98d2 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -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); } /** diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 565df14..b5f007d 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -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 diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 4d8d0c0..a88e707 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -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); diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c index fc4ad46..10ef097 100644 --- a/tests/kms_pipe_crc_basic.c +++ b/tests/kms_pipe_crc_basic.c @@ -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(); -- 2.5.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx