Skip to contentSkip to conversation

Supporting fused display configurations v4

PATCH In review Damien Lespiau 5 participants 19 messages Jan 6, 2014 – Jan 26, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Follow up of the v3:
http://lists.freedesktop.org/archives/intel-gfx/2013-December/037333.html

The main change is the removal of INTEL_INFO() from the driver (patches 1 to 5), a clean-up suggested by Chris: the usage of that macro hides that we go from dev to dev_priv while we could use the dev_priv pointer that is usually available.

Patch 6 is also new, a minor clean-up while at it.

The remaining patches are rebased on top of the INTEL_INFO() change.

Signature · 1 line
Damien
#1 lore raw

PATCH 1/12 drm/i915: Get rid of the INTEL_INFO() usage in i915_drv.h

While the longer goal is to have dev_priv == dev by properly subclassing struct drm_device, quite a few macros in i915_drv.h need the dev argument. Let's not try to disrupt everything yet and just remove their usage of INTEL_INFO() as a first step.

---
 drivers/gpu/drm/i915/i915_drv.h | 81 +++++++++++++++++++++--------------------
 1 file changed, 41 insertions(+), 40 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +41 -40
index cc8afff..e9c3339 100644
@@ -156,7 +156,8 @@ enum hpd_pin {
 	 I915_GEM_DOMAIN_INSTRUCTION | \
 	 I915_GEM_DOMAIN_VERTEX)
 
-#define for_each_pipe(p) for ((p) = 0; (p) < INTEL_INFO(dev)->num_pipes; (p)++)
+#define for_each_pipe(p) \
+	for ((p) = 0; (p) < to_i915(dev)->info->num_pipes; (p)++)
 
 #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
 	list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
@@ -1775,32 +1776,32 @@ struct drm_i915_file_private {
 
 #define IS_I830(dev)		((dev)->pdev->device == 0x3577)
 #define IS_845G(dev)		((dev)->pdev->device == 0x2562)
-#define IS_I85X(dev)		(INTEL_INFO(dev)->is_i85x)
+#define IS_I85X(dev)		(to_i915(dev)->info->is_i85x)
 #define IS_I865G(dev)		((dev)->pdev->device == 0x2572)
-#define IS_I915G(dev)		(INTEL_INFO(dev)->is_i915g)
+#define IS_I915G(dev)		(to_i915(dev)->info->is_i915g)
 #define IS_I915GM(dev)		((dev)->pdev->device == 0x2592)
 #define IS_I945G(dev)		((dev)->pdev->device == 0x2772)
-#define IS_I945GM(dev)		(INTEL_INFO(dev)->is_i945gm)
-#define IS_BROADWATER(dev)	(INTEL_INFO(dev)->is_broadwater)
-#define IS_CRESTLINE(dev)	(INTEL_INFO(dev)->is_crestline)
+#define IS_I945GM(dev)		(to_i915(dev)->info->is_i945gm)
+#define IS_BROADWATER(dev)	(to_i915(dev)->info->is_broadwater)
+#define IS_CRESTLINE(dev)	(to_i915(dev)->info->is_crestline)
 #define IS_GM45(dev)		((dev)->pdev->device == 0x2A42)
-#define IS_G4X(dev)		(INTEL_INFO(dev)->is_g4x)
+#define IS_G4X(dev)		(to_i915(dev)->info->is_g4x)
 #define IS_PINEVIEW_G(dev)	((dev)->pdev->device == 0xa001)
 #define IS_PINEVIEW_M(dev)	((dev)->pdev->device == 0xa011)
-#define IS_PINEVIEW(dev)	(INTEL_INFO(dev)->is_pineview)
-#define IS_G33(dev)		(INTEL_INFO(dev)->is_g33)
+#define IS_PINEVIEW(dev)	(to_i915(dev)->info->is_pineview)
+#define IS_G33(dev)		(to_i915(dev)->info->is_g33)
 #define IS_IRONLAKE_M(dev)	((dev)->pdev->device == 0x0046)
-#define IS_IVYBRIDGE(dev)	(INTEL_INFO(dev)->is_ivybridge)
+#define IS_IVYBRIDGE(dev)	(to_i915(dev)->info->is_ivybridge)
 #define IS_IVB_GT1(dev)		((dev)->pdev->device == 0x0156 || \
 				 (dev)->pdev->device == 0x0152 || \
 				 (dev)->pdev->device == 0x015a)
 #define IS_SNB_GT1(dev)		((dev)->pdev->device == 0x0102 || \
 				 (dev)->pdev->device == 0x0106 || \
 				 (dev)->pdev->device == 0x010A)
-#define IS_VALLEYVIEW(dev)	(INTEL_INFO(dev)->is_valleyview)
-#define IS_HASWELL(dev)	(INTEL_INFO(dev)->is_haswell)
-#define IS_BROADWELL(dev)	(INTEL_INFO(dev)->gen == 8)
-#define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
+#define IS_VALLEYVIEW(dev)	(to_i915(dev)->info->is_valleyview)
+#define IS_HASWELL(dev)		(to_i915(dev)->info->is_haswell)
+#define IS_BROADWELL(dev)	(to_i915(dev)->info->gen == 8)
+#define IS_MOBILE(dev)		(to_i915(dev)->info->is_mobile)
 #define IS_HSW_EARLY_SDV(dev)	(IS_HASWELL(dev) && \
 				 ((dev)->pdev->device & 0xFF00) == 0x0C00)
 #define IS_BDW_ULT(dev)		(IS_BROADWELL(dev) && \
