From: Micah Fedke <micah.fedke@collabora.co.uk>
To: intel-gfx <intel-gfx@lists.freedesktop.org>,
Daniel Vetter <daniel@ffwll.ch>,
chris@chris-wilson.co.uk, Daniel Stone <daniel@fooishbar.org>
Subject: [PATCH v2 4/5] lib/tests: make kmstest_get_pipe_from_crtc_id and igt_enable_connectors generic to prepare for platform agnostic tests
Date: Tue, 11 Aug 2015 11:57:43 -0400 [thread overview]
Message-ID: <55CA1B77.3080401@collabora.co.uk> (raw)
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(-)
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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
reply other threads:[~2015-08-11 15:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55CA1B77.3080401@collabora.co.uk \
--to=micah.fedke@collabora.co.uk \
--cc=chris@chris-wilson.co.uk \
--cc=daniel@ffwll.ch \
--cc=daniel@fooishbar.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox