From: Marius Vlad Subject: Re: [PATCH i-g-t v5 7/7] kms_flip: Change __wait_for_vblank to use helper function. Date: Wed, 18 May 2016 01:37:37 +0300 Message-ID: <20160517223736.GA6483@mcvlad-wk.rb.intel.com> References: <1463405912-1592-1-git-send-email-robert.foss@collabora.com> <1463405912-1592-8-git-send-email-robert.foss@collabora.com> <20160517103227.GA8717@mcvlad-wk.rb.intel.com> <573B2F22.4090804@collabora.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1304965370==" Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 085C36E79D for ; Tue, 17 May 2016 22:34:40 +0000 (UTC) In-Reply-To: <573B2F22.4090804@collabora.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Robert Foss Cc: daniel.stone@collabora.com, jani.nikula@intel.com, daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============1304965370== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UlVJffcvxoiEqYs2" Content-Disposition: inline --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 17, 2016 at 10:48:02AM -0400, Robert Foss wrote: >=20 >=20 > On 2016-05-17 06:32 AM, Marius Vlad wrote: > >On Mon, May 16, 2016 at 09:38:32AM -0400, robert.foss@collabora.com wrot= e: > >>From: Robert Foss > >> > >>Change __wait_for_vblank() to use kmstest_get_vbl_flag() helper functio= n. > >> > >>Signed-off-by: Robert Foss > >>--- > >> tests/kms_flip.c | 8 ++++---- > >> 1 file changed, 4 insertions(+), 4 deletions(-) > >> > >>diff --git a/tests/kms_flip.c b/tests/kms_flip.c > >>index eda2fcc..0ecca07 100644 > >>--- a/tests/kms_flip.c > >>+++ b/tests/kms_flip.c > >>@@ -481,15 +481,15 @@ static int __wait_for_vblank(unsigned int flags, = int crtc_idx, > >> { > >> drmVBlank wait_vbl; > >> int ret; > >>- unsigned crtc_idx_mask; > >>+ uint32_t pipe_id_flag; > >> bool event =3D !(flags & TEST_VBLANK_BLOCK); > >> > >> memset(&wait_vbl, 0, sizeof(wait_vbl)); > >> > >>- crtc_idx_mask =3D crtc_idx << DRM_VBLANK_HIGH_CRTC_SHIFT; > >>- igt_assert(!(crtc_idx_mask & ~DRM_VBLANK_HIGH_CRTC_MASK)); > >If crtc_idx is 1 (pipe B), crtc_idx_mask =3D (1 << DRM_VBLANK_HIGH_CRTC_= SHIFT) =3D 2. > >>+ pipe_id_flag =3D kmstest_get_vbl_flag(crtc_idx); > >>+ igt_assert(!(pipe_id_flag & ~DRM_VBLANK_HIGH_CRTC_MASK)); > >If crtc_idx is 1 (pipe B), kmstest_get_vbl_flag(crtc_idx) =3D DRM_VBLANK= _SECONDARY =3D 0x20000000 > > > >And the assertion fails as !(0x20000000 & ~0x0000003e) =3D 0. > > > >Should kmstest_get_vbl_flag() always return pipe_id << 1? >=20 > From re-reading the pipe id parsing code in drm_irq.c drm_wait_vblank() > it would seem to me that the assertion is incorrect, specifically for the > case of _DRM_VBLANK_SECONDARY. >=20 > Supplying the flag _DRM_VBLANK_SECONDARY and setting the high crtc id fie= ld > to 1 fboth seem to be valid ways to communicate the same thing. Indeed. >=20 > flags =3D vblwait->request.type & _DRM_VBLANK_FLAGS_MASK; > high_pipe =3D (vblwait->request.type &_DRM_VBLANK_HIGH_CRTC_MASK); > if (high_pipe) > pipe =3D high_pipe >> _DRM_VBLANK_HIGH_CRTC_SHIFT; > else > pipe =3D flags & _DRM_VBLANK_SECONDARY ? 1 : 0; >=20 >=20 > Maybe adding correct and more thorough assertion to kmstest_get_vbl_flag() > and removing the failing assertion is the way forward. Sounds reasonable to me, though I assume that the assertion had/has some point in determining that you have a valid crtc_idx. >=20 > > > >> > >>- wait_vbl.request.type =3D crtc_idx_mask; > >>+ wait_vbl.request.type =3D pipe_id_flag; > >> if (flags & TEST_VBLANK_ABSOLUTE) > >> wait_vbl.request.type |=3D DRM_VBLANK_ABSOLUTE; > >> else > >>-- > >>2.7.4 > >> > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx --UlVJffcvxoiEqYs2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJXO50wAAoJELmLWIAQzyE+ACMH/i6xaJrLLv+VXpfcMbVExxdV oyVvtYzd1AzzohfIN/yY7w/GbFpJZ7FWXXy7it0hspxAsxHyfGFX3lkpVDSq1H8q LEDcfOJrBYxcA2MEfT6EC+MHZckexFvOZRO7f4EUX0d3bmaPY/kqJG0im736AenD qPuVcCAAQ6PyJ9ju2JpBDClv1rJuYll9Km71U57h6WYyMp7lT1flhbdznEXKoUc1 NpO+rNxPR5vEqFJMsj6yYztkkVXTDfIxNv29SZVHmTrK3dSUrIUrnXkxztZXfuD2 c9hfVJA0s4v3MRPoABw2EO34dZm8x59v/a8+r7e7wNb8W+hCVIYO+rIGqddz1mo= =W6qU -----END PGP SIGNATURE----- --UlVJffcvxoiEqYs2-- --===============1304965370== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============1304965370==--