linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Cox <alan@linux.jf.intel.com>
To: greg@kroah.com, linux-kernel@vger.kernel.org
Subject: [PATCH 5/5] gma500: Tidy up the allocations
Date: Wed, 13 Apr 2011 10:37:24 +0100	[thread overview]
Message-ID: <20110413093709.28527.23051.stgit@localhost.localdomain> (raw)
In-Reply-To: <20110413093519.28527.36552.stgit@localhost.localdomain>

Now we can do allocations we need to shuffle the fb resource into the fb so
we can one day have multiple frame buffer objects.

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/staging/gma500/psb_drv.h |    2 --
 drivers/staging/gma500/psb_fb.c  |   13 ++++++-------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/gma500/psb_drv.h b/drivers/staging/gma500/psb_drv.h
index 7a0506a..9da6a33 100644
--- a/drivers/staging/gma500/psb_drv.h
+++ b/drivers/staging/gma500/psb_drv.h
@@ -245,8 +245,6 @@ struct drm_psb_private {
 	struct resource *gtt_mem;	/* Our PCI resource */
 	struct gtt_range *gtt_handles[GTT_MAX];
 
-	struct gtt_range *fb;		/* System frame buffer */
-
 	struct psb_mmu_driver *mmu;
 	struct psb_mmu_pd *pf_pd;
 
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
index 06715e8..0bad4e0 100644
--- a/drivers/staging/gma500/psb_fb.c
+++ b/drivers/staging/gma500/psb_fb.c
@@ -466,6 +466,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
 	struct device *device = &dev->pdev->dev;
 	int size, aligned_size;
 	int ret;
+	struct gtt_range *backing;
 
 	mode_cmd.width = sizes->surface_width;
 	mode_cmd.height = sizes->surface_height;
@@ -479,13 +480,12 @@ static int psbfb_create(struct psb_fbdev *fbdev,
 	aligned_size = ALIGN(size, PAGE_SIZE);
 
 	/* Allocate the framebuffer in the GTT */
-	/* FIXME: this cannot live in dev_priv once we go multi head */
-	dev_priv->fb = psb_gtt_alloc_range(dev, aligned_size, "fb");
-	if (dev_priv->fb == NULL)
+	backing = psb_gtt_alloc_range(dev, aligned_size, "fb");
+	if (backing == NULL)
 	        return -ENOMEM;
 
 	mutex_lock(&dev->struct_mutex);
-	fb = psb_framebuffer_create(dev, &mode_cmd, dev_priv->fb);
+	fb = psb_framebuffer_create(dev, &mode_cmd, backing);
 	if (!fb) {
 		DRM_ERROR("failed to allocate fb.\n");
 		ret = -ENOMEM;
@@ -518,7 +518,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
 	/* Accessed via stolen memory directly, This only works for stolem
 	   memory however. Need to address this once we start using gtt
 	   pages we allocate */
-	info->screen_base = (char *)pg->vram_addr + dev_priv->fb->offset;
+	info->screen_base = (char *)pg->vram_addr + backing->offset;
 	info->screen_size = size;
 	memset(info->screen_base, 0, size);
 
@@ -548,8 +548,7 @@ out_err0:
 	fb->funcs->destroy(fb);
 out_err1:
 	mutex_unlock(&dev->struct_mutex);
-	psb_gtt_free_range(dev, dev_priv->fb);
-	dev_priv->fb = NULL;
+	psb_gtt_free_range(dev, backing);
 	return ret;
 }
 


      parent reply	other threads:[~2011-04-13  9:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13  9:35 [PATCH 1/5] gma500: ioctl first pass Alan Cox
2011-04-13  9:35 ` [PATCH 2/5] gma500: prepare to do some actual memory management Alan Cox
2011-04-13  9:36 ` [PATCH 3/5] gma500: backlight warning Alan Cox
2011-04-13 13:17   ` Matthew Garrett
2011-04-13 13:20     ` Alan Cox
2011-04-13 13:23       ` Matthew Garrett
2011-04-13  9:37 ` [PATCH 4/5] gma500: Add a gtt allocator Alan Cox
2011-04-13 10:37   ` Thierry Reding
2011-04-13  9:37 ` Alan Cox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110413093709.28527.23051.stgit@localhost.localdomain \
    --to=alan@linux.jf.intel.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).