Re: [PATCH i-g-t] Lib: Move __gem_context_create to common ioctl wrapper library.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Antonio Argenziano (2017-10-12 00:07:34)
> +int __gem_context_create(int fd, uint32_t *ctx_id)
> +{
> +       struct drm_i915_gem_context_create create;
> +       int err = 0;
> +
> +       memset(&create, 0, sizeof(create));
> +       if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &create) == 0)
> +               *ctx_id = create.ctx_id;
> +       else
> +               err = -errno;
> +
> +       errno = 0;
> +       return err;
> +}
> +
>  /**
>   * gem_context_create:
>   * @fd: open i915 drm file descriptor
> @@ -906,18 +921,16 @@ int gem_madvise(int fd, uint32_t handle, int state)
>   */
>  uint32_t gem_context_create(int fd)
>  {
> -       struct drm_i915_gem_context_create create;
> +       uint32_t ctx_id;
> +       int ret;
>  
> -       memset(&create, 0, sizeof(create));
> -       if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &create)) {
> -               int err = -errno;
> -               igt_skip_on(err == -ENODEV || errno == -EINVAL);
> -               igt_assert_eq(err, 0);
> -       }
> -       igt_assert(create.ctx_id != 0);
> -       errno = 0;
> +       ret = __gem_context_create(fd, &ctx_id);
> +
> +       igt_skip_on(ret == -ENODEV || errno == -EINVAL);

So close and yet so far.

> +       igt_assert_eq(ret, 0);
> +       igt_assert(ctx_id != 0);
>  
> -       return create.ctx_id;
> +       return ctx_id;
>  }

Whilst you are here, can you remove that igt_skip_on() entirely and add
gem_require_contexts() so that we don't have the spam hiding important
details in tests.

Please also think twice before adding it outside of tests/ as the igt_()
infrastructure is snafu there.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux