Re: [PATCH i-g-t] syncobj: Add some wait and reset tests

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

 



Hi Jason,

On 9 August 2017 at 18:04, Jason Ekstrand <jason@xxxxxxxxxxxxxx> wrote:
> +/* One one tenth of a second */
> +#define SHORT_TIME_NSEC 100000000ull

Er, a hundredth? Or only one, one tenth?

> +static void
> +test_wait_illegal_handle(int fd)
> +{
> +       struct drm_syncobj_wait wait = { 0 };
> +       uint32_t handle = 2;

Use 0.

> +static void
> +test_wait_for_submit_unsignaled(int fd)
> +{
> +       uint32_t syncobj = syncobj_create(fd);
> +       struct drm_syncobj_wait wait = { 0 };
> +       int ret;
> +
> +       wait.handles = to_user_pointer(&syncobj);
> +       wait.count_handles = 1;
> +       wait.flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT;
> +       wait.timeout_nsec = short_timeout();
> +
> +       ret = ioctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, &wait);
> +       igt_assert(ret == -1 && errno == ETIME);

There's do_ioctl_err() for this pattern BTW, and I think that takes
care of EINTR as well.

> +static void
> +test_wait_signaled(int fd)
> +{
> +       uint32_t syncobj = syncobj_create(fd);
> +       struct drm_syncobj_wait wait = { 0 };
> +       int ret;
> +
> +       wait.handles = to_user_pointer(&syncobj);
> +       wait.count_handles = 1;
> +
> +       trigger_syncobj(fd, &syncobj, 1, false);
> +
> +       wait.timeout_nsec = 0;
> +       ret = ioctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, &wait);
> +       igt_warn_on(ret != -1 || errno != ETIME);
> +
> +       wait.timeout_nsec = short_timeout();
> +       ret = ioctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, &wait);
> +       igt_assert(ret == 0);

... and do_ioctl() for this pattern.


> +static bool
> +has_syncobj_wait(int fd)
> +{
> +       struct drm_syncobj_wait wait = { 0 };

This probably needs a local_ definition.

> +       uint64_t value;
> +       int ret;
> +
> +       if (drmGetCap(fd, DRM_CAP_SYNCOBJ, &value))
> +               return false;
> +       if (!value)
> +               return false;
> +
> +       /* Try waiting for zero sync objects should fail with EINVAL */
> +       ret = ioctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, &wait);
> +       return ret == -1 && errno == EINVAL;

Unfortunately an unrecognised ioctl also leads to a failure with
EINVAL. Try another test for ioctl presence, e.g. do you get ENOENT if
you pass one handle to wait for, but that handle is 0 (invalid GEM
object ID)?

I couldn't see much else obvious, and it seems like a decent enough
workout of the wait API, so, with these and what Chris suggested:
Acked-by: Daniel Stone <daniels@xxxxxxxxxxxxx>

Cheers,
Daniel
_______________________________________________
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