Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1409659imm; Thu, 5 Jul 2018 22:50:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfIeLRciD8nRFYMlTd4pOvuuXnHG0dpfplItiyCcPbWbq1gckYTBbYIhBfY4rmZNsWSWPgs X-Received: by 2002:a17:902:8607:: with SMTP id f7-v6mr9081980plo.138.1530856239824; Thu, 05 Jul 2018 22:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856239; cv=none; d=google.com; s=arc-20160816; b=JUHuA6bUKMxeLwbZ08Bi1X3V5VVEEZYY5vU7rVGmjom/lv5TM216WUpYxJZ8YprPnv LsXei9dkUGdm/qsLku5VTz1E2yLAD/LUiVtgTkAaC4tD8qO2X63CbCj6OW8WTylKWfuD qss2fzRAs0t6MiOdPWq4qGd34TiEIsD8xpe6Zb3fmvrPsZ7XumnDQo8otBTzwMBib7RR /7Zg1ueiiK+GgFVtz1R2fdUROsmeazkemmS8KUYJnNfM9EJan28q+Agu1yGNsODiyVnP jLrZ7nRuTOu8oMiCPjv6VI6gdFNVZFM5Em+gp9cIFFPrWrf2ckIzFOMRLMx0mqlu5Ipc XBFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=J8j53JhJ9Am1rE3pCtVmCpLsot/BW5PinawZVutjtEE=; b=z/KQyKFwkcHa85EIn32yunLfxHeMdceDTbk9KXPn7NEHymxqTvtMozv1l7AjwG3Pag cuYdsxTGfL+/AMQuJBB1yDsdXZsjohvAasdu1mxYfLzna/qHsVTwhibP3JtbAtilpwkV Bwk/7I/vdnm4yWaaHr5rBfjbVfp+z0LGrylO7KMuZMtyzrQcR4Cw21ku7CgxxKA9mvIh BsrLYElSfxXgeIUIo/tKoEMK3RwIjoPtMdedKjeUNyGsGL0PzAdFxm+Q3RwUlY7ONbda dzSDN3YnFKwJNIUSDymaTN051hgzNf9cm33yxjimW71d279OG0p7v/2a0jeZFEAgnf8X gHEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23-v6si7347282pls.101.2018.07.05.22.50.25; Thu, 05 Jul 2018 22:50:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933335AbeGFFtC (ORCPT + 99 others); Fri, 6 Jul 2018 01:49:02 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60156 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932439AbeGFFtA (ORCPT ); Fri, 6 Jul 2018 01:49:00 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E6098BA2; Fri, 6 Jul 2018 05:48:59 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kenneth Graunke , Chris Wilson , Joonas Lahtinen , Jani Nikula Subject: [PATCH 4.17 40/46] drm/i915: Enable provoking vertex fix on Gen9 systems. Date: Fri, 6 Jul 2018 07:47:01 +0200 Message-Id: <20180706054526.495218065@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054524.595521988@linuxfoundation.org> References: <20180706054524.595521988@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kenneth Graunke commit 7a3727f385dc64773db1c144f6b15c1e9d4735bb upstream. 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: Kenneth Graunke Signed-off-by: Chris Wilson Link: https://patchwork.freedesktop.org/patch/msgid/20180615190605.16238-1-chris@chris-wilson.co.uk Reviewed-by: Joonas Lahtinen Cc: stable@vger.kernel.org (cherry picked from commit b77422f80337d363eed60c8c48db9cb6e33085c9) Signed-off-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/i915_reg.h | 5 +++++ drivers/gpu/drm/i915/intel_lrc.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -2565,12 +2565,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) --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -1386,11 +1386,21 @@ static u32 *gen9_init_indirectctx_bb(str /* 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 */