From: Daniel Vetter <daniel@ffwll.ch>
To: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t] tests: atomic: add test to verify page flip event emissions
Date: Tue, 26 Apr 2016 15:23:41 +0200 [thread overview]
Message-ID: <20160426132341.GH8291@phenom.ffwll.local> (raw)
In-Reply-To: <db2bf54f-db99-c840-8953-ffe49be3e211@intel.com>
On Fri, Apr 22, 2016 at 02:27:28PM +0100, Lionel Landwerlin wrote:
> On 22/04/16 13:59, Daniel Vetter wrote:
> >On Thu, Apr 21, 2016 at 05:01:31PM +0100, Lionel Landwerlin wrote:
> >>It seems we don't have a test verifying events with atomic commits
> >>yet. Here is a first step.
> >>
> >>Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> >>Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> >Feel like also making a testcase variant for the other cases of crtc's
> >ACTIVE property?
> >- off -> off: kernel should reject event generation
> >- off -> on: kernel should generate event, and the frame counter should be
> > just a few frames less (at most) than what you get from the vblank ioctl
> > right after the modeset completes
> >- on -> off: same as off -> on but in reverse
> >
> >Would be awesome ...
> >-Daniel
>
> Sure, I will add more test for those cases.
>
> Though right now, I would like to know whether this test seems wrong or
> broken in any way.
> As I mentioned on IRC, I'm not getting any event when doing atomic commits
> and this test fails.
> I'm concerned that our driver doesn't behave properly with regards to events
> with atomic enabled.
Oh I forgot that. lgtm (without checking details, just top-level
semantics), one comment below.
> >>+static void plane_pageflip_events(struct kms_atomic_crtc_state *crtc,
> >>+ struct kms_atomic_plane_state *plane_old)
> >>+{
> >>+ struct drm_mode_modeinfo *mode = crtc->mode.data;
> >>+ struct kms_atomic_plane_state plane = *plane_old;
> >>+ uint32_t format = plane_get_igt_format(&plane);
> >>+ drmModeAtomicReq *req = drmModeAtomicAlloc();
> >>+ struct igt_fb fb[2];
> >>+ int i, pageflip_count = 0, vblank_count = 0;
> >>+ int flags = DRM_MODE_PAGE_FLIP_EVENT;
> >>+
> >>+ igt_require(format != 0);
> >>+
> >>+ for (i = 0; i < ARRAY_SIZE(fb); i++)
> >>+ igt_create_pattern_fb(plane.state->desc->fd,
> >>+ plane.crtc_w, plane.crtc_h,
> >>+ format, I915_TILING_NONE, &fb[i]);
> >>+
> >>+ plane.src_x = 0;
> >>+ plane.src_y = 0;
> >>+ plane.src_w = mode->hdisplay << 16;
> >>+ plane.src_h = mode->vdisplay << 16;
> >>+ plane.crtc_x = 0;
> >>+ plane.crtc_y = 0;
> >>+ plane.crtc_w = mode->hdisplay;
> >>+ plane.crtc_h = mode->vdisplay;
> >>+ plane.crtc_id = crtc->obj;
> >>+ plane.fb_id = fb[0].fb_id;
> >>+
> >>+ /* Flip the primary plane using the atomic API, and double-check
> >>+ * state is what we think it should be. */
> >>+ crtc_commit_atomic(crtc, &plane, req, ATOMIC_RELAX_NONE);
> >>+
> >>+ get_events(crtc, &pageflip_count, &vblank_count, 0);
> >>+ igt_assert_eq(1, pageflip_count);
> >>+
> >>+ drmModeAtomicFree(req);
> >>+ req = drmModeAtomicAlloc();
> >>+
> >>+ /* Change the framebuffer on the plane, we should get one
> >>+ * pageflip event. */
> >>+ plane.fb_id = fb[1].fb_id;
> >>+ plane_commit_atomic(&plane, req, flags, ATOMIC_RELAX_NONE);
> >>+ get_events(crtc, &pageflip_count, &vblank_count, 20);
> >>+ igt_assert_eq(2, pageflip_count);
> >>+
> >>+ /* No change, page flip event count should remain the same. */
> >>+ plane.fb_id = fb[1].fb_id;
> >>+ plane_commit_atomic(&plane, req, flags, ATOMIC_RELAX_NONE);
> >>+ get_events(crtc, &pageflip_count, &vblank_count, 20);
> >>+ igt_assert_eq(2, pageflip_count);
no-op atomic updates should still result in successful event generation.
But there's no guarantee whether we'll short-circuit the entire thing, or
whether we'll do a dummy flip and hence the vblank count will be
incremented by 1 compared to the last test.
Otherwise the assumption of the test that every atomic commit should
result in an even (if you ask for it) is correct.
-Daniel
> >>+ /* Change back the plane's framebuffer to its original one, we
> >>+ * should get a page flip event. */
> >>+ plane.fb_id = fb[0].fb_id;
> >>+ plane_commit_atomic(&plane, req, flags, ATOMIC_RELAX_NONE);
> >>+ get_events(crtc, &pageflip_count, &vblank_count, 20);
> >>+ igt_assert_eq(3, pageflip_count);
> >>+
> >>+ drmModeAtomicFree(req);
> >>+}
> >>+
> >> igt_main
> >> {
> >> struct kms_atomic_desc desc;
> >>@@ -1373,6 +1479,17 @@ igt_main
> >> atomic_state_free(scratch);
> >> }
> >>+ igt_subtest("atomic_pageflip_events") {
> >>+ struct kms_atomic_state *scratch = atomic_state_dup(current);
> >>+ struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
> >>+ struct kms_atomic_plane_state *plane =
> >>+ find_plane(scratch, PLANE_TYPE_PRIMARY, crtc);
> >>+
> >>+ igt_require(plane);
> >>+ plane_pageflip_events(crtc, plane);
> >>+ atomic_state_free(scratch);
> >>+ }
> >>+
> >> atomic_state_free(current);
> >> igt_fixture
> >>--
> >>2.8.0.rc3.226.g39d4020
> >>
> >>_______________________________________________
> >>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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-04-26 13:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 16:01 [PATCH i-g-t] tests: atomic: add test to verify page flip event emissions Lionel Landwerlin
2016-04-22 12:59 ` Daniel Vetter
2016-04-22 13:27 ` Lionel Landwerlin
2016-04-26 13:23 ` Daniel Vetter [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-04-21 17:43 Lionel Landwerlin
2016-04-25 8:39 ` Maarten Lankhorst
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=20160426132341.GH8291@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=lionel.g.landwerlin@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.