tests/syncobj_eventfd: new test
Subsystems (2)
PATCH v4 1/1 tests/syncobj_eventfd: new test
This series implements a new test suite for the DRM_IOCTL_SYNCOBJ_EVENTFD IOCTL introduced in [1].
v2:
- Check for DRM_CAP_SYNCOBJ_TIMELINE instead of DRM_CAP_SYNCOBJ
- Fix syncobj_eventfd availability check: ENOENT is returned when an IOCTL doesn't exist, so use an error path which returns a different errno
v3: fix IOCTL number conflict with GETFB2 (Vitaly Prosyak)
v4: revert the fix for syncobj_eventfd availability check done in v2, this was a red herring due to the IOCTL number conflict, and drm_ioctl() will return EINVAL for unknown IOCTL numbers
[1]: https://lore.kernel.org/dri-devel/[email protected]/
--- include/drm-uapi/drm.h | 23 +++ lib/igt_syncobj.c | 40 +++++ lib/igt_syncobj.h | 4 + tests/meson.build | 1 + tests/syncobj_eventfd.c | 344 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 412 insertions(+) create mode 100644 tests/syncobj_eventfd.c
include/drm-uapi/drm.h +23 -0
@@ -903,6 +903,27 @@ struct drm_syncobj_timeline_wait {__u32 pad; }; +/** +* struct drm_syncobj_eventfd +* @handle: syncobj handle. +* @flags: Zero to wait for the point to be signalled, or +* &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to wait for a fence to be +* available for the point. +* @point: syncobj timeline point (set to zero for binary syncobjs). +* @fd: Existing eventfd to sent events to. +* @pad: Must be zero. +* +* Register an eventfd to be signalled by a syncobj. The eventfd counter will +* be incremented by one. +*/ +struct drm_syncobj_eventfd { +__u32 handle; +__u32 flags; +__u64 point; +__s32 fd; +__u32 pad; +}; +struct drm_syncobj_array {__u64 handles;
@@ -1092,6 +1113,8 @@ extern "C" {#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2) +#define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd) +/* * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f.
lib/igt_syncobj.c +40 -0
@@ -543,3 +543,43 @@ syncobj_timeline_to_timeline(int fd, timeline_dst, point_dst, timeline_src, point_src, 0), 0); } + +int +__syncobj_eventfd (int fd,uint32_t handle,uint64_t point,uint32_t flags, +int ev_fd) +{ +struct drm_syncobj_eventfd args; +int ret; + + args.handle = handle; + args.flags = flags; + args.point = point; + args.fd = ev_fd; + args.pad =0 ; + + ret =igt_ioctl (fd,DRM_IOCTL_SYNCOBJ_EVENTFD , &args); +if (ret) { + ret = -errno; +igt_assume (ret); + errno =0 ; + } + +return ret; +} + +/** +* syncobj_eventfd: +* @fd: The DRM file descriptor. +* @handle: A syncobj handle. +* @point: A point on the timeline syncobj, or 0 for binary syncobjs. +* @flags: Flags. +* @ev_fd: An eventfd. +* +* Wait for a syncobj with an eventfd. +*/ +void +syncobj_eventfd (int fd,uint32_t handle,uint64_t point,uint32_t flags, +int ev_fd) +{ +igt_assert_eq (__syncobj_eventfd (fd, handle, point, flags, ev_fd),0 ); +}
lib/igt_syncobj.h +4 -0
@@ -65,5 +65,9 @@ void syncobj_timeline_to_timeline(int fd, uint64_t timeline_src, uint32_t point_src);void syncobj_timeline_signal (int fd,uint32_t *handles,uint64_t *points,uint32_t count); +int __syncobj_eventfd (int fd,uint32_t handle,uint64_t point,uint32_t flags, +int ev_fd); +void syncobj_eventfd (int fd,uint32_t handle,uint64_t point,uint32_t flags, +int ev_fd);#endif /* IGT_SYNCOBJ_H */
tests/meson.build +1 -0
@@ -78,6 +78,7 @@ test_progs = [ 'prime_udl', 'prime_vgem', 'syncobj_basic', + 'syncobj_eventfd', 'syncobj_wait', 'syncobj_timeline', 'sw_sync',
tests/syncobj_eventfd.c new file +344 -0
344 lines not on this page · raw message
Signature · 1 line
2.41.0
Patchwork
CI[igt-dev] ○ CI.xeBAT: info for tests/syncobj_eventfd: new test (rev4)
== Series Details ==
== Series Details ==
Series: tests/syncobj_eventfd: new test (rev4)
URL : https://patchwork.freedesktop.org/series/120551/
State : info
== Summary ==
Participating hosts:
bat-pvc-2
bat-atsm-2
bat-dg2-oem2
bat-adlp-7
Missing hosts results[0]:
Results: [IGTPW_9410](https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_9410/index.html)
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for tests/syncobj_eventfd: new test (rev4)
In reply to Simon Ser== Series Details ==
== Series Details ==
Series: tests/syncobj_eventfd: new test (rev4)
URL : https://patchwork.freedesktop.org/series/120551/
State : failure
== Summary ==
CI Bug Log - changes from IGT_7388 -> IGTPW_9410
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_9410 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_9410, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/index.html
Participating hosts (44 -> 43)
------------------------------
Missing (1): fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_9410:
### IGT changes ###
#### Possible regressions ####
* igt@gem_exec_suspend@basic-s0@smem:
- fi-kbl-7567u: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7388/fi-kbl-7567u/igt@gem_exec_suspend@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/fi-kbl-7567u/igt@gem_exec_suspend@[email protected]
Known issues
------------
Here are the changes found in IGTPW_9410 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_pm_rpm@module-reload:
- fi-skl-guc: [PASS][3] -> [FAIL][4] ([i915#7940])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7388/fi-skl-guc/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/fi-skl-guc/igt@[email protected]
* igt@i915_selftest@live@migrate:
- bat-dg2-11: [PASS][5] -> [DMESG-WARN][6] ([i915#7699])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7388/bat-dg2-11/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/bat-dg2-11/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@requests:
- bat-mtlp-6: [PASS][7] -> [ABORT][8] ([i915#7982])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7388/bat-mtlp-6/igt@i915_selftest@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/bat-mtlp-6/igt@i915_selftest@[email protected]
* igt@kms_psr@primary_mmap_gtt:
- bat-rplp-1: NOTRUN -> [SKIP][9] ([i915#1072])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/bat-rplp-1/igt@kms_psr@primary_mmap_gtt.html
* igt@kms_setmode@basic-clone-single-crtc:
- bat-rplp-1: NOTRUN -> [ABORT][10] ([i915#8260] / [i915#8668])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/bat-rplp-1/igt@[email protected]
#### Possible fixes ####
* igt@i915_pm_rpm@basic-pci-d3-state:
- fi-cfl-8109u: [FAIL][11] ([i915#7940]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7388/fi-cfl-8109u/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/fi-cfl-8109u/igt@[email protected]
* igt@i915_pm_rpm@basic-rte:
- fi-skl-guc: [FAIL][13] ([i915#7940]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7388/fi-skl-guc/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/fi-skl-guc/igt@[email protected]
* igt@i915_selftest@live@gt_mocs:
- bat-mtlp-8: [DMESG-FAIL][15] ([i915#7059]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7388/bat-mtlp-8/igt@i915_selftest@live@gt_mocs.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/bat-mtlp-8/igt@i915_selftest@live@gt_mocs.html
* igt@i915_selftest@live@migrate:
- bat-mtlp-8: [DMESG-FAIL][17] ([i915#7699]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7388/bat-mtlp-8/igt@i915_selftest@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/bat-mtlp-8/igt@i915_selftest@[email protected]
#### Warnings ####
* igt@kms_psr@sprite_plane_onoff:
- bat-rplp-1: [ABORT][19] ([i915#8442] / [i915#8668] / [i915#8712]) -> [SKIP][20] ([i915#1072])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_7388/bat-rplp-1/igt@kms_psr@sprite_plane_onoff.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/bat-rplp-1/igt@kms_psr@sprite_plane_onoff.html
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#7059]: https://gitlab.freedesktop.org/drm/intel/issues/7059
[i915#7699]: https://gitlab.freedesktop.org/drm/intel/issues/7699
[i915#7940]: https://gitlab.freedesktop.org/drm/intel/issues/7940
[i915#7982]: https://gitlab.freedesktop.org/drm/intel/issues/7982
[i915#8260]: https://gitlab.freedesktop.org/drm/intel/issues/8260
[i915#8442]: https://gitlab.freedesktop.org/drm/intel/issues/8442
[i915#8668]: https://gitlab.freedesktop.org/drm/intel/issues/8668
[i915#8712]: https://gitlab.freedesktop.org/drm/intel/issues/8712
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7388 -> IGTPW_9410
CI-20190529: 20190529
CI_DRM_13385: f8be3c363790b79801f7be6bd40062219e3789bc @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_9410: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/index.html
IGT_7388: 7388
Testlist changes
----------------
+igt@syncobj_eventfd@binary-wait
+igt@syncobj_eventfd@binary-wait-before-signal
+igt@syncobj_eventfd@binary-wait-signaled
+igt@syncobj_eventfd@invalid-bad-flags
+igt@syncobj_eventfd@invalid-bad-pad
+igt@syncobj_eventfd@invalid-illegal-eventfd
+igt@syncobj_eventfd@invalid-illegal-handle
+igt@syncobj_eventfd@timeline-wait
+igt@syncobj_eventfd@timeline-wait-before-signal
+igt@syncobj_eventfd@timeline-wait-signaled
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9410/index.html
Hi Simon,
Quoted 26 lines · Simon Ser
This series implements a new test suite for the
DRM_IOCTL_SYNCOBJ_EVENTFDIOCTL introduced in [1].v2:
- Check forDRM_CAP_SYNCOBJ_TIMELINEinstead ofDRM_CAP_SYNCOBJ
- Fixsyncobj_eventfdavailability check: ENOENT is returned when an IOCTL doesn't exist, so use an error path which returns a different errnov3: fix IOCTL number conflict with GETFB2 (Vitaly Prosyak)
v4: revert the fix for
syncobj_eventfdavailability check done in v2, this was a red herring due to the IOCTL number conflict, anddrm_ioctl()will return EINVAL for unknown IOCTL numbers[1]: https://lore.kernel.org/dri-devel/[email protected]/
Signed-off-by Simon Ser <[email protected]>Reviewed-by Lionel Landwerlin <[email protected]>Acked-by Christian König <[email protected]>Cc Faith Ekstrand <[email protected]>Cc Bas Nieuwenhuizen <[email protected]>Cc Daniel Stone <[email protected]>Cc James Jones <[email protected]>Cc Austin Shafer <[email protected]>Cc Vitaly Prosyak <[email protected]>
Quoted 2 lines
--- include/drm-uapi/drm.h | 23 +++
Could you split drm-uapi into separate patch? You already have other patch with drm-uapi sync.
Quoted 128 lines
lib/igt_syncobj.c | 40 +++++ lib/igt_syncobj.h | 4 + tests/meson.build | 1 + tests/syncobj_eventfd.c | 344 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 412 insertions(+) create mode 100644 tests/syncobj_eventfd.cinclude/drm-uapi/drm.h +23
-0@@ -903,6 +903,27 @@ struct drm_syncobj_timeline_wait {__u32 pad; }; +/** +* struct drm_syncobj_eventfd +* @handle: syncobj handle. +* @flags: Zero to wait for the point to be signalled, or +* &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to wait for a fence to be +* available for the point. +* @point: syncobj timeline point (set to zero for binary syncobjs). +* @fd: Existing eventfd to sent events to. +* @pad: Must be zero. +* +* Register an eventfd to be signalled by a syncobj. The eventfd counter will +* be incremented by one. +*/ +struct drm_syncobj_eventfd { +__u32 handle; +__u32 flags; +__u64 point; +__s32 fd; +__u32 pad; +}; +struct drm_syncobj_array {__u64 handles;@@ -1092,6 +1113,8 @@ extern "C" {#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2) +#define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd) +/* * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f. lib/igt_syncobj.c +40
-0@@ -543,3 +543,43 @@ syncobj_timeline_to_timeline(int fd, timeline_dst, point_dst, timeline_src, point_src, 0), 0); } + +int +__syncobj_eventfd (int fd,uint32_t handle,uint64_t point,uint32_t flags, +int ev_fd) +{ +struct drm_syncobj_eventfd args; +int ret; + + args.handle = handle; + args.flags = flags; + args.point = point; + args.fd = ev_fd; + args.pad =0 ; + + ret =igt_ioctl (fd,DRM_IOCTL_SYNCOBJ_EVENTFD , &args); +if (ret) { + ret = -errno; +igt_assume (ret); + errno =0 ; + } + +return ret; +} + +/** +* syncobj_eventfd: +* @fd: The DRM file descriptor. +* @handle: A syncobj handle. +* @point: A point on the timeline syncobj, or 0 for binary syncobjs. +* @flags: Flags. +* @ev_fd: An eventfd. +* +* Wait for a syncobj with an eventfd. +*/ +void +syncobj_eventfd (int fd,uint32_t handle,uint64_t point,uint32_t flags, +int ev_fd) +{ +igt_assert_eq (__syncobj_eventfd (fd, handle, point, flags, ev_fd),0 ); +}lib/igt_syncobj.h +4
-0@@ -65,5 +65,9 @@ void syncobj_timeline_to_timeline(int fd, uint64_t timeline_src, uint32_t point_src);void syncobj_timeline_signal (int fd,uint32_t *handles,uint64_t *points,uint32_t count); +int __syncobj_eventfd (int fd,uint32_t handle,uint64_t point,uint32_t flags, +int ev_fd); +void syncobj_eventfd (int fd,uint32_t handle,uint64_t point,uint32_t flags, +int ev_fd);#endif /* IGT_SYNCOBJ_H */ tests/meson.build +1
-0@@ -78,6 +78,7 @@ test_progs = [ 'prime_udl', 'prime_vgem', 'syncobj_basic', + 'syncobj_eventfd', 'syncobj_wait', 'syncobj_timeline', 'sw_sync',tests/syncobj_eventfd.c new file +0
-0
tests/syncobj_eventfd.c line 3
Quoted 3 lines
tests/syncobj_eventfd.c new file +3
-0@@ -0,0 +1,344 @@ +/* +* Copyright © 2023 Simon Ser +*
Please use SPDX licence instead, also use perl script checkpatch.pl from Linux kernel for checks of correct SPDX use.
Quoted 18 lines
tests/syncobj_eventfd.c new file +18
-0+* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE.
tests/syncobj_eventfd.c line 31
Quoted 10 lines
tests/syncobj_eventfd.c new file +10
-0+*/ + +#include "igt.h" +#include "sw_sync.h" +#include "igt_syncobj.h" +#include <fcntl.h> +#include <poll.h> +#include <sys/eventfd.h> +#include <stdint.h> +#include "drm.h"
Sort headers alphabetically, system one first,
then after newline igt ones.
Regards,
Kamil
Quoted 317 lines
tests/syncobj_eventfd.c new file +313
-0+/** +* TEST: syncobj eventfd +* Category: Infrastructure +* Description: Tests for the drm sync object eventfd API +* Feature: synchronization +* Functionality: semaphore +* Run type: FULL +* Sub-category: DRM +* Test category: GEM_Legacy +*/ + +IGT_TEST_DESCRIPTION ("Tests for the drm sync object eventfd API" ); + +static bool +has_syncobj_eventfd (int fd) +{ +uint64_t value; +int ret; + +if (drmGetCap (fd,DRM_CAP_SYNCOBJ_TIMELINE , &value)) +return false; +if (!value) +return false; + +/* Try waiting with invalid syncobj should fail with ENOENT */ + ret =__syncobj_eventfd (fd,0 ,0 ,0 ,-1 ); +return ret == -ENOENT ; +} + +static int +syncobj_attach_sw_sync (int fd,uint32_t handle,uint64_t point) +{ +int timeline, fence; +uint32_t syncobj; + + timeline =sw_sync_timeline_create (); + fence =sw_sync_timeline_create_fence (timeline,1 ); + +if (point ==0 ) { +syncobj_import_sync_file (fd, handle, fence); + }else { + syncobj =syncobj_create (fd,0 ); + +syncobj_import_sync_file (fd, syncobj, fence); +syncobj_binary_to_timeline (fd, handle, point, syncobj); +syncobj_destroy (fd, syncobj); + } + +close (fence); + +return timeline; +} + +static int +ev_fd_read (int ev_fd) +{ +uint64_t ev_fd_value; +int ret; + + ret =read (ev_fd, &ev_fd_value,sizeof (ev_fd_value)); +if (ret ==-1 ) +return -errno; +igt_assert_eq (ret,sizeof (ev_fd_value)); +return 0 ; +} + +static void +ev_fd_poll_in (int ev_fd,bool avail) +{ +struct pollfd pollfd; +int ret; +int timeout_ms; + +/* Wait 5s if we're expecting data, 10ms otherwise */ + timeout_ms = avail ?5000 :10 ; + pollfd.fd = ev_fd; + pollfd.events =POLLIN ; + pollfd.revents =0 ; + ret =poll (&pollfd,1 , timeout_ms); +if (avail) { +igt_assert (ret >=0 ); +igt_assert (pollfd.revents &POLLIN ); + }else { +igt_assert_eq (ret,0 ); + } +} + +static void +ev_fd_assert_unsignaled (int ev_fd) +{ +/* Poll the eventfd to give the kernel time to signal it, error out if +* that happens */ +ev_fd_poll_in (ev_fd, false); +igt_assert_eq (ev_fd_read (ev_fd), -EAGAIN ); +} + +static void +ev_fd_assert_signaled (int ev_fd) +{ +ev_fd_poll_in (ev_fd, true); +igt_assert_eq (ev_fd_read (ev_fd),0 ); +} + +static const char test_bad_flags_desc[] = +"Verifies that passing bad flags is rejected" ; +static void +test_bad_flags (int fd) +{ +uint32_t flags; +uint32_t syncobj; +int ev_fd; + + syncobj =syncobj_create (fd,DRM_SYNCOBJ_CREATE_SIGNALED ); + flags =0xdeadbeef ; + ev_fd =eventfd (0 ,EFD_NONBLOCK ); +igt_assert_eq (__syncobj_eventfd (fd, syncobj,0 , flags, ev_fd), -EINVAL ); + +close (ev_fd); +syncobj_destroy (fd, syncobj); +} + +static const char test_illegal_handle_desc[] = +"Verifies that passing an invalid syncobj handle is rejected" ; +static void +test_illegal_handle (int fd) +{ +int ev_fd; + + ev_fd =eventfd (0 ,EFD_NONBLOCK ); +igt_assert_eq (__syncobj_eventfd (fd,0 ,0 ,0 , ev_fd), -ENOENT ); + +close (ev_fd); +} + +static const char test_illegal_eventfd_desc[] = +"Verifies that passing an invalid eventfd is rejected" ; +static void +test_illegal_eventfd (int fd) +{ +int dev_null; +uint32_t syncobj; + + syncobj =syncobj_create (fd,DRM_SYNCOBJ_CREATE_SIGNALED ); + + dev_null =open ("/dev/null" ,O_RDWR ); +igt_assert (dev_null >=0 ); + +igt_assert_eq (__syncobj_eventfd (fd, syncobj,0 ,0 , dev_null), -EINVAL ); + +close (dev_null); +syncobj_destroy (fd, syncobj); +} + +static const char test_bad_pad_desc[] = +"Verifies that passing a non-zero padding is rejected" ; +static void +test_bad_pad (int fd) +{ +struct drm_syncobj_eventfd args; +int ret; + + args.handle =syncobj_create (fd,DRM_SYNCOBJ_CREATE_SIGNALED ); + args.flags =0 ; + args.point =0 ; + args.fd =eventfd (0 ,EFD_NONBLOCK ); + args.pad =0xdeadbeef ; + + ret =drmIoctl (fd,DRM_IOCTL_SYNCOBJ_EVENTFD , &args); +igt_assert (ret ==-1 && errno ==EINVAL ); +} + +static const char test_wait_desc[] = +"Verifies waiting an already-materialized fence" ; +static void +test_wait (int fd,bool use_timeline) +{ +uint32_t syncobj; +int timeline, ev_fd_wait, ev_fd_avail; +uint64_t point = use_timeline ?1 :0 ; + + syncobj =syncobj_create (fd,0 ); + timeline =syncobj_attach_sw_sync (fd, syncobj, point); + ev_fd_wait =eventfd (0 ,EFD_NONBLOCK ); + ev_fd_avail =eventfd (0 ,EFD_NONBLOCK ); + +syncobj_eventfd (fd, syncobj, point,0 , ev_fd_wait); +syncobj_eventfd (fd, syncobj, point,DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE , + ev_fd_avail); + +ev_fd_assert_unsignaled (ev_fd_wait); +ev_fd_assert_signaled (ev_fd_avail); + +sw_sync_timeline_inc (timeline,1 ); + +ev_fd_assert_signaled (ev_fd_wait); + +close (ev_fd_wait); +close (ev_fd_avail); +close (timeline); +syncobj_destroy (fd, syncobj); +} + +static const char test_wait_before_signal_desc[] = +"Verifies waiting a fence not yet materialized" ; +static void +test_wait_before_signal (int fd,bool use_timeline) +{ +uint32_t syncobj; +int timeline, ev_fd_wait, ev_fd_avail; +uint64_t point = use_timeline ?1 :0 ; + + syncobj =syncobj_create (fd,0 ); + ev_fd_wait =eventfd (0 ,EFD_NONBLOCK ); + ev_fd_avail =eventfd (0 ,EFD_NONBLOCK ); + +syncobj_eventfd (fd, syncobj, point,0 , ev_fd_wait); +syncobj_eventfd (fd, syncobj, point,DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE , + ev_fd_avail); + +ev_fd_assert_unsignaled (ev_fd_wait); +ev_fd_assert_unsignaled (ev_fd_avail); + + timeline =syncobj_attach_sw_sync (fd, syncobj, point); + +ev_fd_assert_unsignaled (ev_fd_wait); +ev_fd_assert_signaled (ev_fd_avail); + +sw_sync_timeline_inc (timeline,1 ); + +ev_fd_assert_signaled (ev_fd_wait); + +close (ev_fd_wait); +close (ev_fd_avail); +close (timeline); +syncobj_destroy (fd, syncobj); +} + +static const char test_wait_signaled_desc[] = +"Verifies waiting an already-signaled fence" ; +static void +test_wait_signaled (int fd,bool use_timeline) +{ +uint32_t syncobj; +int timeline, ev_fd_wait, ev_fd_avail; +uint64_t point = use_timeline ?1 :0 ; + + syncobj =syncobj_create (fd,0 ); + ev_fd_wait =eventfd (0 ,EFD_NONBLOCK ); + ev_fd_avail =eventfd (0 ,EFD_NONBLOCK ); + + timeline =syncobj_attach_sw_sync (fd, syncobj, point); +sw_sync_timeline_inc (timeline,1 ); + +syncobj_eventfd (fd, syncobj, point,0 , ev_fd_wait); +syncobj_eventfd (fd, syncobj, point,DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE , + ev_fd_avail); + +ev_fd_assert_signaled (ev_fd_wait); +ev_fd_assert_signaled (ev_fd_avail); + +close (ev_fd_wait); +close (ev_fd_avail); +close (timeline); +syncobj_destroy (fd, syncobj); +} + +igt_main +{ +int fd =-1 , i; + + igt_fixture { + fd =drm_open_driver (DRIVER_ANY ); +igt_require (has_syncobj_eventfd (fd)); +igt_require_sw_sync (); + } + +igt_describe (test_bad_flags_desc); + igt_subtest("invalid-bad-flags") +test_bad_flags (fd); + +igt_describe (test_illegal_handle_desc); + igt_subtest("invalid-illegal-handle") +test_illegal_handle (fd); + +igt_describe (test_illegal_eventfd_desc); + igt_subtest("invalid-illegal-eventfd") +test_illegal_eventfd (fd); + +igt_describe (test_bad_pad_desc); + igt_subtest("invalid-bad-pad") +test_bad_pad (fd); + +for (i =0 ; i <2 ; i++) { +bool use_timeline = i ==1 ; +const char *kind = use_timeline ?"timeline" :"binary" ; + +igt_describe (test_wait_desc); + igt_subtest_f("%s-wait", kind) +test_wait (fd, use_timeline); + +igt_describe (test_wait_before_signal_desc); + igt_subtest_f("%s-wait-before-signal", kind) +test_wait_before_signal (fd, use_timeline); + +igt_describe (test_wait_signaled_desc); + igt_subtest_f("%s-wait-signaled", kind) +test_wait_signaled (fd, use_timeline); + } + + igt_fixture { +drm_close_driver (fd); + } +}Signature · 1 line
2.41.0
Quoted 2 lines · Kamil Konieczny
Could you split drm-uapi into separate patch? You already have other patch with drm-uapi sync.
I'll wait for the uapi sync patch to be merged before updating this one.