From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kenneth Graunke Subject: Re: [PATCH] drm/i915: Enable the HiZ RAW Stall Optimization on Gen8. Date: Sun, 11 Jan 2015 19:05:21 -0800 Message-ID: <2114285.mhhyazVrFM@vakarian> References: <1420944289-832-1-git-send-email-kenneth@whitecape.org> <3086167.N74lbW7sKX@vakarian> <20150112014609.GA1677@bwidawsk.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0219143367==" Return-path: In-Reply-To: <20150112014609.GA1677@bwidawsk.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: mesa-dev-bounces@lists.freedesktop.org Sender: "mesa-dev" To: Ben Widawsky Cc: mesa-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Jesse Barnes List-Id: intel-gfx@lists.freedesktop.org --===============0219143367== Content-Type: multipart/signed; boundary="nextPart236850820.G690vMLt1E"; micalg="pgp-sha256"; protocol="application/pgp-signature" --nextPart236850820.G690vMLt1E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Sunday, January 11, 2015 05:46:09 PM Ben Widawsky wrote: > On Sun, Jan 11, 2015 at 04:05:25PM -0800, Kenneth Graunke wrote: > > On Sunday, January 11, 2015 01:49:41 PM Ben Widawsky wrote: > > > On Sat, Jan 10, 2015 at 06:44:49PM -0800, Kenneth Graunke wrote: > > > > This is an important optimization for avoiding read-after-write= (RAW) > > > > stalls in the HiZ buffer. Certain workloads would run very slo= wly with > > > > HiZ enabled, but run much faster with the "hiz=3Dfalse" driconf= option. > > > > With this patch, they run at full speed even with HiZ. > > > >=20 > > > > Improves performance in OglVSInstancing by 3.2x on Broadwell GT= 3e > > > > (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 th= e kernel > > > > instead of Mesa. It's probably better to do it there, since th= e kernel > > > > 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 int= el_engine_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, CACH= E_MODE_0: > > > > +=09 * "The Hierarchical Z RAW Stall Optimization allows non-ov= erlapping > > > > +=09 * polygons in the same 8x4 pixel/sample area to be proces= sed without > > > > +=09 * stalling waiting for the earlier ones to write to Hiera= rchical Z > > > > +=09 * buffer." > > > > +=09 * > > > > +=09 * This optimization is off by default for Broadwell; turn = it on. > > > > +=09 */ > > > > +=09WA_CLR_BIT_MASKED(CACHE_MODE_0_GEN7, HIZ_RAW_STALL_OPT_DISA= BLE); > > > > + > > > > =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 int= el_engine_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 documentatio= n, some > > > > +=09 * CHV platforms disable this optimization by default. Tur= n it on. > > > > +=09 */ > > > > +=09WA_CLR_BIT_MASKED(CACHE_MODE_0_GEN7, HIZ_RAW_STALL_OPT_DISA= BLE); > > > > + > > > > =09/* Improve HiZ throughput on CHV. */ > > > > =09WA_SET_BIT_MASKED(HIZ_CHICKEN, CHV_HZ_8X8_MODE_IN_1X); > > > > =20 > > >=20 > > > I think you should do this as two separate patches, 1 per platfor= m. For the BSW > > > patch (given that I had the same functionality in the kernel patc= h I asked you > > > to look at ;-) and FWIW, Jordan has numbers on BSW B-step with my= kernel patch > > > which we can use for the commit): > > > Signed-off-by: Ben Widawsky > >=20 > > Huh, I don't recall seeing that kernel patch. Sorry. I guess I'll= split it > > and resubmit... > >=20 >=20 > It's not my call, it's just nice to have platform specific bisection.= And the > patch wasn't on the list, it was the one I kept asking you to look at= in my > branch :-) >=20 > > > I haven't looked at Broadwell docs, so I'll let someone else take= care of that. > > >=20 > > > I don't know if I agree with Chris that we should call these in t= he workaround > > > section, but whatever. init_clock_gating is equally sucky. > >=20 > > init_clock_gating doesn't work. The register writes don't stick an= d they have > > no effect at all. Setting them here makes them actually take effec= t in the > > context. > >=20 > > --Ken >=20 > Separate thread now, but are you sure? We're setting at least two con= text > specific registers in there today, among them: GEN7_FF_THREAD_MODE (w= hich is > important to performance). It looks like we're setting: =2D [BDW] GAM_ECOCHK - 0x4090 =2D [BDW] CHICKEN_PAR1_1 - 0x42080 =2D [BDW] RC_SLEEP_PSMI_CONTROL - 0x2050 =2D [BDW, CHV] UCGCTL6 - 0x9430 =2D [BDW, CHV] FF_THREAD_MODE - 0x20a0 =2D [CHV] DSPCLK_GATE_D - display =2D [CHV] MI_ARB_VLV - display =2D [CHV] RC_SLEEP_PSMI_CONTROL - 0x12050 =2D [CHV] UCGCTL1 - 0x9400 I searched for all of these in the "Register State Context" tables for = BDW and CHV, and I didn't see any of them listed (including FF_THREAD_MODE = or 0x20a0). So I'm pretty sure these are not part of the context, and so = they should work. =2D-Ken --nextPart236850820.G690vMLt1E 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 iQIcBAABCAAGBQJUsznxAAoJEFtb2gcdScw4gQwQAJD7268Uwq+bNhqU/V+zvXSk 0rfy+Q8etA+aJJeIsEeuYJf7BJ1cPUnXswwei9a9JnaZ3rtsWixEjACW1xez6Ait zczanzzLo0jGbmcAA3iPO9M27AiKxF8hVU5LGC3McHhOod4XBeaOq0W0scFTpXcz 5IYkUgvB3SLQZ+ezhP3FejsGTQjURCTQqTf+mEECy93Nu5CzU4tIUnwomhliJEcG u8ss4EgZ9akdRLvdP2i1ggbkLy00DQ1rslZ4RhQPOj9pXneJ1SX9xz9F1W0a2+Xy E76JoA13i03IaGG203vh8VaqznOvmcqyIJay+Bezg9fKhdWcDpNpGz9S/i7P3Tso B02TIxsnpFsWy1LsXCoch4qBFqLbCGXpSAaJ66ZlU16sP/vX3QS9V63FGHmzM6w8 Zmo4kHiZclJVqFZfi1lxSt8pHwlvmBcvxcsnLAfHh1aoP6ScPuPcm7KcFd0ZqrYp V1iT/2Bosr7yObgUai9G+Hna2xydE0PYOYQtlMI0r2HggULh5q0Npa8bOEFep4dX Nclj7SlSksoSCdx4XDpJdPmPlmzqtt1ULpZ04Q3dkpO64VbRVnMNqG6QvjlSSgLy 56evahNrsEhi0nQDHg6iV+1IEjFZ70P7ZwPYmKTi8DTMMLR6I36OKjnY+cRFyoT3 HvZsI/vDdJMUGSsm6li1 =RoHD -----END PGP SIGNATURE----- --nextPart236850820.G690vMLt1E-- --===============0219143367== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbWVzYS1kZXYg bWFpbGluZyBsaXN0Cm1lc2EtZGV2QGxpc3RzLmZyZWVkZXNrdG9wLm9yZwpodHRwOi8vbGlzdHMu ZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vbWVzYS1kZXYK --===============0219143367==--