Commit cb0ff05a authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

gma500: Tidy up the allocations

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: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8d9c134c
...@@ -245,8 +245,6 @@ struct drm_psb_private { ...@@ -245,8 +245,6 @@ struct drm_psb_private {
struct resource *gtt_mem; /* Our PCI resource */ struct resource *gtt_mem; /* Our PCI resource */
struct gtt_range *gtt_handles[GTT_MAX]; struct gtt_range *gtt_handles[GTT_MAX];
struct gtt_range *fb; /* System frame buffer */
struct psb_mmu_driver *mmu; struct psb_mmu_driver *mmu;
struct psb_mmu_pd *pf_pd; struct psb_mmu_pd *pf_pd;
......
...@@ -466,6 +466,7 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -466,6 +466,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
struct device *device = &dev->pdev->dev; struct device *device = &dev->pdev->dev;
int size, aligned_size; int size, aligned_size;
int ret; int ret;
struct gtt_range *backing;
mode_cmd.width = sizes->surface_width; mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height; mode_cmd.height = sizes->surface_height;
...@@ -479,13 +480,12 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -479,13 +480,12 @@ static int psbfb_create(struct psb_fbdev *fbdev,
aligned_size = ALIGN(size, PAGE_SIZE); aligned_size = ALIGN(size, PAGE_SIZE);
/* Allocate the framebuffer in the GTT */ /* Allocate the framebuffer in the GTT */
/* FIXME: this cannot live in dev_priv once we go multi head */ backing = psb_gtt_alloc_range(dev, aligned_size, "fb");
dev_priv->fb = psb_gtt_alloc_range(dev, aligned_size, "fb"); if (backing == NULL)
if (dev_priv->fb == NULL)
return -ENOMEM; return -ENOMEM;
mutex_lock(&dev->struct_mutex); 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) { if (!fb) {
DRM_ERROR("failed to allocate fb.\n"); DRM_ERROR("failed to allocate fb.\n");
ret = -ENOMEM; ret = -ENOMEM;
...@@ -518,7 +518,7 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -518,7 +518,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
/* Accessed via stolen memory directly, This only works for stolem /* Accessed via stolen memory directly, This only works for stolem
memory however. Need to address this once we start using gtt memory however. Need to address this once we start using gtt
pages we allocate */ 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; info->screen_size = size;
memset(info->screen_base, 0, size); memset(info->screen_base, 0, size);
...@@ -548,8 +548,7 @@ static int psbfb_create(struct psb_fbdev *fbdev, ...@@ -548,8 +548,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
fb->funcs->destroy(fb); fb->funcs->destroy(fb);
out_err1: out_err1:
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
psb_gtt_free_range(dev, dev_priv->fb); psb_gtt_free_range(dev, backing);
dev_priv->fb = NULL;
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment