From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [igt-dev] [Intel-gfx] [PATCH i-g-t] kms_busy: Use igt_waitchildren_timeout()
Date: Mon, 1 Apr 2019 09:32:27 +0200 [thread overview]
Message-ID: <20190401073227.GW2665@phenom.ffwll.local> (raw)
In-Reply-To: <20190330235448.5606-1-chris@chris-wilson.co.uk>
On Sat, Mar 30, 2019 at 11:54:48PM +0000, Chris Wilson wrote:
> Replace the convoluted raising of SIGALRM from the child with an
> interruptible sleep in the parent with the equivalent and far more
> natural igt_waitchildren_timeout().
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103182
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
I guess v2 missing here somewhere? Either way nice cleanup!
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> tests/kms_busy.c | 31 +++++--------------------------
> 1 file changed, 5 insertions(+), 26 deletions(-)
>
> diff --git a/tests/kms_busy.c b/tests/kms_busy.c
> index ed3caae4c..321db8207 100644
> --- a/tests/kms_busy.c
> +++ b/tests/kms_busy.c
> @@ -29,9 +29,6 @@
>
> IGT_TEST_DESCRIPTION("Basic check of KMS ABI with busy framebuffers.");
>
> -#define FRAME_TIME 16 /* milleseconds */
> -#define TIMEOUT (6*16)
> -
> static igt_output_t *
> set_fb_on_crtc(igt_display_t *dpy, int pipe, struct igt_fb *fb)
> {
> @@ -70,17 +67,13 @@ static void do_cleanup_display(igt_display_t *dpy)
> igt_display_commit2(dpy, dpy->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
> }
>
> -static void sighandler(int sig)
> -{
> -}
> -
> static void flip_to_fb(igt_display_t *dpy, int pipe,
> igt_output_t *output,
> struct igt_fb *fb, unsigned ring,
> const char *name, bool modeset)
> {
> struct pollfd pfd = { .fd = dpy->drm_fd, .events = POLLIN };
> - struct timespec tv = { 1, 0 };
> + const int timeout = modeset ? 8500 : 100;
> struct drm_event_vblank ev;
>
> igt_spin_t *t = igt_spin_batch_new(dpy->drm_fd,
> @@ -114,24 +107,14 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,
> DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
> }
>
> - kill(getppid(), SIGALRM);
> - igt_assert(gem_bo_busy(dpy->drm_fd, fb->gem_handle));
> - igt_assert_f(poll(&pfd, 1, modeset ? 8500 : TIMEOUT) == 0,
> + igt_assert_f(poll(&pfd, 1, timeout) == 0,
> "flip completed whilst %s was busy [%d]\n",
> name, gem_bo_busy(dpy->drm_fd, fb->gem_handle));
> + igt_assert(gem_bo_busy(dpy->drm_fd, fb->gem_handle));
> }
>
> - igt_assert_f(nanosleep(&tv, NULL) == -1,
> - "flip to %s blocked waiting for busy fb", name);
> -
> - igt_waitchildren();
> -
> - if (!modeset) {
> - tv.tv_sec = 0;
> - tv.tv_nsec = (2 * TIMEOUT) * 1000000ULL;
> - nanosleep(&tv, NULL);
> - }
> -
> + igt_waitchildren_timeout(5 * timeout,
> + "flip blocked waiting for busy bo\n");
> igt_spin_batch_end(t);
>
> igt_assert(read(dpy->drm_fd, &ev, sizeof(ev)) == sizeof(ev));
> @@ -160,8 +143,6 @@ static void test_flip(igt_display_t *dpy, unsigned ring, int pipe, bool modeset)
> if (modeset)
> igt_require(dpy->is_atomic);
>
> - signal(SIGALRM, sighandler);
> -
> output = set_fb_on_crtc(dpy, pipe, &fb[0]);
> igt_display_commit2(dpy, COMMIT_LEGACY);
>
> @@ -194,8 +175,6 @@ static void test_flip(igt_display_t *dpy, unsigned ring, int pipe, bool modeset)
> do_cleanup_display(dpy);
> igt_remove_fb(dpy->drm_fd, &fb[1]);
> igt_remove_fb(dpy->drm_fd, &fb[0]);
> -
> - signal(SIGALRM, SIG_DFL);
> }
>
> static void test_atomic_commit_hang(igt_display_t *dpy, igt_plane_t *primary,
> --
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-04-01 7:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-30 23:50 [igt-dev] [PATCH i-g-t] kms_busy: Use igt_waitchildren_timeout() Chris Wilson
2019-03-30 23:54 ` Chris Wilson
2019-04-01 7:32 ` Daniel Vetter [this message]
2019-04-01 7:39 ` [igt-dev] [Intel-gfx] " Chris Wilson
2019-03-31 1:02 ` [igt-dev] ✓ Fi.CI.BAT: success for kms_busy: Use igt_waitchildren_timeout() (rev2) Patchwork
2019-03-31 2:03 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190401073227.GW2665@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox