From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kenneth Graunke Subject: Re: [PATCH] drm/i915: Enable provoking vertex fix on Gen9 systems. Date: Fri, 15 Jun 2018 22:07:19 -0700 Message-ID: <3469060.PRjB1TPXYG@kirito> References: <20180614215328.2182-1-kenneth@whitecape.org> <20180615190605.16238-1-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1730632164==" Return-path: Received: from smtp89.ord1d.emailsrvr.com (smtp89.ord1d.emailsrvr.com [184.106.54.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7EC2F6E28B for ; Sat, 16 Jun 2018 05:16:42 +0000 (UTC) In-Reply-To: <20180615190605.16238-1-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Chris Wilson Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============1730632164== Content-Type: multipart/signed; boundary="nextPart2257002.CZQ2zJfJ3Y"; micalg="pgp-sha256"; protocol="application/pgp-signature" --nextPart2257002.CZQ2zJfJ3Y Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Friday, June 15, 2018 12:06:05 PM PDT Chris Wilson wrote: > From: Kenneth Graunke > > The SF and clipper units mishandle the provoking vertex in some cases, > which can cause misrendering with shaders that use flat shaded inputs. > > There are chicken bits in 3D_CHICKEN3 (for SF) and FF_SLICE_CHICKEN > (for the clipper) that work around the issue. These registers are > unfortunately not part of the logical context (even the power context), > and so we must reload them every time we start executing in a context. > > Bugzilla: https://bugs.freedesktop.org/103047 > Signed-off-by: Chris Wilson > --- > > This is only being set for gen9 right now, do we need it for gen10+? The 3D_CHICKEN3 bit is labeled as SKL and KBL. The FF_SLICE_CHICKEN bit is labeled as SKL, with no mention of KBL...but the Windows driver appears to set both on all Gen 9. It doesn't look like it sets them on Gen 10, nor is documented to be necessary. (I haven't brought up a Cannonlake to test it, though...) It looks like some of these registers are gone or reworked on Icelake, so Gen9-only sounds good to me. > Ken, I also need your s-o-b. Oops, sorry...got out of the habit of adding that... Signed-off-by: Kenneth Graunke Feel free to take authorship if you prefer - you've done much more work on it than I have at this point. :) Your call. Thanks for fixing it up and getting it landed, by the way! It's a bummer that we have to do it here...but it seems like the only place that it can realistically happen, with the power context issue. It would be nice to Cc this to stable, but it seems like a lot of the workaround code has changed a lot in the meantime, so not sure how well it'd apply... > An open question is how to record such w/a for easy checking from > userspace. Though something like this might be better as part of an > independent verification tool. > -Chris > --- > drivers/gpu/drm/i915/i915_reg.h | 5 +++++ > drivers/gpu/drm/i915/intel_lrc.c | 12 +++++++++++- > 2 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h > index b8c0ebd50889..54ec7ab57ce8 100644 > --- a/drivers/gpu/drm/i915/i915_reg.h > +++ b/drivers/gpu/drm/i915/i915_reg.h > @@ -2432,12 +2432,17 @@ enum i915_power_well_id { > #define _3D_CHICKEN _MMIO(0x2084) > #define _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB (1 << 10) > #define _3D_CHICKEN2 _MMIO(0x208c) > + > +#define FF_SLICE_CHICKEN _MMIO(0x2088) > +#define FF_SLICE_CHICKEN_CL_PROVOKING_VERTEX_FIX (1 << 1) > + > /* Disables pipelining of read flushes past the SF-WIZ interface. > * Required on all Ironlake steppings according to the B-Spec, but the > * particular danger of not doing so is not specified. > */ > # define _3D_CHICKEN2_WM_READ_PIPELINED (1 << 14) > #define _3D_CHICKEN3 _MMIO(0x2090) > +#define _3D_CHICKEN_SF_PROVOKING_VERTEX_FIX (1 << 12) > #define _3D_CHICKEN_SF_DISABLE_OBJEND_CULL (1 << 10) > #define _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE (1 << 5) > #define _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL (1 << 5) > diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c > index 839cb1fc6a01..2b0ae552cc4e 100644 > --- a/drivers/gpu/drm/i915/intel_lrc.c > +++ b/drivers/gpu/drm/i915/intel_lrc.c > @@ -1575,11 +1575,21 @@ static u32 *gen9_init_indirectctx_bb(struct intel_engine_cs *engine, u32 *batch) > /* WaFlushCoherentL3CacheLinesAtContextSwitch:skl,bxt,glk */ > batch = gen8_emit_flush_coherentl3_wa(engine, batch); > > + *batch++ = MI_LOAD_REGISTER_IMM(3); > + > /* WaDisableGatherAtSetShaderCommonSlice:skl,bxt,kbl,glk */ > - *batch++ = MI_LOAD_REGISTER_IMM(1); > *batch++ = i915_mmio_reg_offset(COMMON_SLICE_CHICKEN2); > *batch++ = _MASKED_BIT_DISABLE( > GEN9_DISABLE_GATHER_AT_SET_SHADER_COMMON_SLICE); > + > + /* BSpec: 11391 */ > + *batch++ = i915_mmio_reg_offset(FF_SLICE_CHICKEN); > + *batch++ = _MASKED_BIT_ENABLE(FF_SLICE_CHICKEN_CL_PROVOKING_VERTEX_FIX); > + > + /* BSpec: 11299 */ > + *batch++ = i915_mmio_reg_offset(_3D_CHICKEN3); > + *batch++ = _MASKED_BIT_ENABLE(_3D_CHICKEN_SF_PROVOKING_VERTEX_FIX); > + > *batch++ = MI_NOOP; > > /* WaClearSlmSpaceAtContextSwitch:kbl */ > --nextPart2257002.CZQ2zJfJ3Y Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE6OtbNAgc4e6ibv4ZW1vaBx1JzDgFAlskmwcACgkQW1vaBx1J zDiGZw//QM3Ck+YTyz0XxvAHin21bMaFxWotK5WV15DhvHrXn+61kuJrgUN89bes M6whB5YI1HltvUnQyw7Irzh96Z8fo1Qx3/iGJoF1xS79HH3puAsNhnODQRqFAw0w iWRrzSm1W/2HJtHU/ZsJQDywVoutBoe/1E/nQuNUAQnnLyEit0HTyfsrOnvb89U3 N5aSEXYZXeT/AKd5Q9oEfpIaSJ6oqxixIeBZeXDegir1ROkFCmuBZKrkfwpBObsg cFvSivRg3Cz2WgN5PVbP8Z3lGyITOPxBXRw3r2SdeNLSQBqrc+ECkxfkGKsTKcp1 4tDq+7PPkmIrnMcFWX/Ooz9rdnDXVB4EKyY8EsIcHuZxkrnL9cfpNhX/fbIEedFt bVbNiFQmAutTbC8eN8x3FUiUm9lZSHixYDroEDQUDuCUaDwoM6KMH3U+C86lALrb 02F+Uge3W1bSzgZzPW7oHehr4RtYVqB7FbLlIQnU4jyGsdbe9dqTERHOgr4JWWrx UT2bO3At7R+X1grVZTK7ZPg3KnDHlc3HzNgrDE9kNZc27tY/0XzCQEevrO4+/b1k bUB3YsMthuSqVwIaSVA5WnJXlj+Qeqrn/xNXT9DeNVf32epVv4ODWniRcJU6OkK2 l5O0BqCgEHqykFfuxQgfD1cWTSeJ5cd69akKe6cvBUK8sBMGMJg= =dUyS -----END PGP SIGNATURE----- --nextPart2257002.CZQ2zJfJ3Y-- --===============1730632164== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============1730632164==--