@@ -1820,33 +1821,33 @@ struct drm_i915_file_private {
  * have their own (e.g. HAS_PCH_SPLIT for ILK+ display, IS_foo for particular
  * chips, etc.).
  */
-#define IS_GEN2(dev)	(INTEL_INFO(dev)->gen == 2)
-#define IS_GEN3(dev)	(INTEL_INFO(dev)->gen == 3)
-#define IS_GEN4(dev)	(INTEL_INFO(dev)->gen == 4)
-#define IS_GEN5(dev)	(INTEL_INFO(dev)->gen == 5)
-#define IS_GEN6(dev)	(INTEL_INFO(dev)->gen == 6)
-#define IS_GEN7(dev)	(INTEL_INFO(dev)->gen == 7)
-#define IS_GEN8(dev)	(INTEL_INFO(dev)->gen == 8)
+#define IS_GEN2(dev)	(to_i915(dev)->info->gen == 2)
+#define IS_GEN3(dev)	(to_i915(dev)->info->gen == 3)
+#define IS_GEN4(dev)	(to_i915(dev)->info->gen == 4)
+#define IS_GEN5(dev)	(to_i915(dev)->info->gen == 5)
+#define IS_GEN6(dev)	(to_i915(dev)->info->gen == 6)
+#define IS_GEN7(dev)	(to_i915(dev)->info->gen == 7)
+#define IS_GEN8(dev)	(to_i915(dev)->info->gen == 8)
 
 #define RENDER_RING		(1<<RCS)
 #define BSD_RING		(1<<VCS)
 #define BLT_RING		(1<<BCS)
 #define VEBOX_RING		(1<<VECS)
-#define HAS_BSD(dev)            (INTEL_INFO(dev)->ring_mask & BSD_RING)
-#define HAS_BLT(dev)            (INTEL_INFO(dev)->ring_mask & BLT_RING)
-#define HAS_VEBOX(dev)            (INTEL_INFO(dev)->ring_mask & VEBOX_RING)
-#define HAS_LLC(dev)            (INTEL_INFO(dev)->has_llc)
+#define HAS_BSD(dev)            (to_i915(dev)->info->ring_mask & BSD_RING)
+#define HAS_BLT(dev)            (to_i915(dev)->info->ring_mask & BLT_RING)
+#define HAS_VEBOX(dev)            (to_i915(dev)->info->ring_mask & VEBOX_RING)
+#define HAS_LLC(dev)            (to_i915(dev)->info->has_llc)
 #define HAS_WT(dev)            (IS_HASWELL(dev) && to_i915(dev)->ellc_size)
-#define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
+#define I915_NEED_GFX_HWS(dev)	(to_i915(dev)->info->need_gfx_hws)
 
-#define HAS_HW_CONTEXTS(dev)	(INTEL_INFO(dev)->gen >= 6)
-#define HAS_ALIASING_PPGTT(dev)	(INTEL_INFO(dev)->gen >= 6 && !IS_VALLEYVIEW(dev))
-#define HAS_PPGTT(dev)		(INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev) && !IS_BROADWELL(dev))
+#define HAS_HW_CONTEXTS(dev)	(to_i915(dev)->info->gen >= 6)
+#define HAS_ALIASING_PPGTT(dev)	(to_i915(dev)->info->gen >= 6 && !IS_VALLEYVIEW(dev))
+#define HAS_PPGTT(dev)		(to_i915(dev)->info->gen >= 7 && !IS_VALLEYVIEW(dev) && !IS_BROADWELL(dev))
 #define USES_ALIASING_PPGTT(dev) intel_enable_ppgtt(dev, false)
 #define USES_FULL_PPGTT(dev)	intel_enable_ppgtt(dev, true)
 
-#define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)
-#define OVERLAY_NEEDS_PHYSICAL(dev)	(INTEL_INFO(dev)->overlay_needs_physical)
+#define HAS_OVERLAY(dev)		(to_i915(dev)->info->has_overlay)
+#define OVERLAY_NEEDS_PHYSICAL(dev)	(to_i915(dev)->info->overlay_needs_physical)
 
 /* Early gen2 have a totally busted CS tlb and require pinned batches. */
 #define HAS_BROKEN_CS_TLB(dev)		(IS_I830(dev) || IS_845G(dev))
@@ -1859,17 +1860,17 @@ struct drm_i915_file_private {
 #define SUPPORTS_DIGITAL_OUTPUTS(dev)	(!IS_GEN2(dev) && !IS_PINEVIEW(dev))
 #define SUPPORTS_INTEGRATED_HDMI(dev)	(IS_G4X(dev) || IS_GEN5(dev))
 #define SUPPORTS_INTEGRATED_DP(dev)	(IS_G4X(dev) || IS_GEN5(dev))
-#define SUPPORTS_TV(dev)		(INTEL_INFO(dev)->supports_tv)
-#define I915_HAS_HOTPLUG(dev)		 (INTEL_INFO(dev)->has_hotplug)
+#define SUPPORTS_TV(dev)		(to_i915(dev)->info->supports_tv)
+#define I915_HAS_HOTPLUG(dev)		 (to_i915(dev)->info->has_hotplug)
 
-#define HAS_FW_BLC(dev) (INTEL_INFO(dev)->gen > 2)
-#define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
-#define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
+#define HAS_FW_BLC(dev) (to_i915(dev)->info->gen > 2)
+#define HAS_PIPE_CXSR(dev) (to_i915(dev)->info->has_pipe_cxsr)
+#define I915_HAS_FBC(dev) (to_i915(dev)->info->has_fbc)
 
 #define HAS_IPS(dev)		(IS_ULT(dev) || IS_BROADWELL(dev))
 
-#define HAS_DDI(dev)		(INTEL_INFO(dev)->has_ddi)
-#define HAS_FPGA_DBG_UNCLAIMED(dev)	(INTEL_INFO(dev)->has_fpga_dbg)
+#define HAS_DDI(dev)		(to_i915(dev)->info->has_ddi)
+#define HAS_FPGA_DBG_UNCLAIMED(dev)	(to_i915(dev)->info->has_fpga_dbg)
 #define HAS_PSR(dev)		(IS_HASWELL(dev) || IS_BROADWELL(dev))
 #define HAS_PC8(dev)		(IS_HASWELL(dev)) /* XXX HSW:ULX */
 #define HAS_RUNTIME_PM(dev)	(IS_HASWELL(dev))
@@ -2297,7 +2298,7 @@ void i915_gem_setup_global_gtt(struct drm_device *dev, unsigned long start,
 int i915_gem_gtt_init(struct drm_device *dev);
 static inline void i915_gem_chipset_flush(struct drm_device *dev)
 {
-	if (INTEL_INFO(dev)->gen < 6)
+	if (to_i915(dev)->info->gen < 6)
 		intel_gtt_chipset_flush();
 }
 int i915_gem_init_ppgtt(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt);
@@ -2311,7 +2312,7 @@ static inline bool intel_enable_ppgtt(struct drm_device *dev, bool full)
 
 #ifdef CONFIG_INTEL_IOMMU
 	/* Disable ppgtt on SNB if VT-d is on. */
-	if (INTEL_INFO(dev)->gen == 6 && intel_iommu_gfx_mapped) {
+	if (to_i915(dev)->info->gen == 6 && intel_iommu_gfx_mapped) {
 		DRM_INFO("Disabling PPGTT because VT-d is on\n");
 		return false;
 	}
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/12 drm/i915: Convert a few WM functions to use struct drm_i915_private directly

In reply to Damien Lespiau

A pointer to the struct drm_device is not needed in a few of the WM functions, so just pass a pointer to dev_priv.

---
 drivers/gpu/drm/i915/intel_pm.c | 50 +++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +26 -24
index 469170c..1316bdb 100644
@@ -1820,24 +1820,25 @@ static uint32_t ilk_compute_fbc_wm(const struct ilk_pipe_wm_parameters *params,
 			  params->pri.bytes_per_pixel);
 }
 
-static unsigned int ilk_display_fifo_size(const struct drm_device *dev)
+static unsigned int
+ilk_display_fifo_size(const struct drm_i915_private *dev_priv)
 {
-	if (INTEL_INFO(dev)->gen >= 8)
+	if (dev_priv->info->gen >= 8)
 		return 3072;
-	else if (INTEL_INFO(dev)->gen >= 7)
+	else if (dev_priv->info->gen >= 7)
 		return 768;
 	else
 		return 512;
 }
 
 /* Calculate the maximum primary/sprite plane watermark */
-static unsigned int ilk_plane_wm_max(const struct drm_device *dev,
+static unsigned int ilk_plane_wm_max(const struct drm_i915_private *dev_priv,
 				     int level,
 				     const struct intel_wm_config *config,
 				     enum intel_ddb_partitioning ddb_partitioning,
 				     bool is_sprite)
 {
-	unsigned int fifo_size = ilk_display_fifo_size(dev);
+	unsigned int fifo_size = ilk_display_fifo_size(dev_priv);
 	unsigned int max;
 
 	/* if sprites aren't enabled, sprites get nothing */
@@ -1846,14 +1847,14 @@ static unsigned int ilk_plane_wm_max(const struct drm_device *dev,
 
 	/* HSW allows LP1+ watermarks even with multiple pipes */
 	if (level == 0 || config->num_pipes_active > 1) {
-		fifo_size /= INTEL_INFO(dev)->num_pipes;
+		fifo_size /= dev_priv->info->num_pipes;
 
 		/*
 		 * For some reason the non self refresh
 		 * FIFO size is only half of the self
 		 * refresh FIFO size on ILK/SNB.
 		 */
-		if (INTEL_INFO(dev)->gen <= 6)
+		if (dev_priv->info->gen <= 6)
 			fifo_size /= 2;
 	}
 
@@ -1869,9 +1870,9 @@ static unsigned int ilk_plane_wm_max(const struct drm_device *dev,
 	}
 
 	/* clamp to max that the registers can hold */
-	if (INTEL_INFO(dev)->gen >= 8)
+	if (dev_priv->info->gen >= 8)
 		max = level == 0 ? 255 : 2047;
-	else if (INTEL_INFO(dev)->gen >= 7)
+	else if (dev_priv->info->gen >= 7)
 		/* IVB/HSW primary/sprite plane watermarks */
 		max = level == 0 ? 127 : 1023;
 	else if (!is_sprite)
@@ -1885,7 +1886,7 @@ static unsigned int ilk_plane_wm_max(const struct drm_device *dev,
 }
 
 /* Calculate the maximum cursor plane watermark */
-static unsigned int ilk_cursor_wm_max(const struct drm_device *dev,
+static unsigned int ilk_cursor_wm_max(const struct drm_i915_private *dev_priv,
 				      int level,
 				      const struct intel_wm_config *config)
 {
@@ -1894,32 +1895,32 @@ static unsigned int ilk_cursor_wm_max(const struct drm_device *dev,
 		return 64;
 
 	/* otherwise just report max that registers can hold */
-	if (INTEL_INFO(dev)->gen >= 7)
+	if (dev_priv->info->gen >= 7)
 		return level == 0 ? 63 : 255;
 	else
 		return level == 0 ? 31 : 63;
 }
 
 /* Calculate the maximum FBC watermark */
-static unsigned int ilk_fbc_wm_max(struct drm_device *dev)
+static unsigned int ilk_fbc_wm_max(struct drm_i915_private *dev_priv)
 {
 	/* max that registers can hold */
-	if (INTEL_INFO(dev)->gen >= 8)
+	if (dev_priv->info->gen >= 8)
 		return 31;
 	else
 		return 15;
 }
 
-static void ilk_compute_wm_maximums(struct drm_device *dev,
+static void ilk_compute_wm_maximums(struct drm_i915_private *dev_priv,
 				    int level,
 				    const struct intel_wm_config *config,
 				    enum intel_ddb_partitioning ddb_partitioning,
 				    struct ilk_wm_maximums *max)
 {
-	max->pri = ilk_plane_wm_max(dev, level, config, ddb_partitioning, false);
-	max->spr = ilk_plane_wm_max(dev, level, config, ddb_partitioning, true);
-	max->cur = ilk_cursor_wm_max(dev, level, config);
-	max->fbc = ilk_fbc_wm_max(dev);
+	max->pri = ilk_plane_wm_max(dev_priv, level, config, ddb_partitioning, false);
+	max->spr = ilk_plane_wm_max(dev_priv, level, config, ddb_partitioning, true);
+	max->cur = ilk_cursor_wm_max(dev_priv, level, config);
+	max->fbc = ilk_fbc_wm_max(dev_priv);
 }
 
 static bool ilk_validate_wm_level(int level,
@@ -2040,10 +2041,11 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[5])
 	}
 }
 
-static void intel_fixup_spr_wm_latency(struct drm_device *dev, uint16_t wm[5])
+static void
+intel_fixup_spr_wm_latency(struct drm_i915_private *dev_priv, uint16_t wm[5])
 {
 	/* ILK sprite LP0 latency is 1300 ns */
-	if (INTEL_INFO(dev)->gen == 5)
+	if (dev_priv->info->gen == 5)
 		wm[0] = 13;
 }
 
@@ -2105,7 +2107,7 @@ static void intel_setup_wm_latency(struct drm_device *dev)
 	memcpy(dev_priv->wm.cur_latency, dev_priv->wm.pri_latency,
 	       sizeof(dev_priv->wm.pri_latency));
 
-	intel_fixup_spr_wm_latency(dev, dev_priv->wm.spr_latency);
+	intel_fixup_spr_wm_latency(dev_priv, dev_priv->wm.spr_latency);
 	intel_fixup_cur_wm_latency(dev, dev_priv->wm.cur_latency);
 
 	intel_print_wm_latency(dev, "Primary", dev_priv->wm.pri_latency);
@@ -2166,7 +2168,7 @@ static bool intel_compute_pipe_wm(struct drm_crtc *crtc,
 	struct ilk_wm_maximums max;
 
 	/* LP0 watermarks always use 1/2 DDB partitioning */
-	ilk_compute_wm_maximums(dev, 0, &config, INTEL_DDB_PART_1_2, &max);
+	ilk_compute_wm_maximums(dev_priv, 0, &config, INTEL_DDB_PART_1_2, &max);
 
 	/* ILK/SNB: LP2+ watermarks only w/o sprites */
 	if (INTEL_INFO(dev)->gen <= 6 && params->spr.enabled)
@@ -2566,13 +2568,13 @@ static void ilk_update_wm(struct drm_crtc *crtc)
 
 	intel_crtc->wm.active = pipe_wm;
 
-	ilk_compute_wm_maximums(dev, 1, &config, INTEL_DDB_PART_1_2, &max);
+	ilk_compute_wm_maximums(dev_priv, 1, &config, INTEL_DDB_PART_1_2, &max);
 	ilk_wm_merge(dev, &config, &max, &lp_wm_1_2);
 
 	/* 5/6 split only in single pipe config on IVB+ */
 	if (INTEL_INFO(dev)->gen >= 7 &&
 	    config.num_pipes_active == 1 && config.sprites_enabled) {
-		ilk_compute_wm_maximums(dev, 1, &config, INTEL_DDB_PART_5_6, &max);
+		ilk_compute_wm_maximums(dev_priv, 1, &config, INTEL_DDB_PART_5_6, &max);
 		ilk_wm_merge(dev, &config, &max, &lp_wm_5_6);
 
 		best_lp_wm = ilk_find_best_result(dev, &lp_wm_1_2, &lp_wm_5_6);
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/12 drm/i915: Mass replace INTEL_INFO() by dev_priv->info

In reply to Damien Lespiau

This was a sed job:
sed -i -e 's/INTEL_INFO(dev)/dev_priv->info/g' drivers/gpu/drm/i915/*[ch]

plus adding:
struct drm_i915_private *dev_priv = dev->dev_private;

in the few functions that didn't have it defined already.

---
 drivers/gpu/drm/i915/i915_debugfs.c        |  24 +++---
 drivers/gpu/drm/i915/i915_dma.c            |  26 +++---
 drivers/gpu/drm/i915/i915_drv.c            |   8 +-
 drivers/gpu/drm/i915/i915_gem.c            |  29 ++++---
 drivers/gpu/drm/i915/i915_gem_context.c    |  10 +--
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  19 +++--
 drivers/gpu/drm/i915/i915_gem_gtt.c        |  16 ++--
 drivers/gpu/drm/i915/i915_gem_stolen.c     |   2 +-
 drivers/gpu/drm/i915/i915_gem_tiling.c     |   9 ++-
 drivers/gpu/drm/i915/i915_gpu_error.c      |  34 ++++----
 drivers/gpu/drm/i915/i915_irq.c            |  47 +++++------
 drivers/gpu/drm/i915/i915_suspend.c        |  14 ++--
 drivers/gpu/drm/i915/i915_sysfs.c          |   5 +-
 drivers/gpu/drm/i915/i915_ums.c            |  24 +++---
 drivers/gpu/drm/i915/intel_bios.c          |   4 +-
 drivers/gpu/drm/i915/intel_crt.c           |   7 +-
 drivers/gpu/drm/i915/intel_display.c       | 123 +++++++++++++++--------------
 drivers/gpu/drm/i915/intel_fbdev.c         |   4 +-
 drivers/gpu/drm/i915/intel_hdmi.c          |   3 +-
 drivers/gpu/drm/i915/intel_i2c.c           |   2 +-
 drivers/gpu/drm/i915/intel_lvds.c          |  10 ++-
 drivers/gpu/drm/i915/intel_overlay.c       |   2 +-
 drivers/gpu/drm/i915/intel_panel.c         |  11 +--
 drivers/gpu/drm/i915/intel_pm.c            |  54 +++++++------
 drivers/gpu/drm/i915/intel_ringbuffer.c    |  42 +++++-----
 drivers/gpu/drm/i915/intel_sdvo.c          |  11 +--
 drivers/gpu/drm/i915/intel_sprite.c        |   5 +-
 drivers/gpu/drm/i915/intel_tv.c            |   2 +-
 drivers/gpu/drm/i915/intel_uncore.c        |  10 ++-
 29 files changed, 299 insertions(+), 258 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +12 -12
index 7252f30..26686f7 100644
@@ -81,7 +81,7 @@ static int i915_capabilities(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	const struct intel_device_info *info = INTEL_INFO(dev);
+	const struct intel_device_info *info = to_i915(dev)->info;
 
 	seq_printf(m, "gen: %d\n", info->gen);
 	seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev));
@@ -601,7 +601,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
 		return ret;
 	intel_runtime_pm_get(dev_priv);
 
-	if (INTEL_INFO(dev)->gen >= 8) {
+	if (dev_priv->info->gen >= 8) {
 		int i;
 		seq_printf(m, "Master Interrupt Control:\t%08x\n",
 			   I915_READ(GEN8_MASTER_IRQ));
@@ -719,7 +719,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
 	seq_printf(m, "Interrupts received: %d\n",
 		   atomic_read(&dev_priv->irq_received));
 	for_each_ring(ring, dev_priv, i) {
-		if (INTEL_INFO(dev)->gen >= 6) {
+		if (dev_priv->info->gen >= 6) {
 			seq_printf(m,
 				   "Graphics Interrupt mask (%s):	%08x\n",
 				   ring->name, I915_READ_IMR(ring));
@@ -1667,7 +1667,7 @@ static int i915_swizzle_info(struct seq_file *m, void *data)
 			   I915_READ16(C0DRB3));
 		seq_printf(m, "C1DRB3 = 0x%04x\n",
 			   I915_READ16(C1DRB3));
-	} else if (INTEL_INFO(dev)->gen >= 6) {
+	} else if (dev_priv->info->gen >= 6) {
 		seq_printf(m, "MAD_DIMM_C0 = 0x%08x\n",
 			   I915_READ(MAD_DIMM_C0));
 		seq_printf(m, "MAD_DIMM_C1 = 0x%08x\n",
@@ -1734,12 +1734,12 @@ static void gen6_ppgtt_info(struct seq_file *m, struct drm_device *dev)
 	struct drm_file *file;
 	int i;
 
-	if (INTEL_INFO(dev)->gen == 6)
+	if (dev_priv->info->gen == 6)
 		seq_printf(m, "GFX_MODE: 0x%08x\n", I915_READ(GFX_MODE));
 
 	for_each_ring(ring, dev_priv, i) {
 		seq_printf(m, "%s\n", ring->name);
-		if (INTEL_INFO(dev)->gen == 7)
+		if (dev_priv->info->gen == 7)
 			seq_printf(m, "GFX_MODE: 0x%08x\n", I915_READ(RING_MODE_GEN7(ring)));
 		seq_printf(m, "PP_DIR_BASE: 0x%08x\n", I915_READ(RING_PP_DIR_BASE(ring)));
 		seq_printf(m, "PP_DIR_BASE_READ: 0x%08x\n", I915_READ(RING_PP_DIR_BASE_READ(ring)));
@@ -1779,9 +1779,9 @@ static int i915_ppgtt_info(struct seq_file *m, void *data)
 		return ret;
 	intel_runtime_pm_get(dev_priv);
 
-	if (INTEL_INFO(dev)->gen >= 8)
+	if (dev_priv->info->gen >= 8)
 		gen8_ppgtt_info(m, dev);
-	else if (INTEL_INFO(dev)->gen >= 6)
+	else if (dev_priv->info->gen >= 6)
 		gen6_ppgtt_info(m, dev);
 
 	intel_runtime_pm_put(dev_priv);
@@ -1884,7 +1884,7 @@ static int i915_energy_uJ(struct seq_file *m, void *data)
 	u64 power;
 	u32 units;
 
-	if (INTEL_INFO(dev)->gen < 6)
+	if (dev_priv->info->gen < 6)
 		return -ENODEV;
 
 	rdmsrl(MSR_RAPL_POWER_UNIT, power);
@@ -2509,7 +2509,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
 
 	if (IS_GEN2(dev))
 		ret = i8xx_pipe_crc_ctl_reg(&source, &val);
-	else if (INTEL_INFO(dev)->gen < 5)
+	else if (dev_priv->info->gen < 5)
 		ret = i9xx_pipe_crc_ctl_reg(dev, pipe, &source, &val);
 	else if (IS_VALLEYVIEW(dev))
 		ret = vlv_pipe_crc_ctl_reg(dev,pipe, &source, &val);
@@ -3133,7 +3133,7 @@ static int i915_forcewake_open(struct inode *inode, struct file *file)
 	struct drm_device *dev = inode->i_private;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (INTEL_INFO(dev)->gen < 6)
+	if (dev_priv->info->gen < 6)
 		return 0;
 
 	intel_runtime_pm_get(dev_priv);
@@ -3147,7 +3147,7 @@ static int i915_forcewake_release(struct inode *inode, struct file *file)
 	struct drm_device *dev = inode->i_private;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (INTEL_INFO(dev)->gen < 6)
+	if (dev_priv->info->gen < 6)
 		return 0;
 
 	gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL);
drivers/gpu/drm/i915/i915_dma.c +13 -13
index ee9502b..188e340 100644
@@ -107,7 +107,7 @@ static void i915_write_hws_pga(struct drm_device *dev)
 	u32 addr;
 
 	addr = dev_priv->status_page_dmah->busaddr;
-	if (INTEL_INFO(dev)->gen >= 4)
+	if (dev_priv->info->gen >= 4)
 		addr |= (dev_priv->status_page_dmah->busaddr >> 28) & 0xf0;
 	I915_WRITE(HWS_PGA, addr);
 }
@@ -399,7 +399,7 @@ i915_emit_box(struct drm_device *dev,
 		return -EINVAL;
 	}
 
-	if (INTEL_INFO(dev)->gen >= 4) {
+	if (dev_priv->info->gen >= 4) {
 		ret = BEGIN_LP_RING(4);
 		if (ret)
 			return ret;
@@ -512,7 +512,7 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev,
 			if (ret)
 				return ret;
 
-			if (INTEL_INFO(dev)->gen >= 4) {
+			if (dev_priv->info->gen >= 4) {
 				OUT_RING(MI_BATCH_BUFFER_START | (2 << 6) | MI_BATCH_NON_SECURE_I965);
 				OUT_RING(batch->start);
 			} else {
@@ -975,7 +975,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
 		value = 1;
 		break;
 	case I915_PARAM_HAS_EXEC_CONSTANTS:
-		value = INTEL_INFO(dev)->gen >= 4;
+		value = dev_priv->info->gen >= 4;
 		break;
 	case I915_PARAM_HAS_RELAXED_DELTA:
 		value = 1;
@@ -1133,12 +1133,12 @@ static int
 intel_alloc_mchbar_resource(struct drm_device *dev)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
-	int reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
+	int reg = dev_priv->info->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
 	u32 temp_lo, temp_hi = 0;
 	u64 mchbar_addr;
 	int ret;
 
-	if (INTEL_INFO(dev)->gen >= 4)
+	if (dev_priv->info->gen >= 4)
 		pci_read_config_dword(dev_priv->bridge_dev, reg + 4, &temp_hi);
 	pci_read_config_dword(dev_priv->bridge_dev, reg, &temp_lo);
 	mchbar_addr = ((u64)temp_hi << 32) | temp_lo;
@@ -1165,7 +1165,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev)
 		return ret;
 	}
 
-	if (INTEL_INFO(dev)->gen >= 4)
+	if (dev_priv->info->gen >= 4)
 		pci_write_config_dword(dev_priv->bridge_dev, reg + 4,
 				       upper_32_bits(dev_priv->mch_res.start));
 
@@ -1179,7 +1179,7 @@ static void
 intel_setup_mchbar(struct drm_device *dev)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
-	int mchbar_reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
+	int mchbar_reg = dev_priv->info->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
 	u32 temp;
 	bool enabled;
 
@@ -1216,7 +1216,7 @@ static void
 intel_teardown_mchbar(struct drm_device *dev)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
-	int mchbar_reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
+	int mchbar_reg = dev_priv->info->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
 	u32 temp;
 
 	if (dev_priv->mchbar_need_disable) {
@@ -1338,7 +1338,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
 	/* Always safe in the mode setting case. */
 	/* FIXME: do pre/post-mode set stuff in core KMS code */
 	dev->vblank_disable_allowed = true;
-	if (INTEL_INFO(dev)->num_pipes == 0) {
+	if (dev_priv->info->num_pipes == 0) {
 		intel_display_power_put(dev, POWER_DOMAIN_VGA);
 		return 0;
 	}
@@ -1639,8 +1639,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	if (IS_VALLEYVIEW(dev))
 		dev_priv->num_plane = 2;
 
-	if (INTEL_INFO(dev)->num_pipes) {
-		ret = drm_vblank_init(dev, INTEL_INFO(dev)->num_pipes);
+	if (dev_priv->info->num_pipes) {
+		ret = drm_vblank_init(dev, dev_priv->info->num_pipes);
 		if (ret)
 			goto out_gem_unload;
 	}
@@ -1660,7 +1660,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 
 	i915_setup_sysfs(dev);
 
-	if (INTEL_INFO(dev)->num_pipes) {
+	if (dev_priv->info->num_pipes) {
 		/* Must be done after probing outputs */
 		intel_opregion_init(dev);
 		acpi_video_register();
drivers/gpu/drm/i915/i915_drv.c +5 -3
index 61fb9fc..9134140 100644
@@ -411,7 +411,7 @@ void intel_detect_pch(struct drm_device *dev)
 	/* In all current cases, num_pipes is equivalent to the PCH_NOP setting
 	 * (which really amounts to a PCH but no South Display).
 	 */
-	if (INTEL_INFO(dev)->num_pipes == 0) {
+	if (dev_priv->info->num_pipes == 0) {
 		dev_priv->pch_type = PCH_NOP;
 		return;
 	}
@@ -480,7 +480,9 @@ check_next:
 
 bool i915_semaphore_is_enabled(struct drm_device *dev)
 {
-	if (INTEL_INFO(dev)->gen < 6)
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	if (dev_priv->info->gen < 6)
 		return false;
 
 	/* Until we get further testing... */
@@ -494,7 +496,7 @@ bool i915_semaphore_is_enabled(struct drm_device *dev)
 
 #ifdef CONFIG_INTEL_IOMMU
 	/* Enable semaphores on SNB when IO remapping is off */
-	if (INTEL_INFO(dev)->gen == 6 && intel_iommu_gfx_mapped)
+	if (dev_priv->info->gen == 6 && intel_iommu_gfx_mapped)
 		return false;
 #endif
 
drivers/gpu/drm/i915/i915_gem.c +17 -12
index 656406d..1ac740e 100644
@@ -180,7 +180,7 @@ i915_gem_init_ioctl(struct drm_device *dev, void *data,
 		return -EINVAL;
 
 	/* GEM with user mode setting was never supported on ilk and later. */
-	if (INTEL_INFO(dev)->gen >= 5)
+	if (dev_priv->info->gen >= 5)
 		return -ENODEV;
 
 	mutex_lock(&dev->struct_mutex);
@@ -1508,14 +1508,15 @@ i915_gem_release_mmap(struct drm_i915_gem_object *obj)
 uint32_t
 i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, int tiling_mode)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t gtt_size;
 
-	if (INTEL_INFO(dev)->gen >= 4 ||
+	if (dev_priv->info->gen >= 4 ||
 	    tiling_mode == I915_TILING_NONE)
 		return size;
 
 	/* Previous chips need a power-of-two fence region when tiling */
-	if (INTEL_INFO(dev)->gen == 3)
+	if (dev_priv->info->gen == 3)
 		gtt_size = 1024*1024;
 	else
 		gtt_size = 512*1024;
@@ -1537,11 +1538,13 @@ uint32_t
 i915_gem_get_gtt_alignment(struct drm_device *dev, uint32_t size,
 			   int tiling_mode, bool fenced)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
 	/*
 	 * Minimum alignment is 4k (GTT page size), but might be greater
 	 * if a fence register is needed for the object.
 	 */
-	if (INTEL_INFO(dev)->gen >= 4 || (!fenced && IS_G33(dev)) ||
+	if (dev_priv->info->gen >= 4 || (!fenced && IS_G33(dev)) ||
 	    tiling_mode == I915_TILING_NONE)
 		return 4096;
 
@@ -2866,7 +2869,7 @@ static void i965_write_fence_reg(struct drm_device *dev, int reg,
 	int fence_reg;
 	int fence_pitch_shift;
 
-	if (INTEL_INFO(dev)->gen >= 6) {
+	if (dev_priv->info->gen >= 6) {
 		fence_reg = FENCE_REG_SANDYBRIDGE_0;
 		fence_pitch_shift = SANDYBRIDGE_FENCE_PITCH_SHIFT;
 	} else {
@@ -3007,7 +3010,7 @@ static void i915_gem_write_fence(struct drm_device *dev, int reg,
 	     "bogus fence setup with stride: 0x%x, tiling mode: %i\n",
 	     obj->stride, obj->tiling_mode);
 
-	switch (INTEL_INFO(dev)->gen) {
+	switch (dev_priv->info->gen) {
 	case 8:
 	case 7:
 	case 6:
@@ -3520,6 +3523,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
 				    enum i915_cache_level cache_level)
 {
 	struct drm_device *dev = obj->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct i915_vma *vma;
 	int ret;
 
@@ -3552,7 +3556,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
 		 * registers with snooped memory, so relinquish any fences
 		 * currently pointing to our region in the aperture.
 		 */
-		if (INTEL_INFO(dev)->gen < 6) {
+		if (dev_priv->info->gen < 6) {
 			ret = i915_gem_object_put_fence(obj);
 			if (ret)
 				return ret;
@@ -3951,11 +3955,12 @@ int
 i915_gem_pin_ioctl(struct drm_device *dev, void *data,
 		   struct drm_file *file)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_i915_gem_pin *args = data;
 	struct drm_i915_gem_object *obj;
 	int ret;
 
-	if (INTEL_INFO(dev)->gen >= 6)
+	if (dev_priv->info->gen >= 6)
 		return -ENODEV;
 
 	ret = i915_mutex_lock_interruptible(dev);
@@ -4364,7 +4369,7 @@ void i915_gem_init_swizzling(struct drm_device *dev)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
 
-	if (INTEL_INFO(dev)->gen < 5 ||
+	if (dev_priv->info->gen < 5 ||
 	    dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_NONE)
 		return;
 
@@ -4453,7 +4458,7 @@ i915_gem_init_hw(struct drm_device *dev)
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	int ret, i;
 
-	if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
+	if (dev_priv->info->gen < 6 && !intel_enable_gtt())
 		return -EIO;
 
 	if (dev_priv->ellc_size)
@@ -4671,9 +4676,9 @@ i915_gem_load(struct drm_device *dev)
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		dev_priv->fence_reg_start = 3;
 
-	if (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev))
+	if (dev_priv->info->gen >= 7 && !IS_VALLEYVIEW(dev))
 		dev_priv->num_fence_regs = 32;
-	else if (INTEL_INFO(dev)->gen >= 4 || IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
+	else if (dev_priv->info->gen >= 4 || IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
 		dev_priv->num_fence_regs = 16;
 	else
 		dev_priv->num_fence_regs = 8;
drivers/gpu/drm/i915/i915_gem_context.c +5 -5
index ebe0f67..d4eb705 100644
@@ -113,7 +113,7 @@ static int get_context_size(struct drm_device *dev)
 	int ret;
 	u32 reg;
 
-	switch (INTEL_INFO(dev)->gen) {
+	switch (dev_priv->info->gen) {
 	case 6:
 		reg = I915_READ(CXT_SIZE);
 		ret = GEN6_CXT_TOTAL_SIZE(reg) * 64;
@@ -195,7 +195,7 @@ __create_hw_context(struct drm_device *dev,
 		return ERR_PTR(-ENOMEM);
 	}
 
-	if (INTEL_INFO(dev)->gen >= 7) {
+	if (dev_priv->info->gen >= 7) {
 		ret = i915_gem_object_set_cache_level(ctx->obj,
 						      I915_CACHE_L3_LLC);
 		/* Failure shouldn't ever happen this early */
@@ -319,7 +319,7 @@ void i915_gem_context_reset(struct drm_device *dev)
 	 * the next switch */
 	for (i = 0; i < I915_NUM_RINGS; i++) {
 		struct i915_hw_context *dctx;
-		if (!(INTEL_INFO(dev)->ring_mask & (1<<i)))
+		if (!(dev_priv->info->ring_mask & (1<<i)))
 			continue;
 
 		/* Do a fake switch to the default context */
@@ -380,7 +380,7 @@ int i915_gem_context_init(struct drm_device *dev)
 	}
 
 	for (i = RCS + 1; i < I915_NUM_RINGS; i++) {
-		if (!(INTEL_INFO(dev)->ring_mask & (1<<i)))
+		if (!(dev_priv->info->ring_mask & (1<<i)))
 			continue;
 
 		ring = &dev_priv->ring[i];
@@ -424,7 +424,7 @@ void i915_gem_context_fini(struct drm_device *dev)
 
 	for (i = 0; i < I915_NUM_RINGS; i++) {
 		struct intel_ring_buffer *ring = &dev_priv->ring[i];
-		if (!(INTEL_INFO(dev)->ring_mask & (1<<i)))
+		if (!(dev_priv->info->ring_mask & (1<<i)))
 			continue;
 
 		if (ring->last_context)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +11 -8
index bbff8f9..65783d5 100644
@@ -265,6 +265,7 @@ relocate_entry_cpu(struct drm_i915_gem_object *obj,
 		   struct drm_i915_gem_relocation_entry *reloc)
 {
 	struct drm_device *dev = obj->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t page_offset = offset_in_page(reloc->offset);
 	char *vaddr;
 	int ret = -EINVAL;
@@ -277,7 +278,7 @@ relocate_entry_cpu(struct drm_i915_gem_object *obj,
 				reloc->offset >> PAGE_SHIFT));
 	*(uint32_t *)(vaddr + page_offset) = reloc->delta;
 
-	if (INTEL_INFO(dev)->gen >= 8) {
+	if (dev_priv->info->gen >= 8) {
 		page_offset = offset_in_page(page_offset + sizeof(uint32_t));
 
 		if (page_offset == 0) {
@@ -320,7 +321,7 @@ relocate_entry_gtt(struct drm_i915_gem_object *obj,
 		(reloc_page + offset_in_page(reloc->offset));
 	iowrite32(reloc->delta, reloc_entry);
 
-	if (INTEL_INFO(dev)->gen >= 8) {
+	if (dev_priv->info->gen >= 8) {
 		reloc_entry += 1;
 
 		if (offset_in_page(reloc->offset + sizeof(uint32_t)) == 0) {
@@ -345,6 +346,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
 				   struct drm_i915_gem_relocation_entry *reloc)
 {
 	struct drm_device *dev = obj->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_gem_object *target_obj;
 	struct drm_i915_gem_object *target_i915_obj;
 	struct i915_vma *target_vma;
@@ -406,7 +408,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
 
 	/* Check that the relocation address is valid... */
 	if (unlikely(reloc->offset >
-		obj->base.size - (INTEL_INFO(dev)->gen >= 8 ? 8 : 4))) {
+		obj->base.size - (dev_priv->info->gen >= 8 ? 8 : 4))) {
 		DRM_DEBUG("Relocation beyond object bounds: "
 			  "obj %p target %d offset %d size %d.\n",
 			  obj, reloc->target_handle,
@@ -1058,15 +1060,15 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 	case I915_EXEC_CONSTANTS_REL_SURFACE:
 		if (ring == &dev_priv->ring[RCS] &&
 		    mode != dev_priv->relative_constants_mode) {
-			if (INTEL_INFO(dev)->gen < 4)
+			if (dev_priv->info->gen < 4)
 				return -EINVAL;
 
-			if (INTEL_INFO(dev)->gen > 5 &&
+			if (dev_priv->info->gen > 5 &&
 			    mode == I915_EXEC_CONSTANTS_REL_SURFACE)
 				return -EINVAL;
 
 			/* The HW changed the meaning on this bit on gen6 */
-			if (INTEL_INFO(dev)->gen >= 6)
+			if (dev_priv->info->gen >= 6)
 				mask &= ~I915_EXEC_CONSTANTS_REL_SURFACE;
 		}
 		break;
@@ -1086,7 +1088,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 			return -EINVAL;
 		}
 
-		if (INTEL_INFO(dev)->gen >= 5) {
+		if (dev_priv->info->gen >= 5) {
 			DRM_DEBUG("clip rectangles are only valid on pre-gen5\n");
 			return -EINVAL;
 		}
@@ -1278,6 +1280,7 @@ int
 i915_gem_execbuffer(struct drm_device *dev, void *data,
 		    struct drm_file *file)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_i915_gem_execbuffer *args = data;
 	struct drm_i915_gem_execbuffer2 exec2;
 	struct drm_i915_gem_exec_object *exec_list = NULL;
@@ -1316,7 +1319,7 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
 		exec2_list[i].relocs_ptr = exec_list[i].relocs_ptr;
 		exec2_list[i].alignment = exec_list[i].alignment;
 		exec2_list[i].offset = exec_list[i].offset;
-		if (INTEL_INFO(dev)->gen < 4)
+		if (dev_priv->info->gen < 4)
 			exec2_list[i].flags = EXEC_OBJECT_NEEDS_FENCE;
 		else
 			exec2_list[i].flags = 0;
drivers/gpu/drm/i915/i915_gem_gtt.c +8 -8
index 998f9a0..3a2e5bc 100644
@@ -964,7 +964,7 @@ int i915_gem_init_ppgtt(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt)
 
 	ppgtt->base.dev = dev;
 
-	if (INTEL_INFO(dev)->gen < 8)
+	if (dev_priv->info->gen < 8)
 		ret = gen6_ppgtt_init(ppgtt);
 	else if (IS_GEN8(dev))
 		ret = gen8_ppgtt_init(ppgtt, dev_priv->gtt.base.total);
@@ -977,7 +977,7 @@ int i915_gem_init_ppgtt(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt)
 		drm_mm_init(&ppgtt->base.mm, ppgtt->base.start,
 			    ppgtt->base.total);
 		i915_init_vm(dev_priv, &ppgtt->base);
-		if (INTEL_INFO(dev)->gen < 8) {
+		if (dev_priv->info->gen < 8) {
 			gen6_write_pdes(ppgtt);
 			DRM_DEBUG("Adding PPGTT at offset %x\n",
 				  ppgtt->pd_offset << 10);
@@ -1053,7 +1053,7 @@ void i915_check_and_clear_faults(struct drm_device *dev)
 	struct intel_ring_buffer *ring;
 	int i;
 
-	if (INTEL_INFO(dev)->gen < 6)
+	if (dev_priv->info->gen < 6)
 		return;
 
 	for_each_ring(ring, dev_priv, i) {
@@ -1083,7 +1083,7 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev)
 	/* Don't bother messing with faults pre GEN6 as we have little
 	 * documentation supporting that it's a good idea.
 	 */
-	if (INTEL_INFO(dev)->gen < 6)
+	if (dev_priv->info->gen < 6)
 		return;
 
 	i915_check_and_clear_faults(dev);
@@ -1124,7 +1124,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
 	}
 
 
-	if (INTEL_INFO(dev)->gen >= 8)
+	if (dev_priv->info->gen >= 8)
 		return;
 
 	list_for_each_entry(vm, &dev_priv->vm_list, global_link) {
@@ -1741,10 +1741,10 @@ int i915_gem_gtt_init(struct drm_device *dev)
 	struct i915_gtt *gtt = &dev_priv->gtt;
 	int ret;
 
-	if (INTEL_INFO(dev)->gen <= 5) {
+	if (dev_priv->info->gen <= 5) {
 		gtt->gtt_probe = i915_gmch_probe;
 		gtt->base.cleanup = i915_gmch_remove;
-	} else if (INTEL_INFO(dev)->gen < 8) {
+	} else if (dev_priv->info->gen < 8) {
 		gtt->gtt_probe = gen6_gmch_probe;
 		gtt->base.cleanup = gen6_gmch_remove;
 		if (IS_HASWELL(dev) && dev_priv->ellc_size)
@@ -1753,7 +1753,7 @@ int i915_gem_gtt_init(struct drm_device *dev)
 			gtt->base.pte_encode = hsw_pte_encode;
 		else if (IS_VALLEYVIEW(dev))
 			gtt->base.pte_encode = byt_pte_encode;
-		else if (INTEL_INFO(dev)->gen >= 7)
+		else if (dev_priv->info->gen >= 7)
 			gtt->base.pte_encode = ivb_pte_encode;
 		else
 			gtt->base.pte_encode = snb_pte_encode;
drivers/gpu/drm/i915/i915_gem_stolen.c +1 -1
index fed87ec..e804c49 100644
@@ -60,7 +60,7 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
 	 * XXX However gen2 requires an unavailable symbol.
 	 */
 	base = 0;
-	if (INTEL_INFO(dev)->gen >= 3) {
+	if (dev_priv->info->gen >= 3) {
 		/* Read Graphics Base of Stolen Memory directly */
 		pci_read_config_dword(dev->pdev, 0x5c, &base);
 		base &= ~((1<<20) - 1);
drivers/gpu/drm/i915/i915_gem_tiling.c +5 -4
index eb99358..e7dedd4 100644
@@ -94,7 +94,7 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
 	if (IS_VALLEYVIEW(dev)) {
 		swizzle_x = I915_BIT_6_SWIZZLE_NONE;
 		swizzle_y = I915_BIT_6_SWIZZLE_NONE;
-	} else if (INTEL_INFO(dev)->gen >= 6) {
+	} else if (dev_priv->info->gen >= 6) {
 		uint32_t dimm_c0, dimm_c1;
 		dimm_c0 = I915_READ(MAD_DIMM_C0);
 		dimm_c1 = I915_READ(MAD_DIMM_C1);
@@ -204,6 +204,7 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
 static bool
 i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	int tile_width;
 
 	/* Linear is always fine */
@@ -219,10 +220,10 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
 	/* check maximum stride & object size */
 	/* i965+ stores the end address of the gtt mapping in the fence
 	 * reg, so dont bother to check the size */
-	if (INTEL_INFO(dev)->gen >= 7) {
+	if (dev_priv->info->gen >= 7) {
 		if (stride / 128 > GEN7_FENCE_MAX_PITCH_VAL)
 			return false;
-	} else if (INTEL_INFO(dev)->gen >= 4) {
+	} else if (dev_priv->info->gen >= 4) {
 		if (stride / 128 > I965_FENCE_MAX_PITCH_VAL)
 			return false;
 	} else {
@@ -242,7 +243,7 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
 		return false;
 
 	/* 965+ just needs multiples of tile width */
-	if (INTEL_INFO(dev)->gen >= 4) {
+	if (dev_priv->info->gen >= 4) {
 		if (stride & (tile_width - 1))
 			return false;
 		return true;
drivers/gpu/drm/i915/i915_gpu_error.c +18 -16
index ae8cf61..c3f35a4 100644
@@ -238,6 +238,8 @@ static void i915_ring_error_state(struct drm_i915_error_state_buf *m,
 				  struct drm_i915_error_state *error,
 				  unsigned ring)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
 	BUG_ON(ring >= I915_NUM_RINGS); /* shut up confused gcc */
 	err_printf(m, "%s command stream:\n", ring_str(ring));
 	err_printf(m, "  HEAD: 0x%08x\n", error->head[ring]);
@@ -247,14 +249,14 @@ static void i915_ring_error_state(struct drm_i915_error_state_buf *m,
 	err_printf(m, "  IPEIR: 0x%08x\n", error->ipeir[ring]);
 	err_printf(m, "  IPEHR: 0x%08x\n", error->ipehr[ring]);
 	err_printf(m, "  INSTDONE: 0x%08x\n", error->instdone[ring]);
-	if (INTEL_INFO(dev)->gen >= 4) {
+	if (dev_priv->info->gen >= 4) {
 		err_printf(m, "  BBADDR: 0x%08llx\n", error->bbaddr[ring]);
 		err_printf(m, "  BB_STATE: 0x%08x\n", error->bbstate[ring]);
 		err_printf(m, "  INSTPS: 0x%08x\n", error->instps[ring]);
 	}
 	err_printf(m, "  INSTPM: 0x%08x\n", error->instpm[ring]);
 	err_printf(m, "  FADDR: 0x%08x\n", error->faddr[ring]);
-	if (INTEL_INFO(dev)->gen >= 6) {
+	if (dev_priv->info->gen >= 6) {
 		err_printf(m, "  RC PSMI: 0x%08x\n", error->rc_psmi[ring]);
 		err_printf(m, "  FAULT_REG: 0x%08x\n", error->fault_reg[ring]);
 		err_printf(m, "  SYNC_0: 0x%08x [last synced 0x%08x]\n",
@@ -320,12 +322,12 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 		err_printf(m, "  INSTDONE_%d: 0x%08x\n", i,
 			   error->extra_instdone[i]);
 
-	if (INTEL_INFO(dev)->gen >= 6) {
+	if (dev_priv->info->gen >= 6) {
 		err_printf(m, "ERROR: 0x%08x\n", error->error);
 		err_printf(m, "DONE_REG: 0x%08x\n", error->done_reg);
 	}
 
-	if (INTEL_INFO(dev)->gen == 7)
+	if (dev_priv->info->gen == 7)
 		err_printf(m, "ERR_INT: 0x%08x\n", error->err_int);
 
 	for_each_ring(ring, dev_priv, i)
@@ -628,7 +630,7 @@ static void i915_gem_record_fences(struct drm_device *dev,
 	int i;
 
 	/* Fences */
-	switch (INTEL_INFO(dev)->gen) {
+	switch (dev_priv->info->gen) {
 	case 8:
 	case 7:
 	case 6:
@@ -663,13 +665,13 @@ static bool is_active_vm(struct i915_address_space *vm,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct i915_hw_ppgtt *ppgtt;
 
-	if (INTEL_INFO(dev)->gen < 7)
+	if (dev_priv->info->gen < 7)
 		return i915_is_ggtt(vm);
 
 	/* FIXME: This ignores that the global gtt vm is also on this list. */
 	ppgtt = container_of(vm, struct i915_hw_ppgtt, base);
 
-	if (INTEL_INFO(dev)->gen >= 8) {
+	if (dev_priv->info->gen >= 8) {
 		u64 pdp0 = (u64)I915_READ(GEN8_RING_PDP_UDW(ring, 0)) << 32;
 		pdp0 |=  I915_READ(GEN8_RING_PDP_LDW(ring, 0));
 		return pdp0 == ppgtt->pd_dma_addr[0];
@@ -740,7 +742,7 @@ static void i915_record_ring_state(struct drm_device *dev,
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (INTEL_INFO(dev)->gen >= 6) {
+	if (dev_priv->info->gen >= 6) {
 		error->rc_psmi[ring->id] = I915_READ(ring->mmio_base + 0x50);
 		error->fault_reg[ring->id] = I915_READ(RING_FAULT_REG(ring));
 		error->semaphore_mboxes[ring->id][0]
@@ -757,14 +759,14 @@ static void i915_record_ring_state(struct drm_device *dev,
 		error->semaphore_seqno[ring->id][2] = ring->sync_seqno[2];
 	}
 
-	if (INTEL_INFO(dev)->gen >= 4) {
+	if (dev_priv->info->gen >= 4) {
 		error->faddr[ring->id] = I915_READ(RING_DMA_FADD(ring->mmio_base));
 		error->ipeir[ring->id] = I915_READ(RING_IPEIR(ring->mmio_base));
 		error->ipehr[ring->id] = I915_READ(RING_IPEHR(ring->mmio_base));
 		error->instdone[ring->id] = I915_READ(RING_INSTDONE(ring->mmio_base));
 		error->instps[ring->id] = I915_READ(RING_INSTPS(ring->mmio_base));
 		error->bbaddr[ring->id] = I915_READ(RING_BBADDR(ring->mmio_base));
-		if (INTEL_INFO(dev)->gen >= 8)
+		if (dev_priv->info->gen >= 8)
 			error->bbaddr[ring->id] |= (u64) I915_READ(RING_BBADDR_UDW(ring->mmio_base)) << 32;
 		error->bbstate[ring->id] = I915_READ(RING_BBSTATE(ring->mmio_base));
 	} else {
@@ -971,26 +973,26 @@ void i915_capture_error_state(struct drm_device *dev)
 	else
 		error->ier = I915_READ(IER);
 
-	if (INTEL_INFO(dev)->gen >= 6)
+	if (dev_priv->info->gen >= 6)
 		error->derrmr = I915_READ(DERRMR);
 
 	if (IS_VALLEYVIEW(dev))
 		error->forcewake = I915_READ(FORCEWAKE_VLV);
-	else if (INTEL_INFO(dev)->gen >= 7)
+	else if (dev_priv->info->gen >= 7)
 		error->forcewake = I915_READ(FORCEWAKE_MT);
-	else if (INTEL_INFO(dev)->gen == 6)
+	else if (dev_priv->info->gen == 6)
 		error->forcewake = I915_READ(FORCEWAKE);
 
 	if (!HAS_PCH_SPLIT(dev))
 		for_each_pipe(pipe)
 			error->pipestat[pipe] = I915_READ(PIPESTAT(pipe));
 
-	if (INTEL_INFO(dev)->gen >= 6) {
+	if (dev_priv->info->gen >= 6) {
 		error->error = I915_READ(ERROR_GEN6);
 		error->done_reg = I915_READ(DONE_REG);
 	}
 
-	if (INTEL_INFO(dev)->gen == 7)
+	if (dev_priv->info->gen == 7)
 		error->err_int = I915_READ(GEN7_ERR_INT);
 
 	i915_get_extra_instdone(dev, error->extra_instdone);
@@ -1067,7 +1069,7 @@ void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	memset(instdone, 0, sizeof(*instdone) * I915_NUM_INSTDONE_REG);
 
-	switch (INTEL_INFO(dev)->gen) {
+	switch (dev_priv->info->gen) {
 	case 2:
 	case 3:
 		instdone[0] = I915_READ(INSTDONE);
drivers/gpu/drm/i915/i915_irq.c +24 -23

182 lines not on this page · raw message

drivers/gpu/drm/i915/i915_suspend.c +7 -7
index 6b8fef7..a2716d2 100644
@@ -194,7 +194,7 @@ static void i915_save_display(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
 	/* Display arbitration control */
-	if (INTEL_INFO(dev)->gen <= 4)
+	if (dev_priv->info->gen <= 4)
 		dev_priv->regfile.saveDSPARB = I915_READ(DSPARB);
 
 	/* This is only meaningful in non-KMS mode */
@@ -260,7 +260,7 @@ static void i915_restore_display(struct drm_device *dev)
 	u32 mask = 0xffffffff;
 
 	/* Display arbitration */
-	if (INTEL_INFO(dev)->gen <= 4)
+	if (dev_priv->info->gen <= 4)
 		I915_WRITE(DSPARB, dev_priv->regfile.saveDSPARB);
 
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
@@ -271,7 +271,7 @@ static void i915_restore_display(struct drm_device *dev)
 
 	if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
 		I915_WRITE(PCH_LVDS, dev_priv->regfile.saveLVDS & mask);
-	else if (INTEL_INFO(dev)->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
+	else if (dev_priv->info->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
 		I915_WRITE(LVDS, dev_priv->regfile.saveLVDS & mask);
 
 	if (!IS_I830(dev) && !IS_845G(dev) && !HAS_PCH_SPLIT(dev))
@@ -324,7 +324,7 @@ int i915_save_state(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int i;
 
-	if (INTEL_INFO(dev)->gen <= 4)
+	if (dev_priv->info->gen <= 4)
 		pci_read_config_byte(dev->pdev, LBB,
 				     &dev_priv->regfile.saveLBB);
 
@@ -353,7 +353,7 @@ int i915_save_state(struct drm_device *dev)
 	intel_disable_gt_powersave(dev);
 
 	/* Cache mode state */
-	if (INTEL_INFO(dev)->gen < 7)
+	if (dev_priv->info->gen < 7)
 		dev_priv->regfile.saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0);
 
 	/* Memory Arbitration state */
@@ -377,7 +377,7 @@ int i915_restore_state(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int i;
 
-	if (INTEL_INFO(dev)->gen <= 4)
+	if (dev_priv->info->gen <= 4)
 		pci_write_config_byte(dev->pdev, LBB,
 				      dev_priv->regfile.saveLBB);
 
@@ -403,7 +403,7 @@ int i915_restore_state(struct drm_device *dev)
 	}
 
 	/* Cache mode state */
-	if (INTEL_INFO(dev)->gen < 7)
+	if (dev_priv->info->gen < 7)
 		I915_WRITE(CACHE_MODE_0, dev_priv->regfile.saveCACHE_MODE_0 |
 			   0xffff0000);
 
drivers/gpu/drm/i915/i915_sysfs.c +3 -2
index 33bcae3..bccc52f 100644
@@ -558,10 +558,11 @@ static struct bin_attribute error_state_attr = {
 
 void i915_setup_sysfs(struct drm_device *dev)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	int ret;
 
 #ifdef CONFIG_PM
-	if (INTEL_INFO(dev)->gen >= 6) {
+	if (dev_priv->info->gen >= 6) {
 		ret = sysfs_merge_group(&dev->primary->kdev->kobj,
 					&rc6_attr_group);
 		if (ret)
@@ -584,7 +585,7 @@ void i915_setup_sysfs(struct drm_device *dev)
 	ret = 0;
 	if (IS_VALLEYVIEW(dev))
 		ret = sysfs_create_files(&dev->primary->kdev->kobj, vlv_attrs);
-	else if (INTEL_INFO(dev)->gen >= 6)
+	else if (dev_priv->info->gen >= 6)
 		ret = sysfs_create_files(&dev->primary->kdev->kobj, gen6_attrs);
 	if (ret)
 		DRM_ERROR("RPS sysfs setup failed\n");
drivers/gpu/drm/i915/i915_ums.c +12 -12
index caa18e8..08b588e 100644
@@ -124,7 +124,7 @@ void i915_save_display_reg(struct drm_device *dev)
 		dev_priv->regfile.saveFPA1 = I915_READ(_FPA1);
 		dev_priv->regfile.saveDPLL_A = I915_READ(_DPLL_A);
 	}
-	if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev))
+	if (dev_priv->info->gen >= 4 && !HAS_PCH_SPLIT(dev))
 		dev_priv->regfile.saveDPLL_A_MD = I915_READ(_DPLL_A_MD);
 	dev_priv->regfile.saveHTOTAL_A = I915_READ(_HTOTAL_A);
 	dev_priv->regfile.saveHBLANK_A = I915_READ(_HBLANK_A);
@@ -162,7 +162,7 @@ void i915_save_display_reg(struct drm_device *dev)
 	dev_priv->regfile.saveDSPASIZE = I915_READ(_DSPASIZE);
 	dev_priv->regfile.saveDSPAPOS = I915_READ(_DSPAPOS);
 	dev_priv->regfile.saveDSPAADDR = I915_READ(_DSPAADDR);
-	if (INTEL_INFO(dev)->gen >= 4) {
+	if (dev_priv->info->gen >= 4) {
 		dev_priv->regfile.saveDSPASURF = I915_READ(_DSPASURF);
 		dev_priv->regfile.saveDSPATILEOFF = I915_READ(_DSPATILEOFF);
 	}
@@ -181,7 +181,7 @@ void i915_save_display_reg(struct drm_device *dev)
 		dev_priv->regfile.saveFPB1 = I915_READ(_FPB1);
 		dev_priv->regfile.saveDPLL_B = I915_READ(_DPLL_B);
 	}
-	if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev))
+	if (dev_priv->info->gen >= 4 && !HAS_PCH_SPLIT(dev))
 		dev_priv->regfile.saveDPLL_B_MD = I915_READ(_DPLL_B_MD);
 	dev_priv->regfile.saveHTOTAL_B = I915_READ(_HTOTAL_B);
 	dev_priv->regfile.saveHBLANK_B = I915_READ(_HBLANK_B);
@@ -219,7 +219,7 @@ void i915_save_display_reg(struct drm_device *dev)
 	dev_priv->regfile.saveDSPBSIZE = I915_READ(_DSPBSIZE);
 	dev_priv->regfile.saveDSPBPOS = I915_READ(_DSPBPOS);
 	dev_priv->regfile.saveDSPBADDR = I915_READ(_DSPBADDR);
-	if (INTEL_INFO(dev)->gen >= 4) {
+	if (dev_priv->info->gen >= 4) {
 		dev_priv->regfile.saveDSPBSURF = I915_READ(_DSPBSURF);
 		dev_priv->regfile.saveDSPBTILEOFF = I915_READ(_DSPBTILEOFF);
 	}
@@ -227,7 +227,7 @@ void i915_save_display_reg(struct drm_device *dev)
 	dev_priv->regfile.savePIPEBSTAT = I915_READ(_PIPEBSTAT);
 
 	/* Fences */
-	switch (INTEL_INFO(dev)->gen) {
+	switch (dev_priv->info->gen) {
 	case 7:
 	case 6:
 		for (i = 0; i < 16; i++)
@@ -278,7 +278,7 @@ void i915_save_display_reg(struct drm_device *dev)
 		dev_priv->regfile.saveBLC_CPU_PWM_CTL2 = I915_READ(BLC_PWM_CPU_CTL2);
 	} else {
 		dev_priv->regfile.saveBLC_PWM_CTL = I915_READ(BLC_PWM_CTL);
-		if (INTEL_INFO(dev)->gen >= 4)
+		if (dev_priv->info->gen >= 4)
 			dev_priv->regfile.saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_CTL2);
 	}
 
@@ -302,7 +302,7 @@ void i915_restore_display_reg(struct drm_device *dev)
 		I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->regfile.saveBLC_CPU_PWM_CTL2);
 		I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->regfile.saveBLC_CPU_PWM_CTL);
 	} else {
-		if (INTEL_INFO(dev)->gen >= 4)
+		if (dev_priv->info->gen >= 4)
 			I915_WRITE(BLC_PWM_CTL2, dev_priv->regfile.saveBLC_PWM_CTL2);
 		I915_WRITE(BLC_PWM_CTL, dev_priv->regfile.saveBLC_PWM_CTL);
 	}
@@ -320,7 +320,7 @@ void i915_restore_display_reg(struct drm_device *dev)
 	}
 
 	/* Fences */
-	switch (INTEL_INFO(dev)->gen) {
+	switch (dev_priv->info->gen) {
 	case 7:
 	case 6:
 		for (i = 0; i < 16; i++)
@@ -377,7 +377,7 @@ void i915_restore_display_reg(struct drm_device *dev)
 	I915_WRITE(dpll_a_reg, dev_priv->regfile.saveDPLL_A);
 	POSTING_READ(dpll_a_reg);
 	udelay(150);
-	if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) {
+	if (dev_priv->info->gen >= 4 && !HAS_PCH_SPLIT(dev)) {
 		I915_WRITE(_DPLL_A_MD, dev_priv->regfile.saveDPLL_A_MD);
 		POSTING_READ(_DPLL_A_MD);
 	}
@@ -421,7 +421,7 @@ void i915_restore_display_reg(struct drm_device *dev)
 	I915_WRITE(_PIPEASRC, dev_priv->regfile.savePIPEASRC);
 	I915_WRITE(_DSPAADDR, dev_priv->regfile.saveDSPAADDR);
 	I915_WRITE(_DSPASTRIDE, dev_priv->regfile.saveDSPASTRIDE);
-	if (INTEL_INFO(dev)->gen >= 4) {
+	if (dev_priv->info->gen >= 4) {
 		I915_WRITE(_DSPASURF, dev_priv->regfile.saveDSPASURF);
 		I915_WRITE(_DSPATILEOFF, dev_priv->regfile.saveDSPATILEOFF);
 	}
@@ -446,7 +446,7 @@ void i915_restore_display_reg(struct drm_device *dev)
 	I915_WRITE(dpll_b_reg, dev_priv->regfile.saveDPLL_B);
 	POSTING_READ(dpll_b_reg);
 	udelay(150);
-	if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) {
+	if (dev_priv->info->gen >= 4 && !HAS_PCH_SPLIT(dev)) {
 		I915_WRITE(_DPLL_B_MD, dev_priv->regfile.saveDPLL_B_MD);
 		POSTING_READ(_DPLL_B_MD);
 	}
@@ -490,7 +490,7 @@ void i915_restore_display_reg(struct drm_device *dev)
 	I915_WRITE(_PIPEBSRC, dev_priv->regfile.savePIPEBSRC);
 	I915_WRITE(_DSPBADDR, dev_priv->regfile.saveDSPBADDR);
 	I915_WRITE(_DSPBSTRIDE, dev_priv->regfile.saveDSPBSTRIDE);
-	if (INTEL_INFO(dev)->gen >= 4) {
+	if (dev_priv->info->gen >= 4) {
 		I915_WRITE(_DSPBSURF, dev_priv->regfile.saveDSPBSURF);
 		I915_WRITE(_DSPBTILEOFF, dev_priv->regfile.saveDSPBTILEOFF);
 	}
drivers/gpu/drm/i915/intel_bios.c +3 -1
index f220419..4523e51 100644
@@ -353,7 +353,9 @@ parse_sdvo_panel_data(struct drm_i915_private *dev_priv,
 static int intel_bios_ssc_frequency(struct drm_device *dev,
 				    bool alternate)
 {
-	switch (INTEL_INFO(dev)->gen) {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	switch (dev_priv->info->gen) {
 	case 2:
 		return alternate ? 66667 : 48000;
 	case 3:
drivers/gpu/drm/i915/intel_crt.c +4 -3
index e2e39e6..8e66a96 100644
@@ -179,12 +179,13 @@ static void intel_enable_crt(struct intel_encoder *encoder)
 static void intel_crt_dpms(struct drm_connector *connector, int mode)
 {
 	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_encoder *encoder = intel_attached_encoder(connector);
 	struct drm_crtc *crtc;
 	int old_dpms;
 
 	/* PCH platforms and VLV only support on/off. */
-	if (INTEL_INFO(dev)->gen >= 5 && mode != DRM_MODE_DPMS_ON)
+	if (dev_priv->info->gen >= 5 && mode != DRM_MODE_DPMS_ON)
 		mode = DRM_MODE_DPMS_OFF;
 
 	if (mode == connector->dpms)
@@ -275,7 +276,7 @@ static void intel_crt_mode_set(struct intel_encoder *encoder)
 	struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode;
 	u32 adpa;
 
-	if (INTEL_INFO(dev)->gen >= 5)
+	if (dev_priv->info->gen >= 5)
 		adpa = ADPA_HOTPLUG_BITS;
 	else
 		adpa = 0;
@@ -712,7 +713,7 @@ static void intel_crt_reset(struct drm_connector *connector)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crt *crt = intel_attached_crt(connector);
 
-	if (INTEL_INFO(dev)->gen >= 5) {
+	if (dev_priv->info->gen >= 5) {
 		u32 adpa;
 
 		adpa = I915_READ(crt->adpa_reg);
drivers/gpu/drm/i915/intel_display.c +65 -58

457 lines not on this page · raw message

drivers/gpu/drm/i915/intel_fbdev.c +2 -2
index d53c17d..6e8adc3 100644
@@ -276,7 +276,7 @@ int intel_fbdev_init(struct drm_device *dev)
 	ifbdev->helper.funcs = &intel_fb_helper_funcs;
 
 	ret = drm_fb_helper_init(dev, &ifbdev->helper,
-				 INTEL_INFO(dev)->num_pipes,
+				 dev_priv->info->num_pipes,
 				 4);
 	if (ret) {
 		kfree(ifbdev);
@@ -341,7 +341,7 @@ void intel_fbdev_restore_mode(struct drm_device *dev)
 	int ret;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (INTEL_INFO(dev)->num_pipes == 0)
+	if (dev_priv->info->num_pipes == 0)
 		return;
 
 	drm_modeset_lock_all(dev);
drivers/gpu/drm/i915/intel_hdmi.c +2 -1
index 6db0d9d..1243af0 100644
@@ -844,10 +844,11 @@ static void intel_disable_hdmi(struct intel_encoder *encoder)
 static int hdmi_portclock_limit(struct intel_hdmi *hdmi)
 {
 	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
+	struct drm_i915_private *dev_priv = dev->dev_private;
 
 	if (IS_G4X(dev))
 		return 165000;
-	else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8)
+	else if (IS_HASWELL(dev) || dev_priv->info->gen >= 8)
 		return 300000;
 	else
 		return 225000;
drivers/gpu/drm/i915/intel_i2c.c +1 -1
index b1dc33f..e97b563 100644
@@ -264,7 +264,7 @@ intel_gpio_setup(struct intel_gmbus *bus, u32 pin)
  * shared with another device. The kernel then disables that interrupt source
  * and so prevents the other device from working properly.
  */
-#define HAS_GMBUS_IRQ(dev) (INTEL_INFO(dev)->gen >= 5)
+#define HAS_GMBUS_IRQ(dev) (dev_priv->info->gen >= 5)
 static int
 gmbus_wait_hw_status(struct drm_i915_private *dev_priv,
 		     u32 gmbus2_status,
drivers/gpu/drm/i915/intel_lvds.c +6 -4
index 8bcb93a..2cd7315 100644
@@ -112,7 +112,7 @@ static void intel_lvds_get_config(struct intel_encoder *encoder,
 	pipe_config->adjusted_mode.flags |= flags;
 
 	/* gen2/3 store dither state in pfit control, needs to match */
-	if (INTEL_INFO(dev)->gen < 4) {
+	if (dev_priv->info->gen < 4) {
 		tmp = I915_READ(PFIT_CONTROL);
 
 		pipe_config->gmch_pfit.control |= tmp & PANEL_8TO6_DITHER_ENABLE;
@@ -182,7 +182,7 @@ static void intel_pre_enable_lvds(struct intel_encoder *encoder)
 	/* Set the dithering flag on LVDS as needed, note that there is no
 	 * special lvds dither control bit on pch-split platforms, dithering is
 	 * only controlled through the PIPECONF reg. */
-	if (INTEL_INFO(dev)->gen == 4) {
+	if (dev_priv->info->gen == 4) {
 		/* Bspec wording suggests that LVDS port dithering only exists
 		 * for 18bpp panels. */
 		if (crtc->config.dither && crtc->config.pipe_bpp == 18)
@@ -285,7 +285,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
 	unsigned int lvds_bpp;
 
 	/* Should never happen!! */
-	if (INTEL_INFO(dev)->gen < 4 && intel_crtc->pipe == 0) {
+	if (dev_priv->info->gen < 4 && intel_crtc->pipe == 0) {
 		DRM_ERROR("Can't support LVDS on pipe A\n");
 		return false;
 	}
@@ -868,6 +868,8 @@ static bool compute_is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder)
 
 static bool intel_lvds_supported(struct drm_device *dev)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
 	/* With the introduction of the PCH we gained a dedicated
 	 * LVDS presence pin, use it. */
 	if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
@@ -875,7 +877,7 @@ static bool intel_lvds_supported(struct drm_device *dev)
 
 	/* Otherwise LVDS was only attached to mobile products,
 	 * except for the inglorious 830gm */
-	if (INTEL_INFO(dev)->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
+	if (dev_priv->info->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
 		return true;
 
 	return false;
drivers/gpu/drm/i915/intel_overlay.c +1 -1
index a1397b1..2e0b899 100644
@@ -841,7 +841,7 @@ static void update_pfit_vscale_ratio(struct intel_overlay *overlay)
 	/* XXX: This is not the same logic as in the xorg driver, but more in
 	 * line with the intel documentation for the i965
 	 */
-	if (INTEL_INFO(dev)->gen >= 4) {
+	if (dev_priv->info->gen >= 4) {
 		/* on i965 use the PGM reg to read out the autoscaler values */
 		ratio = I915_READ(PFIT_PGM_RATIOS) >> PFIT_VERT_SCALE_SHIFT_965;
 	} else {
drivers/gpu/drm/i915/intel_panel.c +6 -5
index 20ebc3e..c3ceb84 100644
@@ -254,6 +254,7 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
 			      int fitting_mode)
 {
 	struct drm_device *dev = intel_crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 pfit_control = 0, pfit_pgm_ratios = 0, border = 0;
 	struct drm_display_mode *adjusted_mode;
 
@@ -276,7 +277,7 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
 		break;
 	case DRM_MODE_SCALE_ASPECT:
 		/* Scale but preserve the aspect ratio */
-		if (INTEL_INFO(dev)->gen >= 4)
+		if (dev_priv->info->gen >= 4)
 			i965_scale_aspect(pipe_config, &pfit_control);
 		else
 			i9xx_scale_aspect(pipe_config, &pfit_control,
@@ -290,7 +291,7 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
 		if (pipe_config->pipe_src_h != adjusted_mode->vdisplay ||
 		    pipe_config->pipe_src_w != adjusted_mode->hdisplay) {
 			pfit_control |= PFIT_ENABLE;
-			if (INTEL_INFO(dev)->gen >= 4)
+			if (dev_priv->info->gen >= 4)
 				pfit_control |= PFIT_SCALING_AUTO;
 			else
 				pfit_control |= (VERT_AUTO_SCALE |
@@ -306,7 +307,7 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
 
 	/* 965+ wants fuzzy fitting */
 	/* FIXME: handle multiple panels by failing gracefully */
-	if (INTEL_INFO(dev)->gen >= 4)
+	if (dev_priv->info->gen >= 4)
 		pfit_control |= ((intel_crtc->pipe << PFIT_PIPE_SHIFT) |
 				 PFIT_FILTER_FUZZY);
 
@@ -317,7 +318,7 @@ out:
 	}
 
 	/* Make sure pre-965 set dither correctly for 18bpp panels. */
-	if (INTEL_INFO(dev)->gen < 4 && pipe_config->pipe_bpp == 18)
+	if (dev_priv->info->gen < 4 && pipe_config->pipe_bpp == 18)
 		pfit_control |= PANEL_8TO6_DITHER_ENABLE;
 
 	pipe_config->gmch_pfit.control = pfit_control;
@@ -376,7 +377,7 @@ static u32 i9xx_get_backlight(struct intel_connector *connector)
 	u32 val;
 
 	val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
-	if (INTEL_INFO(dev)->gen < 4)
+	if (dev_priv->info->gen < 4)
 		val >>= 1;
 
 	if (panel->backlight.combination_mode) {
drivers/gpu/drm/i915/intel_pm.c +31 -23

201 lines not on this page · raw message

drivers/gpu/drm/i915/intel_ringbuffer.c +21 -21

149 lines not on this page · raw message

drivers/gpu/drm/i915/intel_sdvo.c +6 -5
index 95bdfb3..4e44733 100644
@@ -1254,13 +1254,13 @@ static void intel_sdvo_mode_set(struct intel_encoder *intel_encoder)
 		return;
 
 	/* Set the SDVO control regs. */
-	if (INTEL_INFO(dev)->gen >= 4) {
+	if (dev_priv->info->gen >= 4) {
 		/* The real mode polarity is set by the SDVO commands, using
 		 * struct intel_sdvo_dtd. */
 		sdvox = SDVO_VSYNC_ACTIVE_HIGH | SDVO_HSYNC_ACTIVE_HIGH;
 		if (!HAS_PCH_SPLIT(dev) && intel_sdvo->is_hdmi)
 			sdvox |= intel_sdvo->color_range;
-		if (INTEL_INFO(dev)->gen < 5)
+		if (dev_priv->info->gen < 5)
 			sdvox |= SDVO_BORDER_ENABLE;
 	} else {
 		sdvox = I915_READ(intel_sdvo->sdvo_reg);
@@ -1283,7 +1283,7 @@ static void intel_sdvo_mode_set(struct intel_encoder *intel_encoder)
 	if (intel_sdvo->has_hdmi_audio)
 		sdvox |= SDVO_AUDIO_ENABLE;
 
-	if (INTEL_INFO(dev)->gen >= 4) {
+	if (dev_priv->info->gen >= 4) {
 		/* done in crtc_mode_set as the dpll_md reg must be written early */
 	} else if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) {
 		/* done in crtc_mode_set as it lives inside the dpll register */
@@ -1293,7 +1293,7 @@ static void intel_sdvo_mode_set(struct intel_encoder *intel_encoder)
 	}
 
 	if (input_dtd.part2.sdvo_flags & SDVO_NEED_TO_STALL &&
-	    INTEL_INFO(dev)->gen < 5)
+	    dev_priv->info->gen < 5)
 		sdvox |= SDVO_STALL_SELECT;
 	intel_sdvo_write_sdvox(intel_sdvo, sdvox);
 }
@@ -2407,9 +2407,10 @@ intel_sdvo_add_hdmi_properties(struct intel_sdvo *intel_sdvo,
 			       struct intel_sdvo_connector *connector)
 {
 	struct drm_device *dev = connector->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 
 	intel_attach_force_audio_property(&connector->base.base);
-	if (INTEL_INFO(dev)->gen >= 4 && IS_MOBILE(dev)) {
+	if (dev_priv->info->gen >= 4 && IS_MOBILE(dev)) {
 		intel_attach_broadcast_rgb_property(&connector->base.base);
 		intel_sdvo->color_range_auto = true;
 	}
drivers/gpu/drm/i915/intel_sprite.c +3 -2
index fe4de89..5584cd9 100644
@@ -1073,20 +1073,21 @@ static uint32_t vlv_plane_formats[] = {
 int
 intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_plane *intel_plane;
 	unsigned long possible_crtcs;
 	const uint32_t *plane_formats;
 	int num_plane_formats;
 	int ret;
 
-	if (INTEL_INFO(dev)->gen < 5)
+	if (dev_priv->info->gen < 5)
 		return -ENODEV;
 
 	intel_plane = kzalloc(sizeof(*intel_plane), GFP_KERNEL);
 	if (!intel_plane)
 		return -ENOMEM;
 
-	switch (INTEL_INFO(dev)->gen) {
+	switch (dev_priv->info->gen) {
 	case 5:
 	case 6:
 		intel_plane->can_scale = true;
drivers/gpu/drm/i915/intel_tv.c +1 -1
index 22cf0f4..0448f0b 100644
@@ -1083,7 +1083,7 @@ static void intel_tv_mode_set(struct intel_encoder *encoder)
 			   color_conversion->av);
 	}
 
-	if (INTEL_INFO(dev)->gen >= 4)
+	if (dev_priv->info->gen >= 4)
 		I915_WRITE(TV_CLR_KNOBS, 0x00404000);
 	else
 		I915_WRITE(TV_CLR_KNOBS, 0x00606000);
drivers/gpu/drm/i915/intel_uncore.c +6 -4
index 646fecf..e8850b8 100644
@@ -307,7 +307,7 @@ static void intel_uncore_forcewake_reset(struct drm_device *dev)
 
 	if (IS_VALLEYVIEW(dev)) {
 		vlv_force_wake_reset(dev_priv);
-	} else if (INTEL_INFO(dev)->gen >= 6) {
+	} else if (dev_priv->info->gen >= 6) {
 		__gen6_gt_force_wake_reset(dev_priv);
 		if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
 			__gen6_gt_force_wake_mt_reset(dev_priv);
@@ -728,7 +728,7 @@ void intel_uncore_init(struct drm_device *dev)
 			__gen6_gt_force_wake_put;
 	}
 
-	switch (INTEL_INFO(dev)->gen) {
+	switch (dev_priv->info->gen) {
 	default:
 		dev_priv->uncore.funcs.mmio_writeb  = gen8_write8;
 		dev_priv->uncore.funcs.mmio_writew  = gen8_write16;
@@ -818,7 +818,7 @@ int i915_reg_read_ioctl(struct drm_device *dev,
 
 	for (i = 0; i < ARRAY_SIZE(whitelist); i++, entry++) {
 		if (entry->offset == reg->offset &&
-		    (1 << INTEL_INFO(dev)->gen & entry->gen_bitmask))
+		    (1 << dev_priv->info->gen & entry->gen_bitmask))
 			break;
 	}
 
@@ -981,7 +981,9 @@ static int gen6_do_reset(struct drm_device *dev)
 
 int intel_gpu_reset(struct drm_device *dev)
 {
-	switch (INTEL_INFO(dev)->gen) {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	switch (dev_priv->info->gen) {
 	case 8:
 	case 7:
 	case 6: return gen6_do_reset(dev);
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 4/12 drm/i915: Finish replacing INTEL_INFO() by direct dev_priv usage

In reply to Damien Lespiau

The last occurences of INTEL_INFO() that weren't caught by the sed in:
drm/i915: Mass replace INTEL_INFO() by dev_priv->info

Nothing particularly noticeable except, maybe, the nice feeling of removing a few back and forth between *dev and *dev_priv.

---
 drivers/gpu/drm/i915/i915_debugfs.c        |  2 +-
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  4 ++--
 drivers/gpu/drm/i915/i915_gem_gtt.c        |  2 +-
 drivers/gpu/drm/i915/i915_gem_tiling.c     |  5 +++--
 drivers/gpu/drm/i915/intel_ringbuffer.c    | 16 +++++++++-------
 drivers/gpu/drm/i915/intel_uncore.c        |  2 +-
 6 files changed, 17 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index 26686f7..db8f381 100644
@@ -2004,7 +2004,7 @@ static int i915_pipe_crc_open(struct inode *inode, struct file *filep)
 	struct drm_i915_private *dev_priv = info->dev->dev_private;
 	struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[info->pipe];
 
-	if (info->pipe >= INTEL_INFO(info->dev)->num_pipes)
+	if (info->pipe >= dev_priv->info->num_pipes)
 		return -ENODEV;
 
 	spin_lock_irq(&pipe_crc->lock);
drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 -2
index 65783d5..431a65a 100644
@@ -545,7 +545,7 @@ i915_gem_execbuffer_reserve_vma(struct i915_vma *vma,
 {
 	struct drm_i915_gem_object *obj = vma->obj;
 	struct drm_i915_gem_exec_object2 *entry = vma->exec_entry;
-	bool has_fenced_gpu_access = INTEL_INFO(ring->dev)->gen < 4;
+	bool has_fenced_gpu_access = to_i915(ring->dev)->info->gen < 4;
 	bool need_fence, need_mappable;
 	u32 flags = (entry->flags & EXEC_OBJECT_NEEDS_GTT) &&
 		!vma->obj->has_global_gtt_mapping ? GLOBAL_BIND : 0;
@@ -601,7 +601,7 @@ i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring,
 	struct i915_vma *vma;
 	struct i915_address_space *vm;
 	struct list_head ordered_vmas;
-	bool has_fenced_gpu_access = INTEL_INFO(ring->dev)->gen < 4;
+	bool has_fenced_gpu_access = to_i915(ring->dev)->info->gen < 4;
 	int retry;
 
 	if (list_empty(vmas))
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -1
index 3a2e5bc..2f76c77 100644
@@ -1791,7 +1791,7 @@ static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj,
 	vma->vm = vm;
 	vma->obj = obj;
 
-	switch (INTEL_INFO(vm->dev)->gen) {
+	switch (to_i915(vm->dev)->info->gen) {
 	case 8:
 	case 7:
 	case 6:
drivers/gpu/drm/i915/i915_gem_tiling.c +3 -2
index e7dedd4..2d3535f 100644
@@ -260,15 +260,16 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
 static bool
 i915_gem_object_fence_ok(struct drm_i915_gem_object *obj, int tiling_mode)
 {
+	struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
 	u32 size;
 
 	if (tiling_mode == I915_TILING_NONE)
 		return true;
 
-	if (INTEL_INFO(obj->base.dev)->gen >= 4)
+	if (dev_priv->info->gen >= 4)
 		return true;
 
-	if (INTEL_INFO(obj->base.dev)->gen == 3) {
+	if (dev_priv->info->gen == 3) {
 		if (i915_gem_obj_ggtt_offset(obj) & ~I915_FENCE_START_MASK)
 			return false;
 	} else {
drivers/gpu/drm/i915/intel_ringbuffer.c +9 -7
index 99a82d6..1ac11a9 100644
@@ -413,7 +413,7 @@ static void ring_write_tail(struct intel_ring_buffer *ring,
 u32 intel_ring_get_active_head(struct intel_ring_buffer *ring)
 {
 	drm_i915_private_t *dev_priv = ring->dev->dev_private;
-	u32 acthd_reg = INTEL_INFO(ring->dev)->gen >= 4 ?
+	u32 acthd_reg = dev_priv->info->gen >= 4 ?
 			RING_ACTHD(ring->mmio_base) : ACTHD;
 
 	return I915_READ(acthd_reg);
@@ -425,7 +425,7 @@ static void ring_setup_phys_status_page(struct intel_ring_buffer *ring)
 	u32 addr;
 
 	addr = dev_priv->status_page_dmah->busaddr;
-	if (INTEL_INFO(ring->dev)->gen >= 4)
+	if (dev_priv->info->gen >= 4)
 		addr |= (dev_priv->status_page_dmah->busaddr >> 28) & 0xf0;
 	I915_WRITE(HWS_PGA, addr);
 }
@@ -1653,7 +1653,7 @@ void intel_ring_init_seqno(struct intel_ring_buffer *ring, u32 seqno)
 
 	BUG_ON(ring->outstanding_lazy_seqno);
 
-	if (INTEL_INFO(ring->dev)->gen >= 6) {
+	if (dev_priv->info->gen >= 6) {
 		I915_WRITE(RING_SYNC_0(ring->mmio_base), 0);
 		I915_WRITE(RING_SYNC_1(ring->mmio_base), 0);
 		if (HAS_VEBOX(ring->dev))
@@ -1700,6 +1700,7 @@ static void gen6_bsd_ring_write_tail(struct intel_ring_buffer *ring,
 static int gen6_bsd_ring_flush(struct intel_ring_buffer *ring,
 			       u32 invalidate, u32 flush)
 {
+	drm_i915_private_t *dev_priv = ring->dev->dev_private;
 	uint32_t cmd;
 	int ret;
 
@@ -1708,7 +1709,7 @@ static int gen6_bsd_ring_flush(struct intel_ring_buffer *ring,
 		return ret;
 
 	cmd = MI_FLUSH_DW;
-	if (INTEL_INFO(ring->dev)->gen >= 8)
+	if (dev_priv->info->gen >= 8)
 		cmd += 1;
 	/*
 	 * Bspec vol 1c.5 - video engine command streamer:
@@ -1721,7 +1722,7 @@ static int gen6_bsd_ring_flush(struct intel_ring_buffer *ring,
 			MI_FLUSH_DW_STORE_INDEX | MI_FLUSH_DW_OP_STOREDW;
 	intel_ring_emit(ring, cmd);
 	intel_ring_emit(ring, I915_GEM_HWS_SCRATCH_ADDR | MI_FLUSH_DW_USE_GTT);
-	if (INTEL_INFO(ring->dev)->gen >= 8) {
+	if (dev_priv->info->gen >= 8) {
 		intel_ring_emit(ring, 0); /* upper addr */
 		intel_ring_emit(ring, 0); /* value */
 	} else  {
@@ -1804,6 +1805,7 @@ static int gen6_ring_flush(struct intel_ring_buffer *ring,
 			   u32 invalidate, u32 flush)
 {
 	struct drm_device *dev = ring->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t cmd;
 	int ret;
 
@@ -1812,7 +1814,7 @@ static int gen6_ring_flush(struct intel_ring_buffer *ring,
 		return ret;
 
 	cmd = MI_FLUSH_DW;
-	if (INTEL_INFO(ring->dev)->gen >= 8)
+	if (dev_priv->info->gen >= 8)
 		cmd += 1;
 	/*
 	 * Bspec vol 1c.3 - blitter engine command streamer:
@@ -1825,7 +1827,7 @@ static int gen6_ring_flush(struct intel_ring_buffer *ring,
 			MI_FLUSH_DW_OP_STOREDW;
 	intel_ring_emit(ring, cmd);
 	intel_ring_emit(ring, I915_GEM_HWS_SCRATCH_ADDR | MI_FLUSH_DW_USE_GTT);
-	if (INTEL_INFO(ring->dev)->gen >= 8) {
+	if (dev_priv->info->gen >= 8) {
 		intel_ring_emit(ring, 0); /* upper addr */
 		intel_ring_emit(ring, 0); /* value */
 	} else  {
drivers/gpu/drm/i915/intel_uncore.c +1 -1
index e8850b8..3283059f 100644
@@ -114,7 +114,7 @@ static void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv,
 		DRM_ERROR("Timed out waiting for forcewake to ack request.\n");
 
 	/* WaRsForcewakeWaitTC0:ivb,hsw */
-	if (INTEL_INFO(dev_priv->dev)->gen < 8)
+	if (dev_priv->info->gen < 8)
 		__gen6_gt_wait_for_thread_c0(dev_priv);
 }
 
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH 5/12 drm/i915: Remove INTEL_INFO()

In reply to Damien Lespiau

Finally, we reach the goal of the last few patches: the removal of INTEL_INFO() in favor of a direct dev_priv usage.

---
 drivers/gpu/drm/i915/i915_drv.h | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -2
index e9c3339..54ee3a8 100644
@@ -1772,8 +1772,6 @@ struct drm_i915_file_private {
 	atomic_t rps_wait_boost;
 };
 
-#define INTEL_INFO(dev)	(to_i915(dev)->info)
-
 #define IS_I830(dev)		((dev)->pdev->device == 0x3577)
 #define IS_845G(dev)		((dev)->pdev->device == 0x2562)
 #define IS_I85X(dev)		(to_i915(dev)->info->is_i85x)
Signature · 1 line
1.8.3.1
#6 lore raw

Re: [PATCH 05/12] drm/i915: Remove INTEL_INFO()

Quoted 4 lines · Damien Lespiau

Finally, we reach the goal of the last few patches: the removal of INTEL_INFO() in favor of a direct dev_priv usage.

Please pardon my incompetence, but I think I need to pull a heelturn on this one :(

Apparently product groups noticed again that we have a unified driver across all platforms ever shipped and they don't like the space overhead that much. Since the usual approaches of splattering #ifdefs all over the code or (gasp!) editing all the sources files are complete no-goes for upstream we need something else. My idea would be to:
- convert all HAS_FOO macros to used INTEL_INFO underneath.
- allow hard-coding of INTEL_INFO structs.
- enable LTE on i915 and let gcc's DCE path take care of all the dead code removal.

Minimal overhead for upstream, still tidy code and a good chance to get product groups what they want. But it also means we'll need to keep INTEL_INFO around, hence why I'll nak patches 1-5.

Patch 6 is merged with Paulo's r-b (it still applied).

Ofc to_i915_dev is still really nice, so can I sheepishly ask you to resurrect that part of your patches and roll to_i915_dev a bit out over the tree?

I think I'll owe you a few rounds of your $favourite_beverage the next time we meet for recompense, maybe at fosdem ...

Cheers, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#7 lore raw

PATCH 6/12 drm/i915: Constify the drm_i915_private pointer a bit more

In reply to Damien Lespiau

A lot of the WM functions are only reading from that structure and are already using const. While converting the code to use dev_priv instead of dev, I noticed a few places where we can give that hint.

---
 drivers/gpu/drm/i915/intel_pm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +4 -4
index 95eb4cc..f018d24 100644
@@ -1902,7 +1902,7 @@ static unsigned int ilk_cursor_wm_max(const struct drm_i915_private *dev_priv,
 }
 
 /* Calculate the maximum FBC watermark */
-static unsigned int ilk_fbc_wm_max(struct drm_i915_private *dev_priv)
+static unsigned int ilk_fbc_wm_max(const struct drm_i915_private *dev_priv)
 {
 	/* max that registers can hold */
 	if (dev_priv->info->gen >= 8)
@@ -1911,7 +1911,7 @@ static unsigned int ilk_fbc_wm_max(struct drm_i915_private *dev_priv)
 		return 15;
 }
 
-static void ilk_compute_wm_maximums(struct drm_i915_private *dev_priv,
+static void ilk_compute_wm_maximums(const struct drm_i915_private *dev_priv,
 				    int level,
 				    const struct intel_wm_config *config,
 				    enum intel_ddb_partitioning ddb_partitioning,
@@ -1964,7 +1964,7 @@ static bool ilk_validate_wm_level(int level,
 	return ret;
 }
 
-static void ilk_compute_wm_level(struct drm_i915_private *dev_priv,
+static void ilk_compute_wm_level(const struct drm_i915_private *dev_priv,
 				 int level,
 				 const struct ilk_pipe_wm_parameters *p,
 				 struct intel_wm_level *result)
@@ -2161,7 +2161,7 @@ static bool intel_compute_pipe_wm(struct drm_crtc *crtc,
 				  struct intel_pipe_wm *pipe_wm)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	const struct drm_i915_private *dev_priv = dev->dev_private;
 	int level, max_level = ilk_wm_max_level(dev);
 	/* LP0 watermark maximums depend on this pipe alone */
 	struct intel_wm_config config = {
Signature · 1 line
1.8.3.1
#8 lore raw

PATCH 7/12 drm/i915: Make the intel_device_info structure kept in dev_priv writable

In reply to Damien Lespiau

Turns out it'd be nice to change some device information at run-time or simply have some code to fill in the info struct instead of having to declare the values in 30+ structures.

What prompted this change is handling fused out display/pipe and tweaking num_pipes at run-time, but I'm quite sure we'll find other flags/limits to stick into dev_priv->info.

Most of the changes were done with two sed commands:
sed -i -e 's/dev_priv->info->/dev_priv->info./g' drivers/gpu/drm/i915/*[ch] sed -i -e 's/to_i915(\(.*\))->info->/to_i915(\1)->info./g' drivers/gpu/drm/i915/*[ch]

with a few tweaks to make it all work:
- Change the field definition in struct drm_i915_private
- adjust i915_dump_device_info()
- adjust i915_driver_load()
- adjust i915_debugfs.c:i915_capabilities() that needed a pointer to

    dev_priv->info.

v2: cast the info pointer returned by INTEL_INFO() to be const to catch
uses that would modify the structure post-initialization. (Ville Syrjälä)

v3: Rebase on to of the INTEL_INFO() removal

---
 drivers/gpu/drm/i915/i915_debugfs.c        |  26 ++--
 drivers/gpu/drm/i915/i915_dma.c            |  45 ++++--
 drivers/gpu/drm/i915/i915_drv.c            |   6 +-
 drivers/gpu/drm/i915/i915_drv.h            |  82 +++++------
 drivers/gpu/drm/i915/i915_gem.c            |  26 ++--
 drivers/gpu/drm/i915/i915_gem_context.c    |  10 +-
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  20 +--
 drivers/gpu/drm/i915/i915_gem_gtt.c        |  18 +--
 drivers/gpu/drm/i915/i915_gem_stolen.c     |   2 +-
 drivers/gpu/drm/i915/i915_gem_tiling.c     |  12 +-
 drivers/gpu/drm/i915/i915_gpu_error.c      |  32 ++--
 drivers/gpu/drm/i915/i915_irq.c            |  50 +++----
 drivers/gpu/drm/i915/i915_reg.h            | 228 ++++++++++++++---------------
 drivers/gpu/drm/i915/i915_suspend.c        |  14 +-
 drivers/gpu/drm/i915/i915_sysfs.c          |   4 +-
 drivers/gpu/drm/i915/i915_ums.c            |  24 +--
 drivers/gpu/drm/i915/intel_bios.c          |   2 +-
 drivers/gpu/drm/i915/intel_crt.c           |   6 +-
 drivers/gpu/drm/i915/intel_display.c       | 134 ++++++++---------
 drivers/gpu/drm/i915/intel_fbdev.c         |   4 +-
 drivers/gpu/drm/i915/intel_hdmi.c          |   2 +-
 drivers/gpu/drm/i915/intel_i2c.c           |   2 +-
 drivers/gpu/drm/i915/intel_lvds.c          |   8 +-
 drivers/gpu/drm/i915/intel_overlay.c       |   2 +-
 drivers/gpu/drm/i915/intel_panel.c         |  10 +-
 drivers/gpu/drm/i915/intel_pm.c            |  72 ++++-----
 drivers/gpu/drm/i915/intel_ringbuffer.c    |  54 +++----
 drivers/gpu/drm/i915/intel_sdvo.c          |  10 +-
 drivers/gpu/drm/i915/intel_sprite.c        |   4 +-
 drivers/gpu/drm/i915/intel_tv.c            |   2 +-
 drivers/gpu/drm/i915/intel_uncore.c        |  10 +-
 31 files changed, 468 insertions(+), 453 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +13 -13
index db8f381..91fb09d 100644
@@ -81,7 +81,7 @@ static int i915_capabilities(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	const struct intel_device_info *info = to_i915(dev)->info;
+	const struct intel_device_info *info = &to_i915(dev)->info;
 
 	seq_printf(m, "gen: %d\n", info->gen);
 	seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev));
@@ -601,7 +601,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
 		return ret;
 	intel_runtime_pm_get(dev_priv);
 
-	if (dev_priv->info->gen >= 8) {
+	if (dev_priv->info.gen >= 8) {
 		int i;
 		seq_printf(m, "Master Interrupt Control:\t%08x\n",
 			   I915_READ(GEN8_MASTER_IRQ));
@@ -719,7 +719,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
 	seq_printf(m, "Interrupts received: %d\n",
 		   atomic_read(&dev_priv->irq_received));
 	for_each_ring(ring, dev_priv, i) {
-		if (dev_priv->info->gen >= 6) {
+		if (dev_priv->info.gen >= 6) {
 			seq_printf(m,
 				   "Graphics Interrupt mask (%s):	%08x\n",
 				   ring->name, I915_READ_IMR(ring));
@@ -1667,7 +1667,7 @@ static int i915_swizzle_info(struct seq_file *m, void *data)
 			   I915_READ16(C0DRB3));
 		seq_printf(m, "C1DRB3 = 0x%04x\n",
 			   I915_READ16(C1DRB3));
-	} else if (dev_priv->info->gen >= 6) {
+	} else if (dev_priv->info.gen >= 6) {
 		seq_printf(m, "MAD_DIMM_C0 = 0x%08x\n",
 			   I915_READ(MAD_DIMM_C0));
 		seq_printf(m, "MAD_DIMM_C1 = 0x%08x\n",
@@ -1734,12 +1734,12 @@ static void gen6_ppgtt_info(struct seq_file *m, struct drm_device *dev)
 	struct drm_file *file;
 	int i;
 
-	if (dev_priv->info->gen == 6)
+	if (dev_priv->info.gen == 6)
 		seq_printf(m, "GFX_MODE: 0x%08x\n", I915_READ(GFX_MODE));
 
 	for_each_ring(ring, dev_priv, i) {
 		seq_printf(m, "%s\n", ring->name);
-		if (dev_priv->info->gen == 7)
+		if (dev_priv->info.gen == 7)
 			seq_printf(m, "GFX_MODE: 0x%08x\n", I915_READ(RING_MODE_GEN7(ring)));
 		seq_printf(m, "PP_DIR_BASE: 0x%08x\n", I915_READ(RING_PP_DIR_BASE(ring)));
 		seq_printf(m, "PP_DIR_BASE_READ: 0x%08x\n", I915_READ(RING_PP_DIR_BASE_READ(ring)));
@@ -1779,9 +1779,9 @@ static int i915_ppgtt_info(struct seq_file *m, void *data)
 		return ret;
 	intel_runtime_pm_get(dev_priv);
 
-	if (dev_priv->info->gen >= 8)
+	if (dev_priv->info.gen >= 8)
 		gen8_ppgtt_info(m, dev);
-	else if (dev_priv->info->gen >= 6)
+	else if (dev_priv->info.gen >= 6)
 		gen6_ppgtt_info(m, dev);
 
 	intel_runtime_pm_put(dev_priv);
@@ -1884,7 +1884,7 @@ static int i915_energy_uJ(struct seq_file *m, void *data)
 	u64 power;
 	u32 units;
 
-	if (dev_priv->info->gen < 6)
+	if (dev_priv->info.gen < 6)
 		return -ENODEV;
 
 	rdmsrl(MSR_RAPL_POWER_UNIT, power);
@@ -2004,7 +2004,7 @@ static int i915_pipe_crc_open(struct inode *inode, struct file *filep)
 	struct drm_i915_private *dev_priv = info->dev->dev_private;
 	struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[info->pipe];
 
-	if (info->pipe >= dev_priv->info->num_pipes)
+	if (info->pipe >= dev_priv->info.num_pipes)
 		return -ENODEV;
 
 	spin_lock_irq(&pipe_crc->lock);
@@ -2509,7 +2509,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
 
 	if (IS_GEN2(dev))
 		ret = i8xx_pipe_crc_ctl_reg(&source, &val);
-	else if (dev_priv->info->gen < 5)
+	else if (dev_priv->info.gen < 5)
 		ret = i9xx_pipe_crc_ctl_reg(dev, pipe, &source, &val);
 	else if (IS_VALLEYVIEW(dev))
 		ret = vlv_pipe_crc_ctl_reg(dev,pipe, &source, &val);
@@ -3133,7 +3133,7 @@ static int i915_forcewake_open(struct inode *inode, struct file *file)
 	struct drm_device *dev = inode->i_private;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (dev_priv->info->gen < 6)
+	if (dev_priv->info.gen < 6)
 		return 0;
 
 	intel_runtime_pm_get(dev_priv);
@@ -3147,7 +3147,7 @@ static int i915_forcewake_release(struct inode *inode, struct file *file)
 	struct drm_device *dev = inode->i_private;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (dev_priv->info->gen < 6)
+	if (dev_priv->info.gen < 6)
 		return 0;
 
 	gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL);
drivers/gpu/drm/i915/i915_dma.c +30 -15

133 lines not on this page · raw message

drivers/gpu/drm/i915/i915_drv.c +3 -3
index 9134140..db43df6 100644
@@ -411,7 +411,7 @@ void intel_detect_pch(struct drm_device *dev)
 	/* In all current cases, num_pipes is equivalent to the PCH_NOP setting
 	 * (which really amounts to a PCH but no South Display).
 	 */
-	if (dev_priv->info->num_pipes == 0) {
+	if (dev_priv->info.num_pipes == 0) {
 		dev_priv->pch_type = PCH_NOP;
 		return;
 	}
@@ -482,7 +482,7 @@ bool i915_semaphore_is_enabled(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (dev_priv->info->gen < 6)
+	if (dev_priv->info.gen < 6)
 		return false;
 
 	/* Until we get further testing... */
@@ -496,7 +496,7 @@ bool i915_semaphore_is_enabled(struct drm_device *dev)
 
 #ifdef CONFIG_INTEL_IOMMU
 	/* Enable semaphores on SNB when IO remapping is off */
-	if (dev_priv->info->gen == 6 && intel_iommu_gfx_mapped)
+	if (dev_priv->info.gen == 6 && intel_iommu_gfx_mapped)
 		return false;
 #endif
 
drivers/gpu/drm/i915/i915_drv.h +41 -41

151 lines not on this page · raw message

drivers/gpu/drm/i915/i915_gem.c +13 -13
index 1ac740e..f098e3a 100644
@@ -180,7 +180,7 @@ i915_gem_init_ioctl(struct drm_device *dev, void *data,
 		return -EINVAL;
 
 	/* GEM with user mode setting was never supported on ilk and later. */
-	if (dev_priv->info->gen >= 5)
+	if (dev_priv->info.gen >= 5)
 		return -ENODEV;
 
 	mutex_lock(&dev->struct_mutex);
@@ -1029,7 +1029,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
 
 	timeout_expire = timeout ? jiffies + timespec_to_jiffies_timeout(timeout) : 0;
 
-	if (dev_priv->info->gen >= 6 && can_wait_boost(file_priv)) {
+	if (dev_priv->info.gen >= 6 && can_wait_boost(file_priv)) {
 		gen6_rps_boost(dev_priv);
 		if (file_priv)
 			mod_delayed_work(dev_priv->wq,
@@ -1511,12 +1511,12 @@ i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, int tiling_mode)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t gtt_size;
 
-	if (dev_priv->info->gen >= 4 ||
+	if (dev_priv->info.gen >= 4 ||
 	    tiling_mode == I915_TILING_NONE)
 		return size;
 
 	/* Previous chips need a power-of-two fence region when tiling */
-	if (dev_priv->info->gen == 3)
+	if (dev_priv->info.gen == 3)
 		gtt_size = 1024*1024;
 	else
 		gtt_size = 512*1024;
@@ -1544,7 +1544,7 @@ i915_gem_get_gtt_alignment(struct drm_device *dev, uint32_t size,
 	 * Minimum alignment is 4k (GTT page size), but might be greater
 	 * if a fence register is needed for the object.
 	 */
-	if (dev_priv->info->gen >= 4 || (!fenced && IS_G33(dev)) ||
+	if (dev_priv->info.gen >= 4 || (!fenced && IS_G33(dev)) ||
 	    tiling_mode == I915_TILING_NONE)
 		return 4096;
 
@@ -2869,7 +2869,7 @@ static void i965_write_fence_reg(struct drm_device *dev, int reg,
 	int fence_reg;
 	int fence_pitch_shift;
 
-	if (dev_priv->info->gen >= 6) {
+	if (dev_priv->info.gen >= 6) {
 		fence_reg = FENCE_REG_SANDYBRIDGE_0;
 		fence_pitch_shift = SANDYBRIDGE_FENCE_PITCH_SHIFT;
 	} else {
@@ -3010,7 +3010,7 @@ static void i915_gem_write_fence(struct drm_device *dev, int reg,
 	     "bogus fence setup with stride: 0x%x, tiling mode: %i\n",
 	     obj->stride, obj->tiling_mode);
 
-	switch (dev_priv->info->gen) {
+	switch (dev_priv->info.gen) {
 	case 8:
 	case 7:
 	case 6:
@@ -3556,7 +3556,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
 		 * registers with snooped memory, so relinquish any fences
 		 * currently pointing to our region in the aperture.
 		 */
-		if (dev_priv->info->gen < 6) {
+		if (dev_priv->info.gen < 6) {
 			ret = i915_gem_object_put_fence(obj);
 			if (ret)
 				return ret;
@@ -3960,7 +3960,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
 	struct drm_i915_gem_object *obj;
 	int ret;
 
-	if (dev_priv->info->gen >= 6)
+	if (dev_priv->info.gen >= 6)
 		return -ENODEV;
 
 	ret = i915_mutex_lock_interruptible(dev);
@@ -4369,7 +4369,7 @@ void i915_gem_init_swizzling(struct drm_device *dev)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
 
-	if (dev_priv->info->gen < 5 ||
+	if (dev_priv->info.gen < 5 ||
 	    dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_NONE)
 		return;
 
@@ -4458,7 +4458,7 @@ i915_gem_init_hw(struct drm_device *dev)
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	int ret, i;
 
-	if (dev_priv->info->gen < 6 && !intel_enable_gtt())
+	if (dev_priv->info.gen < 6 && !intel_enable_gtt())
 		return -EIO;
 
 	if (dev_priv->ellc_size)
@@ -4676,9 +4676,9 @@ i915_gem_load(struct drm_device *dev)
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		dev_priv->fence_reg_start = 3;
 
-	if (dev_priv->info->gen >= 7 && !IS_VALLEYVIEW(dev))
+	if (dev_priv->info.gen >= 7 && !IS_VALLEYVIEW(dev))
 		dev_priv->num_fence_regs = 32;
-	else if (dev_priv->info->gen >= 4 || IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
+	else if (dev_priv->info.gen >= 4 || IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
 		dev_priv->num_fence_regs = 16;
 	else
 		dev_priv->num_fence_regs = 8;
drivers/gpu/drm/i915/i915_gem_context.c +5 -5
index d4eb705..662b293 100644
@@ -113,7 +113,7 @@ static int get_context_size(struct drm_device *dev)
 	int ret;
 	u32 reg;
 
-	switch (dev_priv->info->gen) {
+	switch (dev_priv->info.gen) {
 	case 6:
 		reg = I915_READ(CXT_SIZE);
 		ret = GEN6_CXT_TOTAL_SIZE(reg) * 64;
@@ -195,7 +195,7 @@ __create_hw_context(struct drm_device *dev,
 		return ERR_PTR(-ENOMEM);
 	}
 
-	if (dev_priv->info->gen >= 7) {
+	if (dev_priv->info.gen >= 7) {
 		ret = i915_gem_object_set_cache_level(ctx->obj,
 						      I915_CACHE_L3_LLC);
 		/* Failure shouldn't ever happen this early */
@@ -319,7 +319,7 @@ void i915_gem_context_reset(struct drm_device *dev)
 	 * the next switch */
 	for (i = 0; i < I915_NUM_RINGS; i++) {
 		struct i915_hw_context *dctx;
-		if (!(dev_priv->info->ring_mask & (1<<i)))
+		if (!(dev_priv->info.ring_mask & (1<<i)))
 			continue;
 
 		/* Do a fake switch to the default context */
@@ -380,7 +380,7 @@ int i915_gem_context_init(struct drm_device *dev)
 	}
 
 	for (i = RCS + 1; i < I915_NUM_RINGS; i++) {
-		if (!(dev_priv->info->ring_mask & (1<<i)))
+		if (!(dev_priv->info.ring_mask & (1<<i)))
 			continue;
 
 		ring = &dev_priv->ring[i];
@@ -424,7 +424,7 @@ void i915_gem_context_fini(struct drm_device *dev)
 
 	for (i = 0; i < I915_NUM_RINGS; i++) {
 		struct intel_ring_buffer *ring = &dev_priv->ring[i];
-		if (!(dev_priv->info->ring_mask & (1<<i)))
+		if (!(dev_priv->info.ring_mask & (1<<i)))
 			continue;
 
 		if (ring->last_context)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +10 -10
index 431a65a..f81c1f1 100644
@@ -278,7 +278,7 @@ relocate_entry_cpu(struct drm_i915_gem_object *obj,
 				reloc->offset >> PAGE_SHIFT));
 	*(uint32_t *)(vaddr + page_offset) = reloc->delta;
 
-	if (dev_priv->info->gen >= 8) {
+	if (dev_priv->info.gen >= 8) {
 		page_offset = offset_in_page(page_offset + sizeof(uint32_t));
 
 		if (page_offset == 0) {
@@ -321,7 +321,7 @@ relocate_entry_gtt(struct drm_i915_gem_object *obj,
 		(reloc_page + offset_in_page(reloc->offset));
 	iowrite32(reloc->delta, reloc_entry);
 
-	if (dev_priv->info->gen >= 8) {
+	if (dev_priv->info.gen >= 8) {
 		reloc_entry += 1;
 
 		if (offset_in_page(reloc->offset + sizeof(uint32_t)) == 0) {
@@ -408,7 +408,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
 
 	/* Check that the relocation address is valid... */
 	if (unlikely(reloc->offset >
-		obj->base.size - (dev_priv->info->gen >= 8 ? 8 : 4))) {
+		obj->base.size - (dev_priv->info.gen >= 8 ? 8 : 4))) {
 		DRM_DEBUG("Relocation beyond object bounds: "
 			  "obj %p target %d offset %d size %d.\n",
 			  obj, reloc->target_handle,
@@ -545,7 +545,7 @@ i915_gem_execbuffer_reserve_vma(struct i915_vma *vma,
 {
 	struct drm_i915_gem_object *obj = vma->obj;
 	struct drm_i915_gem_exec_object2 *entry = vma->exec_entry;
-	bool has_fenced_gpu_access = to_i915(ring->dev)->info->gen < 4;
+	bool has_fenced_gpu_access = to_i915(ring->dev)->info.gen < 4;
 	bool need_fence, need_mappable;
 	u32 flags = (entry->flags & EXEC_OBJECT_NEEDS_GTT) &&
 		!vma->obj->has_global_gtt_mapping ? GLOBAL_BIND : 0;
@@ -601,7 +601,7 @@ i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring,
 	struct i915_vma *vma;
 	struct i915_address_space *vm;
 	struct list_head ordered_vmas;
-	bool has_fenced_gpu_access = to_i915(ring->dev)->info->gen < 4;
+	bool has_fenced_gpu_access = to_i915(ring->dev)->info.gen < 4;
 	int retry;
 
 	if (list_empty(vmas))
@@ -1060,15 +1060,15 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 	case I915_EXEC_CONSTANTS_REL_SURFACE:
 		if (ring == &dev_priv->ring[RCS] &&
 		    mode != dev_priv->relative_constants_mode) {
-			if (dev_priv->info->gen < 4)
+			if (dev_priv->info.gen < 4)
 				return -EINVAL;
 
-			if (dev_priv->info->gen > 5 &&
+			if (dev_priv->info.gen > 5 &&
 			    mode == I915_EXEC_CONSTANTS_REL_SURFACE)
 				return -EINVAL;
 
 			/* The HW changed the meaning on this bit on gen6 */
-			if (dev_priv->info->gen >= 6)
+			if (dev_priv->info.gen >= 6)
 				mask &= ~I915_EXEC_CONSTANTS_REL_SURFACE;
 		}
 		break;
@@ -1088,7 +1088,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 			return -EINVAL;
 		}
 
-		if (dev_priv->info->gen >= 5) {
+		if (dev_priv->info.gen >= 5) {
 			DRM_DEBUG("clip rectangles are only valid on pre-gen5\n");
 			return -EINVAL;
 		}
@@ -1319,7 +1319,7 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
 		exec2_list[i].relocs_ptr = exec_list[i].relocs_ptr;
 		exec2_list[i].alignment = exec_list[i].alignment;
 		exec2_list[i].offset = exec_list[i].offset;
-		if (dev_priv->info->gen < 4)
+		if (dev_priv->info.gen < 4)
 			exec2_list[i].flags = EXEC_OBJECT_NEEDS_FENCE;
 		else
 			exec2_list[i].flags = 0;
drivers/gpu/drm/i915/i915_gem_gtt.c +9 -9
index 2f76c77..1328943 100644
@@ -964,7 +964,7 @@ int i915_gem_init_ppgtt(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt)
 
 	ppgtt->base.dev = dev;
 
-	if (dev_priv->info->gen < 8)
+	if (dev_priv->info.gen < 8)
 		ret = gen6_ppgtt_init(ppgtt);
 	else if (IS_GEN8(dev))
 		ret = gen8_ppgtt_init(ppgtt, dev_priv->gtt.base.total);
@@ -977,7 +977,7 @@ int i915_gem_init_ppgtt(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt)
 		drm_mm_init(&ppgtt->base.mm, ppgtt->base.start,
 			    ppgtt->base.total);
 		i915_init_vm(dev_priv, &ppgtt->base);
-		if (dev_priv->info->gen < 8) {
+		if (dev_priv->info.gen < 8) {
 			gen6_write_pdes(ppgtt);
 			DRM_DEBUG("Adding PPGTT at offset %x\n",
 				  ppgtt->pd_offset << 10);
@@ -1053,7 +1053,7 @@ void i915_check_and_clear_faults(struct drm_device *dev)
 	struct intel_ring_buffer *ring;
 	int i;
 
-	if (dev_priv->info->gen < 6)
+	if (dev_priv->info.gen < 6)
 		return;
 
 	for_each_ring(ring, dev_priv, i) {
@@ -1083,7 +1083,7 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev)
 	/* Don't bother messing with faults pre GEN6 as we have little
 	 * documentation supporting that it's a good idea.
 	 */
-	if (dev_priv->info->gen < 6)
+	if (dev_priv->info.gen < 6)
 		return;
 
 	i915_check_and_clear_faults(dev);
@@ -1124,7 +1124,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
 	}
 
 
-	if (dev_priv->info->gen >= 8)
+	if (dev_priv->info.gen >= 8)
 		return;
 
 	list_for_each_entry(vm, &dev_priv->vm_list, global_link) {
@@ -1741,10 +1741,10 @@ int i915_gem_gtt_init(struct drm_device *dev)
 	struct i915_gtt *gtt = &dev_priv->gtt;
 	int ret;
 
-	if (dev_priv->info->gen <= 5) {
+	if (dev_priv->info.gen <= 5) {
 		gtt->gtt_probe = i915_gmch_probe;
 		gtt->base.cleanup = i915_gmch_remove;
-	} else if (dev_priv->info->gen < 8) {
+	} else if (dev_priv->info.gen < 8) {
 		gtt->gtt_probe = gen6_gmch_probe;
 		gtt->base.cleanup = gen6_gmch_remove;
 		if (IS_HASWELL(dev) && dev_priv->ellc_size)
@@ -1753,7 +1753,7 @@ int i915_gem_gtt_init(struct drm_device *dev)
 			gtt->base.pte_encode = hsw_pte_encode;
 		else if (IS_VALLEYVIEW(dev))
 			gtt->base.pte_encode = byt_pte_encode;
-		else if (dev_priv->info->gen >= 7)
+		else if (dev_priv->info.gen >= 7)
 			gtt->base.pte_encode = ivb_pte_encode;
 		else
 			gtt->base.pte_encode = snb_pte_encode;
@@ -1791,7 +1791,7 @@ static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj,
 	vma->vm = vm;
 	vma->obj = obj;
 
-	switch (to_i915(vm->dev)->info->gen) {
+	switch (to_i915(vm->dev)->info.gen) {
 	case 8:
 	case 7:
 	case 6:
drivers/gpu/drm/i915/i915_gem_stolen.c +1 -1
index e804c49..84617a5 100644
@@ -60,7 +60,7 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
 	 * XXX However gen2 requires an unavailable symbol.
 	 */
 	base = 0;
-	if (dev_priv->info->gen >= 3) {
+	if (dev_priv->info.gen >= 3) {
 		/* Read Graphics Base of Stolen Memory directly */
 		pci_read_config_dword(dev->pdev, 0x5c, &base);
 		base &= ~((1<<20) - 1);
drivers/gpu/drm/i915/i915_gem_tiling.c +6 -6
index 2d3535f..afb67a8 100644
@@ -94,7 +94,7 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
 	if (IS_VALLEYVIEW(dev)) {
 		swizzle_x = I915_BIT_6_SWIZZLE_NONE;
 		swizzle_y = I915_BIT_6_SWIZZLE_NONE;
-	} else if (dev_priv->info->gen >= 6) {
+	} else if (dev_priv->info.gen >= 6) {
 		uint32_t dimm_c0, dimm_c1;
 		dimm_c0 = I915_READ(MAD_DIMM_C0);
 		dimm_c1 = I915_READ(MAD_DIMM_C1);
@@ -220,10 +220,10 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
 	/* check maximum stride & object size */
 	/* i965+ stores the end address of the gtt mapping in the fence
 	 * reg, so dont bother to check the size */
-	if (dev_priv->info->gen >= 7) {
+	if (dev_priv->info.gen >= 7) {
 		if (stride / 128 > GEN7_FENCE_MAX_PITCH_VAL)
 			return false;
-	} else if (dev_priv->info->gen >= 4) {
+	} else if (dev_priv->info.gen >= 4) {
 		if (stride / 128 > I965_FENCE_MAX_PITCH_VAL)
 			return false;
 	} else {
@@ -243,7 +243,7 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
 		return false;
 
 	/* 965+ just needs multiples of tile width */
-	if (dev_priv->info->gen >= 4) {
+	if (dev_priv->info.gen >= 4) {
 		if (stride & (tile_width - 1))
 			return false;
 		return true;
@@ -266,10 +266,10 @@ i915_gem_object_fence_ok(struct drm_i915_gem_object *obj, int tiling_mode)
 	if (tiling_mode == I915_TILING_NONE)
 		return true;
 
-	if (dev_priv->info->gen >= 4)
+	if (dev_priv->info.gen >= 4)
 		return true;
 
-	if (dev_priv->info->gen == 3) {
+	if (dev_priv->info.gen == 3) {
 		if (i915_gem_obj_ggtt_offset(obj) & ~I915_FENCE_START_MASK)
 			return false;
 	} else {
drivers/gpu/drm/i915/i915_gpu_error.c +16 -16
index c3f35a4..8b2b96e 100644
@@ -249,14 +249,14 @@ static void i915_ring_error_state(struct drm_i915_error_state_buf *m,
 	err_printf(m, "  IPEIR: 0x%08x\n", error->ipeir[ring]);
 	err_printf(m, "  IPEHR: 0x%08x\n", error->ipehr[ring]);
 	err_printf(m, "  INSTDONE: 0x%08x\n", error->instdone[ring]);
-	if (dev_priv->info->gen >= 4) {
+	if (dev_priv->info.gen >= 4) {
 		err_printf(m, "  BBADDR: 0x%08llx\n", error->bbaddr[ring]);
 		err_printf(m, "  BB_STATE: 0x%08x\n", error->bbstate[ring]);
 		err_printf(m, "  INSTPS: 0x%08x\n", error->instps[ring]);
 	}
 	err_printf(m, "  INSTPM: 0x%08x\n", error->instpm[ring]);
 	err_printf(m, "  FADDR: 0x%08x\n", error->faddr[ring]);
-	if (dev_priv->info->gen >= 6) {
+	if (dev_priv->info.gen >= 6) {
 		err_printf(m, "  RC PSMI: 0x%08x\n", error->rc_psmi[ring]);
 		err_printf(m, "  FAULT_REG: 0x%08x\n", error->fault_reg[ring]);
 		err_printf(m, "  SYNC_0: 0x%08x [last synced 0x%08x]\n",
@@ -322,12 +322,12 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 		err_printf(m, "  INSTDONE_%d: 0x%08x\n", i,
 			   error->extra_instdone[i]);
 
-	if (dev_priv->info->gen >= 6) {
+	if (dev_priv->info.gen >= 6) {
 		err_printf(m, "ERROR: 0x%08x\n", error->error);
 		err_printf(m, "DONE_REG: 0x%08x\n", error->done_reg);
 	}
 
-	if (dev_priv->info->gen == 7)
+	if (dev_priv->info.gen == 7)
 		err_printf(m, "ERR_INT: 0x%08x\n", error->err_int);
 
 	for_each_ring(ring, dev_priv, i)
@@ -630,7 +630,7 @@ static void i915_gem_record_fences(struct drm_device *dev,
 	int i;
 
 	/* Fences */
-	switch (dev_priv->info->gen) {
+	switch (dev_priv->info.gen) {
 	case 8:
 	case 7:
 	case 6:
@@ -665,13 +665,13 @@ static bool is_active_vm(struct i915_address_space *vm,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct i915_hw_ppgtt *ppgtt;
 
-	if (dev_priv->info->gen < 7)
+	if (dev_priv->info.gen < 7)
 		return i915_is_ggtt(vm);
 
 	/* FIXME: This ignores that the global gtt vm is also on this list. */
 	ppgtt = container_of(vm, struct i915_hw_ppgtt, base);
 
-	if (dev_priv->info->gen >= 8) {
+	if (dev_priv->info.gen >= 8) {
 		u64 pdp0 = (u64)I915_READ(GEN8_RING_PDP_UDW(ring, 0)) << 32;
 		pdp0 |=  I915_READ(GEN8_RING_PDP_LDW(ring, 0));
 		return pdp0 == ppgtt->pd_dma_addr[0];
@@ -742,7 +742,7 @@ static void i915_record_ring_state(struct drm_device *dev,
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (dev_priv->info->gen >= 6) {
+	if (dev_priv->info.gen >= 6) {
 		error->rc_psmi[ring->id] = I915_READ(ring->mmio_base + 0x50);
 		error->fault_reg[ring->id] = I915_READ(RING_FAULT_REG(ring));
 		error->semaphore_mboxes[ring->id][0]
@@ -759,14 +759,14 @@ static void i915_record_ring_state(struct drm_device *dev,
 		error->semaphore_seqno[ring->id][2] = ring->sync_seqno[2];
 	}
 
-	if (dev_priv->info->gen >= 4) {
+	if (dev_priv->info.gen >= 4) {
 		error->faddr[ring->id] = I915_READ(RING_DMA_FADD(ring->mmio_base));
 		error->ipeir[ring->id] = I915_READ(RING_IPEIR(ring->mmio_base));
 		error->ipehr[ring->id] = I915_READ(RING_IPEHR(ring->mmio_base));
 		error->instdone[ring->id] = I915_READ(RING_INSTDONE(ring->mmio_base));
 		error->instps[ring->id] = I915_READ(RING_INSTPS(ring->mmio_base));
 		error->bbaddr[ring->id] = I915_READ(RING_BBADDR(ring->mmio_base));
-		if (dev_priv->info->gen >= 8)
+		if (dev_priv->info.gen >= 8)
 			error->bbaddr[ring->id] |= (u64) I915_READ(RING_BBADDR_UDW(ring->mmio_base)) << 32;
 		error->bbstate[ring->id] = I915_READ(RING_BBSTATE(ring->mmio_base));
 	} else {
@@ -973,26 +973,26 @@ void i915_capture_error_state(struct drm_device *dev)
 	else
 		error->ier = I915_READ(IER);
 
-	if (dev_priv->info->gen >= 6)
+	if (dev_priv->info.gen >= 6)
 		error->derrmr = I915_READ(DERRMR);
 
 	if (IS_VALLEYVIEW(dev))
 		error->forcewake = I915_READ(FORCEWAKE_VLV);
-	else if (dev_priv->info->gen >= 7)
+	else if (dev_priv->info.gen >= 7)
 		error->forcewake = I915_READ(FORCEWAKE_MT);
-	else if (dev_priv->info->gen == 6)
+	else if (dev_priv->info.gen == 6)
 		error->forcewake = I915_READ(FORCEWAKE);
 
 	if (!HAS_PCH_SPLIT(dev))
 		for_each_pipe(pipe)
 			error->pipestat[pipe] = I915_READ(PIPESTAT(pipe));
 
-	if (dev_priv->info->gen >= 6) {
+	if (dev_priv->info.gen >= 6) {
 		error->error = I915_READ(ERROR_GEN6);
 		error->done_reg = I915_READ(DONE_REG);
 	}
 
-	if (dev_priv->info->gen == 7)
+	if (dev_priv->info.gen == 7)
 		error->err_int = I915_READ(GEN7_ERR_INT);
 
 	i915_get_extra_instdone(dev, error->extra_instdone);
@@ -1069,7 +1069,7 @@ void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	memset(instdone, 0, sizeof(*instdone) * I915_NUM_INSTDONE_REG);
 
-	switch (dev_priv->info->gen) {
+	switch (dev_priv->info.gen) {
 	case 2:
 	case 3:
 		instdone[0] = I915_READ(INSTDONE);
drivers/gpu/drm/i915/i915_irq.c +25 -25

195 lines not on this page · raw message

drivers/gpu/drm/i915/i915_reg.h +114 -114

444 lines not on this page · raw message

drivers/gpu/drm/i915/i915_suspend.c +7 -7
index a2716d2..28dcb47 100644
@@ -194,7 +194,7 @@ static void i915_save_display(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
 	/* Display arbitration control */
-	if (dev_priv->info->gen <= 4)
+	if (dev_priv->info.gen <= 4)
 		dev_priv->regfile.saveDSPARB = I915_READ(DSPARB);
 
 	/* This is only meaningful in non-KMS mode */
@@ -260,7 +260,7 @@ static void i915_restore_display(struct drm_device *dev)
 	u32 mask = 0xffffffff;
 
 	/* Display arbitration */
-	if (dev_priv->info->gen <= 4)
+	if (dev_priv->info.gen <= 4)
 		I915_WRITE(DSPARB, dev_priv->regfile.saveDSPARB);
 
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
@@ -271,7 +271,7 @@ static void i915_restore_display(struct drm_device *dev)
 
 	if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
 		I915_WRITE(PCH_LVDS, dev_priv->regfile.saveLVDS & mask);
-	else if (dev_priv->info->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
+	else if (dev_priv->info.gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
 		I915_WRITE(LVDS, dev_priv->regfile.saveLVDS & mask);
 
 	if (!IS_I830(dev) && !IS_845G(dev) && !HAS_PCH_SPLIT(dev))
@@ -324,7 +324,7 @@ int i915_save_state(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int i;
 
-	if (dev_priv->info->gen <= 4)
+	if (dev_priv->info.gen <= 4)
 		pci_read_config_byte(dev->pdev, LBB,
 				     &dev_priv->regfile.saveLBB);
 
@@ -353,7 +353,7 @@ int i915_save_state(struct drm_device *dev)
 	intel_disable_gt_powersave(dev);
 
 	/* Cache mode state */
-	if (dev_priv->info->gen < 7)
+	if (dev_priv->info.gen < 7)
 		dev_priv->regfile.saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0);
 
 	/* Memory Arbitration state */
@@ -377,7 +377,7 @@ int i915_restore_state(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int i;
 
-	if (dev_priv->info->gen <= 4)
+	if (dev_priv->info.gen <= 4)
 		pci_write_config_byte(dev->pdev, LBB,
 				      dev_priv->regfile.saveLBB);
 
@@ -403,7 +403,7 @@ int i915_restore_state(struct drm_device *dev)
 	}
 
 	/* Cache mode state */
-	if (dev_priv->info->gen < 7)
+	if (dev_priv->info.gen < 7)
 		I915_WRITE(CACHE_MODE_0, dev_priv->regfile.saveCACHE_MODE_0 |
 			   0xffff0000);
 
drivers/gpu/drm/i915/i915_sysfs.c +2 -2
index bccc52f..e1bdce9 100644
@@ -562,7 +562,7 @@ void i915_setup_sysfs(struct drm_device *dev)
 	int ret;
 
 #ifdef CONFIG_PM
-	if (dev_priv->info->gen >= 6) {
+	if (dev_priv->info.gen >= 6) {
 		ret = sysfs_merge_group(&dev->primary->kdev->kobj,
 					&rc6_attr_group);
 		if (ret)
@@ -585,7 +585,7 @@ void i915_setup_sysfs(struct drm_device *dev)
 	ret = 0;
 	if (IS_VALLEYVIEW(dev))
 		ret = sysfs_create_files(&dev->primary->kdev->kobj, vlv_attrs);
-	else if (dev_priv->info->gen >= 6)
+	else if (dev_priv->info.gen >= 6)
 		ret = sysfs_create_files(&dev->primary->kdev->kobj, gen6_attrs);
 	if (ret)
 		DRM_ERROR("RPS sysfs setup failed\n");
drivers/gpu/drm/i915/i915_ums.c +12 -12
index 08b588e..9b1c6d8 100644
@@ -124,7 +124,7 @@ void i915_save_display_reg(struct drm_device *dev)
 		dev_priv->regfile.saveFPA1 = I915_READ(_FPA1);
 		dev_priv->regfile.saveDPLL_A = I915_READ(_DPLL_A);
 	}
-	if (dev_priv->info->gen >= 4 && !HAS_PCH_SPLIT(dev))
+	if (dev_priv->info.gen >= 4 && !HAS_PCH_SPLIT(dev))
 		dev_priv->regfile.saveDPLL_A_MD = I915_READ(_DPLL_A_MD);
 	dev_priv->regfile.saveHTOTAL_A = I915_READ(_HTOTAL_A);
 	dev_priv->regfile.saveHBLANK_A = I915_READ(_HBLANK_A);
@@ -162,7 +162,7 @@ void i915_save_display_reg(struct drm_device *dev)
 	dev_priv->regfile.saveDSPASIZE = I915_READ(_DSPASIZE);
 	dev_priv->regfile.saveDSPAPOS = I915_READ(_DSPAPOS);
 	dev_priv->regfile.saveDSPAADDR = I915_READ(_DSPAADDR);
-	if (dev_priv->info->gen >= 4) {
+	if (dev_priv->info.gen >= 4) {
 		dev_priv->regfile.saveDSPASURF = I915_READ(_DSPASURF);
 		dev_priv->regfile.saveDSPATILEOFF = I915_READ(_DSPATILEOFF);
 	}
@@ -181,7 +181,7 @@ void i915_save_display_reg(struct drm_device *dev)
 		dev_priv->regfile.saveFPB1 = I915_READ(_FPB1);
 		dev_priv->regfile.saveDPLL_B = I915_READ(_DPLL_B);
 	}
-	if (dev_priv->info->gen >= 4 && !HAS_PCH_SPLIT(dev))
+	if (dev_priv->info.gen >= 4 && !HAS_PCH_SPLIT(dev))
 		dev_priv->regfile.saveDPLL_B_MD = I915_READ(_DPLL_B_MD);
 	dev_priv->regfile.saveHTOTAL_B = I915_READ(_HTOTAL_B);
 	dev_priv->regfile.saveHBLANK_B = I915_READ(_HBLANK_B);
@@ -219,7 +219,7 @@ void i915_save_display_reg(struct drm_device *dev)
 	dev_priv->regfile.saveDSPBSIZE = I915_READ(_DSPBSIZE);
 	dev_priv->regfile.saveDSPBPOS = I915_READ(_DSPBPOS);
 	dev_priv->regfile.saveDSPBADDR = I915_READ(_DSPBADDR);
-	if (dev_priv->info->gen >= 4) {
+	if (dev_priv->info.gen >= 4) {
 		dev_priv->regfile.saveDSPBSURF = I915_READ(_DSPBSURF);
 		dev_priv->regfile.saveDSPBTILEOFF = I915_READ(_DSPBTILEOFF);
 	}
@@ -227,7 +227,7 @@ void i915_save_display_reg(struct drm_device *dev)
 	dev_priv->regfile.savePIPEBSTAT = I915_READ(_PIPEBSTAT);
 
 	/* Fences */
-	switch (dev_priv->info->gen) {
+	switch (dev_priv->info.gen) {
 	case 7:
 	case 6:
 		for (i = 0; i < 16; i++)
@@ -278,7 +278,7 @@ void i915_save_display_reg(struct drm_device *dev)
 		dev_priv->regfile.saveBLC_CPU_PWM_CTL2 = I915_READ(BLC_PWM_CPU_CTL2);
 	} else {
 		dev_priv->regfile.saveBLC_PWM_CTL = I915_READ(BLC_PWM_CTL);
-		if (dev_priv->info->gen >= 4)
+		if (dev_priv->info.gen >= 4)
 			dev_priv->regfile.saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_CTL2);
 	}
 
@@ -302,7 +302,7 @@ void i915_restore_display_reg(struct drm_device *dev)
 		I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->regfile.saveBLC_CPU_PWM_CTL2);
 		I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->regfile.saveBLC_CPU_PWM_CTL);
 	} else {
-		if (dev_priv->info->gen >= 4)
+		if (dev_priv->info.gen >= 4)
 			I915_WRITE(BLC_PWM_CTL2, dev_priv->regfile.saveBLC_PWM_CTL2);
 		I915_WRITE(BLC_PWM_CTL, dev_priv->regfile.saveBLC_PWM_CTL);
 	}
@@ -320,7 +320,7 @@ void i915_restore_display_reg(struct drm_device *dev)
 	}
 
 	/* Fences */
-	switch (dev_priv->info->gen) {
+	switch (dev_priv->info.gen) {
 	case 7:
 	case 6:
 		for (i = 0; i < 16; i++)
@@ -377,7 +377,7 @@ void i915_restore_display_reg(struct drm_device *dev)
 	I915_WRITE(dpll_a_reg, dev_priv->regfile.saveDPLL_A);
 	POSTING_READ(dpll_a_reg);
 	udelay(150);
-	if (dev_priv->info->gen >= 4 && !HAS_PCH_SPLIT(dev)) {
+	if (dev_priv->info.gen >= 4 && !HAS_PCH_SPLIT(dev)) {
 		I915_WRITE(_DPLL_A_MD, dev_priv->regfile.saveDPLL_A_MD);
 		POSTING_READ(_DPLL_A_MD);
 	}
@@ -421,7 +421,7 @@ void i915_restore_display_reg(struct drm_device *dev)
 	I915_WRITE(_PIPEASRC, dev_priv->regfile.savePIPEASRC);
 	I915_WRITE(_DSPAADDR, dev_priv->regfile.saveDSPAADDR);
 	I915_WRITE(_DSPASTRIDE, dev_priv->regfile.saveDSPASTRIDE);
-	if (dev_priv->info->gen >= 4) {
+	if (dev_priv->info.gen >= 4) {
 		I915_WRITE(_DSPASURF, dev_priv->regfile.saveDSPASURF);
 		I915_WRITE(_DSPATILEOFF, dev_priv->regfile.saveDSPATILEOFF);
 	}
@@ -446,7 +446,7 @@ void i915_restore_display_reg(struct drm_device *dev)
 	I915_WRITE(dpll_b_reg, dev_priv->regfile.saveDPLL_B);
 	POSTING_READ(dpll_b_reg);
 	udelay(150);
-	if (dev_priv->info->gen >= 4 && !HAS_PCH_SPLIT(dev)) {
+	if (dev_priv->info.gen >= 4 && !HAS_PCH_SPLIT(dev)) {
 		I915_WRITE(_DPLL_B_MD, dev_priv->regfile.saveDPLL_B_MD);
 		POSTING_READ(_DPLL_B_MD);
 	}
@@ -490,7 +490,7 @@ void i915_restore_display_reg(struct drm_device *dev)
 	I915_WRITE(_PIPEBSRC, dev_priv->regfile.savePIPEBSRC);
 	I915_WRITE(_DSPBADDR, dev_priv->regfile.saveDSPBADDR);
 	I915_WRITE(_DSPBSTRIDE, dev_priv->regfile.saveDSPBSTRIDE);
-	if (dev_priv->info->gen >= 4) {
+	if (dev_priv->info.gen >= 4) {
 		I915_WRITE(_DSPBSURF, dev_priv->regfile.saveDSPBSURF);
 		I915_WRITE(_DSPBTILEOFF, dev_priv->regfile.saveDSPBTILEOFF);
 	}
drivers/gpu/drm/i915/intel_bios.c +1 -1
index 4523e51..e3aaac6 100644
@@ -355,7 +355,7 @@ static int intel_bios_ssc_frequency(struct drm_device *dev,
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	switch (dev_priv->info->gen) {
+	switch (dev_priv->info.gen) {
 	case 2:
 		return alternate ? 66667 : 48000;
 	case 3:
drivers/gpu/drm/i915/intel_crt.c +3 -3
index 8e66a96..20b5ebd 100644
@@ -185,7 +185,7 @@ static void intel_crt_dpms(struct drm_connector *connector, int mode)
 	int old_dpms;
 
 	/* PCH platforms and VLV only support on/off. */
-	if (dev_priv->info->gen >= 5 && mode != DRM_MODE_DPMS_ON)
+	if (dev_priv->info.gen >= 5 && mode != DRM_MODE_DPMS_ON)
 		mode = DRM_MODE_DPMS_OFF;
 
 	if (mode == connector->dpms)
@@ -276,7 +276,7 @@ static void intel_crt_mode_set(struct intel_encoder *encoder)
 	struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode;
 	u32 adpa;
 
-	if (dev_priv->info->gen >= 5)
+	if (dev_priv->info.gen >= 5)
 		adpa = ADPA_HOTPLUG_BITS;
 	else
 		adpa = 0;
@@ -713,7 +713,7 @@ static void intel_crt_reset(struct drm_connector *connector)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crt *crt = intel_attached_crt(connector);
 
-	if (dev_priv->info->gen >= 5) {
+	if (dev_priv->info.gen >= 5) {
 		u32 adpa;
 
 		adpa = I915_READ(crt->adpa_reg);
drivers/gpu/drm/i915/intel_display.c +67 -67

501 lines not on this page · raw message

drivers/gpu/drm/i915/intel_fbdev.c +2 -2
index 6e8adc3..f44a4c6 100644
@@ -276,7 +276,7 @@ int intel_fbdev_init(struct drm_device *dev)
 	ifbdev->helper.funcs = &intel_fb_helper_funcs;
 
 	ret = drm_fb_helper_init(dev, &ifbdev->helper,
-				 dev_priv->info->num_pipes,
+				 dev_priv->info.num_pipes,
 				 4);
 	if (ret) {
 		kfree(ifbdev);
@@ -341,7 +341,7 @@ void intel_fbdev_restore_mode(struct drm_device *dev)
 	int ret;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (dev_priv->info->num_pipes == 0)
+	if (dev_priv->info.num_pipes == 0)
 		return;
 
 	drm_modeset_lock_all(dev);
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
index 1243af0..0eec394 100644
@@ -848,7 +848,7 @@ static int hdmi_portclock_limit(struct intel_hdmi *hdmi)
 
 	if (IS_G4X(dev))
 		return 165000;
-	else if (IS_HASWELL(dev) || dev_priv->info->gen >= 8)
+	else if (IS_HASWELL(dev) || dev_priv->info.gen >= 8)
 		return 300000;
 	else
 		return 225000;
drivers/gpu/drm/i915/intel_i2c.c +1 -1
index e97b563..3e1e819 100644
@@ -264,7 +264,7 @@ intel_gpio_setup(struct intel_gmbus *bus, u32 pin)
  * shared with another device. The kernel then disables that interrupt source
  * and so prevents the other device from working properly.
  */
-#define HAS_GMBUS_IRQ(dev) (dev_priv->info->gen >= 5)
+#define HAS_GMBUS_IRQ(dev) (dev_priv->info.gen >= 5)
 static int
 gmbus_wait_hw_status(struct drm_i915_private *dev_priv,
 		     u32 gmbus2_status,
drivers/gpu/drm/i915/intel_lvds.c +4 -4
index 2cd7315..994364d 100644
@@ -112,7 +112,7 @@ static void intel_lvds_get_config(struct intel_encoder *encoder,
 	pipe_config->adjusted_mode.flags |= flags;
 
 	/* gen2/3 store dither state in pfit control, needs to match */
-	if (dev_priv->info->gen < 4) {
+	if (dev_priv->info.gen < 4) {
 		tmp = I915_READ(PFIT_CONTROL);
 
 		pipe_config->gmch_pfit.control |= tmp & PANEL_8TO6_DITHER_ENABLE;
@@ -182,7 +182,7 @@ static void intel_pre_enable_lvds(struct intel_encoder *encoder)
 	/* Set the dithering flag on LVDS as needed, note that there is no
 	 * special lvds dither control bit on pch-split platforms, dithering is
 	 * only controlled through the PIPECONF reg. */
-	if (dev_priv->info->gen == 4) {
+	if (dev_priv->info.gen == 4) {
 		/* Bspec wording suggests that LVDS port dithering only exists
 		 * for 18bpp panels. */
 		if (crtc->config.dither && crtc->config.pipe_bpp == 18)
@@ -285,7 +285,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
 	unsigned int lvds_bpp;
 
 	/* Should never happen!! */
-	if (dev_priv->info->gen < 4 && intel_crtc->pipe == 0) {
+	if (dev_priv->info.gen < 4 && intel_crtc->pipe == 0) {
 		DRM_ERROR("Can't support LVDS on pipe A\n");
 		return false;
 	}
@@ -877,7 +877,7 @@ static bool intel_lvds_supported(struct drm_device *dev)
 
 	/* Otherwise LVDS was only attached to mobile products,
 	 * except for the inglorious 830gm */
-	if (dev_priv->info->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
+	if (dev_priv->info.gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
 		return true;
 
 	return false;
drivers/gpu/drm/i915/intel_overlay.c +1 -1
index 2e0b899..70f029e 100644
@@ -841,7 +841,7 @@ static void update_pfit_vscale_ratio(struct intel_overlay *overlay)
 	/* XXX: This is not the same logic as in the xorg driver, but more in
 	 * line with the intel documentation for the i965
 	 */
-	if (dev_priv->info->gen >= 4) {
+	if (dev_priv->info.gen >= 4) {
 		/* on i965 use the PGM reg to read out the autoscaler values */
 		ratio = I915_READ(PFIT_PGM_RATIOS) >> PFIT_VERT_SCALE_SHIFT_965;
 	} else {
drivers/gpu/drm/i915/intel_panel.c +5 -5
index c3ceb84..beb45ea 100644
@@ -277,7 +277,7 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
 		break;
 	case DRM_MODE_SCALE_ASPECT:
 		/* Scale but preserve the aspect ratio */
-		if (dev_priv->info->gen >= 4)
+		if (dev_priv->info.gen >= 4)
 			i965_scale_aspect(pipe_config, &pfit_control);
 		else
 			i9xx_scale_aspect(pipe_config, &pfit_control,
@@ -291,7 +291,7 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
 		if (pipe_config->pipe_src_h != adjusted_mode->vdisplay ||
 		    pipe_config->pipe_src_w != adjusted_mode->hdisplay) {
 			pfit_control |= PFIT_ENABLE;
-			if (dev_priv->info->gen >= 4)
+			if (dev_priv->info.gen >= 4)
 				pfit_control |= PFIT_SCALING_AUTO;
 			else
 				pfit_control |= (VERT_AUTO_SCALE |
@@ -307,7 +307,7 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
 
 	/* 965+ wants fuzzy fitting */
 	/* FIXME: handle multiple panels by failing gracefully */
-	if (dev_priv->info->gen >= 4)
+	if (dev_priv->info.gen >= 4)
 		pfit_control |= ((intel_crtc->pipe << PFIT_PIPE_SHIFT) |
 				 PFIT_FILTER_FUZZY);
 
@@ -318,7 +318,7 @@ out:
 	}
 
 	/* Make sure pre-965 set dither correctly for 18bpp panels. */
-	if (dev_priv->info->gen < 4 && pipe_config->pipe_bpp == 18)
+	if (dev_priv->info.gen < 4 && pipe_config->pipe_bpp == 18)
 		pfit_control |= PANEL_8TO6_DITHER_ENABLE;
 
 	pipe_config->gmch_pfit.control = pfit_control;
@@ -377,7 +377,7 @@ static u32 i9xx_get_backlight(struct intel_connector *connector)
 	u32 val;
 
 	val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
-	if (dev_priv->info->gen < 4)
+	if (dev_priv->info.gen < 4)
 		val >>= 1;
 
 	if (panel->backlight.combination_mode) {
drivers/gpu/drm/i915/intel_pm.c +36 -36

273 lines not on this page · raw message

drivers/gpu/drm/i915/intel_ringbuffer.c +27 -27

199 lines not on this page · raw message

drivers/gpu/drm/i915/intel_sdvo.c +5 -5
index 4e44733..008878d 100644
@@ -1254,13 +1254,13 @@ static void intel_sdvo_mode_set(struct intel_encoder *intel_encoder)
 		return;
 
 	/* Set the SDVO control regs. */
-	if (dev_priv->info->gen >= 4) {
+	if (dev_priv->info.gen >= 4) {
 		/* The real mode polarity is set by the SDVO commands, using
 		 * struct intel_sdvo_dtd. */
 		sdvox = SDVO_VSYNC_ACTIVE_HIGH | SDVO_HSYNC_ACTIVE_HIGH;
 		if (!HAS_PCH_SPLIT(dev) && intel_sdvo->is_hdmi)
 			sdvox |= intel_sdvo->color_range;
-		if (dev_priv->info->gen < 5)
+		if (dev_priv->info.gen < 5)
 			sdvox |= SDVO_BORDER_ENABLE;
 	} else {
 		sdvox = I915_READ(intel_sdvo->sdvo_reg);
@@ -1283,7 +1283,7 @@ static void intel_sdvo_mode_set(struct intel_encoder *intel_encoder)
 	if (intel_sdvo->has_hdmi_audio)
 		sdvox |= SDVO_AUDIO_ENABLE;
 
-	if (dev_priv->info->gen >= 4) {
+	if (dev_priv->info.gen >= 4) {
 		/* done in crtc_mode_set as the dpll_md reg must be written early */
 	} else if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) {
 		/* done in crtc_mode_set as it lives inside the dpll register */
@@ -1293,7 +1293,7 @@ static void intel_sdvo_mode_set(struct intel_encoder *intel_encoder)
 	}
 
 	if (input_dtd.part2.sdvo_flags & SDVO_NEED_TO_STALL &&
-	    dev_priv->info->gen < 5)
+	    dev_priv->info.gen < 5)
 		sdvox |= SDVO_STALL_SELECT;
 	intel_sdvo_write_sdvox(intel_sdvo, sdvox);
 }
@@ -2410,7 +2410,7 @@ intel_sdvo_add_hdmi_properties(struct intel_sdvo *intel_sdvo,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
 	intel_attach_force_audio_property(&connector->base.base);
-	if (dev_priv->info->gen >= 4 && IS_MOBILE(dev)) {
+	if (dev_priv->info.gen >= 4 && IS_MOBILE(dev)) {
 		intel_attach_broadcast_rgb_property(&connector->base.base);
 		intel_sdvo->color_range_auto = true;
 	}
drivers/gpu/drm/i915/intel_sprite.c +2 -2
index 5584cd9..7fd1cb2 100644
@@ -1080,14 +1080,14 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 	int num_plane_formats;
 	int ret;
 
-	if (dev_priv->info->gen < 5)
+	if (dev_priv->info.gen < 5)
 		return -ENODEV;
 
 	intel_plane = kzalloc(sizeof(*intel_plane), GFP_KERNEL);
 	if (!intel_plane)
 		return -ENOMEM;
 
-	switch (dev_priv->info->gen) {
+	switch (dev_priv->info.gen) {
 	case 5:
 	case 6:
 		intel_plane->can_scale = true;
drivers/gpu/drm/i915/intel_tv.c +1 -1
index 0448f0b..460ac9e 100644
@@ -1083,7 +1083,7 @@ static void intel_tv_mode_set(struct intel_encoder *encoder)
 			   color_conversion->av);
 	}
 
-	if (dev_priv->info->gen >= 4)
+	if (dev_priv->info.gen >= 4)
 		I915_WRITE(TV_CLR_KNOBS, 0x00404000);
 	else
 		I915_WRITE(TV_CLR_KNOBS, 0x00606000);
drivers/gpu/drm/i915/intel_uncore.c +5 -5
index 3283059f..22ada66 100644
@@ -114,7 +114,7 @@ static void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv,
 		DRM_ERROR("Timed out waiting for forcewake to ack request.\n");
 
 	/* WaRsForcewakeWaitTC0:ivb,hsw */
-	if (dev_priv->info->gen < 8)
+	if (dev_priv->info.gen < 8)
 		__gen6_gt_wait_for_thread_c0(dev_priv);
 }
 
@@ -307,7 +307,7 @@ static void intel_uncore_forcewake_reset(struct drm_device *dev)
 
 	if (IS_VALLEYVIEW(dev)) {
 		vlv_force_wake_reset(dev_priv);
-	} else if (dev_priv->info->gen >= 6) {
+	} else if (dev_priv->info.gen >= 6) {
 		__gen6_gt_force_wake_reset(dev_priv);
 		if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
 			__gen6_gt_force_wake_mt_reset(dev_priv);
@@ -728,7 +728,7 @@ void intel_uncore_init(struct drm_device *dev)
 			__gen6_gt_force_wake_put;
 	}
 
-	switch (dev_priv->info->gen) {
+	switch (dev_priv->info.gen) {
 	default:
 		dev_priv->uncore.funcs.mmio_writeb  = gen8_write8;
 		dev_priv->uncore.funcs.mmio_writew  = gen8_write16;
@@ -818,7 +818,7 @@ int i915_reg_read_ioctl(struct drm_device *dev,
 
 	for (i = 0; i < ARRAY_SIZE(whitelist); i++, entry++) {
 		if (entry->offset == reg->offset &&
-		    (1 << dev_priv->info->gen & entry->gen_bitmask))
+		    (1 << dev_priv->info.gen & entry->gen_bitmask))
 			break;
 	}
 
@@ -983,7 +983,7 @@ int intel_gpu_reset(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	switch (dev_priv->info->gen) {
+	switch (dev_priv->info.gen) {
 	case 8:
 	case 7:
 	case 6: return gen6_do_reset(dev);
Signature · 6 lines
1.8.3.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 8/12 drm/i915: Move num_plane to the intel_device_info structure

In reply to Damien Lespiau

And rename it to num_sprites as this value doesn't count the primary plane.

This limit lives with num_pipes really, and now that dev_priv->info is writable we can put it there instead.

While at it, introduce a intel_device_info_runtime_init() where we'll be able to gather the device info fields at run-time.

v2: rename num_plane to num_sprites (Ville Syrjälä)

v3: Rebase on to of the INTEL_INFO() removal

---
 drivers/gpu/drm/i915/i915_dma.c      | 28 +++++++++++++++++++++++++---
 drivers/gpu/drm/i915/i915_drv.h      |  5 ++---
 drivers/gpu/drm/i915/intel_display.c |  4 ++--
 3 files changed, 29 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +25 -3
index 2b10e41..953e35e 100644
@@ -1473,6 +1473,30 @@ intel_device_info_init(struct drm_i915_private *dev_priv,
 	memcpy(info, start_info, sizeof(*info));
 }
 
+/*
+ * Determine various intel_device_info fields at runtime.
+ *
+ * Use it when either:
+ *   - it's judged too laborious to fill n static structures with the limit
+ *     when a simple if statement does the job,
+ *   - run-time checks (eg read fuse/strap registers) are needed.
+ */
+static void intel_device_info_runtime_init(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_device_info *info;
+
+	/*
+	 * dev_priv->info is const for the rest of the driver but we make
+	 * an exception here to setup the run-time configuration.
+	 */
+	info = (struct intel_device_info *)&dev_priv->info;
+
+	info->num_sprites = 1;
+	if (IS_VALLEYVIEW(dev))
+		info->num_sprites = 2;
+}
+
 /**
  * i915_driver_load - setup chip and create an initial config
  * @dev: DRM device
@@ -1650,9 +1674,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	if (!IS_I945G(dev) && !IS_I945GM(dev))
 		pci_enable_msi(dev->pdev);
 
-	dev_priv->num_plane = 1;
-	if (IS_VALLEYVIEW(dev))
-		dev_priv->num_plane = 2;
+	intel_device_info_runtime_init(dev);
 
 	if (dev_priv->info.num_pipes) {
 		ret = drm_vblank_init(dev, dev_priv->info.num_pipes);
drivers/gpu/drm/i915/i915_drv.h +2 -3
index 9a6bd68..a0713e2 100644
@@ -77,7 +77,7 @@ enum plane {
 };
 #define plane_name(p) ((p) + 'A')
 
-#define sprite_name(p, s) ((p) * dev_priv->num_plane + (s) + 'A')
+#define sprite_name(p, s) ((p) * dev_priv->info.num_sprites + (s) + 'A')
 
 enum port {
 	PORT_A = 0,
@@ -504,6 +504,7 @@ struct intel_uncore {
 struct intel_device_info {
 	u32 display_mmio_offset;
 	u8 num_pipes:3;
+	u8 num_sprites:2;
 	u8 gen;
 	u8 ring_mask; /* Rings supported by the HW */
 	DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG, SEP_SEMICOLON);
@@ -1423,8 +1424,6 @@ typedef struct drm_i915_private {
 	u32 hpd_event_bits;
 	struct timer_list hotplug_reenable_timer;
 
-	int num_plane;
-
 	struct i915_fbc fbc;
 	struct intel_opregion opregion;
 	struct intel_vbt_data vbt;
drivers/gpu/drm/i915/intel_display.c +2 -2
index 6478334..d017aec 100644
@@ -1189,7 +1189,7 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
 	u32 val;
 
 	if (IS_VALLEYVIEW(dev)) {
-		for (i = 0; i < dev_priv->num_plane; i++) {
+		for (i = 0; i < dev_priv->info.num_sprites; i++) {
 			reg = SPCNTR(pipe, i);
 			val = I915_READ(reg);
 			WARN((val & SP_ENABLE),
@@ -10878,7 +10878,7 @@ void intel_modeset_init(struct drm_device *dev)
 
 	for_each_pipe(i) {
 		intel_crtc_init(dev, i);
-		for (j = 0; j < dev_priv->num_plane; j++) {
+		for (j = 0; j < dev_priv->info.num_sprites; j++) {
 			ret = intel_plane_init(dev, i, j);
 			if (ret)
 				DRM_DEBUG_KMS("pipe %c sprite %c init failed: %d\n",
Signature · 6 lines
1.8.3.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH 9/12 drm/i915: Consolidate FUSE_STRAP in one set of defines

In reply to Damien Lespiau

We had 2 set of defines for the same register, so make it one.

---
 drivers/gpu/drm/i915/i915_reg.h      | 18 ++++++++----------
 drivers/gpu/drm/i915/intel_ddi.c     |  2 +-
 drivers/gpu/drm/i915/intel_display.c |  3 +--
 3 files changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +8 -10
index 6e3dd6c..daa308c 100644
@@ -4081,13 +4081,14 @@
 #define  ILK_ELPIN_409_SELECT	(1 << 25)
 #define  ILK_DPARB_GATE	(1<<22)
 #define  ILK_VSDPFD_FULL	(1<<21)
-#define ILK_DISPLAY_CHICKEN_FUSES	0x42014
-#define  ILK_INTERNAL_GRAPHICS_DISABLE	(1<<31)
-#define  ILK_INTERNAL_DISPLAY_DISABLE	(1<<30)
-#define  ILK_DISPLAY_DEBUG_DISABLE	(1<<29)
-#define  ILK_HDCP_DISABLE		(1<<25)
-#define  ILK_eDP_A_DISABLE		(1<<24)
-#define  ILK_DESKTOP			(1<<23)
+#define FUSE_STRAP			0x42014
+#define  ILK_INTERNAL_GRAPHICS_DISABLE	(1 << 31)
+#define  ILK_INTERNAL_DISPLAY_DISABLE	(1 << 30)
+#define  ILK_DISPLAY_DEBUG_DISABLE	(1 << 29)
+#define  ILK_HDCP_DISABLE		(1 << 25)
+#define  ILK_eDP_A_DISABLE		(1 << 24)
+#define  HSW_CDCLK_LIMIT		(1 << 24)
+#define  ILK_DESKTOP			(1 << 23)
 
 #define ILK_DSPCLK_GATE_D			0x42020
 #define   ILK_VRHUNIT_CLOCK_GATE_DISABLE	(1 << 28)
@@ -4145,9 +4146,6 @@
 #define HSW_SCRATCH1				0xb038
 #define  HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE	(1<<27)
 
-#define HSW_FUSE_STRAP		0x42014
-#define  HSW_CDCLK_LIMIT	(1 << 24)
-
 /* PCH */
 
 /* south display engine interrupt: IBX */
drivers/gpu/drm/i915/intel_ddi.c +1 -1
index 1488b28..f31e184 100644
@@ -1319,7 +1319,7 @@ int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
 
 	if (lcpll & LCPLL_CD_SOURCE_FCLK) {
 		return 800000;
-	} else if (I915_READ(HSW_FUSE_STRAP) & HSW_CDCLK_LIMIT) {
+	} else if (I915_READ(FUSE_STRAP) & HSW_CDCLK_LIMIT) {
 		return 450000;
 	} else if (freq == LCPLL_CLK_FREQ_450) {
 		return 450000;
drivers/gpu/drm/i915/intel_display.c +1 -2
index d017aec..0518ec0 100644
@@ -10247,8 +10247,7 @@ static bool has_edp_a(struct drm_device *dev)
 	if ((I915_READ(DP_A) & DP_DETECTED) == 0)
 		return false;
 
-	if (IS_GEN5(dev) &&
-	    (I915_READ(ILK_DISPLAY_CHICKEN_FUSES) & ILK_eDP_A_DISABLE))
+	if (IS_GEN5(dev) && (I915_READ(FUSE_STRAP) & ILK_eDP_A_DISABLE))
 		return false;
 
 	return true;
Signature · 6 lines
1.8.3.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH 10/12 drm/i915: Disable display when fused off

In reply to Damien Lespiau

FUSE_STRAP has a bit to inform us that the display has been fused off. Use it to setup the definitive number of pipes at run-time.

v2: actually tweak num_pipes, not num_planes
v3: also tests SFUSE_STRAP bit 7
v4: rebase on top of the INTEL_INFO() removal

---
 drivers/gpu/drm/i915/i915_dma.c | 15 +++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h |  1 +
 2 files changed, 16 insertions(+)
drivers/gpu/drm/i915/i915_dma.c +15 -0
index 953e35e..c208650 100644
@@ -1480,6 +1480,9 @@ intel_device_info_init(struct drm_i915_private *dev_priv,
  *   - it's judged too laborious to fill n static structures with the limit
  *     when a simple if statement does the job,
  *   - run-time checks (eg read fuse/strap registers) are needed.
+ *
+ * This function needs to be called after the MMIO has been setup as we are
+ * reading registers, and before the first usage of the fields it can tweak.
  */
 static void intel_device_info_runtime_init(struct drm_device *dev)
 {
@@ -1495,6 +1498,18 @@ static void intel_device_info_runtime_init(struct drm_device *dev)
 	info->num_sprites = 1;
 	if (IS_VALLEYVIEW(dev))
 		info->num_sprites = 2;
+
+	if ((dev_priv->info.gen == 7 || dev_priv->info.gen == 8) &&
+	    !IS_VALLEYVIEW(dev)) {
+		u32 fuse_strap = I915_READ(FUSE_STRAP);
+		u32 sfuse_strap = I915_READ(SFUSE_STRAP);
+
+		if (fuse_strap & ILK_INTERNAL_DISPLAY_DISABLE ||
+		    sfuse_strap & SFUSE_STRAP_DISPLAY_DISABLED) {
+			DRM_DEBUG_DRIVER("Display fused off, disabling\n");
+			info->num_pipes = 0;
+		}
+	}
 }
 
 /**
drivers/gpu/drm/i915/i915_reg.h +1 -0
index daa308c..40df997 100644
@@ -5382,6 +5382,7 @@
 
 /* SFUSE_STRAP */
 #define SFUSE_STRAP			0xc2014
+#define  SFUSE_STRAP_DISPLAY_DISABLED	(1<<7)
 #define  SFUSE_STRAP_DDIB_DETECTED	(1<<2)
 #define  SFUSE_STRAP_DDIC_DETECTED	(1<<1)
 #define  SFUSE_STRAP_DDID_DETECTED	(1<<0)
Signature · 6 lines
1.8.3.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

PATCH 11/12 drm/i915: Remove the Quanta special case

In reply to Damien Lespiau

We now read out the FUSE_STRAP and SFUSE_STRAP registers, looking for configurations with display fused off. Let's remove the Quanta special case and rely on the programmed fuses to set num_pipes to 0.

This patch is untested and could use a good soul with such a device to give it a go.

---
 drivers/gpu/drm/i915/i915_drv.c | 13 -------------
 include/drm/i915_pciids.h       |  9 ---------
 2 files changed, 22 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -13
index db43df6..9021dc5 100644
@@ -299,12 +299,6 @@ static const struct intel_device_info intel_ivybridge_m_info = {
 	.is_mobile = 1,
 };
 
-static const struct intel_device_info intel_ivybridge_q_info = {
-	GEN7_FEATURES,
-	.is_ivybridge = 1,
-	.num_pipes = 0, /* legal, last one wins */
-};
-
 static const struct intel_device_info intel_valleyview_m_info = {
 	GEN7_FEATURES,
 	.is_mobile = 1,
@@ -359,12 +353,6 @@ static const struct intel_device_info intel_broadwell_m_info = {
 	.has_ddi = 1,
 };
 
-/*
- * Make sure any device matches here are from most specific to most
- * general.  For example, since the Quanta match is based on the subsystem
- * and subvendor IDs, we need it to come before the more general IVB
- * PCI ID matches, otherwise we'll use the wrong info struct above.
- */
 #define INTEL_PCI_IDS \
 	INTEL_I830_IDS(&intel_i830_info),	\
 	INTEL_I845G_IDS(&intel_845g_info),	\
@@ -384,7 +372,6 @@ static const struct intel_device_info intel_broadwell_m_info = {
 	INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info),	\
 	INTEL_SNB_D_IDS(&intel_sandybridge_d_info),	\
 	INTEL_SNB_M_IDS(&intel_sandybridge_m_info),	\
-	INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */ \
 	INTEL_IVB_M_IDS(&intel_ivybridge_m_info),	\
 	INTEL_IVB_D_IDS(&intel_ivybridge_d_info),	\
 	INTEL_HSW_D_IDS(&intel_haswell_d_info), \
include/drm/i915_pciids.h +0 -9
index 940ece4..02ebb67 100644
@@ -41,12 +41,6 @@
 	0x030000, 0xff0000,			\
 	(unsigned long) info }
 
-#define INTEL_QUANTA_VGA_DEVICE(info) {		\
-	0x8086,	0x16a,				\
-	0x152d,	0x8990,				\
-	0x030000, 0xff0000,			\
-	(unsigned long) info }
-
 #define INTEL_I830_IDS(info)				\
 	INTEL_VGA_DEVICE(0x3577, info)
 
@@ -131,9 +125,6 @@
 	INTEL_VGA_DEVICE(0x015a, info), /* GT1 server */ \
 	INTEL_VGA_DEVICE(0x016a, info)  /* GT2 server */
 
-#define INTEL_IVB_Q_IDS(info) \
-	INTEL_QUANTA_VGA_DEVICE(info) /* Quanta transcode */
-
 #define INTEL_HSW_D_IDS(info) \
 	INTEL_VGA_DEVICE(0x0402, info), /* GT1 desktop */ \
 	INTEL_VGA_DEVICE(0x0412, info), /* GT2 desktop */ \
Signature · 6 lines
1.8.3.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

PATCH 12/12 drm/i915: Use I915_MAX_PIPES in the pipe/plane_to_crtc_mapping definitions

In reply to Damien Lespiau
---
 drivers/gpu/drm/i915/i915_drv.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -2
index a0713e2..c289b8f 100644
@@ -1473,8 +1473,8 @@ typedef struct drm_i915_private {
 
 	struct sdvo_device_mapping sdvo_mappings[2];
 
-	struct drm_crtc *plane_to_crtc_mapping[3];
-	struct drm_crtc *pipe_to_crtc_mapping[3];
+	struct drm_crtc *plane_to_crtc_mapping[I915_MAX_PIPES];
+	struct drm_crtc *pipe_to_crtc_mapping[I915_MAX_PIPES];
 	wait_queue_head_t pending_flip_queue;
 
 #ifdef CONFIG_DEBUG_FS
Signature · 6 lines
1.8.3.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by
#14 lore raw
In reply to Damien Lespiau

Hi

2014/1/6 Damien Lespiau <[email protected]>:

Quoted 9 lines

Follow up of the v3:
http://lists.freedesktop.org/archives/intel-gfx/2013-December/037333.html

The main change is the removal of INTEL_INFO() from the driver (patches 1 to 5), a clean-up suggested by Chris: the usage of that macro hides that we go from dev to dev_priv while we could use the dev_priv pointer that is usually available.

Patch 6 is also new, a minor clean-up while at it.

For patches 1 to 6:

Some comments/bikesheds (I'm not requiring these changes, just throwing some ideas):

- You removed INTEL_INFO, but all those IS_SOMETHING and HAS_SOMETHING macros still accept dev as argument instead of dev_priv. Do we have plans to change this too? I can remember many places where I had to add a "dev" variable just because of these macros. Perhaps maybe the new goal is a series removing the to_i915 macro? I could see a lot of code getting almost entirely rid of "dev" with these changes.

- It would be nice if we could come up with a clever strategy to find out if a still-not-initialized field of intel_device_info is being used. No clever ideas here, besides the obvious implementations that don't look good.

- Quick! Merge patch 3 before it conflicts and someone needs to review that giant thing again!

Quoted 10 lines

The remaining patches are rebased on top of the INTEL_INFO() change.

--
Damien

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 1 line
Paulo Zanoni
#15 lore raw
Quoted 20 lines · Paulo Zanoni

Hi

2014/1/6 Damien Lespiau <[email protected]>:

Quoted 9 lines

Follow up of the v3:
http://lists.freedesktop.org/archives/intel-gfx/2013-December/037333.html

The main change is the removal of INTEL_INFO() from the driver (patches 1 to 5), a clean-up suggested by Chris: the usage of that macro hides that we go from dev to dev_priv while we could use the dev_priv pointer that is usually available.

Patch 6 is also new, a minor clean-up while at it.

For patches 1 to 6:

Some comments/bikesheds (I'm not requiring these changes, just throwing some ideas):

Quoted 6 lines

- You removed INTEL_INFO, but all those IS_SOMETHING and HAS_SOMETHING macros still accept dev as argument instead of dev_priv. Do we have plans to change this too? I can remember many places where I had to add a "dev" variable just because of these macros. Perhaps maybe the new goal is a series removing the to_i915 macro? I could see a lot of code getting almost entirely rid of "dev" with these changes.

Once we have proper subclassing casting between drm_device and i915_device is very cheap, so I'm ok with sprinkling to_i915 all over those macros. If we end up with tons of IS_SOMETHING(&dev_priv->base) kind of code in a glorious future we can then switch things around.

Quoted 4 lines

- It would be nice if we could come up with a clever strategy to find out if a still-not-initialized field of intel_device_info is being used. No clever ideas here, besides the obvious implementations that don't look good.

Same here - would be neat but no idea.

Quoted 2 lines

- Quick! Merge patch 3 before it conflicts and someone needs to review that giant thing again!

As long as topic/ppgtt is still hanging out there and not yet merged into dinq that can't happen due to conflict galore. And since there are still some regressions pending that'll take a while.

Please don't blame me for this mess, I never really liked this approach of merging ppgtt ...
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#16 lore raw
Quoted 9 lines · Daniel Vetter
Quoted 2 lines

- Quick! Merge patch 3 before it conflicts and someone needs to review that giant thing again!

As long as topic/ppgtt is still hanging out there and not yet merged into dinq that can't happen due to conflict galore. And since there are still some regressions pending that'll take a while.

Please don't blame me for this mess, I never really liked this approach of merging ppgtt ...

I don't mind rebasing those patches and be second to ppggt in the queue, that makes quite a bit of sense priority wise. They are also quite easy to rebase.

We may still be able to merge patches 01,02,06 and 12 so I only have to rebase the remaining ones.

Signature · 1 line
Damien
maintainer
#17 lore raw
In reply to Paulo Zanoni
Quoted 6 lines · Paulo Zanoni

- You removed INTEL_INFO, but all those IS_SOMETHING and HAS_SOMETHING macros still accept dev as argument instead of dev_priv. Do we have plans to change this too? I can remember many places where I had to add a "dev" variable just because of these macros. Perhaps maybe the new goal is a series removing the to_i915 macro? I could see a lot of code getting almost entirely rid of "dev" with these changes.

You can get from dev to dev_priv and back easily enough. Replacing dev with dev_priv in function parameters seems like pointless churn to me. If (and that's a big if) we wanted to "standardize" on one or the other, I'd go for struct drm_device *dev.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#18 lore raw
Quoted 8 lines · Jani Nikula
Quoted 6 lines · Paulo Zanoni

- You removed INTEL_INFO, but all those IS_SOMETHING and HAS_SOMETHING macros still accept dev as argument instead of dev_priv. Do we have plans to change this too? I can remember many places where I had to add a "dev" variable just because of these macros. Perhaps maybe the new goal is a series removing the to_i915 macro? I could see a lot of code getting almost entirely rid of "dev" with these changes.

Quoted 4 lines

You can get from dev to dev_priv and back easily enough. Replacing dev with dev_priv in function parameters seems like pointless churn to me. If (and that's a big if) we wanted to "standardize" on one or the other, I'd go for struct drm_device *dev.

The long-long-longterm plan is to subclass struct drm_device, then passing around struct drm_device or struct i915_device becomes a moot point - but imho using struct i915_device internally provides a clear separation between boundary functions and our internals. Another bit of churn that would be a win in the long term, would be to starting splitting out a struct intel_device (or whatever) to segregrate the display stuff from GEM.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre