From: Daniel Vetter Subject: Re: [PATCH v2 3/3] drm/i915: Prevent MI_DISPLAY_FLIP straddling two cachelines on IVB Date: Tue, 11 Feb 2014 17:01:39 +0100 Message-ID: <20140211160139.GM17001@phenom.ffwll.local> References: <1392126950-13225-1-git-send-email-ville.syrjala@linux.intel.com> <1392126950-13225-4-git-send-email-ville.syrjala@linux.intel.com> <20140211141428.GC11275@nuc-i3427.alporthouse.com> <20140211155005.GV3891@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com [209.85.217.180]) by gabe.freedesktop.org (Postfix) with ESMTP id 5163AFA9E6 for ; Tue, 11 Feb 2014 08:01:48 -0800 (PST) Received: by mail-lb0-f180.google.com with SMTP id n15so6149513lbi.11 for ; Tue, 11 Feb 2014 08:01:44 -0800 (PST) Content-Disposition: inline In-Reply-To: <20140211155005.GV3891@intel.com> 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: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Cc: Enrico Tagliavini , intel-gfx@lists.freedesktop.org, Alexandru DAMIAN , Bjoern C List-Id: intel-gfx@lists.freedesktop.org On Tue, Feb 11, 2014 at 05:50:05PM +0200, Ville Syrj=E4l=E4 wrote: > On Tue, Feb 11, 2014 at 02:14:28PM +0000, Chris Wilson wrote: > > On Tue, Feb 11, 2014 at 03:55:50PM +0200, ville.syrjala@linux.intel.com= wrote: > > > From: Ville Syrj=E4l=E4 > > > = > > > According to BSpec the entire MI_DISPLAY_FLIP packet must be contained > > > in a single cacheline. Make sure that happens. > > > = > > > v2: Use intel_ring_begin_cacheline_safe() > > = > > Ugh, no. Let's not make intel_ring_begin() any more complicated and just > > introduce a function to align the current head in the ringbuffer to a > > cacheline. Especially with such an interface that is hard to get right. > = > This doesn't make intel_ring_begin() itself more complicated, but I > guess you meant that the new special version is too complicated for > your taste? > = > So I guess you want somehting like this: > = > int ring_align() > { > nops =3D (64 - (tail & 63)) / 4; > = > ret =3D ring_begin(nops); > if (ret) > return ret; > while (nops--) > ring_emit(MI_NOOP); > ring_advance() > = > return 0; > } > = > int queue_flip() > { > ret =3D ring_align(); > if (ret) > return ret; > = > ret =3D ring_begin(len); > if (ret) > return ret; > if (RCS) > emit LRI DERRMR; > emit MI_DISPLAY_FLIP; > ring_advance() > = > return 0; > } > = > So we end up relying on the fact that the entire > LRI+MI_DISPLAY_FLIP sequence will fit within one cacheline. Although if > that would be problem I suppose we could always emit the LRI before > aligning the tail. > = > If no one is concerned about the useless MI_NOOPs we'll be emitting for > most flips, I guess it's a good enough solution. Yeah Chris&me discussed this quickly on irc and I concur with him that an intel_ring_cacheline_align(ring) helper is sufficient and much less crazy ;-) Cheers, Daniel -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch