diff options
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 1bd37e34c77e..d8def48242c8 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1920,6 +1920,16 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1920 | if (IS_GEN2(dev)) | 1920 | if (IS_GEN2(dev)) |
1921 | dma_set_coherent_mask(&dev->pdev->dev, DMA_BIT_MASK(30)); | 1921 | dma_set_coherent_mask(&dev->pdev->dev, DMA_BIT_MASK(30)); |
1922 | 1922 | ||
1923 | dev_priv->mm.gtt = intel_gtt_get(); | ||
1924 | if (!dev_priv->mm.gtt) { | ||
1925 | DRM_ERROR("Failed to initialize GTT\n"); | ||
1926 | ret = -ENODEV; | ||
1927 | goto out_iomapfree; | ||
1928 | } | ||
1929 | |||
1930 | prealloc_size = dev_priv->mm.gtt->gtt_stolen_entries << PAGE_SHIFT; | ||
1931 | agp_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; | ||
1932 | |||
1923 | dev_priv->regs = ioremap(base, size); | 1933 | dev_priv->regs = ioremap(base, size); |
1924 | if (!dev_priv->regs) { | 1934 | if (!dev_priv->regs) { |
1925 | DRM_ERROR("failed to map registers\n"); | 1935 | DRM_ERROR("failed to map registers\n"); |
@@ -1928,8 +1938,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1928 | } | 1938 | } |
1929 | 1939 | ||
1930 | dev_priv->mm.gtt_mapping = | 1940 | dev_priv->mm.gtt_mapping = |
1931 | io_mapping_create_wc(dev->agp->base, | 1941 | io_mapping_create_wc(dev->agp->base, agp_size); |
1932 | dev->agp->agp_info.aper_size * 1024*1024); | ||
1933 | if (dev_priv->mm.gtt_mapping == NULL) { | 1942 | if (dev_priv->mm.gtt_mapping == NULL) { |
1934 | ret = -EIO; | 1943 | ret = -EIO; |
1935 | goto out_rmmap; | 1944 | goto out_rmmap; |
@@ -1941,24 +1950,13 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1941 | * MTRR if present. Even if a UC MTRR isn't present. | 1950 | * MTRR if present. Even if a UC MTRR isn't present. |
1942 | */ | 1951 | */ |
1943 | dev_priv->mm.gtt_mtrr = mtrr_add(dev->agp->base, | 1952 | dev_priv->mm.gtt_mtrr = mtrr_add(dev->agp->base, |
1944 | dev->agp->agp_info.aper_size * | 1953 | agp_size, |
1945 | 1024 * 1024, | ||
1946 | MTRR_TYPE_WRCOMB, 1); | 1954 | MTRR_TYPE_WRCOMB, 1); |
1947 | if (dev_priv->mm.gtt_mtrr < 0) { | 1955 | if (dev_priv->mm.gtt_mtrr < 0) { |
1948 | DRM_INFO("MTRR allocation failed. Graphics " | 1956 | DRM_INFO("MTRR allocation failed. Graphics " |
1949 | "performance may suffer.\n"); | 1957 | "performance may suffer.\n"); |
1950 | } | 1958 | } |
1951 | 1959 | ||
1952 | dev_priv->mm.gtt = intel_gtt_get(); | ||
1953 | if (!dev_priv->mm.gtt) { | ||
1954 | DRM_ERROR("Failed to initialize GTT\n"); | ||
1955 | ret = -ENODEV; | ||
1956 | goto out_iomapfree; | ||
1957 | } | ||
1958 | |||
1959 | prealloc_size = dev_priv->mm.gtt->gtt_stolen_entries << PAGE_SHIFT; | ||
1960 | agp_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; | ||
1961 | |||
1962 | /* The i915 workqueue is primarily used for batched retirement of | 1960 | /* The i915 workqueue is primarily used for batched retirement of |
1963 | * requests (and thus managing bo) once the task has been completed | 1961 | * requests (and thus managing bo) once the task has been completed |
1964 | * by the GPU. i915_gem_retire_requests() is called directly when we | 1962 | * by the GPU. i915_gem_retire_requests() is called directly when we |