From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [Intel-gfx] [PATCH 7/8] drm/irq: Implement a generic vblank_wait function Date: Wed, 30 Jul 2014 17:36:21 +0300 Message-ID: <20140730143621.GF4193@intel.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <20140730142024.GO29590@ulmo> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Thierry Reding Cc: Daniel Vetter , Michel =?iso-8859-1?Q?D=E4nzer?= , Intel Graphics Development , DRI Development List-Id: intel-gfx@lists.freedesktop.org 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=E4nzer wrote: > > On 30.07.2014 17:22, Daniel Vetter wrote: > > > On Wed, Jul 30, 2014 at 11:59:33AM +0900, Michel D=E4nzer 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 something= to > > >> clarify the purpose and reduce potential confusion versus drm_wait_v= blank(). > > > = > > > Yeah that name is just transferred from the i915 driver. What about > > > drm_wait_one_vblank()/drm_crtc_wait_one_vblank()? > > = > > I don't care that much :), go ahead. > = > 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: > = > void drm_wait_vblank_count(struct drm_device *dev, unsigned int crtc, > unsigned int count) > { > u32 last; > int ret; > = > ret =3D drm_vblank_get(dev, crtc); > if (WARN_ON(ret)) > return; > = > while (count--) { > last =3D drm_vblank_count(dev, crtc); > = > ... > } > = > drm_vblank_put(dev, crtc); > } 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). -- = Ville Syrj=E4l=E4 Intel OTC