diff mbox

[SRU,xenial] UBUNTU: SAUCE: i915_bpo: Sync with v4.7

Message ID 1470310116-3844-1-git-send-email-tjaalton@ubuntu.com
State New
Headers show

Commit Message

Timo Aaltonen Aug. 4, 2016, 11:28 a.m. UTC
BugLink: http://bugs.launchpad.net/bugs/1609742

Sync with v4.7 and un-revert 280201ac81f which got fixed upstream.

Also drop two workarounds from 9f81d279c08:

drm/i915/edp: Add WaKVMNotificationOnConfigChange:bdw
- it's only for BDW which doesn't use i915_bpo

drm/i915/skl: Add WAC6entrylatency
- it didn't end up in 4.7

Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
---
 ubuntu/i915/i915_drv.h          |  5 +++++
 ubuntu/i915/i915_gem_shrinker.c |  2 +-
 ubuntu/i915/i915_reg.h          | 11 +++++------
 ubuntu/i915/intel_bios.c        | 20 +++++++++++++++-----
 ubuntu/i915/intel_csr.c         | 30 +++++++++++++++++++-----------
 ubuntu/i915/intel_display.c     |  6 ++++++
 ubuntu/i915/intel_dp.c          |  2 +-
 ubuntu/i915/intel_lrc.c         |  9 +++++----
 ubuntu/i915/intel_opregion.c    | 39 +++++++++++++++++++++++++++++++++++++++
 ubuntu/i915/intel_pm.c          | 12 ++++--------
 ubuntu/i915/intel_ringbuffer.c  |  6 ++++--
 11 files changed, 104 insertions(+), 38 deletions(-)

Comments

Stefan Bader Aug. 4, 2016, 12:36 p.m. UTC | #1
On 04.08.2016 13:28, Timo Aaltonen wrote:
> BugLink: http://bugs.launchpad.net/bugs/1609742

Ugly and not reviewable. Only reason to ack is testing and the fact that the bpo
driver is already a hack only used for the newer gpus.

-Stefan

> 
> Sync with v4.7 and un-revert 280201ac81f which got fixed upstream.
> 
> Also drop two workarounds from 9f81d279c08:
> 
> drm/i915/edp: Add WaKVMNotificationOnConfigChange:bdw
> - it's only for BDW which doesn't use i915_bpo
> 
> drm/i915/skl: Add WAC6entrylatency
> - it didn't end up in 4.7
> 
> Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Kamal Mostafa Aug. 4, 2016, 4:12 p.m. UTC | #2

diff mbox

Patch

diff --git a/ubuntu/i915/i915_drv.h b/ubuntu/i915/i915_drv.h
index d39737c..17ea268 100644
--- a/ubuntu/i915/i915_drv.h
+++ b/ubuntu/i915/i915_drv.h
@@ -3508,6 +3508,7 @@  extern int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
 					 bool enable);
 extern int intel_opregion_notify_adapter(struct drm_device *dev,
 					 pci_power_t state);
+extern int intel_opregion_get_panel_type(struct drm_device *dev);
 #else
 static inline int intel_opregion_setup(struct drm_device *dev) { return 0; }
 static inline void intel_opregion_init(struct drm_device *dev) { return; }
@@ -3523,6 +3524,10 @@  intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)
 {
 	return 0;
 }
+static inline int intel_opregion_get_panel_type(struct drm_device *dev)
+{
+	return -ENODEV;
+}
 #endif
 
 /* intel_acpi.c */
diff --git a/ubuntu/i915/i915_gem_shrinker.c b/ubuntu/i915/i915_gem_shrinker.c
index 5d40a17..27f7436 100644
--- a/ubuntu/i915/i915_gem_shrinker.c
+++ b/ubuntu/i915/i915_gem_shrinker.c
@@ -39,7 +39,7 @@  static bool mutex_is_locked_by(struct mutex *mutex, struct task_struct *task)
 	if (!mutex_is_locked(mutex))
 		return false;
 
-#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_MUTEXES)
+#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)
 	return mutex->owner == task;
 #else
 	/* Since UP may be pre-empted, we cannot assume that we own the lock */
diff --git a/ubuntu/i915/i915_reg.h b/ubuntu/i915/i915_reg.h
index 5b779b9..3fcf7dd 100644
--- a/ubuntu/i915/i915_reg.h
+++ b/ubuntu/i915/i915_reg.h
@@ -1810,6 +1810,10 @@  enum skl_disp_power_wells {
 #define   GEN9_IZ_HASHING_MASK(slice)			(0x3 << ((slice) * 2))
 #define   GEN9_IZ_HASHING(slice, val)			((val) << ((slice) * 2))
 
+/* chicken reg for WaConextSwitchWithConcurrentTLBInvalidate */
+#define GEN9_CSFE_CHICKEN1_RCS _MMIO(0x20D4)
+#define   GEN9_PREEMPT_GPGPU_SYNC_SWITCH_DISABLE (1 << 2)
+
 /* WaClearTdlStateAckDirtyBits */
 #define GEN8_STATE_ACK		_MMIO(0x20F0)
 #define GEN9_STATE_ACK_SLICE1	_MMIO(0x20F8)
@@ -2167,9 +2171,6 @@  enum skl_disp_power_wells {
 
 #define FBC_LL_SIZE		(1536)
 
-#define FBC_LLC_READ_CTRL	_MMIO(0x9044)
-#define   FBC_LLC_FULLY_OPEN	(1<<30)
-
 /* Framebuffer compression for GM45+ */
 #define DPFC_CB_BASE		_MMIO(0x3200)
 #define DPFC_CONTROL		_MMIO(0x3208)
@@ -6042,9 +6043,7 @@  enum skl_disp_power_wells {
 #define CHICKEN_PAR1_1		_MMIO(0x42080)
 #define  DPA_MASK_VBLANK_SRD	(1 << 15)
 #define  FORCE_ARB_IDLE_PLANES	(1 << 14)
-
-#define CHICKEN_PAR2_1		_MMIO(0x42090)
-#define  KVM_CONFIG_CHANGE_NOTIFICATION_SELECT	(1 << 14)
+#define  SKL_EDP_PSR_FIX_RDWRAP	(1 << 3)
 
 #define _CHICKEN_PIPESL_1_A	0x420b0
 #define _CHICKEN_PIPESL_1_B	0x420b4
diff --git a/ubuntu/i915/intel_bios.c b/ubuntu/i915/intel_bios.c
index 017dfd0..b9022fa 100644
--- a/ubuntu/i915/intel_bios.c
+++ b/ubuntu/i915/intel_bios.c
@@ -210,19 +210,29 @@  parse_lfp_panel_data(struct drm_i915_private *dev_priv,
 	struct drm_display_mode *panel_fixed_mode;
 	int panel_type;
 	int drrs_mode;
+	int ret;
 
 	lvds_options = find_section(bdb, BDB_LVDS_OPTIONS);
 	if (!lvds_options)
 		return;
 
 	dev_priv->vbt.lvds_dither = lvds_options->pixel_dither;
-	if (lvds_options->panel_type > 0xf) {
-		DRM_DEBUG_KMS("Invalid VBT panel type 0x%x\n",
-			      lvds_options->panel_type);
-		return;
+
+	ret = intel_opregion_get_panel_type(dev_priv->dev);
+	if (ret >= 0) {
+		WARN_ON(ret > 0xf);
+		panel_type = ret;
+		DRM_DEBUG_KMS("Panel type: %d (OpRegion)\n", panel_type);
+	} else {
+		if (lvds_options->panel_type > 0xf) {
+			DRM_DEBUG_KMS("Invalid VBT panel type 0x%x\n",
+				      lvds_options->panel_type);
+			return;
+		}
+		panel_type = lvds_options->panel_type;
+		DRM_DEBUG_KMS("Panel type: %d (VBT)\n", panel_type);
 	}
 
-	panel_type = lvds_options->panel_type;
 	dev_priv->vbt.panel_type = panel_type;
 
 	drrs_mode = (lvds_options->dps_panel_type_bits
diff --git a/ubuntu/i915/intel_csr.c b/ubuntu/i915/intel_csr.c
index a34c23e..2b3b428 100644
--- a/ubuntu/i915/intel_csr.c
+++ b/ubuntu/i915/intel_csr.c
@@ -41,16 +41,22 @@ 
  * be moved to FW_FAILED.
  */
 
+#define I915_CSR_KBL "i915/kbl_dmc_ver1.bin"
+MODULE_FIRMWARE(I915_CSR_KBL);
+#define KBL_CSR_VERSION_REQUIRED	CSR_VERSION(1, 1)
+
 #define I915_CSR_SKL "i915/skl_dmc_ver1.bin"
+MODULE_FIRMWARE(I915_CSR_SKL);
+#define SKL_CSR_VERSION_REQUIRED	CSR_VERSION(1, 23)
+
 #define I915_CSR_BXT "i915/bxt_dmc_ver1.bin"
+MODULE_FIRMWARE(I915_CSR_BXT);
+#define BXT_CSR_VERSION_REQUIRED	CSR_VERSION(1, 7)
 
 #define FIRMWARE_URL  "https://01.org/linuxgraphics/intel-linux-graphics-firmwares"
 
-MODULE_FIRMWARE(I915_CSR_SKL);
-MODULE_FIRMWARE(I915_CSR_BXT);
 
-#define SKL_CSR_VERSION_REQUIRED	CSR_VERSION(1, 23)
-#define BXT_CSR_VERSION_REQUIRED	CSR_VERSION(1, 7)
+
 
 #define CSR_MAX_FW_SIZE			0x2FFF
 #define CSR_DEFAULT_FW_OFFSET		0xFFFFFFFF
@@ -169,12 +175,10 @@  struct stepping_info {
 	char substepping;
 };
 
-/*
- * Kabylake derivated from Skylake H0, so SKL H0
- * is the right firmware for KBL A0 (revid 0).
- */
 static const struct stepping_info kbl_stepping_info[] = {
-	{'H', '0'}, {'I', '0'}
+	{'A', '0'}, {'B', '0'}, {'C', '0'},
+	{'D', '0'}, {'E', '0'}, {'F', '0'},
+	{'G', '0'}, {'H', '0'}, {'I', '0'},
 };
 
 static const struct stepping_info skl_stepping_info[] = {
@@ -298,7 +302,9 @@  static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv,
 
 	csr->version = css_header->version;
 
-	if (IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv)) {
+	if (IS_KABYLAKE(dev_priv)) {
+		required_min_version = KBL_CSR_VERSION_REQUIRED;
+	} else if (IS_SKYLAKE(dev_priv)) {
 		required_min_version = SKL_CSR_VERSION_REQUIRED;
 	} else if (IS_BROXTON(dev_priv)) {
 		required_min_version = BXT_CSR_VERSION_REQUIRED;
@@ -446,7 +452,9 @@  void intel_csr_ucode_init(struct drm_i915_private *dev_priv)
 	if (!HAS_CSR(dev_priv))
 		return;
 
-	if (IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv))
+	if (IS_KABYLAKE(dev_priv))
+		csr->fw_path = I915_CSR_KBL;
+	else if (IS_SKYLAKE(dev_priv))
 		csr->fw_path = I915_CSR_SKL;
 	else if (IS_BROXTON(dev_priv))
 		csr->fw_path = I915_CSR_BXT;
diff --git a/ubuntu/i915/intel_display.c b/ubuntu/i915/intel_display.c
index f46500c..a331a24 100644
--- a/ubuntu/i915/intel_display.c
+++ b/ubuntu/i915/intel_display.c
@@ -11997,6 +11997,12 @@  static int intel_crtc_atomic_check(struct drm_crtc *crtc,
 		ret = intel_color_check(crtc, crtc_state);
 		if (ret)
 			return ret;
+
+		/*
+		 * Changing color management on Intel hardware is
+		 * handled as part of planes update.
+		 */
+		crtc_state->planes_changed = true;
 	}
 
 	ret = 0;
diff --git a/ubuntu/i915/intel_dp.c b/ubuntu/i915/intel_dp.c
index 641b1c75..94b3571 100644
--- a/ubuntu/i915/intel_dp.c
+++ b/ubuntu/i915/intel_dp.c
@@ -4645,7 +4645,7 @@  intel_dp_detect(struct drm_connector *connector, bool force)
 
 	intel_dp->detect_done = false;
 
-	if (intel_connector->detect_edid)
+	if (is_edp(intel_dp) || intel_connector->detect_edid)
 		return connector_status_connected;
 	else
 		return connector_status_disconnected;
diff --git a/ubuntu/i915/intel_lrc.c b/ubuntu/i915/intel_lrc.c
index 17a3af2..7f2d841 100644
--- a/ubuntu/i915/intel_lrc.c
+++ b/ubuntu/i915/intel_lrc.c
@@ -1103,6 +1103,7 @@  static inline int gen8_emit_flush_coherentl3_wa(struct intel_engine_cs *engine,
 						uint32_t *const batch,
 						uint32_t index)
 {
+	struct drm_i915_private *dev_priv = engine->dev->dev_private;
 	uint32_t l3sqc4_flush = (0x40400000 | GEN8_LQSC_FLUSH_COHERENT_LINES);
 
 	/*
@@ -1111,9 +1112,8 @@  static inline int gen8_emit_flush_coherentl3_wa(struct intel_engine_cs *engine,
 	 * this batch updates GEN8_L3SQCREG4 with default value we need to
 	 * set this bit here to retain the WA during flush.
 	 */
-
-	if (IS_SKL_REVID(engine->dev, 0, SKL_REVID_E0) ||
-	    IS_KBL_REVID(engine->dev, 0, KBL_REVID_E0))
+	if (IS_SKL_REVID(dev_priv, 0, SKL_REVID_E0) ||
+	    IS_KBL_REVID(dev_priv, 0, KBL_REVID_E0))
 		l3sqc4_flush |= GEN8_LQSC_RO_PERF_DIS;
 
 	wa_ctx_emit(batch, index, (MI_STORE_REGISTER_MEM_GEN8 |
@@ -1275,6 +1275,7 @@  static int gen9_init_indirectctx_bb(struct intel_engine_cs *engine,
 {
 	int ret;
 	struct drm_device *dev = engine->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t index = wa_ctx_start(wa_ctx, *offset, CACHELINE_DWORDS);
 
 	/* WaDisableCtxRestoreArbitration:skl,bxt */
@@ -1290,7 +1291,7 @@  static int gen9_init_indirectctx_bb(struct intel_engine_cs *engine,
 
 	/* WaClearSlmSpaceAtContextSwitch:kbl */
 	/* Actual scratch location is at 128 bytes offset */
-	if (IS_KBL_REVID(engine->dev, 0, KBL_REVID_A0)) {
+	if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_A0)) {
 		uint32_t scratch_addr
 			= engine->scratch.gtt_offset + 2*CACHELINE_BYTES;
 
diff --git a/ubuntu/i915/intel_opregion.c b/ubuntu/i915/intel_opregion.c
index 0c7cf16..16e209d 100644
--- a/ubuntu/i915/intel_opregion.c
+++ b/ubuntu/i915/intel_opregion.c
@@ -1012,3 +1012,42 @@  err_out:
 	memunmap(base);
 	return err;
 }
+
+int
+intel_opregion_get_panel_type(struct drm_device *dev)
+{
+	u32 panel_details;
+	int ret;
+
+	ret = swsci(dev, SWSCI_GBDA_PANEL_DETAILS, 0x0, &panel_details);
+	if (ret) {
+		DRM_DEBUG_KMS("Failed to get panel details from OpRegion (%d)\n",
+			      ret);
+		return ret;
+	}
+
+	ret = (panel_details >> 8) & 0xff;
+	if (ret > 0x10) {
+		DRM_DEBUG_KMS("Invalid OpRegion panel type 0x%x\n", ret);
+		return -EINVAL;
+	}
+
+	/* fall back to VBT panel type? */
+	if (ret == 0x0) {
+		DRM_DEBUG_KMS("No panel type in OpRegion\n");
+		return -ENODEV;
+	}
+
+	/*
+	 * FIXME On Dell XPS 13 9350 the OpRegion panel type (0) gives us
+	 * low vswing for eDP, whereas the VBT panel type (2) gives us normal
+	 * vswing instead. Low vswing results in some display flickers, so
+	 * let's simply ignore the OpRegion panel type on SKL for now.
+	 */
+	if (IS_SKYLAKE(dev)) {
+		DRM_DEBUG_KMS("Ignoring OpRegion panel type (%d)\n", ret - 1);
+		return -ENODEV;
+	}
+
+	return ret - 1;
+}
diff --git a/ubuntu/i915/intel_pm.c b/ubuntu/i915/intel_pm.c
index af64860..320d8e6 100644
--- a/ubuntu/i915/intel_pm.c
+++ b/ubuntu/i915/intel_pm.c
@@ -58,6 +58,10 @@  static void gen9_init_clock_gating(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
+	/* See Bspec note for PSR2_CTL bit 31, Wa#828:skl,bxt,kbl */
+	I915_WRITE(CHICKEN_PAR1_1,
+		   I915_READ(CHICKEN_PAR1_1) | SKL_EDP_PSR_FIX_RDWRAP);
+
 	I915_WRITE(GEN8_CONFIG0,
 		   I915_READ(GEN8_CONFIG0) | GEN9_DEFAULT_FIXES);
 
@@ -6749,10 +6753,6 @@  static void skylake_init_clock_gating(struct drm_device *dev)
 
 	gen9_init_clock_gating(dev);
 
-	/* WAC6entrylatency:skl */
-	I915_WRITE(FBC_LLC_READ_CTRL, I915_READ(FBC_LLC_READ_CTRL) |
-		   FBC_LLC_FULLY_OPEN);
-
 	/* WaFbcNukeOnHostModify:skl */
 	I915_WRITE(ILK_DPFC_CHICKEN, I915_READ(ILK_DPFC_CHICKEN) |
 		   ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
@@ -6815,10 +6815,6 @@  static void broadwell_init_clock_gating(struct drm_device *dev)
 	 */
 	I915_WRITE(HSW_GTT_CACHE_EN, GTT_CACHE_EN_ALL);
 
-	/* WaKVMNotificationOnConfigChange:bdw */
-	I915_WRITE(CHICKEN_PAR2_1, I915_READ(CHICKEN_PAR2_1)
-		   | KVM_CONFIG_CHANGE_NOTIFICATION_SELECT);
-
 	lpt_init_clock_gating(dev);
 }
 
diff --git a/ubuntu/i915/intel_ringbuffer.c b/ubuntu/i915/intel_ringbuffer.c
index c363d31..c2858f1 100644
--- a/ubuntu/i915/intel_ringbuffer.c
+++ b/ubuntu/i915/intel_ringbuffer.c
@@ -915,6 +915,9 @@  static int gen9_init_workarounds(struct intel_engine_cs *engine)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int ret;
 
+	/* WaConextSwitchWithConcurrentTLBInvalidate:skl,bxt,kbl */
+	I915_WRITE(GEN9_CSFE_CHICKEN1_RCS, _MASKED_BIT_ENABLE(GEN9_PREEMPT_GPGPU_SYNC_SWITCH_DISABLE));
+
 	/* WaEnableLbsSlaRetryTimerDecrement:skl,bxt,kbl */
 	I915_WRITE(BDW_SCRATCH1, I915_READ(BDW_SCRATCH1) |
 		   GEN9_LBS_SLA_RETRY_TIMER_DECREMENT_ENABLE);
@@ -1196,8 +1199,7 @@  static int bxt_init_workarounds(struct intel_engine_cs *engine)
 
 static int kbl_init_workarounds(struct intel_engine_cs *engine)
 {
-	struct drm_device *dev = engine->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = engine->dev->dev_private;
 	int ret;
 
 	ret = gen9_init_workarounds(engine);