From patchwork Tue Mar 2 08:22:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 83151 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o228N63q013222 for ; Tue, 2 Mar 2010 08:23:47 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A76E99F3A5; Tue, 2 Mar 2010 00:22:36 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail.ffwll.ch (cable-static-49-187.intergga.ch [157.161.49.187]) by gabe.freedesktop.org (Postfix) with ESMTP id D7D779F368 for ; Tue, 2 Mar 2010 00:22:33 -0800 (PST) Received: by mail.ffwll.ch (Postfix, from userid 1000) id 33C7C20C435; Tue, 2 Mar 2010 09:22:33 +0100 (CET) X-Spam-ASN: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on orange.ffwll.ch X-Spam-Level: X-Spam-Hammy: 0.000-+--struct, 0.000-+--100644, 0.000-+--signedoffby X-Spam-Status: No, score=-4.4 required=6.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Spammy: 0.987-1--fulfill Received: from fliege.ffwll.ch (unknown [192.168.23.131]) by mail.ffwll.ch (Postfix) with ESMTP id 4DDB320C434; Tue, 2 Mar 2010 09:22:13 +0100 (CET) Received: from fliege.ffwll.ch (localhost.localdomain [127.0.0.1]) by fliege.ffwll.ch (8.14.3/8.14.3) with ESMTP id o228N7cl026176; Tue, 2 Mar 2010 09:23:07 +0100 Received: (from daniel@localhost) by fliege.ffwll.ch (8.14.3/8.14.3/Submit) id o228N7oL026175; Tue, 2 Mar 2010 09:23:07 +0100 From: Daniel Vetter To: intel-gfx@lists.freedesktop.org Date: Tue, 2 Mar 2010 09:22:36 +0100 Message-Id: <99c9af5f2a445be52d5f47058298c2d280600654.1267517278.git.daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: References: <9e33573053467e42d03de8ed74d1f1885b999cc3.1267517278.git.daniel.vetter@ffwll.ch> In-Reply-To: References: Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 05/13] i830_memory: rip out the old video memory allocator X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 02 Mar 2010 08:23:47 +0000 (UTC) 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);