From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 5/5] drm/i915: Allow vblank interrupts during modeset and eliminate some vblank races Date: Tue, 4 Mar 2014 10:13:43 +0100 Message-ID: <20140304091343.GP17001@phenom.ffwll.local> References: <1393009415-27651-1-git-send-email-ville.syrjala@linux.intel.com> <1393009415-27651-6-git-send-email-ville.syrjala@linux.intel.com> <1393213735.27769.8.camel@thor.local> <20140224121101.GN3852@intel.com> <1393297106.27769.48.camel@thor.local> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by gabe.freedesktop.org (Postfix) with ESMTP id CAF86FB599 for ; Tue, 4 Mar 2014 01:13:47 -0800 (PST) Received: by mail-ee0-f43.google.com with SMTP id e53so4409118eek.16 for ; Tue, 04 Mar 2014 01:13:46 -0800 (PST) Content-Disposition: inline In-Reply-To: <1393297106.27769.48.camel@thor.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Michel =?iso-8859-1?Q?D=E4nzer?= Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Tue, Feb 25, 2014 at 11:58:26AM +0900, Michel D=E4nzer wrote: > On Mon, 2014-02-24 at 14:11 +0200, Ville Syrj=E4l=E4 wrote: > > On Mon, Feb 24, 2014 at 12:48:55PM +0900, Michel D=E4nzer wrote: > > > On Fre, 2014-02-21 at 21:03 +0200, ville.syrjala@linux.intel.com wrot= e: > > > > = > > > > We can kill of the drm_vblank_{pre,post}_modeset() calls since thos= e are > > > > there simply to make drm_vblank_get() fail during a modeset. > > > = > > > Actually, their original purpose was to keep the DRM vblank counter > > > consistent across modesets, assuming the modeset resets the hardware > > > vblank counter. > > = > > I see. Well, actually I really don't. The code is too funky for me to > > tell what it actually ends up doing. The obvious way would be to > > resample the hardware counter at drm_vblank_post_modeset(), which the > > code certainly doesn't do. But maybe it did something sensible in the > > past. > = > When the pre/post-modeset hooks were originally added, it worked like > this: the pre-modeset hook enabled the vblank interrupt, which updated > the DRM vblank counter from the driver/HW counter. The post-modeset hook > disabled the vblank interrupt again, which recorded the post-modeset > driver/HW counter value. > = > But the vblank code has changed a lot since then, not sure it still > works like that. It still works like that, but there's two fundamental issues with this trick: - There's a race where the vblank state is fubar right between the completion of the modeset and before the first vblank happened. - It doesn't work across suspend/resume since no one re-enables the vblank interrupt. Cheers, Daniel -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch