From: Kenneth Graunke Subject: Re: [PATCH] drm/i915: Enable the HiZ RAW Stall Optimization on Gen8. Date: Mon, 12 Jan 2015 13:41:08 -0800 Message-ID: <1955977.zLjZJzAKfp@vakarian> References: <1420944289-832-1-git-send-email-kenneth@whitecape.org> <20150112123220.GF10649@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0507914672==" Return-path: In-Reply-To: <20150112123220.GF10649@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Ville =?ISO-8859-1?Q?Syrj=E4l=E4?= Cc: mesa-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============0507914672== Content-Type: multipart/signed; boundary="nextPart3384708.LQFntQuRkr"; micalg="pgp-sha256"; protocol="application/pgp-signature" --nextPart3384708.LQFntQuRkr Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" On Monday, January 12, 2015 02:32:20 PM Ville Syrj=E4l=E4 wrote: > On Sat, Jan 10, 2015 at 06:44:49PM -0800, Kenneth Graunke wrote: > > This is an important optimization for avoiding read-after-write (RA= W) > > stalls in the HiZ buffer. Certain workloads would run very slowly = with > > HiZ enabled, but run much faster with the "hiz=3Dfalse" driconf opt= ion. > > With this patch, they run at full speed even with HiZ. > >=20 > > Improves performance in OglVSInstancing by 3.2x on Broadwell GT3e > > (Iris Pro 6200). > >=20 > > Thanks to Jesse Barnes for finding this missing bit! > > Thanks to Chris Wilson for helping me find where to set it. > >=20 > > Signed-off-by: Kenneth Graunke > > Cc: Jesse Barnes > > --- > > drivers/gpu/drm/i915/intel_ringbuffer.c | 15 +++++++++++++++ > > 1 file changed, 15 insertions(+) > >=20 > > Here's an alternate patch which implements the workaround in the ke= rnel > > instead of Mesa. It's probably better to do it there, since the ke= rnel > > does it on Haswell already. > >=20 > > diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/= drm/i915/intel_ringbuffer.c > > index dabc1d8..23020d6 100644 > > --- a/drivers/gpu/drm/i915/intel_ringbuffer.c > > +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c > > @@ -796,6 +796,16 @@ static int bdw_init_workarounds(struct intel_e= ngine_cs *ring) > > =09=09=09 HDC_DONOT_FETCH_MEM_WHEN_MASKED | > > =09=09=09 (IS_BDW_GT3(dev) ? HDC_FENCE_DEST_SLM_DISABLE : 0)); > > =20 > > +=09/* From the Haswell PRM, Command Reference: Registers, CACHE_MO= DE_0: > > +=09 * "The Hierarchical Z RAW Stall Optimization allows non-overla= pping > > +=09 * polygons in the same 8x4 pixel/sample area to be processed = without > > +=09 * stalling waiting for the earlier ones to write to Hierarchi= cal Z > > +=09 * buffer." > > +=09 * > > +=09 * This optimization is off by default for Broadwell; turn it o= n. > > +=09 */ > > +=09WA_CLR_BIT_MASKED(CACHE_MODE_0_GEN7, HIZ_RAW_STALL_OPT_DISABLE)= ; > > + > > =09/* Wa4x4STCOptimizationDisable:bdw */ > > =09WA_SET_BIT_MASKED(CACHE_MODE_1, > > =09=09=09 GEN8_4x4_STC_OPTIMIZATION_DISABLE); > > @@ -836,6 +846,11 @@ static int chv_init_workarounds(struct intel_e= ngine_cs *ring) > > =09=09=09 HDC_FORCE_NON_COHERENT | > > =09=09=09 HDC_DONOT_FETCH_MEM_WHEN_MASKED); > > =20 > > +=09/* According to the CACHE_MODE_0 default value documentation, s= ome > > +=09 * CHV platforms disable this optimization by default. Turn it= on. > > +=09 */ > > +=09WA_CLR_BIT_MASKED(CACHE_MODE_0_GEN7, HIZ_RAW_STALL_OPT_DISABLE)= ; > > + >=20 > I remember looking at this when the HSW version was done, and at the > time the docs claimed that the default value on gen8 was already good= . > Looks like the docs have been updated since then. Also my BSW agrees > that the disable bit is now set by default. >=20 > I suppose we could assume that since it works on HSW, it'll work on > gen8. However, I find it a bit suspicious that the later steppings se= em > to have changed the default to disable the optimization. IVB suffered= > from real problems with the optimization enabled and hence the IVB pa= tch > was reverted. IIRC Chia-I wrote some kind of test to demonstrate the > problem on IVB, so maybe you want to run it and make sure it still > works correctly on gen8. Here's the test: > http://permalink.gmane.org/gmane.comp.freedesktop.xorg.drivers.intel/= 35399 I just ran Chia-I's program on BSW, and it appears to be working fine. Classic swrast and i965/hardware both produced an identical image. =2D-Ken --nextPart3384708.LQFntQuRkr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJUtD90AAoJEFtb2gcdScw44A0P+gIo5kGl6SEdxRJKXCpWevfS dW2BeOv6EeVDxoBbc6GKOV8fgTZnYiEL/cb4OE7TbNWITS/x9qEdx/Ex7EjyvBpC 6RltfSqEuR9ERVCaGNIA2WZsHfNc2vLpxDSQ8bpkQU3waIxEW0wfMl/++XuE3G+N IHFilJzsi9ji5cbxJJGbnJ79xoEB/FE5OHEUgc8pI+Q049vzK4uXjFiNkCOXZjzB syWmLtJBn1UW3a1K4/ax88fPolobzD+UgSXwPYfGrAiL/ZiaYkeuCa7CrbteJ+X7 mKtQHqAUJLoUwbr6ZRzyo3RfmGTwmmtOlK1ocx9Q7toA4EjjvPN6q3XQf29co4x0 8MnZB6ddcyC9cdzVUJ6sef28w1TaPXr9RFnln+yClpwZSo2O3s8nTF0rNJR92QIq tLzCsI0dEHrEvLzRTHGwEJ5OEmxcOP2Unfar1u1ZvNdYshKST3t4Z6wMl0N0ifeG GPOQAmhJS5swwv+pNtIgkDNUYKNy40YuJS4phMFYJN80AOT7fDakbJn+YvF9alTx 1iF1gPN1tVOPtEuwKmJAgjWLHs7boc9i0Ee7CKHod3bGnyDnhffvs4wU3jWn4zbV LFQ1pMrKzu8kjA6X3jN5eF9GWOG12COybTg/ijs5ZliN1u2XMROgTBcj32R4kA4y ZmXjpZ8J7/sEIwiGF9e8 =nK5O -----END PGP SIGNATURE----- --nextPart3384708.LQFntQuRkr-- --===============0507914672== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pbnRlbC1nZngK --===============0507914672==--