All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
To: Petri Latvala <petri.latvala@intel.com>,
	Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t] Make force work with multiple drivers available
Date: Fri, 11 Jan 2019 11:13:37 -0200	[thread overview]
Message-ID: <20190111131337.vrsiq5hk32eramdm@smtp.gmail.com> (raw)

The force option allows users to specify which driver they want that IGT
uses. Nonetheless, if the user has two or more loaded drivers in his
system, the force option will not work as expected because IGT will take
the first driver found at /dev/dri. This problem can be reproduced in a
QEMU VM that using Bochs and VKMS. This patch handles this scenario by
ensuring that IGT uses the forced module specified via IGT_FORCE_DRIVER.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/drmtest.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 35914c50..7c124ac6 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -250,10 +250,8 @@ static int open_device(const char *name, unsigned int chipset)
 		goto err;
 
 	forced = forced_driver();
-	if (forced && chipset == DRIVER_ANY && !strcmp(forced, dev_name)) {
-		igt_debug("Force option used: Using driver %s\n", dev_name);
-		return fd;
-	}
+	if (forced && chipset == DRIVER_ANY && strcmp(forced, dev_name))
+		goto err;
 
 	for (int start = 0, end = ARRAY_SIZE(modules) - 1; start < end; ){
 		int mid = start + (end - start) / 2;
@@ -277,6 +275,12 @@ err:
 
 static int __search_and_open(const char *base, int offset, unsigned int chipset)
 {
+	const char *forced;
+
+	forced = forced_driver();
+	if (forced)
+		igt_info("Force option used: Using driver %s\n", forced);
+
 	for (int i = 0; i < 16; i++) {
 		char name[80];
 		int fd;
-- 
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
To: Petri Latvala <petri.latvala@intel.com>,
	Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] Make force work with multiple drivers available
Date: Fri, 11 Jan 2019 11:13:37 -0200	[thread overview]
Message-ID: <20190111131337.vrsiq5hk32eramdm@smtp.gmail.com> (raw)

The force option allows users to specify which driver they want that IGT
uses. Nonetheless, if the user has two or more loaded drivers in his
system, the force option will not work as expected because IGT will take
the first driver found at /dev/dri. This problem can be reproduced in a
QEMU VM that using Bochs and VKMS. This patch handles this scenario by
ensuring that IGT uses the forced module specified via IGT_FORCE_DRIVER.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/drmtest.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 35914c50..7c124ac6 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -250,10 +250,8 @@ static int open_device(const char *name, unsigned int chipset)
 		goto err;
 
 	forced = forced_driver();
-	if (forced && chipset == DRIVER_ANY && !strcmp(forced, dev_name)) {
-		igt_debug("Force option used: Using driver %s\n", dev_name);
-		return fd;
-	}
+	if (forced && chipset == DRIVER_ANY && strcmp(forced, dev_name))
+		goto err;
 
 	for (int start = 0, end = ARRAY_SIZE(modules) - 1; start < end; ){
 		int mid = start + (end - start) / 2;
@@ -277,6 +275,12 @@ err:
 
 static int __search_and_open(const char *base, int offset, unsigned int chipset)
 {
+	const char *forced;
+
+	forced = forced_driver();
+	if (forced)
+		igt_info("Force option used: Using driver %s\n", forced);
+
 	for (int i = 0; i < 16; i++) {
 		char name[80];
 		int fd;
-- 
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2019-01-11 13:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11 13:13 Rodrigo Siqueira [this message]
2019-01-11 13:13 ` [igt-dev] [PATCH i-g-t] Make force work with multiple drivers available Rodrigo Siqueira
2019-01-11 14:17 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-01-11 18:31 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-01-14 10:52 ` [PATCH i-g-t] " Petri Latvala
2019-01-14 10:52   ` [igt-dev] " Petri Latvala
2019-01-14 11:47   ` Rodrigo Siqueira
2019-01-14 11:47     ` [igt-dev] " Rodrigo Siqueira

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=20190111131337.vrsiq5hk32eramdm@smtp.gmail.com \
    --to=rodrigosiqueiramelo@gmail.com \
    --cc=arkadiusz.hiler@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.