@@ -430,6 +430,9 @@ struct i915_address_space {
*/
struct i915_gtt {
struct i915_address_space base;
+
+ struct drm_mm stolen;
+ unsigned long stolen_base; /* limited to low memory (32-bit) */
size_t stolen_size; /* Total size of stolen memory */
unsigned long mappable_end; /* End offset that we can CPU map */
@@ -770,8 +773,6 @@ struct intel_l3_parity {
};
struct i915_gem_mm {
- /** Memory allocator for GTT stolen memory */
- struct drm_mm stolen;
/** Memory allocator for GTT */
struct drm_mm gtt_space;
/** List of all objects in gtt_space. Used to restore gtt
@@ -784,9 +785,6 @@ struct i915_gem_mm {
*/
struct list_head unbound_list;
- /** Usable portion of the GTT for GEM */
- unsigned long stolen_base; /* limited to low memory (32-bit) */
-
/** PPGTT used for aliasing the PPGTT with the GTT */
struct i915_hw_ppgtt *aliasing_ppgtt;
@@ -94,10 +94,10 @@ static int i915_setup_compression(struct drm_device *dev, int size)
struct drm_mm_node *compressed_fb, *uninitialized_var(compressed_llb);
/* Try to over-allocate to reduce reallocations and fragmentation */
- compressed_fb = drm_mm_search_free(&dev_priv->mm.stolen,
+ compressed_fb = drm_mm_search_free(&dev_priv->gtt.stolen,
size <<= 1, 4096, 0);
if (!compressed_fb)
- compressed_fb = drm_mm_search_free(&dev_priv->mm.stolen,
+ compressed_fb = drm_mm_search_free(&dev_priv->gtt.stolen,
size >>= 1, 4096, 0);
if (compressed_fb)
compressed_fb = drm_mm_get_block(compressed_fb, size, 4096);
@@ -109,7 +109,7 @@ static int i915_setup_compression(struct drm_device *dev, int size)
else if (IS_GM45(dev)) {
I915_WRITE(DPFC_CB_BASE, compressed_fb->start);
} else {
- compressed_llb = drm_mm_search_free(&dev_priv->mm.stolen,
+ compressed_llb = drm_mm_search_free(&dev_priv->gtt.stolen,
4096, 4096, 0);
if (compressed_llb)
compressed_llb = drm_mm_get_block(compressed_llb,
@@ -120,9 +120,9 @@ static int i915_setup_compression(struct drm_device *dev, int size)
dev_priv->fbc.compressed_llb = compressed_llb;
I915_WRITE(FBC_CFB_BASE,
- dev_priv->mm.stolen_base + compressed_fb->start);
+ dev_priv->gtt.stolen_base + compressed_fb->start);
I915_WRITE(FBC_LL_BASE,
- dev_priv->mm.stolen_base + compressed_llb->start);
+ dev_priv->gtt.stolen_base + compressed_llb->start);
}
dev_priv->fbc.compressed_fb = compressed_fb;
@@ -144,7 +144,7 @@ int i915_gem_stolen_setup_compression(struct drm_device *dev, int size)
{
struct drm_i915_private *dev_priv = dev->dev_private;
- if (dev_priv->mm.stolen_base == 0)
+ if (dev_priv->gtt.stolen_base == 0)
return -ENODEV;
if (size < dev_priv->fbc.size)
@@ -177,22 +177,22 @@ void i915_gem_cleanup_stolen(struct drm_device *dev)
struct drm_i915_private *dev_priv = dev->dev_private;
i915_gem_stolen_cleanup_compression(dev);
- drm_mm_takedown(&dev_priv->mm.stolen);
+ drm_mm_takedown(&dev_priv->gtt.stolen);
}
int i915_gem_init_stolen(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
- dev_priv->mm.stolen_base = i915_stolen_to_physical(dev);
- if (dev_priv->mm.stolen_base == 0)
+ dev_priv->gtt.stolen_base = i915_stolen_to_physical(dev);
+ if (dev_priv->gtt.stolen_base == 0)
return 0;
DRM_DEBUG_KMS("found %zd bytes of stolen memory at %08lx\n",
- dev_priv->gtt.stolen_size, dev_priv->mm.stolen_base);
+ dev_priv->gtt.stolen_size, dev_priv->gtt.stolen_base);
/* Basic memrange allocator for stolen space */
- drm_mm_init(&dev_priv->mm.stolen, 0, dev_priv->gtt.stolen_size);
+ drm_mm_init(&dev_priv->gtt.stolen, 0, dev_priv->gtt.stolen_size);
return 0;
}
@@ -226,7 +226,7 @@ i915_pages_create_for_stolen(struct drm_device *dev,
sg->offset = offset;
sg->length = size;
- sg_dma_address(sg) = (dma_addr_t)dev_priv->mm.stolen_base + offset;
+ sg_dma_address(sg) = (dma_addr_t)dev_priv->gtt.stolen_base + offset;
sg_dma_len(sg) = size;
return st;
@@ -292,14 +292,14 @@ i915_gem_object_create_stolen(struct drm_device *dev, u32 size)
struct drm_i915_gem_object *obj;
struct drm_mm_node *stolen;
- if (dev_priv->mm.stolen_base == 0)
+ if (dev_priv->gtt.stolen_base == 0)
return NULL;
DRM_DEBUG_KMS("creating stolen object: size=%x\n", size);
if (size == 0)
return NULL;
- stolen = drm_mm_search_free(&dev_priv->mm.stolen, size, 4096, 0);
+ stolen = drm_mm_search_free(&dev_priv->gtt.stolen, size, 4096, 0);
if (stolen)
stolen = drm_mm_get_block(stolen, size, 4096);
if (stolen == NULL)
@@ -323,7 +323,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
struct drm_i915_gem_object *obj;
struct drm_mm_node *stolen;
- if (dev_priv->mm.stolen_base == 0)
+ if (dev_priv->gtt.stolen_base == 0)
return NULL;
DRM_DEBUG_KMS("creating preallocated stolen object: stolen_offset=%x, gtt_offset=%x, size=%x\n",
@@ -337,7 +337,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
if (WARN_ON(size == 0))
return NULL;
- stolen = drm_mm_create_block(&dev_priv->mm.stolen,
+ stolen = drm_mm_create_block(&dev_priv->gtt.stolen,
stolen_offset, size,
false);
if (stolen == NULL) {
@@ -1500,7 +1500,7 @@ i915_error_object_create_sized(struct drm_i915_private *dev_priv,
} else if (src->stolen) {
unsigned long offset;
- offset = dev_priv->mm.stolen_base;
+ offset = dev_priv->gtt.stolen_base;
offset += src->stolen->start;
offset += i << PAGE_SHIFT;
It doesn't apply to generic VMA, so it belongs with the gtt. for file in `ls drivers/gpu/drm/i915/*.c` ; do sed -i "s/mm.stolen_base/gtt.stolen_base/" $file; done for file in `ls drivers/gpu/drm/i915/*.c` ; do sed -i "s/mm.stolen/gtt.stolen/" $file; done Signed-off-by: Ben Widawsky <ben@bwidawsk.net> --- drivers/gpu/drm/i915/i915_drv.h | 8 +++----- drivers/gpu/drm/i915/i915_gem_stolen.c | 32 ++++++++++++++++---------------- drivers/gpu/drm/i915/i915_irq.c | 2 +- 3 files changed, 20 insertions(+), 22 deletions(-)