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. Signed-off-by: Damien Lespiau <damien.lespiau@xxxxxxxxx> --- 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(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 7252f30..26686f7 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -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); diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index ee9502b..188e340 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -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(); diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 61fb9fc..9134140 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -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 diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 656406d..1ac740e 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -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; diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index ebe0f67..d4eb705 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@ -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) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index bbff8f9..65783d5 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -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; diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 998f9a0..3a2e5bc 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -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; diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index fed87ec..e804c49 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -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); diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index eb99358..e7dedd4 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c @@ -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; diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index ae8cf61..c3f35a4 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -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); diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 1d44c79..5170e4d 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -505,7 +505,7 @@ static void i915_enable_asle_pipestat(struct drm_device *dev) spin_lock_irqsave(&dev_priv->irq_lock, irqflags); i915_enable_pipestat(dev_priv, PIPE_B, PIPE_LEGACY_BLC_EVENT_ENABLE); - if (INTEL_INFO(dev)->gen >= 4) + if (dev_priv->info->gen >= 4) i915_enable_pipestat(dev_priv, PIPE_A, PIPE_LEGACY_BLC_EVENT_ENABLE); @@ -639,13 +639,13 @@ static bool intel_pipe_in_vblank_locked(struct drm_device *dev, enum pipe pipe) I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT; reg = ISR; - } else if (INTEL_INFO(dev)->gen < 5) { + } else if (dev_priv->info->gen < 5) { status = pipe == PIPE_A ? I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT : I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT; reg = ISR; - } else if (INTEL_INFO(dev)->gen < 7) { + } else if (dev_priv->info->gen < 7) { status = pipe == PIPE_A ? DE_PIPEA_VBLANK : DE_PIPEB_VBLANK; @@ -713,7 +713,7 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe, if (stime) *stime = ktime_get(); - if (IS_GEN2(dev) || IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) { + if (IS_GEN2(dev) || IS_G4X(dev) || dev_priv->info->gen >= 5) { /* No obvious pixelcount register. Only query vertical * scanout position from Display scan line register. */ @@ -767,7 +767,7 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe, else position += vtotal - vbl_end; - if (IS_GEN2(dev) || IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) { + if (IS_GEN2(dev) || IS_G4X(dev) || dev_priv->info->gen >= 5) { *vpos = position; *hpos = 0; } else { @@ -787,9 +787,10 @@ static int i915_get_vblank_timestamp(struct drm_device *dev, int pipe, struct timeval *vblank_time, unsigned flags) { + struct drm_i915_private *dev_priv = dev->dev_private; struct drm_crtc *crtc; - if (pipe < 0 || pipe >= INTEL_INFO(dev)->num_pipes) { + if (pipe < 0 || pipe >= dev_priv->info->num_pipes) { DRM_ERROR("Invalid crtc %d\n", pipe); return -EINVAL; } @@ -1366,12 +1367,12 @@ static void i9xx_pipe_crc_irq_handler(struct drm_device *dev, enum pipe pipe) struct drm_i915_private *dev_priv = dev->dev_private; uint32_t res1, res2; - if (INTEL_INFO(dev)->gen >= 3) + if (dev_priv->info->gen >= 3) res1 = I915_READ(PIPE_CRC_RES_RES1_I915(pipe)); else res1 = 0; - if (INTEL_INFO(dev)->gen >= 5 || IS_G4X(dev)) + if (dev_priv->info->gen >= 5 || IS_G4X(dev)) res2 = I915_READ(PIPE_CRC_RES_RES2_G4X(pipe)); else res2 = 0; @@ -1755,7 +1756,7 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg) gt_iir = I915_READ(GTIIR); if (gt_iir) { - if (INTEL_INFO(dev)->gen >= 6) + if (dev_priv->info->gen >= 6) snb_gt_irq_handler(dev, dev_priv, gt_iir); else ilk_gt_irq_handler(dev, dev_priv, gt_iir); @@ -1765,7 +1766,7 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg) de_iir = I915_READ(DEIIR); if (de_iir) { - if (INTEL_INFO(dev)->gen >= 7) + if (dev_priv->info->gen >= 7) ivb_display_irq_handler(dev, de_iir); else ilk_display_irq_handler(dev, de_iir); @@ -1773,7 +1774,7 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg) ret = IRQ_HANDLED; } - if (INTEL_INFO(dev)->gen >= 6) { + if (dev_priv->info->gen >= 6) { u32 pm_iir = I915_READ(GEN6_PMIIR); if (pm_iir) { gen6_rps_irq_handler(dev_priv, pm_iir); @@ -2063,7 +2064,7 @@ static void i915_report_and_clear_eir(struct drm_device *dev) pr_err(" INSTPM: 0x%08x\n", I915_READ(INSTPM)); for (i = 0; i < ARRAY_SIZE(instdone); i++) pr_err(" INSTDONE_%d: 0x%08x\n", i, instdone[i]); - if (INTEL_INFO(dev)->gen < 4) { + if (dev_priv->info->gen < 4) { u32 ipeir = I915_READ(IPEIR); pr_err(" IPEIR: 0x%08x\n", I915_READ(IPEIR)); @@ -2170,7 +2171,7 @@ static void __always_unused i915_pageflip_stall_check(struct drm_device *dev, in /* Potential stall - if we see that the flip has happened, assume a missed interrupt */ obj = work->pending_flip_obj; - if (INTEL_INFO(dev)->gen >= 4) { + if (dev_priv->info->gen >= 4) { int dspsurf = DSPSURF(intel_crtc->plane); stall_detected = I915_HI_DISPBASE(I915_READ(dspsurf)) == i915_gem_obj_ggtt_offset(obj); @@ -2201,7 +2202,7 @@ static int i915_enable_vblank(struct drm_device *dev, int pipe) return -EINVAL; spin_lock_irqsave(&dev_priv->irq_lock, irqflags); - if (INTEL_INFO(dev)->gen >= 4) + if (dev_priv->info->gen >= 4) i915_enable_pipestat(dev_priv, pipe, PIPE_START_VBLANK_INTERRUPT_ENABLE); else @@ -2220,7 +2221,7 @@ static int ironlake_enable_vblank(struct drm_device *dev, int pipe) { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; unsigned long irqflags; - uint32_t bit = (INTEL_INFO(dev)->gen >= 7) ? DE_PIPE_VBLANK_IVB(pipe) : + uint32_t bit = (dev_priv->info->gen >= 7) ? DE_PIPE_VBLANK_IVB(pipe) : DE_PIPE_VBLANK(pipe); if (!i915_pipe_enabled(dev, pipe)) @@ -2294,7 +2295,7 @@ static void ironlake_disable_vblank(struct drm_device *dev, int pipe) { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; unsigned long irqflags; - uint32_t bit = (INTEL_INFO(dev)->gen >= 7) ? DE_PIPE_VBLANK_IVB(pipe) : + uint32_t bit = (dev_priv->info->gen >= 7) ? DE_PIPE_VBLANK_IVB(pipe) : DE_PIPE_VBLANK(pipe); spin_lock_irqsave(&dev_priv->irq_lock, irqflags); @@ -2435,7 +2436,7 @@ ring_stuck(struct intel_ring_buffer *ring, u32 acthd) return HANGCHECK_KICK; } - if (INTEL_INFO(dev)->gen >= 6 && tmp & RING_WAIT_SEMAPHORE) { + if (dev_priv->info->gen >= 6 && tmp & RING_WAIT_SEMAPHORE) { switch (semaphore_passed(ring)) { default: return HANGCHECK_HUNG; @@ -2611,7 +2612,7 @@ static void gen5_gt_irq_preinstall(struct drm_device *dev) I915_WRITE(GTIER, 0x0); POSTING_READ(GTIER); - if (INTEL_INFO(dev)->gen >= 6) { + if (dev_priv->info->gen >= 6) { /* and PM */ I915_WRITE(GEN6_PMIMR, 0xffffffff); I915_WRITE(GEN6_PMIER, 0x0); @@ -2799,7 +2800,7 @@ static void gen5_gt_irq_postinstall(struct drm_device *dev) I915_WRITE(GTIER, gt_irqs); POSTING_READ(GTIER); - if (INTEL_INFO(dev)->gen >= 6) { + if (dev_priv->info->gen >= 6) { pm_irqs |= GEN6_PM_RPS_EVENTS; if (HAS_VEBOX(dev)) @@ -2819,7 +2820,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev) drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; u32 display_mask, extra_mask; - if (INTEL_INFO(dev)->gen >= 7) { + if (dev_priv->info->gen >= 7) { display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE_IVB | DE_PCH_EVENT_IVB | DE_PLANEC_FLIP_DONE_IVB | DE_PLANEB_FLIP_DONE_IVB | @@ -3798,7 +3799,7 @@ void intel_irq_init(struct drm_device *dev) if (IS_GEN2(dev)) { dev->max_vblank_count = 0; dev->driver->get_vblank_counter = i8xx_get_vblank_counter; - } else if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) { + } else if (IS_G4X(dev) || dev_priv->info->gen >= 5) { dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */ dev->driver->get_vblank_counter = gm45_get_vblank_counter; } else { @@ -3836,12 +3837,12 @@ void intel_irq_init(struct drm_device *dev) dev->driver->disable_vblank = ironlake_disable_vblank; dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup; } else { - if (INTEL_INFO(dev)->gen == 2) { + if (dev_priv->info->gen == 2) { dev->driver->irq_preinstall = i8xx_irq_preinstall; dev->driver->irq_postinstall = i8xx_irq_postinstall; dev->driver->irq_handler = i8xx_irq_handler; dev->driver->irq_uninstall = i8xx_irq_uninstall; - } else if (INTEL_INFO(dev)->gen == 3) { + } else if (dev_priv->info->gen == 3) { dev->driver->irq_preinstall = i915_irq_preinstall; dev->driver->irq_postinstall = i915_irq_postinstall; dev->driver->irq_uninstall = i915_irq_uninstall; diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 6b8fef7..a2716d2 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c @@ -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); diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c index 33bcae3..bccc52f 100644 --- a/drivers/gpu/drm/i915/i915_sysfs.c +++ b/drivers/gpu/drm/i915/i915_sysfs.c @@ -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"); diff --git a/drivers/gpu/drm/i915/i915_ums.c b/drivers/gpu/drm/i915/i915_ums.c index caa18e8..08b588e 100644 --- a/drivers/gpu/drm/i915/i915_ums.c +++ b/drivers/gpu/drm/i915/i915_ums.c @@ -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); } diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index f220419..4523e51 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c @@ -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: diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index e2e39e6..8e66a96 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c @@ -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); diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 4d1357a..ab016f0 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -778,7 +778,7 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe) struct drm_i915_private *dev_priv = dev->dev_private; int pipestat_reg = PIPESTAT(pipe); - if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) { + if (IS_G4X(dev) || dev_priv->info->gen >= 5) { g4x_wait_for_vblank(dev, pipe); return; } @@ -848,7 +848,7 @@ void intel_wait_for_pipe_off(struct drm_device *dev, int pipe) enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, pipe); - if (INTEL_INFO(dev)->gen >= 4) { + if (dev_priv->info->gen >= 4) { int reg = PIPECONF(cpu_transcoder); /* Wait for the Pipe State to go off */ @@ -1160,7 +1160,7 @@ static void assert_planes_disabled(struct drm_i915_private *dev_priv, int cur_pipe; /* Primary planes are fixed to pipes on gen4+ */ - if (INTEL_INFO(dev)->gen >= 4) { + if (dev_priv->info->gen >= 4) { reg = DSPCNTR(pipe); val = I915_READ(reg); WARN((val & DISPLAY_PLANE_ENABLE), @@ -1196,13 +1196,13 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv, "sprite %c assertion failure, should be off on pipe %c but is still active\n", sprite_name(pipe, i), pipe_name(pipe)); } - } else if (INTEL_INFO(dev)->gen >= 7) { + } else if (dev_priv->info->gen >= 7) { reg = SPRCTL(pipe); val = I915_READ(reg); WARN((val & SPRITE_ENABLE), "sprite %c assertion failure, should be off on pipe %c but is still active\n", plane_name(pipe), pipe_name(pipe)); - } else if (INTEL_INFO(dev)->gen >= 5) { + } else if (dev_priv->info->gen >= 5) { reg = DVSCNTR(pipe); val = I915_READ(reg); WARN((val & DVS_ENABLE), @@ -1454,7 +1454,7 @@ static void i9xx_enable_pll(struct intel_crtc *crtc) POSTING_READ(reg); udelay(150); - if (INTEL_INFO(dev)->gen >= 4) { + if (dev_priv->info->gen >= 4) { I915_WRITE(DPLL_MD(crtc->pipe), crtc->config.dpll_hw_state.dpll_md); } else { @@ -1918,8 +1918,10 @@ static void intel_disable_primary_plane(struct drm_i915_private *dev_priv, static bool need_vtd_wa(struct drm_device *dev) { + struct drm_i915_private *dev_priv = dev->dev_private; + #ifdef CONFIG_INTEL_IOMMU - if (INTEL_INFO(dev)->gen >= 6 && intel_iommu_gfx_mapped) + if (dev_priv->info->gen >= 6 && intel_iommu_gfx_mapped) return true; #endif return false; @@ -1938,7 +1940,7 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, case I915_TILING_NONE: if (IS_BROADWATER(dev) || IS_CRESTLINE(dev)) alignment = 128 * 1024; - else if (INTEL_INFO(dev)->gen >= 4) + else if (dev_priv->info->gen >= 4) alignment = 4 * 1024; else alignment = 64 * 1024; @@ -2081,7 +2083,7 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, BUG(); } - if (INTEL_INFO(dev)->gen >= 4) { + if (dev_priv->info->gen >= 4) { if (obj->tiling_mode != I915_TILING_NONE) dspcntr |= DISPPLANE_TILED; else @@ -2095,7 +2097,7 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8); - if (INTEL_INFO(dev)->gen >= 4) { + if (dev_priv->info->gen >= 4) { intel_crtc->dspaddr_offset = intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode, fb->bits_per_pixel / 8, @@ -2109,7 +2111,7 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, i915_gem_obj_ggtt_offset(obj), linear_offset, x, y, fb->pitches[0]); I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); - if (INTEL_INFO(dev)->gen >= 4) { + if (dev_priv->info->gen >= 4) { I915_MODIFY_DISPBASE(DSPSURF(plane), i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); I915_WRITE(DSPTILEOFF(plane), (y << 16) | x); @@ -2338,10 +2340,10 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, return 0; } - if (intel_crtc->plane > INTEL_INFO(dev)->num_pipes) { + if (intel_crtc->plane > dev_priv->info->num_pipes) { DRM_ERROR("no plane for crtc: plane %c, num_pipes %d\n", plane_name(intel_crtc->plane), - INTEL_INFO(dev)->num_pipes); + dev_priv->info->num_pipes); return -EINVAL; } @@ -4470,7 +4472,7 @@ static bool ironlake_check_fdi_lanes(struct drm_device *dev, enum pipe pipe, } } - if (INTEL_INFO(dev)->num_pipes == 2) + if (dev_priv->info->num_pipes == 2) return true; /* Ivybridge 3 pipe is really complicated */ @@ -4562,11 +4564,11 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc, struct intel_crtc_config *pipe_config) { struct drm_device *dev = crtc->base.dev; + struct drm_i915_private *dev_priv = dev->dev_private; struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; /* FIXME should check pixel clock limits on all platforms */ - if (INTEL_INFO(dev)->gen < 4) { - struct drm_i915_private *dev_priv = dev->dev_private; + if (dev_priv->info->gen < 4) { int clock_limit = dev_priv->display.get_display_clock_speed(dev); @@ -4600,13 +4602,13 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc, /* Cantiga+ cannot handle modes with a hsync front porch of 0. * WaPruneModeWithIncorrectHsyncOffset:ctg,elk,ilk,snb,ivb,vlv,hsw. */ - if ((INTEL_INFO(dev)->gen > 4 || IS_G4X(dev)) && + if ((dev_priv->info->gen > 4 || IS_G4X(dev)) && adjusted_mode->hsync_start == adjusted_mode->hdisplay) return -EINVAL; if ((IS_G4X(dev) || IS_VALLEYVIEW(dev)) && pipe_config->pipe_bpp > 10*3) { pipe_config->pipe_bpp = 10*3; /* 12bpc is gen5+ */ - } else if (INTEL_INFO(dev)->gen <= 4 && pipe_config->pipe_bpp > 8*3) { + } else if (dev_priv->info->gen <= 4 && pipe_config->pipe_bpp > 8*3) { /* only a 8bpc pipe, with 6bpc dither through the panel fitter * for lvds. */ pipe_config->pipe_bpp = 8*3; @@ -4874,7 +4876,7 @@ static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc, int pipe = crtc->pipe; enum transcoder transcoder = crtc->config.cpu_transcoder; - if (INTEL_INFO(dev)->gen >= 5) { + if (dev_priv->info->gen >= 5) { I915_WRITE(PIPE_DATA_M1(transcoder), TU_SIZE(m_n->tu) | m_n->gmch_m); I915_WRITE(PIPE_DATA_N1(transcoder), m_n->gmch_n); I915_WRITE(PIPE_LINK_M1(transcoder), m_n->link_m); @@ -5058,7 +5060,7 @@ static void i9xx_update_pll(struct intel_crtc *crtc, dpll |= DPLLB_LVDS_P2_CLOCK_DIV_14; break; } - if (INTEL_INFO(dev)->gen >= 4) + if (dev_priv->info->gen >= 4) dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT); if (crtc->config.sdvo_tv_clock) @@ -5072,7 +5074,7 @@ static void i9xx_update_pll(struct intel_crtc *crtc, dpll |= DPLL_VCO_ENABLE; crtc->config.dpll_hw_state.dpll = dpll; - if (INTEL_INFO(dev)->gen >= 4) { + if (dev_priv->info->gen >= 4) { u32 dpll_md = (crtc->config.pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT; crtc->config.dpll_hw_state.dpll_md = dpll_md; @@ -5144,7 +5146,7 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) vsyncshift = 0; } - if (INTEL_INFO(dev)->gen > 3) + if (dev_priv->info->gen > 3) I915_WRITE(VSYNCSHIFT(cpu_transcoder), vsyncshift); I915_WRITE(HTOTAL(cpu_transcoder), @@ -5434,7 +5436,7 @@ static void i9xx_get_pfit_config(struct intel_crtc *crtc, return; /* Check whether the pfit is attached to our pipe. */ - if (INTEL_INFO(dev)->gen < 4) { + if (dev_priv->info->gen < 4) { if (crtc->pipe != PIPE_B) return; } else { @@ -5444,7 +5446,7 @@ static void i9xx_get_pfit_config(struct intel_crtc *crtc, pipe_config->gmch_pfit.control = tmp; pipe_config->gmch_pfit.pgm_ratios = I915_READ(PFIT_PGM_RATIOS); - if (INTEL_INFO(dev)->gen < 5) + if (dev_priv->info->gen < 5) pipe_config->gmch_pfit.lvds_border_bits = I915_READ(LVDS) & LVDS_BORDER_ENABLE; } @@ -5505,14 +5507,14 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc, } } - if (INTEL_INFO(dev)->gen < 4) + if (dev_priv->info->gen < 4) pipe_config->double_wide = tmp & PIPECONF_DOUBLE_WIDE; intel_get_pipe_timings(crtc, pipe_config); i9xx_get_pfit_config(crtc, pipe_config); - if (INTEL_INFO(dev)->gen >= 4) { + if (dev_priv->info->gen >= 4) { tmp = I915_READ(DPLL_MD(crtc->pipe)); pipe_config->pixel_multiplier = ((tmp & DPLL_MD_UDI_MULTIPLIER_MASK) @@ -6010,7 +6012,7 @@ static void intel_set_pipe_csc(struct drm_crtc *crtc) I915_WRITE(PIPE_CSC_PREOFF_ME(pipe), 0); I915_WRITE(PIPE_CSC_PREOFF_LO(pipe), 0); - if (INTEL_INFO(dev)->gen > 6) { + if (dev_priv->info->gen > 6) { uint16_t postoff = 0; if (intel_crtc->config.limited_color_range) @@ -6358,7 +6360,7 @@ static void intel_cpu_transcoder_get_m_n(struct intel_crtc *crtc, struct drm_i915_private *dev_priv = dev->dev_private; enum pipe pipe = crtc->pipe; - if (INTEL_INFO(dev)->gen >= 5) { + if (dev_priv->info->gen >= 5) { m_n->link_m = I915_READ(PIPE_LINK_M1(transcoder)); m_n->link_n = I915_READ(PIPE_LINK_N1(transcoder)); m_n->gmch_m = I915_READ(PIPE_DATA_M1(transcoder)) @@ -8619,7 +8621,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, * TILEOFF/LINOFF registers can't be changed via MI display flips. * Note that pitch changes could also affect these register. */ - if (INTEL_INFO(dev)->gen > 3 && + if (dev_priv->info->gen > 3 && (fb->offsets[0] != crtc->fb->offsets[0] || fb->pitches[0] != crtc->fb->pitches[0])) return -EINVAL; @@ -8805,6 +8807,7 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc, struct intel_crtc_config *pipe_config) { struct drm_device *dev = crtc->base.dev; + struct drm_i915_private *dev_priv = dev->dev_private; struct intel_connector *connector; int bpp; @@ -8815,7 +8818,7 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc, case DRM_FORMAT_XRGB1555: case DRM_FORMAT_ARGB1555: /* checked in intel_framebuffer_init already */ - if (WARN_ON(INTEL_INFO(dev)->gen > 3)) + if (WARN_ON(dev_priv->info->gen > 3)) return -EINVAL; case DRM_FORMAT_RGB565: bpp = 6*3; /* min is 18bpp */ @@ -8823,7 +8826,7 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc, case DRM_FORMAT_XBGR8888: case DRM_FORMAT_ABGR8888: /* checked in intel_framebuffer_init already */ - if (WARN_ON(INTEL_INFO(dev)->gen < 4)) + if (WARN_ON(dev_priv->info->gen < 4)) return -EINVAL; case DRM_FORMAT_XRGB8888: case DRM_FORMAT_ARGB8888: @@ -8834,7 +8837,7 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc, case DRM_FORMAT_XBGR2101010: case DRM_FORMAT_ABGR2101010: /* checked in intel_framebuffer_init already */ - if (WARN_ON(INTEL_INFO(dev)->gen < 4)) + if (WARN_ON(dev_priv->info->gen < 4)) return -EINVAL; bpp = 10*3; break; @@ -9235,6 +9238,8 @@ intel_pipe_config_compare(struct drm_device *dev, struct intel_crtc_config *current_config, struct intel_crtc_config *pipe_config) { + struct drm_i915_private *dev_priv = dev->dev_private; + #define PIPE_CONF_CHECK_X(name) \ if (current_config->name != pipe_config->name) { \ DRM_ERROR("mismatch in " #name " " \ @@ -9326,7 +9331,7 @@ intel_pipe_config_compare(struct drm_device *dev, PIPE_CONF_CHECK_I(gmch_pfit.control); /* pfit ratios are autocomputed by the hw on gen4+ */ - if (INTEL_INFO(dev)->gen < 4) + if (dev_priv->info->gen < 4) PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios); PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits); PIPE_CONF_CHECK_I(pch_pfit.enabled); @@ -9345,7 +9350,7 @@ intel_pipe_config_compare(struct drm_device *dev, PIPE_CONF_CHECK_X(dpll_hw_state.fp0); PIPE_CONF_CHECK_X(dpll_hw_state.fp1); - if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) + if (IS_G4X(dev) || dev_priv->info->gen >= 5) PIPE_CONF_CHECK_I(pipe_bpp); if (!HAS_DDI(dev)) { @@ -10160,7 +10165,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) */ intel_crtc->pipe = pipe; intel_crtc->plane = pipe; - if (IS_MOBILE(dev) && INTEL_INFO(dev)->gen < 4) { + if (IS_MOBILE(dev) && dev_priv->info->gen < 4) { DRM_DEBUG_KMS("swapping pipes & planes for FBC\n"); intel_crtc->plane = !pipe; } @@ -10409,6 +10414,7 @@ int intel_framebuffer_init(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd, struct drm_i915_gem_object *obj) { + struct drm_i915_private *dev_priv = dev->dev_private; int aligned_height, tile_height; int pitch_limit; int ret; @@ -10426,14 +10432,14 @@ int intel_framebuffer_init(struct drm_device *dev, return -EINVAL; } - if (INTEL_INFO(dev)->gen >= 5 && !IS_VALLEYVIEW(dev)) { + if (dev_priv->info->gen >= 5 && !IS_VALLEYVIEW(dev)) { pitch_limit = 32*1024; - } else if (INTEL_INFO(dev)->gen >= 4) { + } else if (dev_priv->info->gen >= 4) { if (obj->tiling_mode) pitch_limit = 16*1024; else pitch_limit = 32*1024; - } else if (INTEL_INFO(dev)->gen >= 3) { + } else if (dev_priv->info->gen >= 3) { if (obj->tiling_mode) pitch_limit = 8*1024; else @@ -10465,7 +10471,7 @@ int intel_framebuffer_init(struct drm_device *dev, break; case DRM_FORMAT_XRGB1555: case DRM_FORMAT_ARGB1555: - if (INTEL_INFO(dev)->gen > 3) { + if (dev_priv->info->gen > 3) { DRM_DEBUG("unsupported pixel format: %s\n", drm_get_format_name(mode_cmd->pixel_format)); return -EINVAL; @@ -10477,7 +10483,7 @@ int intel_framebuffer_init(struct drm_device *dev, case DRM_FORMAT_ARGB2101010: case DRM_FORMAT_XBGR2101010: case DRM_FORMAT_ABGR2101010: - if (INTEL_INFO(dev)->gen < 4) { + if (dev_priv->info->gen < 4) { DRM_DEBUG("unsupported pixel format: %s\n", drm_get_format_name(mode_cmd->pixel_format)); return -EINVAL; @@ -10487,7 +10493,7 @@ int intel_framebuffer_init(struct drm_device *dev, case DRM_FORMAT_UYVY: case DRM_FORMAT_YVYU: case DRM_FORMAT_VYUY: - if (INTEL_INFO(dev)->gen < 5) { + if (dev_priv->info->gen < 5) { DRM_DEBUG("unsupported pixel format: %s\n", drm_get_format_name(mode_cmd->pixel_format)); return -EINVAL; @@ -10652,7 +10658,7 @@ static void intel_init_display(struct drm_device *dev) /* Default just returns -ENODEV to indicate unsupported */ dev_priv->display.queue_flip = intel_default_queue_flip; - switch (INTEL_INFO(dev)->gen) { + switch (dev_priv->info->gen) { case 2: dev_priv->display.queue_flip = intel_gen2_queue_flip; break; @@ -10849,7 +10855,7 @@ void intel_modeset_init(struct drm_device *dev) intel_init_pm(dev); - if (INTEL_INFO(dev)->num_pipes == 0) + if (dev_priv->info->num_pipes == 0) return; intel_init_display(dev); @@ -10867,8 +10873,8 @@ void intel_modeset_init(struct drm_device *dev) dev->mode_config.fb_base = dev_priv->gtt.mappable_base; DRM_DEBUG_KMS("%d display pipe%s available.\n", - INTEL_INFO(dev)->num_pipes, - INTEL_INFO(dev)->num_pipes > 1 ? "s" : ""); + dev_priv->info->num_pipes, + dev_priv->info->num_pipes > 1 ? "s" : ""); for_each_pipe(i) { intel_crtc_init(dev, i); @@ -10937,7 +10943,7 @@ intel_check_plane_mapping(struct intel_crtc *crtc) struct drm_i915_private *dev_priv = dev->dev_private; u32 reg, val; - if (INTEL_INFO(dev)->num_pipes == 1) + if (dev_priv->info->num_pipes == 1) return true; reg = DSPCNTR(!crtc->plane); @@ -10963,7 +10969,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) /* We need to sanitize the plane -> pipe mapping first because this will * disable the crtc (and hence change the state) if it is wrong. Note * that gen4+ has a fixed plane -> pipe mapping. */ - if (INTEL_INFO(dev)->gen < 4 && !intel_check_plane_mapping(crtc)) { + if (dev_priv->info->gen < 4 && !intel_check_plane_mapping(crtc)) { struct intel_connector *connector; bool plane; @@ -11341,7 +11347,7 @@ void intel_connector_attach_encoder(struct intel_connector *connector, int intel_modeset_vga_set_state(struct drm_device *dev, bool state) { struct drm_i915_private *dev_priv = dev->dev_private; - unsigned reg = INTEL_INFO(dev)->gen >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL; + unsigned reg = dev_priv->info->gen >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL; u16 gmch_ctrl; pci_read_config_word(dev_priv->bridge_dev, reg, &gmch_ctrl); @@ -11409,7 +11415,7 @@ intel_display_capture_error_state(struct drm_device *dev) }; int i; - if (INTEL_INFO(dev)->num_pipes == 0) + if (dev_priv->info->num_pipes == 0) return NULL; error = kzalloc(sizeof(*error), GFP_ATOMIC); @@ -11425,7 +11431,7 @@ intel_display_capture_error_state(struct drm_device *dev) if (!error->pipe[i].power_domain_on) continue; - if (INTEL_INFO(dev)->gen <= 6 || IS_VALLEYVIEW(dev)) { + if (dev_priv->info->gen <= 6 || IS_VALLEYVIEW(dev)) { error->cursor[i].control = I915_READ(CURCNTR(i)); error->cursor[i].position = I915_READ(CURPOS(i)); error->cursor[i].base = I915_READ(CURBASE(i)); @@ -11437,13 +11443,13 @@ intel_display_capture_error_state(struct drm_device *dev) error->plane[i].control = I915_READ(DSPCNTR(i)); error->plane[i].stride = I915_READ(DSPSTRIDE(i)); - if (INTEL_INFO(dev)->gen <= 3) { + if (dev_priv->info->gen <= 3) { error->plane[i].size = I915_READ(DSPSIZE(i)); error->plane[i].pos = I915_READ(DSPPOS(i)); } - if (INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev)) + if (dev_priv->info->gen <= 7 && !IS_HASWELL(dev)) error->plane[i].addr = I915_READ(DSPADDR(i)); - if (INTEL_INFO(dev)->gen >= 4) { + if (dev_priv->info->gen >= 4) { error->plane[i].surface = I915_READ(DSPSURF(i)); error->plane[i].tile_offset = I915_READ(DSPTILEOFF(i)); } @@ -11451,7 +11457,7 @@ intel_display_capture_error_state(struct drm_device *dev) error->pipe[i].source = I915_READ(PIPESRC(i)); } - error->num_transcoders = INTEL_INFO(dev)->num_pipes; + error->num_transcoders = dev_priv->info->num_pipes; if (HAS_DDI(dev_priv->dev)) error->num_transcoders++; /* Account for eDP. */ @@ -11484,12 +11490,13 @@ intel_display_print_error_state(struct drm_i915_error_state_buf *m, struct drm_device *dev, struct intel_display_error_state *error) { + struct drm_i915_private *dev_priv = dev->dev_private; int i; if (!error) return; - err_printf(m, "Num Pipes: %d\n", INTEL_INFO(dev)->num_pipes); + err_printf(m, "Num Pipes: %d\n", dev_priv->info->num_pipes); if (IS_HASWELL(dev) || IS_BROADWELL(dev)) err_printf(m, "PWR_WELL_CTL2: %08x\n", error->power_well_driver); @@ -11502,13 +11509,13 @@ intel_display_print_error_state(struct drm_i915_error_state_buf *m, err_printf(m, "Plane [%d]:\n", i); err_printf(m, " CNTR: %08x\n", error->plane[i].control); err_printf(m, " STRIDE: %08x\n", error->plane[i].stride); - if (INTEL_INFO(dev)->gen <= 3) { + if (dev_priv->info->gen <= 3) { err_printf(m, " SIZE: %08x\n", error->plane[i].size); err_printf(m, " POS: %08x\n", error->plane[i].pos); } - if (INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev)) + if (dev_priv->info->gen <= 7 && !IS_HASWELL(dev)) err_printf(m, " ADDR: %08x\n", error->plane[i].addr); - if (INTEL_INFO(dev)->gen >= 4) { + if (dev_priv->info->gen >= 4) { err_printf(m, " SURF: %08x\n", error->plane[i].surface); err_printf(m, " TILEOFF: %08x\n", error->plane[i].tile_offset); } diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index d53c17d..6e8adc3 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -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); diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 6db0d9d..1243af0 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -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; diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index b1dc33f..e97b563 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c @@ -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, diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 8bcb93a..2cd7315 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -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; diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index a1397b1..2e0b899 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c @@ -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 { diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 20ebc3e..c3ceb84 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -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) { diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 1316bdb..95eb4cc 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -506,7 +506,7 @@ void intel_update_fbc(struct drm_device *dev) adjusted_mode = &intel_crtc->config.adjusted_mode; if (i915_enable_fbc < 0 && - INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev)) { + dev_priv->info->gen <= 7 && !IS_HASWELL(dev)) { if (set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT)) DRM_DEBUG_KMS("disabled per chip default\n"); goto out_disable; @@ -524,7 +524,7 @@ void intel_update_fbc(struct drm_device *dev) goto out_disable; } - if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) { + if (IS_G4X(dev) || dev_priv->info->gen >= 5) { max_width = 4096; max_height = 2048; } else { @@ -537,7 +537,7 @@ void intel_update_fbc(struct drm_device *dev) DRM_DEBUG_KMS("mode too large for compression, disabling\n"); goto out_disable; } - if ((INTEL_INFO(dev)->gen < 4 || IS_HASWELL(dev)) && + if ((dev_priv->info->gen < 4 || IS_HASWELL(dev)) && intel_crtc->plane != PLANE_A) { if (set_no_fbc_reason(dev_priv, FBC_BAD_PLANE)) DRM_DEBUG_KMS("plane not A, disabling compression\n"); @@ -2024,14 +2024,14 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[5]) wm[2] = (sskpd >> 12) & 0xFF; wm[3] = (sskpd >> 20) & 0x1FF; wm[4] = (sskpd >> 32) & 0x1FF; - } else if (INTEL_INFO(dev)->gen >= 6) { + } else if (dev_priv->info->gen >= 6) { uint32_t sskpd = I915_READ(MCH_SSKPD); wm[0] = (sskpd >> SSKPD_WM0_SHIFT) & SSKPD_WM_MASK; wm[1] = (sskpd >> SSKPD_WM1_SHIFT) & SSKPD_WM_MASK; wm[2] = (sskpd >> SSKPD_WM2_SHIFT) & SSKPD_WM_MASK; wm[3] = (sskpd >> SSKPD_WM3_SHIFT) & SSKPD_WM_MASK; - } else if (INTEL_INFO(dev)->gen >= 5) { + } else if (dev_priv->info->gen >= 5) { uint32_t mltr = I915_READ(MLTR_ILK); /* ILK primary LP0 latency is 700 ns */ @@ -2051,8 +2051,10 @@ intel_fixup_spr_wm_latency(struct drm_i915_private *dev_priv, uint16_t wm[5]) static void intel_fixup_cur_wm_latency(struct drm_device *dev, uint16_t wm[5]) { + struct drm_i915_private *dev_priv = dev->dev_private; + /* ILK cursor LP0 latency is 1300 ns */ - if (INTEL_INFO(dev)->gen == 5) + if (dev_priv->info->gen == 5) wm[0] = 13; /* WaDoubleCursorLP3Latency:ivb */ @@ -2062,10 +2064,12 @@ static void intel_fixup_cur_wm_latency(struct drm_device *dev, uint16_t wm[5]) static int ilk_wm_max_level(const struct drm_device *dev) { + struct drm_i915_private *dev_priv = dev->dev_private; + /* how many WM levels are we expecting */ if (IS_HASWELL(dev)) return 4; - else if (INTEL_INFO(dev)->gen >= 6) + else if (dev_priv->info->gen >= 6) return 3; else return 2; @@ -2171,7 +2175,7 @@ static bool intel_compute_pipe_wm(struct drm_crtc *crtc, 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) + if (dev_priv->info->gen <= 6 && params->spr.enabled) max_level = 1; /* ILK/SNB/IVB: LP1+ watermarks only w/o scaling */ @@ -2222,15 +2226,16 @@ static void ilk_wm_merge(struct drm_device *dev, const struct ilk_wm_maximums *max, struct intel_pipe_wm *merged) { + struct drm_i915_private *dev_priv = dev->dev_private; int level, max_level = ilk_wm_max_level(dev); /* ILK/SNB/IVB: LP1+ watermarks only w/ single pipe */ - if ((INTEL_INFO(dev)->gen <= 6 || IS_IVYBRIDGE(dev)) && + if ((dev_priv->info->gen <= 6 || IS_IVYBRIDGE(dev)) && config->num_pipes_active > 1) return; /* ILK: FBC WM must be disabled always */ - merged->fbc_wm_enabled = INTEL_INFO(dev)->gen >= 6; + merged->fbc_wm_enabled = dev_priv->info->gen >= 6; /* merge each WM1+ level */ for (level = 1; level <= max_level; level++) { @@ -2288,6 +2293,7 @@ static void ilk_compute_wm_results(struct drm_device *dev, enum intel_ddb_partitioning partitioning, struct ilk_wm_values *results) { + struct drm_i915_private *dev_priv = dev->dev_private; struct intel_crtc *intel_crtc; int level, wm_lp; @@ -2309,14 +2315,14 @@ static void ilk_compute_wm_results(struct drm_device *dev, (r->pri_val << WM1_LP_SR_SHIFT) | r->cur_val; - if (INTEL_INFO(dev)->gen >= 8) + if (dev_priv->info->gen >= 8) results->wm_lp[wm_lp - 1] |= r->fbc_val << WM1_LP_FBC_SHIFT_BDW; else results->wm_lp[wm_lp - 1] |= r->fbc_val << WM1_LP_FBC_SHIFT; - if (INTEL_INFO(dev)->gen <= 6 && r->spr_val) { + if (dev_priv->info->gen <= 6 && r->spr_val) { WARN_ON(wm_lp != 1); results->wm_lp_spr[wm_lp - 1] = WM1S_LP_EN | r->spr_val; } else @@ -2522,7 +2528,7 @@ static void ilk_write_wm_values(struct drm_i915_private *dev_priv, previous->wm_lp_spr[0] != results->wm_lp_spr[0]) I915_WRITE(WM1S_LP_ILK, results->wm_lp_spr[0]); - if (INTEL_INFO(dev)->gen >= 7) { + if (dev_priv->info->gen >= 7) { if (dirty & WM_DIRTY_LP(2) && previous->wm_lp_spr[1] != results->wm_lp_spr[1]) I915_WRITE(WM2S_LP_IVB, results->wm_lp_spr[1]); if (dirty & WM_DIRTY_LP(3) && previous->wm_lp_spr[2] != results->wm_lp_spr[2]) @@ -2572,7 +2578,7 @@ static void ilk_update_wm(struct drm_crtc *crtc) 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 && + if (dev_priv->info->gen >= 7 && config.num_pipes_active == 1 && config.sprites_enabled) { ilk_compute_wm_maximums(dev_priv, 1, &config, INTEL_DDB_PART_5_6, &max); ilk_wm_merge(dev, &config, &max, &lp_wm_5_6); @@ -3163,8 +3169,10 @@ static void intel_print_rc6_info(struct drm_device *dev, u32 mode) int intel_enable_rc6(const struct drm_device *dev) { + struct drm_i915_private *dev_priv = dev->dev_private; + /* No RC6 before Ironlake */ - if (INTEL_INFO(dev)->gen < 5) + if (dev_priv->info->gen < 5) return 0; /* Respect the kernel parameter if it is set */ @@ -3172,14 +3180,14 @@ int intel_enable_rc6(const struct drm_device *dev) return i915_enable_rc6; /* Disable RC6 on Ironlake */ - if (INTEL_INFO(dev)->gen == 5) + if (dev_priv->info->gen == 5) return 0; if (IS_HASWELL(dev)) return INTEL_RC6_ENABLE; /* snb/ivb have more than one rc6 state. */ - if (INTEL_INFO(dev)->gen == 6) + if (dev_priv->info->gen == 6) return INTEL_RC6_ENABLE; return (INTEL_RC6_ENABLE | INTEL_RC6p_ENABLE); @@ -3202,7 +3210,7 @@ static void gen6_enable_rps_interrupts(struct drm_device *dev) /* IVB and SNB hard hangs on looping batchbuffer * if GEN6_PM_UP_EI_EXPIRED is masked. */ - if (INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev)) + if (dev_priv->info->gen <= 7 && !IS_HASWELL(dev)) enabled_intrs |= GEN6_PM_RP_UP_EI_EXPIRED; I915_WRITE(GEN6_PMINTRMSK, ~enabled_intrs); @@ -3442,7 +3450,7 @@ void gen6_update_ring_freq(struct drm_device *dev) int diff = dev_priv->rps.max_delay - gpu_freq; unsigned int ia_freq = 0, ring_freq = 0; - if (INTEL_INFO(dev)->gen >= 8) { + if (dev_priv->info->gen >= 8) { /* max(2 * GT, DDR). NB: GT is 50MHz units */ ring_freq = max(min_ring_freq, gpu_freq); } else if (IS_HASWELL(dev)) { @@ -4368,7 +4376,7 @@ void intel_disable_gt_powersave(struct drm_device *dev) if (IS_IRONLAKE_M(dev)) { ironlake_disable_drps(dev); ironlake_disable_rc6(dev); - } else if (INTEL_INFO(dev)->gen >= 6) { + } else if (dev_priv->info->gen >= 6) { cancel_delayed_work_sync(&dev_priv->rps.delayed_resume_work); cancel_work_sync(&dev_priv->rps.work); mutex_lock(&dev_priv->rps.hw_lock); @@ -5545,11 +5553,11 @@ void intel_init_pm(struct drm_device *dev) struct drm_i915_private *dev_priv = dev->dev_private; if (I915_HAS_FBC(dev)) { - if (INTEL_INFO(dev)->gen >= 7) { + if (dev_priv->info->gen >= 7) { dev_priv->display.fbc_enabled = ironlake_fbc_enabled; dev_priv->display.enable_fbc = gen7_enable_fbc; dev_priv->display.disable_fbc = ironlake_disable_fbc; - } else if (INTEL_INFO(dev)->gen >= 5) { + } else if (dev_priv->info->gen >= 5) { dev_priv->display.fbc_enabled = ironlake_fbc_enabled; dev_priv->display.enable_fbc = ironlake_enable_fbc; dev_priv->display.disable_fbc = ironlake_disable_fbc; @@ -5629,7 +5637,7 @@ void intel_init_pm(struct drm_device *dev) dev_priv->display.update_wm = NULL; } dev_priv->display.init_clock_gating = haswell_init_clock_gating; - } else if (INTEL_INFO(dev)->gen == 8) { + } else if (dev_priv->info->gen == 8) { dev_priv->display.init_clock_gating = gen8_init_clock_gating; } else dev_priv->display.update_wm = NULL; diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 442c9a6..99a82d6 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -562,7 +562,7 @@ static int init_render_ring(struct intel_ring_buffer *ring) struct drm_i915_private *dev_priv = dev->dev_private; int ret = init_ring_common(ring); - if (INTEL_INFO(dev)->gen > 3) + if (dev_priv->info->gen > 3) I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH)); /* We need to disable the AsyncFlip performance optimisations in order @@ -571,11 +571,11 @@ static int init_render_ring(struct intel_ring_buffer *ring) * * WaDisableAsyncFlipPerfMode:snb,ivb,hsw,vlv */ - if (INTEL_INFO(dev)->gen >= 6) + if (dev_priv->info->gen >= 6) I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(ASYNC_FLIP_PERF_DISABLE)); /* Required for the hardware to program scanline values for waiting */ - if (INTEL_INFO(dev)->gen == 6) + if (dev_priv->info->gen == 6) I915_WRITE(GFX_MODE, _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_ALWAYS)); @@ -584,7 +584,7 @@ static int init_render_ring(struct intel_ring_buffer *ring) _MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) | _MASKED_BIT_ENABLE(GFX_REPLAY_MODE)); - if (INTEL_INFO(dev)->gen >= 5) { + if (dev_priv->info->gen >= 5) { ret = init_pipe_control(ring); if (ret) return ret; @@ -607,7 +607,7 @@ static int init_render_ring(struct intel_ring_buffer *ring) !!(I915_READ(GFX_MODE) & GFX_TLB_INVALIDATE_ALWAYS); } - if (INTEL_INFO(dev)->gen >= 6) + if (dev_priv->info->gen >= 6) I915_WRITE(INSTPM, _MASKED_BIT_ENABLE(INSTPM_FORCE_ORDERING)); if (HAS_L3_DPF(dev)) @@ -618,12 +618,12 @@ static int init_render_ring(struct intel_ring_buffer *ring) static void render_ring_cleanup(struct intel_ring_buffer *ring) { - struct drm_device *dev = ring->dev; + struct drm_i915_private *dev_priv = to_i915(ring->dev); if (ring->scratch.obj == NULL) return; - if (INTEL_INFO(dev)->gen >= 5) { + if (dev_priv->info->gen >= 5) { kunmap(sg_page(ring->scratch.obj->pages->sgl)); i915_gem_object_ggtt_unpin(ring->scratch.obj); } @@ -976,7 +976,7 @@ void intel_ring_setup_status_page(struct intel_ring_buffer *ring) POSTING_READ(mmio); /* Flush the TLB for this page */ - if (INTEL_INFO(dev)->gen >= 6) { + if (dev_priv->info->gen >= 6) { u32 reg = RING_INSTPM(ring->mmio_base); I915_WRITE(reg, _MASKED_BIT_ENABLE(INSTPM_TLB_INVALIDATE | @@ -1849,12 +1849,12 @@ int intel_init_render_ring_buffer(struct drm_device *dev) ring->id = RCS; ring->mmio_base = RENDER_RING_BASE; - if (INTEL_INFO(dev)->gen >= 6) { + if (dev_priv->info->gen >= 6) { ring->add_request = gen6_add_request; ring->flush = gen7_render_ring_flush; - if (INTEL_INFO(dev)->gen == 6) + if (dev_priv->info->gen == 6) ring->flush = gen6_render_ring_flush; - if (INTEL_INFO(dev)->gen >= 8) { + if (dev_priv->info->gen >= 8) { ring->flush = gen8_render_ring_flush; ring->irq_get = gen8_ring_get_irq; ring->irq_put = gen8_ring_put_irq; @@ -1885,7 +1885,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev) GT_RENDER_PIPECTL_NOTIFY_INTERRUPT; } else { ring->add_request = i9xx_add_request; - if (INTEL_INFO(dev)->gen < 4) + if (dev_priv->info->gen < 4) ring->flush = gen2_render_ring_flush; else ring->flush = gen4_render_ring_flush; @@ -1905,9 +1905,9 @@ int intel_init_render_ring_buffer(struct drm_device *dev) ring->dispatch_execbuffer = hsw_ring_dispatch_execbuffer; else if (IS_GEN8(dev)) ring->dispatch_execbuffer = gen8_ring_dispatch_execbuffer; - else if (INTEL_INFO(dev)->gen >= 6) + else if (dev_priv->info->gen >= 6) ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer; - else if (INTEL_INFO(dev)->gen >= 4) + else if (dev_priv->info->gen >= 4) ring->dispatch_execbuffer = i965_dispatch_execbuffer; else if (IS_I830(dev) || IS_845G(dev)) ring->dispatch_execbuffer = i830_dispatch_execbuffer; @@ -1951,7 +1951,7 @@ int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size) ring->id = RCS; ring->mmio_base = RENDER_RING_BASE; - if (INTEL_INFO(dev)->gen >= 6) { + if (dev_priv->info->gen >= 6) { /* non-kms not supported on gen6+ */ return -ENODEV; } @@ -1960,7 +1960,7 @@ int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size) * gem_init ioctl returns with -ENODEV). Hence we do not need to set up * the special gen5 functions. */ ring->add_request = i9xx_add_request; - if (INTEL_INFO(dev)->gen < 4) + if (dev_priv->info->gen < 4) ring->flush = gen2_render_ring_flush; else ring->flush = gen4_render_ring_flush; @@ -1975,7 +1975,7 @@ int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size) } ring->irq_enable_mask = I915_USER_INTERRUPT; ring->write_tail = ring_write_tail; - if (INTEL_INFO(dev)->gen >= 4) + if (dev_priv->info->gen >= 4) ring->dispatch_execbuffer = i965_dispatch_execbuffer; else if (IS_I830(dev) || IS_845G(dev)) ring->dispatch_execbuffer = i830_dispatch_execbuffer; @@ -2018,7 +2018,7 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev) ring->id = VCS; ring->write_tail = ring_write_tail; - if (INTEL_INFO(dev)->gen >= 6) { + if (dev_priv->info->gen >= 6) { ring->mmio_base = GEN6_BSD_RING_BASE; /* gen6 bsd needs a special wa for tail updates */ if (IS_GEN6(dev)) @@ -2027,7 +2027,7 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev) ring->add_request = gen6_add_request; ring->get_seqno = gen6_ring_get_seqno; ring->set_seqno = ring_set_seqno; - if (INTEL_INFO(dev)->gen >= 8) { + if (dev_priv->info->gen >= 8) { ring->irq_enable_mask = GT_RENDER_USER_INTERRUPT << GEN8_VCS1_IRQ_SHIFT; ring->irq_get = gen8_ring_get_irq; @@ -2086,7 +2086,7 @@ int intel_init_blt_ring_buffer(struct drm_device *dev) ring->add_request = gen6_add_request; ring->get_seqno = gen6_ring_get_seqno; ring->set_seqno = ring_set_seqno; - if (INTEL_INFO(dev)->gen >= 8) { + if (dev_priv->info->gen >= 8) { ring->irq_enable_mask = GT_RENDER_USER_INTERRUPT << GEN8_BCS_IRQ_SHIFT; ring->irq_get = gen8_ring_get_irq; @@ -2127,7 +2127,7 @@ int intel_init_vebox_ring_buffer(struct drm_device *dev) ring->get_seqno = gen6_ring_get_seqno; ring->set_seqno = ring_set_seqno; - if (INTEL_INFO(dev)->gen >= 8) { + if (dev_priv->info->gen >= 8) { ring->irq_enable_mask = GT_RENDER_USER_INTERRUPT << GEN8_VECS_IRQ_SHIFT; ring->irq_get = gen8_ring_get_irq; diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 95bdfb3..4e44733 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -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; } diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index fe4de89..5584cd9 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -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; diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 22cf0f4..0448f0b 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c @@ -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); diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index 646fecf..e8850b8 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -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); -- 1.8.3.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx