[Intel-gfx] [PATCH 23/66] drm/i915: Move stolen stuff to i915_gtt
Ben Widawsky
ben at bwidawsk.net
Fri Jun 28 01:30:24 CEST 2013
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 at 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 +-
drivers/gpu/drm/i915/intel_pm.c | 4 ++--
4 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index f428076..7016074 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -473,6 +473,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 */
@@ -828,8 +831,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
@@ -842,9 +843,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;
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 8e02344..fd812d5 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -97,10 +97,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);
@@ -112,7 +112,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,
@@ -123,9 +123,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;
@@ -147,7 +147,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)
@@ -180,7 +180,7 @@ 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)
@@ -188,18 +188,18 @@ int i915_gem_init_stolen(struct drm_device *dev)
struct drm_i915_private *dev_priv = dev->dev_private;
int bios_reserved = 0;
- 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);
if (IS_VALLEYVIEW(dev))
bios_reserved = 1024*1024; /* top 1M on VLV/BYT */
/* 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 -
bios_reserved);
return 0;
@@ -234,7 +234,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;
@@ -300,14 +300,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)
@@ -331,7 +331,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",
@@ -344,7 +344,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) {
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index fa70fd0..1e25920 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1538,7 +1538,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;
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index d32734d..02f2dea 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3464,7 +3464,7 @@ static void valleyview_setup_pctx(struct drm_device *dev)
/* BIOS set it up already, grab the pre-alloc'd space */
int pcbr_offset;
- pcbr_offset = (pcbr & (~4095)) - dev_priv->mm.stolen_base;
+ pcbr_offset = (pcbr & (~4095)) - dev_priv->gtt.stolen_base;
pctx = i915_gem_object_create_stolen_for_preallocated(dev_priv->dev,
pcbr_offset,
-1,
@@ -3486,7 +3486,7 @@ static void valleyview_setup_pctx(struct drm_device *dev)
return;
}
- pctx_paddr = dev_priv->mm.stolen_base + pctx->stolen->start;
+ pctx_paddr = dev_priv->gtt.stolen_base + pctx->stolen->start;
I915_WRITE(VLV_PCBR, pctx_paddr);
out:
--
1.8.3.1
More information about the Intel-gfx
mailing list