提交 71e9339c 编写于 作者: C Chris Wilson

drm/i915: Use the agp_size determined from the GTT

This is the same value as before, but it just makes the code slightly
more readable to use the local variable than converting the aperture
size into bytes every time.
Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
上级 da761a6e
...@@ -1920,6 +1920,16 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -1920,6 +1920,16 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
if (IS_GEN2(dev)) if (IS_GEN2(dev))
dma_set_coherent_mask(&dev->pdev->dev, DMA_BIT_MASK(30)); dma_set_coherent_mask(&dev->pdev->dev, DMA_BIT_MASK(30));
dev_priv->mm.gtt = intel_gtt_get();
if (!dev_priv->mm.gtt) {
DRM_ERROR("Failed to initialize GTT\n");
ret = -ENODEV;
goto out_iomapfree;
}
prealloc_size = dev_priv->mm.gtt->gtt_stolen_entries << PAGE_SHIFT;
agp_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT;
dev_priv->regs = ioremap(base, size); dev_priv->regs = ioremap(base, size);
if (!dev_priv->regs) { if (!dev_priv->regs) {
DRM_ERROR("failed to map registers\n"); DRM_ERROR("failed to map registers\n");
...@@ -1928,8 +1938,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -1928,8 +1938,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
} }
dev_priv->mm.gtt_mapping = dev_priv->mm.gtt_mapping =
io_mapping_create_wc(dev->agp->base, io_mapping_create_wc(dev->agp->base, agp_size);
dev->agp->agp_info.aper_size * 1024*1024);
if (dev_priv->mm.gtt_mapping == NULL) { if (dev_priv->mm.gtt_mapping == NULL) {
ret = -EIO; ret = -EIO;
goto out_rmmap; goto out_rmmap;
...@@ -1941,24 +1950,13 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -1941,24 +1950,13 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
* MTRR if present. Even if a UC MTRR isn't present. * MTRR if present. Even if a UC MTRR isn't present.
*/ */
dev_priv->mm.gtt_mtrr = mtrr_add(dev->agp->base, dev_priv->mm.gtt_mtrr = mtrr_add(dev->agp->base,
dev->agp->agp_info.aper_size * agp_size,
1024 * 1024,
MTRR_TYPE_WRCOMB, 1); MTRR_TYPE_WRCOMB, 1);
if (dev_priv->mm.gtt_mtrr < 0) { if (dev_priv->mm.gtt_mtrr < 0) {
DRM_INFO("MTRR allocation failed. Graphics " DRM_INFO("MTRR allocation failed. Graphics "
"performance may suffer.\n"); "performance may suffer.\n");
} }
dev_priv->mm.gtt = intel_gtt_get();
if (!dev_priv->mm.gtt) {
DRM_ERROR("Failed to initialize GTT\n");
ret = -ENODEV;
goto out_iomapfree;
}
prealloc_size = dev_priv->mm.gtt->gtt_stolen_entries << PAGE_SHIFT;
agp_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT;
/* The i915 workqueue is primarily used for batched retirement of /* The i915 workqueue is primarily used for batched retirement of
* requests (and thus managing bo) once the task has been completed * requests (and thus managing bo) once the task has been completed
* by the GPU. i915_gem_retire_requests() is called directly when we * by the GPU. i915_gem_retire_requests() is called directly when we
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册