All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Skip if the KMS interface is not supported
@ 2018-09-13 19:09 Chris Wilson
  2018-09-13 19:22 ` Ville Syrjälä
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2018-09-13 19:09 UTC (permalink / raw)
  To: igt-dev

Some drivers and some hardware do not support KMS and so the addfb
ioctls are expected to fail. However, since they are expected to fail
with a specific errno (ENOTSUPP) in the case KMS is not supported on the
fd, we can check for that and skip the tests where they are not
appropriate.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 tests/kms_addfb_basic.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index ce48d24fa..400241a92 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -667,12 +667,37 @@ static void prop_tests(int fd)
 
 }
 
+static bool has_addfb2_iface(int fd)
+{
+	struct local_drm_mode_fb_cmd2 f = {};
+	int err;
+
+	err = 0;
+	if (drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f))
+		err = -errno;
+	switch (err) {
+	case -ENOTTY: /* ioctl unrecognised (kernel too old) */
+	case -ENOTSUP: /* driver doesn't support KMS */
+		return false;
+
+		/*
+		 * The only other valid response is -EINVAL, but we leave
+		 * that for the actual tests themselves to discover for
+		 * more accurate reporting.
+		 */
+	default:
+		return true;
+	}
+}
+
 int fd;
 
 igt_main
 {
-	igt_fixture
+	igt_fixture {
 		fd = drm_open_driver_master(DRIVER_ANY);
+		igt_require(has_addfb2_iface(fd));
+	}
 
 	invalid_tests(fd);
 
-- 
2.19.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Skip if the KMS interface is not supported
  2018-09-13 19:09 [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Skip if the KMS interface is not supported Chris Wilson
@ 2018-09-13 19:22 ` Ville Syrjälä
  2018-09-13 19:24   ` Chris Wilson
  2018-09-13 19:25   ` Ville Syrjälä
  0 siblings, 2 replies; 6+ messages in thread
From: Ville Syrjälä @ 2018-09-13 19:22 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

