From patchwork Sat May 25 19:26:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 2614111 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 0B2F9DF2A2 for ; Sat, 25 May 2013 19:35:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DD755E5D38 for ; Sat, 25 May 2013 12:35:08 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from shiva.localdomain (unknown [209.20.75.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 30BB8E5E13 for ; Sat, 25 May 2013 12:24:52 -0700 (PDT) Received: by shiva.localdomain (Postfix, from userid 1005) id 14CF788750; Sat, 25 May 2013 19:24:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on shiva.chad-versace.us X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham version=3.3.2 Received: from lundgren.kumite (c-24-21-100-90.hsd1.or.comcast.net [24.21.100.90]) by shiva.localdomain (Postfix) with ESMTPSA id A4BE28874E; Sat, 25 May 2013 19:24:48 +0000 (UTC) From: Ben Widawsky To: Intel GFX Date: Sat, 25 May 2013 12:26:57 -0700 Message-Id: <1369510028-3343-24-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1369510028-3343-1-git-send-email-ben@bwidawsk.net> References: <1369510028-3343-1-git-send-email-ben@bwidawsk.net> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH 23/34] drm/i915: Move stolen stuff to i915_gtt X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 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+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org 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 --- 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(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index ae10e28..dfce9cb 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -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; diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 2efa3d4..1b7c604 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -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) { diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 879c4cc..f49db99 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -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;