[Intel-gfx] [PATCH i-g-t 05/16] i915/gem_ctx_create: Basic checks for constructor properties

Chris Wilson chris at chris-wilson.co.uk
Wed May 15 19:09:25 UTC 2019


Quoting Chris Wilson (2019-05-15 20:06:45)
> Quoting Tvrtko Ursulin (2019-05-14 13:27:38)
> > 
> > On 08/05/2019 11:09, Chris Wilson wrote:
> > > Check that the extended create interface accepts setparam.
> > > 
> > > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > > ---
> > >   tests/i915/gem_ctx_create.c | 225 ++++++++++++++++++++++++++++++++++--
> > >   1 file changed, 213 insertions(+), 12 deletions(-)
> > > 
> > > diff --git a/tests/i915/gem_ctx_create.c b/tests/i915/gem_ctx_create.c
> > > index a664070db..9b4fddbe7 100644
> > > --- a/tests/i915/gem_ctx_create.c
> > > +++ b/tests/i915/gem_ctx_create.c
> > > @@ -33,6 +33,7 @@
> > >   #include <time.h>
> > >   
> > >   #include "igt_rand.h"
> > > +#include "sw_sync.h"
> > >   
> > >   #define LOCAL_I915_EXEC_BSD_SHIFT      (13)
> > >   #define LOCAL_I915_EXEC_BSD_MASK       (3 << LOCAL_I915_EXEC_BSD_SHIFT)
> > > @@ -45,12 +46,33 @@ static unsigned all_nengine;
> > >   static unsigned ppgtt_engines[16];
> > >   static unsigned ppgtt_nengine;
> > >   
> > > -static int __gem_context_create_local(int fd, struct drm_i915_gem_context_create *arg)
> > > +static int create_ioctl(int fd, struct drm_i915_gem_context_create *arg)
> > >   {
> > > -     int ret = 0;
> > > -     if (drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, arg))
> > > -             ret = -errno;
> > > -     return ret;
> > > +     int err;
> > > +
> > > +     err = 0;
> > > +     if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, arg)) {
> > > +             err = -errno;
> > > +             igt_assert(err);
> > > +     }
> > > +
> > > +     errno = 0;
> > > +     return err;
> > > +}
> > > +
> > > +static int create_ext_ioctl(int i915,
> > > +                         struct drm_i915_gem_context_create_ext *arg)
> > > +{
> > > +     int err;
> > > +
> > > +     err = 0;
> > > +     if (igt_ioctl(i915, DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT, arg)) {
> > > +             err = -errno;
> > > +             igt_assume(err);
> > > +     }
> > > +
> > > +     errno = 0;
> > > +     return err;
> > >   }
> > >   
> > >   static double elapsed(const struct timespec *start,
> > > @@ -308,6 +330,187 @@ static void maximum(int fd, int ncpus, unsigned mode)
> > >       free(contexts);
> > >   }
> > >   
> > > +static void basic_ext_param(int i915)
> > > +{
> > > +     struct drm_i915_gem_context_create_ext_setparam ext = {
> > > +             { .name = I915_CONTEXT_CREATE_EXT_SETPARAM },
> > > +     };
> > > +     struct drm_i915_gem_context_create_ext create = {
> > > +             .flags = I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS
> > > +     };
> > > +     struct drm_i915_gem_context_param get;
> > > +
> > > +     igt_require(create_ext_ioctl(i915, &create) == 0);
> > > +     gem_context_destroy(i915, create.ctx_id);
> > > +
> > > +     create.extensions = -1ull;
> > > +     igt_assert_eq(create_ext_ioctl(i915, &create), -EFAULT);
> > > +
> > > +     create.extensions = to_user_pointer(&ext);
> > > +     igt_assert_eq(create_ext_ioctl(i915, &create), -EINVAL);
> > 
> > I think this is the unknown param, right?
> > 
> > Need another -EINVAL test for non-zero ext.ctx_id.
> 
> No, this is non-zero ctx_id.

No, I read the wrong ctx_id.
-Chris


More information about the Intel-gfx mailing list