[Intel-gfx] [PATCH 05/13] i830_memory: rip out the old video memory allocator

Daniel Vetter daniel.vetter at ffwll.ch
Tue Mar 2 09:22:36 CET 2010


Besides the debug stuff the went away in the previous patch,
this stuff was totally unused ...

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 src/i830.h        |    7 -----
 src/i830_driver.c |   10 +------
 src/i830_memory.c |   69 -----------------------------------------------------
 3 files changed, 2 insertions(+), 84 deletions(-)

diff --git a/src/i830.h b/src/i830.h
index 5789976..45b6028 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -244,11 +244,6 @@ typedef struct intel_screen_private {
 	long FbMapSize;
 	long GTTMapSize;
 
-	/**
-	 * Linked list of video memory allocations.  The head and tail are
-	 * dummy entries that bound the allocation area.
-	 */
-	i830_memory *memory_list;
 	/** Linked list of buffer object memory allocations */
 	i830_memory *bo_list;
 
@@ -446,8 +441,6 @@ extern Bool i830_crtc_on(xf86CrtcPtr crtc);
 extern int i830_crtc_to_pipe(xf86CrtcPtr crtc);
 extern Bool I830AccelInit(ScreenPtr pScreen);
 
-Bool i830_allocator_init(ScrnInfoPtr scrn, unsigned long size);
-void i830_allocator_fini(ScrnInfoPtr scrn);
 i830_memory *i830_allocate_memory(ScrnInfoPtr scrn, const char *name,
 				  unsigned long size, unsigned long pitch,
 				  int flags, uint32_t tile_format);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 14d4432..4b2e617 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1016,13 +1016,6 @@ static Bool i830_memory_init(ScrnInfoPtr scrn)
 	Bool tiled = FALSE;
 
 	tiled = i830_tiled_width(intel, &scrn->displayWidth, intel->cpp);
-	/* Set up our video memory allocator for the chosen videoRam */
-	if (!i830_allocator_init(scrn, scrn->videoRam * KB(1))) {
-		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-			   "Couldn't initialize video memory allocator\n");
-		PreInitCleanup(scrn);
-		return FALSE;
-	}
 
 	xf86DrvMsg(scrn->scrnIndex,
 		   intel->pEnt->device->videoRam ? X_CONFIG : X_DEFAULT,
@@ -1457,7 +1450,8 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen)
 
 	xf86_cursors_fini(screen);
 
-	i830_allocator_fini(scrn);
+	/* Free most of the allocations */
+	i830_reset_allocations(scrn);
 
 	i965_free_video(scrn);
 
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 4202aa5..0d7ae43 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -206,13 +206,6 @@ void i830_reset_allocations(ScrnInfoPtr scrn)
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	int p;
 
-	/* While there is any memory between the start and end markers, free it. */
-	while (intel->memory_list->next->next != NULL) {
-		i830_memory *mem = intel->memory_list->next;
-
-		i830_free_memory(scrn, mem);
-	}
-
 	/* Free any allocations in buffer objects */
 	while (intel->bo_list != NULL)
 		i830_free_memory(scrn, intel->bo_list);
@@ -226,65 +219,6 @@ void i830_reset_allocations(ScrnInfoPtr scrn)
 	intel->front_buffer = NULL;
 }
 
-/**
- * Initialize's the driver's video memory allocator to allocate in the
- * given range.
- *
- * This sets up the kernel memory manager to manage as much of the memory
- * as we think it can, while leaving enough to us to fulfill our non-GEM
- * static allocations.  Some of these exist because of the need for physical
- * addresses to reference.
- */
-Bool i830_allocator_init(ScrnInfoPtr scrn, unsigned long size)
-{
-	intel_screen_private *intel = intel_get_screen_private(scrn);
-	i830_memory *start, *end;
-
-	start = xcalloc(1, sizeof(*start));
-	if (start == NULL)
-		return FALSE;
-	start->name = xstrdup("start marker");
-	if (start->name == NULL) {
-		xfree(start);
-		return FALSE;
-	}
-	end = xcalloc(1, sizeof(*end));
-	if (end == NULL) {
-		xfree(start->name);
-		xfree(start);
-		return FALSE;
-	}
-	end->name = xstrdup("end marker");
-	if (end->name == NULL) {
-		xfree(start->name);
-		xfree(start);
-		xfree(end);
-		return FALSE;
-	}
-
-	start->size = 0;
-	start->next = end;
-	end->size = 0;
-	end->prev = start;
-
-	intel->memory_list = start;
-
-	return TRUE;
-}
-
-void i830_allocator_fini(ScrnInfoPtr scrn)
-{
-	intel_screen_private *intel = intel_get_screen_private(scrn);
-
-	/* Free most of the allocations */
-	i830_reset_allocations(scrn);
-
-	/* Free the start/end markers */
-	free(intel->memory_list->next);
-	free(intel->memory_list);
-	intel->memory_list = NULL;
-}
-
 /* Allocates video memory at the given size, pitch, alignment and tile format.
  *
  * The memory will be bound automatically when the driver is in control of the
@@ -517,9 +451,6 @@ Bool i830_bind_all_memory(ScrnInfoPtr scrn)
 	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
 	int i;
 
-	if (intel->memory_list == NULL)
-		return TRUE;
-
 	for (i = 0; i < xf86_config->num_crtc; i++)
 		drmmode_crtc_set_cursor_bo(xf86_config->crtc[i],
 					   intel->cursor_mem_argb[i]->bo);
-- 
1.6.6.1




More information about the Intel-gfx mailing list