Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e76e9aeb authored by Ben Widawsky's avatar Ben Widawsky Committed by Daniel Vetter
Browse files

drm/i915: Stop using AGP layer for GEN6+



As a quick hack we make the old intel_gtt structure mutable so we can
fool a bunch of the existing code which depends on elements in that data
structure. We can/should try to remove this in a subsequent patch.

This should preserve the old gtt init behavior which upon writing these
patches seems incorrect. The next patch will fix these things.

The one exception is VLV which doesn't have the preserved flush control
write behavior. Since we want to do that for all GEN6+ stuff, we'll
handle that in a later patch. Mainstream VLV support doesn't actually
exist yet anyway.

v2: Update the comment to remove the "voodoo"
Check that the last pte written matches what we readback

v3: actually kill cache_level_to_agp_type since most of the flags will
disappear in an upcoming patch

v4: v3 was actually not what we wanted (Daniel)
Make the ggtt bind assertions better and stricter (Chris)
Fix some uncaught errors at gtt init (Chris)
Some other random stuff that Chris wanted

v5: check for i==0 in gen6_ggtt_bind_object to shut up gcc (Ben)

Signed-off-by: default avatarBen Widawsky <ben@bwidawsk.net>
Reviewed-by [v4]: Chris Wilson <chris@chris-wilson.co.uk>
[danvet: Make the cache_level -> agp_flags conversion for pre-gen6 a
tad more robust by mapping everything != CACHE_NONE to the cached agp
flag - we have a 1:1 uncached mapping, but different modes of
cacheable (at least on later generations). Suggested by Chris Wilson.]
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent b3fcabb1
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1686,7 +1686,7 @@ int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,
}
}
EXPORT_SYMBOL(intel_gmch_probe);
EXPORT_SYMBOL(intel_gmch_probe);


const struct intel_gtt *intel_gtt_get(void)
struct intel_gtt *intel_gtt_get(void)
{
{
	return &intel_private.base;
	return &intel_private.base;
}
}
+3 −13
Original line number Original line Diff line number Diff line
@@ -1496,19 +1496,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
		goto free_priv;
		goto free_priv;
	}
	}


	ret = intel_gmch_probe(dev_priv->bridge_dev, dev->pdev, NULL);
	ret = i915_gem_gtt_init(dev);
	if (!ret) {
	if (ret)
		DRM_ERROR("failed to set up gmch\n");
		ret = -EIO;
		goto put_bridge;
		goto put_bridge;
	}

	dev_priv->mm.gtt = intel_gtt_get();
	if (!dev_priv->mm.gtt) {
		DRM_ERROR("Failed to initialize GTT\n");
		ret = -ENODEV;
		goto put_gmch;
	}


	i915_kick_out_firmware_fb(dev_priv);
	i915_kick_out_firmware_fb(dev_priv);


@@ -1683,7 +1673,7 @@ out_mtrrfree:
out_rmmap:
out_rmmap:
	pci_iounmap(dev->pdev, dev_priv->regs);
	pci_iounmap(dev->pdev, dev_priv->regs);
put_gmch:
put_gmch:
	intel_gmch_remove();
	i915_gem_gtt_fini(dev);
put_bridge:
put_bridge:
	pci_dev_put(dev_priv->bridge_dev);
	pci_dev_put(dev_priv->bridge_dev);
free_priv:
free_priv:
+9 −1
Original line number Original line Diff line number Diff line
@@ -746,7 +746,7 @@ typedef struct drm_i915_private {


	struct {
	struct {
		/** Bridge to intel-gtt-ko */
		/** Bridge to intel-gtt-ko */
		const struct intel_gtt *gtt;
		struct intel_gtt *gtt;
		/** Memory allocator for GTT stolen memory */
		/** Memory allocator for GTT stolen memory */
		struct drm_mm stolen;
		struct drm_mm stolen;
		/** Memory allocator for GTT */
		/** Memory allocator for GTT */
@@ -1538,6 +1538,14 @@ void i915_gem_init_global_gtt(struct drm_device *dev,
			      unsigned long start,
			      unsigned long start,
			      unsigned long mappable_end,
			      unsigned long mappable_end,
			      unsigned long end);
			      unsigned long end);
int i915_gem_gtt_init(struct drm_device *dev);
void i915_gem_gtt_fini(struct drm_device *dev);
extern inline void i915_gem_chipset_flush(struct drm_device *dev)
{
	if (INTEL_INFO(dev)->gen < 6)
		intel_gtt_chipset_flush();
}



/* i915_gem_evict.c */
/* i915_gem_evict.c */
int __must_check i915_gem_evict_something(struct drm_device *dev, int min_size,
int __must_check i915_gem_evict_something(struct drm_device *dev, int min_size,
+6 −6
Original line number Original line Diff line number Diff line
@@ -845,12 +845,12 @@ out:
		 * domain anymore. */
		 * domain anymore. */
		if (obj->base.write_domain != I915_GEM_DOMAIN_CPU) {
		if (obj->base.write_domain != I915_GEM_DOMAIN_CPU) {
			i915_gem_clflush_object(obj);
			i915_gem_clflush_object(obj);
			intel_gtt_chipset_flush();
			i915_gem_chipset_flush(dev);
		}
		}
	}
	}


	if (needs_clflush_after)
	if (needs_clflush_after)
		intel_gtt_chipset_flush();
		i915_gem_chipset_flush(dev);


	return ret;
	return ret;
}
}
@@ -3058,7 +3058,7 @@ i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj)
		return;
		return;


	i915_gem_clflush_object(obj);
	i915_gem_clflush_object(obj);
	intel_gtt_chipset_flush();
	i915_gem_chipset_flush(obj->base.dev);
	old_write_domain = obj->base.write_domain;
	old_write_domain = obj->base.write_domain;
	obj->base.write_domain = 0;
	obj->base.write_domain = 0;


@@ -3959,7 +3959,7 @@ i915_gem_init_hw(struct drm_device *dev)
	drm_i915_private_t *dev_priv = dev->dev_private;
	drm_i915_private_t *dev_priv = dev->dev_private;
	int ret;
	int ret;


	if (!intel_enable_gtt())
	if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
		return -EIO;
		return -EIO;


	if (IS_HASWELL(dev) && (I915_READ(0x120010) == 1))
	if (IS_HASWELL(dev) && (I915_READ(0x120010) == 1))
@@ -4294,7 +4294,7 @@ void i915_gem_detach_phys_object(struct drm_device *dev,
			page_cache_release(page);
			page_cache_release(page);
		}
		}
	}
	}
	intel_gtt_chipset_flush();
	i915_gem_chipset_flush(dev);


	obj->phys_obj->cur_obj = NULL;
	obj->phys_obj->cur_obj = NULL;
	obj->phys_obj = NULL;
	obj->phys_obj = NULL;
@@ -4381,7 +4381,7 @@ i915_gem_phys_pwrite(struct drm_device *dev,
			return -EFAULT;
			return -EFAULT;
	}
	}


	intel_gtt_chipset_flush();
	i915_gem_chipset_flush(dev);
	return 0;
	return 0;
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -672,7 +672,7 @@ i915_gem_execbuffer_move_to_gpu(struct intel_ring_buffer *ring,
	}
	}


	if (flush_domains & I915_GEM_DOMAIN_CPU)
	if (flush_domains & I915_GEM_DOMAIN_CPU)
		intel_gtt_chipset_flush();
		i915_gem_chipset_flush(ring->dev);


	if (flush_domains & I915_GEM_DOMAIN_GTT)
	if (flush_domains & I915_GEM_DOMAIN_GTT)
		wmb();
		wmb();
Loading