From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [Intel-gfx] [PATCH 7/8] drm/irq: Implement a generic vblank_wait function Date: Wed, 30 Jul 2014 17:21:36 +0200 Message-ID: <20140730152135.GD1345@ulmo> References: <1406669543-31213-1-git-send-email-daniel.vetter@ffwll.ch> <1406669543-31213-8-git-send-email-daniel.vetter@ffwll.ch> <53D85F95.3050502@daenzer.net> <20140730082212.GH4747@phenom.ffwll.local> <53D8AD9C.7000006@daenzer.net> <20140730142024.GO29590@ulmo> <20140730143621.GF4193@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2013128640==" Return-path: In-Reply-To: <20140730143621.GF4193@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Ville =?utf-8?B?U3lyasOkbMOk?= Cc: Daniel Vetter , Michel =?utf-8?Q?D=C3=A4nzer?= , Intel Graphics Development , DRI Development List-Id: intel-gfx@lists.freedesktop.org --===============2013128640== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7DO5AaGCk89r4vaK" Content-Disposition: inline --7DO5AaGCk89r4vaK Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 30, 2014 at 05:36:21PM +0300, Ville Syrj=C3=A4l=C3=A4 wrote: > On Wed, Jul 30, 2014 at 04:20:25PM +0200, Thierry Reding wrote: > > On Wed, Jul 30, 2014 at 05:32:28PM +0900, Michel D=C3=A4nzer wrote: > > > On 30.07.2014 17:22, Daniel Vetter wrote: > > > > On Wed, Jul 30, 2014 at 11:59:33AM +0900, Michel D=C3=A4nzer wrote: > > > >> On 30.07.2014 06:32, Daniel Vetter wrote: > > > >>> + * due to lack of driver support or because the crtc is off. > > > >>> + */ > > > >>> +void drm_crtc_vblank_wait(struct drm_crtc *crtc) > > > >>> +{ > > > >>> + drm_vblank_wait(crtc->dev, drm_crtc_index(crtc)); > > > >>> +} > > > >>> +EXPORT_SYMBOL(drm_crtc_vblank_wait); > > > >>> + > > > >>> +/** > > > >> > > > >> Maybe the function names should be *_vblank_wait_next() or somethi= ng to > > > >> clarify the purpose and reduce potential confusion versus drm_wait= _vblank(). > > > >=20 > > > > Yeah that name is just transferred from the i915 driver. What about > > > > drm_wait_one_vblank()/drm_crtc_wait_one_vblank()? > > >=20 > > > I don't care that much :), go ahead. > >=20 > > Just my two cents: our downstream kernel has a helper somewhat like this > > which waits for a specified number of frames (apparently this is useful > > for some panels that require up to 5 or 6 frames before they display the > > correct image on screen). So perhaps something like this could work: > >=20 > > void drm_wait_vblank_count(struct drm_device *dev, unsigned int crtc, > > unsigned int count) > > { > > u32 last; > > int ret; > >=20 > > ret =3D drm_vblank_get(dev, crtc); > > if (WARN_ON(ret)) > > return; > >=20 > > while (count--) { > > last =3D drm_vblank_count(dev, crtc); > >=20 > > ... > > } > >=20 > > drm_vblank_put(dev, crtc); > > } >=20 > Would be nicer to wait for an absolute vblank count instead IMO. Or > if you want to pass a relative count in just convert it to an absolute > count first and wait for it (taking wraparound into account obviously). Hmm... would something like this work? target =3D drm_vblank_count(dev, crtc) + count; ret =3D wait_event_timeout(..., drm_vblank_count(dev, crtc) =3D=3D target, ...); That should properly take into account wrap-around given that both sites use drm_vblank_count(). Thierry --7DO5AaGCk89r4vaK Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJT2Q1/AAoJEN0jrNd/PrOhpBoP/0HRdZIQ1nLlZD1WhDax9HjT dvAR5hayCWCN/6djZLGnblw4qx1lwWYnND667JAxlmWrBnAudljm55RP4wljhZEn 99JOfDJ8iULrBx0SYEODvHLHMzUIL/bkM1wrPNcqdG6JY2cHBOlzLM+fsZNfum+G QfiktYx5AWUVeaF9Gg0apm2vJoI6SWxI7Yp3CV6f6iF3AKhHyLlYcsPuLj2VgiJv po+hanO2FYi+eaQczLuM/y4QKO0zGy+1Dp5ut4QIM8GD7UfB5uVzQE5kgvY1kf5/ TudC9iQM34xjACnprU6P2IL5U76xOEDVbO6rW7MJRHWI887geG+jRUiz/JnQV45Y OhxwTTt1cDdtlwkmM8o4xDIBTeHvjIgWSo7FPkpgfJ2rcao8a5t9VmwCCwn3MSZN 5ABsi/WZ80eMEHE997hE4iHpcF343NDZzz6etuNIQkxsXIIlwJpK1HPJzKrqqEuX IemlnBSHu6eVlqq6fFemR88aLcoux/AYZZ8vlQSj3PkyO+9yxa9hqjZ8b7qpesGF YDBVqYrM85iZVFGdF1Xow/Vu4GooIf9W8Ig5aJimeCF0ZkqmNGXEI7FO9dgYPHAQ EL5em8jiIAUQb+tlFkQpgdnWcE1ZzqExIKSFWEsTGWehBSo3g1hTDt82KU2Gur4r MYsaZb7+N+YopB4tK0F2 =L99K -----END PGP SIGNATURE----- --7DO5AaGCk89r4vaK-- --===============2013128640== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============2013128640==--