Re: [Intel-gfx] [PATCH i-g-t] Make force work with multiple drivers available

2019-01-14 Thread Rodrigo Siqueira
On 01/14, Petri Latvala wrote:
> On Fri, Jan 11, 2019 at 11:13:37AM -0200, Rodrigo Siqueira wrote:
> > 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 
> > ---
> >  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;
> 
> 
> Yep, an obvious logic error by me.
> 
> Reviewed-by: Petri Latvala 
> 
> and merging this momentarily.

Thanks for the review and merging :)
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH i-g-t] Make force work with multiple drivers available

2019-01-14 Thread Petri Latvala
On Fri, Jan 11, 2019 at 11:13:37AM -0200, Rodrigo Siqueira wrote:
> 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 
> ---
>  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;


Yep, an obvious logic error by me.

Reviewed-by: Petri Latvala 

and merging this momentarily.
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t] Make force work with multiple drivers available

2019-01-11 Thread Rodrigo Siqueira
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 
---
 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