On Thu, Sep 13, 2018 at 08:09:42PM +0100, Chris Wilson wrote:
> Some drivers and some hardware do not support KMS and so the addfb
> ioctls are expected to fail. However, since they are expected to fail
> with a specific errno (ENOTSUPP) in the case KMS is not supported on the
> fd, we can check for that and skip the tests where they are not
> appropriate.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  tests/kms_addfb_basic.c | 27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> index ce48d24fa..400241a92 100644
> --- a/tests/kms_addfb_basic.c
> +++ b/tests/kms_addfb_basic.c
> @@ -667,12 +667,37 @@ static void prop_tests(int fd)
>  
>  }
>  
> +static bool has_addfb2_iface(int fd)
> +{
> +	struct local_drm_mode_fb_cmd2 f = {};
> +	int err;
> +
> +	err = 0;
> +	if (drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f))
> +		err = -errno;
> +	switch (err) {
> +	case -ENOTTY: /* ioctl unrecognised (kernel too old) */
> +	case -ENOTSUP: /* driver doesn't support KMS */

P once or P twice?

Oh, ENOTSUPP not in uapi headers AFAICS. Is this the same thing even?

> +		return false;
> +
> +		/*
> +		 * The only other valid response is -EINVAL, but we leave
> +		 * that for the actual tests themselves to discover for
> +		 * more accurate reporting.
> +		 */
> +	default:
> +		return true;
> +	}
> +}
> +
>  int fd;
>  
>  igt_main
>  {
> -	igt_fixture
> +	igt_fixture {
>  		fd = drm_open_driver_master(DRIVER_ANY);
> +		igt_require(has_addfb2_iface(fd));
> +	}
>  
>  	invalid_tests(fd);
>  
> -- 
> 2.19.0
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Skip if the KMS interface is not supported
  2018-09-13 19:22 ` Ville Syrjälä
@ 2018-09-13 19:24   ` Chris Wilson
  2018-09-13 19:25   ` Ville Syrjälä
  1 sibling, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2018-09-13 19:24 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: igt-dev

Quoting Ville Syrjälä (2018-09-13 20:22:26)
> On Thu, Sep 13, 2018 at 08:09:42PM +0100, Chris Wilson wrote:
> > Some drivers and some hardware do not support KMS and so the addfb
> > ioctls are expected to fail. However, since they are expected to fail
> > with a specific errno (ENOTSUPP) in the case KMS is not supported on the
> > fd, we can check for that and skip the tests where they are not
> > appropriate.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > ---
> >  tests/kms_addfb_basic.c | 27 ++++++++++++++++++++++++++-
> >  1 file changed, 26 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> > index ce48d24fa..400241a92 100644
> > --- a/tests/kms_addfb_basic.c
> > +++ b/tests/kms_addfb_basic.c
> > @@ -667,12 +667,37 @@ static void prop_tests(int fd)
> >  
> >  }
> >  
> > +static bool has_addfb2_iface(int fd)
> > +{
> > +     struct local_drm_mode_fb_cmd2 f = {};
> > +     int err;
> > +
> > +     err = 0;
> > +     if (drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f))
> > +             err = -errno;
> > +     switch (err) {
> > +     case -ENOTTY: /* ioctl unrecognised (kernel too old) */
> > +     case -ENOTSUP: /* driver doesn't support KMS */
> 
> P once or P twice?
> 
> Oh, ENOTSUPP not in uapi headers AFAICS. Is this the same thing even?

No. It wasn't. The danger in testing! I had to send v3 with the
correction as the kernel calls this EOPNOTSUPP, much to POSIX's chagrin.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Skip if the KMS interface is not supported
  2018-09-13 19:22 ` Ville Syrjälä
  2018-09-13 19:24   ` Chris Wilson
@ 2018-09-13 19:25   ` Ville Syrjälä
  2018-09-13 19:46     ` Ville Syrjälä
  1 sibling, 1 reply; 6+ messages in thread
From: Ville Syrjälä @ 2018-09-13 19:25 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

On Thu, Sep 13, 2018 at 10:22:26PM +0300, Ville Syrjälä wrote:
> On Thu, Sep 13, 2018 at 08:09:42PM +0100, Chris Wilson wrote:
> > Some drivers and some hardware do not support KMS and so the addfb
> > ioctls are expected to fail. However, since they are expected to fail
> > with a specific errno (ENOTSUPP) in the case KMS is not supported on the
> > fd, we can check for that and skip the tests where they are not
> > appropriate.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > ---
> >  tests/kms_addfb_basic.c | 27 ++++++++++++++++++++++++++-
> >  1 file changed, 26 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> > index ce48d24fa..400241a92 100644
> > --- a/tests/kms_addfb_basic.c
> > +++ b/tests/kms_addfb_basic.c
> > @@ -667,12 +667,37 @@ static void prop_tests(int fd)
> >  
> >  }
> >  
> > +static bool has_addfb2_iface(int fd)
> > +{
> > +	struct local_drm_mode_fb_cmd2 f = {};
> > +	int err;
> > +
> > +	err = 0;
> > +	if (drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f))
> > +		err = -errno;
> > +	switch (err) {
> > +	case -ENOTTY: /* ioctl unrecognised (kernel too old) */
> > +	case -ENOTSUP: /* driver doesn't support KMS */
> 
> P once or P twice?
> 
> Oh, ENOTSUPP not in uapi headers AFAICS. Is this the same thing even?

Ah, explained in the kernel patch. Commit msg here could
use a fix then I think.

> 
> > +		return false;
> > +
> > +		/*
> > +		 * The only other valid response is -EINVAL, but we leave
> > +		 * that for the actual tests themselves to discover for
> > +		 * more accurate reporting.
> > +		 */
> > +	default:
> > +		return true;
> > +	}
> > +}
> > +
> >  int fd;
> >  
> >  igt_main
> >  {
> > -	igt_fixture
> > +	igt_fixture {
> >  		fd = drm_open_driver_master(DRIVER_ANY);
> > +		igt_require(has_addfb2_iface(fd));
> > +	}
> >  
> >  	invalid_tests(fd);
> >  
> > -- 
> > 2.19.0
> > 
> > _______________________________________________
> > igt-dev mailing list
> > igt-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
> 
> -- 
> Ville Syrjälä
> Intel

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Skip if the KMS interface is not supported
  2018-09-13 19:25   ` Ville Syrjälä
@ 2018-09-13 19:46     ` Ville Syrjälä
  2018-09-13 19:59       ` Chris Wilson
  0 siblings, 1 reply; 6+ messages in thread
From: Ville Syrjälä @ 2018-09-13 19:46 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

On Thu, Sep 13, 2018 at 10:25:59PM +0300, Ville Syrjälä wrote:
> On Thu, Sep 13, 2018 at 10:22:26PM +0300, Ville Syrjälä wrote:
> > On Thu, Sep 13, 2018 at 08:09:42PM +0100, Chris Wilson wrote:
> > > Some drivers and some hardware do not support KMS and so the addfb
> > > ioctls are expected to fail. However, since they are expected to fail
> > > with a specific errno (ENOTSUPP) in the case KMS is not supported on the
> > > fd, we can check for that and skip the tests where they are not
> > > appropriate.
> > > 
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > ---
> > >  tests/kms_addfb_basic.c | 27 ++++++++++++++++++++++++++-
> > >  1 file changed, 26 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> > > index ce48d24fa..400241a92 100644
> > > --- a/tests/kms_addfb_basic.c
> > > +++ b/tests/kms_addfb_basic.c
> > > @@ -667,12 +667,37 @@ static void prop_tests(int fd)
> > >  
> > >  }
> > >  
> > > +static bool has_addfb2_iface(int fd)
> > > +{
> > > +	struct local_drm_mode_fb_cmd2 f = {};
> > > +	int err;
> > > +
> > > +	err = 0;
> > > +	if (drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f))
> > > +		err = -errno;
> > > +	switch (err) {
> > > +	case -ENOTTY: /* ioctl unrecognised (kernel too old) */
> > > +	case -ENOTSUP: /* driver doesn't support KMS */
> > 
> > P once or P twice?
> > 
> > Oh, ENOTSUPP not in uapi headers AFAICS. Is this the same thing even?
> 
> Ah, explained in the kernel patch. Commit msg here could
> use a fix then I think.

and with that this seems reasonable enough to me so
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> 
> > 
> > > +		return false;
> > > +
> > > +		/*
> > > +		 * The only other valid response is -EINVAL, but we leave
> > > +		 * that for the actual tests themselves to discover for
> > > +		 * more accurate reporting.
> > > +		 */
> > > +	default:
> > > +		return true;
> > > +	}
> > > +}
> > > +
> > >  int fd;
> > >  
> > >  igt_main
> > >  {
> > > -	igt_fixture
> > > +	igt_fixture {
> > >  		fd = drm_open_driver_master(DRIVER_ANY);
> > > +		igt_require(has_addfb2_iface(fd));
> > > +	}
> > >  
> > >  	invalid_tests(fd);
> > >  
> > > -- 
> > > 2.19.0
> > > 
> > > _______________________________________________
> > > igt-dev mailing list
> > > igt-dev@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/igt-dev
> > 
> > -- 
> > Ville Syrjälä
> > Intel
> 
> -- 
> Ville Syrjälä
> Intel

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Skip if the KMS interface is not supported
  2018-09-13 19:46     ` Ville Syrjälä
@ 2018-09-13 19:59       ` Chris Wilson
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2018-09-13 19:59 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: igt-dev

Quoting Ville Syrjälä (2018-09-13 20:46:09)
> On Thu, Sep 13, 2018 at 10:25:59PM +0300, Ville Syrjälä wrote:
> > On Thu, Sep 13, 2018 at 10:22:26PM +0300, Ville Syrjälä wrote:
> > > On Thu, Sep 13, 2018 at 08:09:42PM +0100, Chris Wilson wrote:
> > > > Some drivers and some hardware do not support KMS and so the addfb
> > > > ioctls are expected to fail. However, since they are expected to fail
> > > > with a specific errno (ENOTSUPP) in the case KMS is not supported on the
> > > > fd, we can check for that and skip the tests where they are not
> > > > appropriate.
> > > > 
> > > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > > ---
> > > >  tests/kms_addfb_basic.c | 27 ++++++++++++++++++++++++++-
> > > >  1 file changed, 26 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> > > > index ce48d24fa..400241a92 100644
> > > > --- a/tests/kms_addfb_basic.c
> > > > +++ b/tests/kms_addfb_basic.c
> > > > @@ -667,12 +667,37 @@ static void prop_tests(int fd)
> > > >  
> > > >  }
> > > >  
> > > > +static bool has_addfb2_iface(int fd)
> > > > +{
> > > > + struct local_drm_mode_fb_cmd2 f = {};
> > > > + int err;
> > > > +
> > > > + err = 0;
> > > > + if (drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f))
> > > > +         err = -errno;
> > > > + switch (err) {
> > > > + case -ENOTTY: /* ioctl unrecognised (kernel too old) */
> > > > + case -ENOTSUP: /* driver doesn't support KMS */
> > > 
> > > P once or P twice?
> > > 
> > > Oh, ENOTSUPP not in uapi headers AFAICS. Is this the same thing even?
> > 
> > Ah, explained in the kernel patch. Commit msg here could
> > use a fix then I think.
> 
> and with that this seems reasonable enough to me so
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Ta, I'll just wait a bit to see if anyone raises an objection to using
-EOPNOTSUPP in the kernel patch and then apply both. I've corrected the
changelog here.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-09-13 19:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-13 19:09 [igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Skip if the KMS interface is not supported Chris Wilson
2018-09-13 19:22 ` Ville Syrjälä
2018-09-13 19:24   ` Chris Wilson
2018-09-13 19:25   ` Ville Syrjälä
2018-09-13 19:46     ` Ville Syrjälä
2018-09-13 19:59       ` Chris Wilson

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.