From: Eric Anholt Subject: Re: [PATCH] drm/i915: don't queue flips during a flip pending event Date: Thu, 29 Apr 2010 15:52:36 -0700 Message-ID: <87r5lxooqz.fsf@pollan.anholt.net> References: <20100405140831.00892ba7@jbarnes-piketon> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0520266683==" Return-path: In-Reply-To: <20100405140831.00892ba7@jbarnes-piketon> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Jesse Barnes , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============0520266683== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --=-=-= Content-Transfer-Encoding: quoted-printable On Mon, 5 Apr 2010 14:08:31 -0700, Jesse Barnes = wrote: > Hardware will set the flip pending ISR bit as soon as it receives the > flip instruction, and (supposedly) clear it once the flip completes > (e.g. at the next vblank). If we try to send down a flip instruction > while the ISR bit is set, the hardware can become very confused, and we > may never receive the corresponding flip pending interrupt, effectively > hanging the chip. >=20 > Fixes fdo bug #27040. >=20 > Signed-off-by: Jesse Barnes > --- > drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++ > 1 files changed, 10 insertions(+), 0 deletions(-) >=20 > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/= intel_display.c > index 6f5e7f5..24853e1 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -4235,6 +4235,7 @@ static int intel_crtc_page_flip(struct drm_crtc *cr= tc, > unsigned long flags; > int pipesrc_reg =3D (intel_crtc->pipe =3D=3D 0) ? PIPEASRC : PIPEBSRC; > int ret, pipesrc; > + u32 flip_mask; > RING_LOCALS; >=20=20 > work =3D kzalloc(sizeof *work, GFP_KERNEL); > @@ -4285,6 +4286,15 @@ static int intel_crtc_page_flip(struct drm_crtc *c= rtc, > atomic_inc(&obj_priv->pending_flip); > work->pending_flip_obj =3D obj; >=20=20 > + if (intel_crtc->plane) > + flip_mask =3D I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT; > + else > + flip_mask =3D I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT; > + > + /* Wait for any previous flip to finish */ > + while (I915_READ(ISR) & flip_mask) > + ; > + I'm confused about how this patch works. It looks like there's a race where the ISR bit could get set at this point after the loop checking it, and you would lose. The whole thing seems very dubious -- why does the state of the ISR at the time you queue a flip matter? I could imagine there being an issue with the state of the ISR at the point that a flip packet is processed, but this doesn't handle that (seems like only throttling flips to avoid outstanding flips would) > BEGIN_LP_RING(4); > if (IS_I965G(dev)) { > OUT_RING(MI_DISPLAY_FLIP | > --=20 > 1.6.6.1 >=20 --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkvaDbQACgkQHUdvYGzw6vfPfgCcDhEDfWTdu5f+JfO+I6tgW5DK fkMAnAwiPOVhjYhKa2yiN42Q5apYW6If =tijp -----END PGP SIGNATURE----- --=-=-=-- --===============0520266683== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx --===============0520266683==--