Dave,
  this is an old patch that seems to have slip through the net, without
it my i915 runs out of GTT space within seconds during firefox replays.

>From e2cf2574d43f12934a20d2672d47fec082db7c5a Mon Sep 17 00:00:00 2001
From: Chris Wilson <ch...@chris-wilson.co.uk>
Date: Fri, 22 May 2009 13:52:03 +0100
Subject: [PATCH 08/10] drm: Memory fragmentation from lost alignment blocks

If the block needs an alignment but otherwise fits exactly into the tail,
then the split-off block from the start would remain marked as non-free.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
---
 drivers/gpu/drm/drm_mm.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 367c590..68e1b06 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -138,36 +138,34 @@ static struct drm_mm_node *drm_mm_split_at_start(struct 
drm_mm_node *parent,
 }
 
 
-
-struct drm_mm_node *drm_mm_get_block(struct drm_mm_node * parent,
+struct drm_mm_node *drm_mm_get_block(struct drm_mm_node * node,
                                unsigned long size, unsigned alignment)
 {
 
        struct drm_mm_node *align_splitoff = NULL;
-       struct drm_mm_node *child;
        unsigned tmp = 0;
 
        if (alignment)
-               tmp = parent->start % alignment;
+               tmp = node->start % alignment;
 
        if (tmp) {
-               align_splitoff = drm_mm_split_at_start(parent, alignment - tmp);
+               align_splitoff = drm_mm_split_at_start(node, alignment - tmp);
                if (!align_splitoff)
                        return NULL;
+
        }
 
-       if (parent->size == size) {
-               list_del_init(&parent->fl_entry);
-               parent->free = 0;
-               return parent;
+       if (node->size == size) {
+               list_del_init(&node->fl_entry);
+               node->free = 0;
        } else {
-               child = drm_mm_split_at_start(parent, size);
+               node = drm_mm_split_at_start(node, size);
        }
 
        if (align_splitoff)
                drm_mm_put_block(align_splitoff);
 
-       return child;
+       return node;
 }
 EXPORT_SYMBOL(drm_mm_get_block);
 
-- 
1.6.3.1


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to