aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2011-11-29 17:19:47 -0500
committerDave Airlie <airlied@redhat.com>2011-12-06 04:55:29 -0500
commitdffc9ceb55695f121adc57dd1fde7304c3afe81e (patch)
treeb1457b5299c08ad2a03e9da4f38743f2fbcb7556 /drivers
parent838fa588a29331da012876623c3bc170d7d647c2 (diff)
gma500: kill virtual mapping support
This isn't actually usable - we simply don't have the vmap space on a 32bit system to do this stunt. Instead we will rely on the low level drivers limiting the console resolution as before. The real fix is for someone to write a page table aware version of the framebuffer console blit functions. Good university student project perhaps.. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/gma500/framebuffer.c52
-rw-r--r--drivers/gpu/drm/gma500/framebuffer.h1
2 files changed, 8 insertions, 45 deletions
diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index 171c4419b7f6..867a04722b05 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -309,13 +309,10 @@ static struct drm_framebuffer *psb_framebuffer_create
309 * 309 *
310 * Allocate the frame buffer. In the usual case we get a GTT range that 310 * Allocate the frame buffer. In the usual case we get a GTT range that
311 * is stolen memory backed and life is simple. If there isn't sufficient 311 * is stolen memory backed and life is simple. If there isn't sufficient
312 * stolen memory or the system has no stolen memory we allocate a range 312 * we fail as we don't have the virtual mapping space to really vmap it
313 * and back it with a GEM object. 313 * and the kernel console code can't handle non linear framebuffers.
314 * 314 *
315 * In this case the GEM object has no handle. 315 * Re-address this as and if the framebuffer layer grows this ability.
316 *
317 * FIXME: console speed up - allocate twice the space if room and use
318 * hardware scrolling for acceleration.
319 */ 316 */
320static struct gtt_range *psbfb_alloc(struct drm_device *dev, int aligned_size) 317static struct gtt_range *psbfb_alloc(struct drm_device *dev, int aligned_size)
321{ 318{
@@ -328,17 +325,7 @@ static struct gtt_range *psbfb_alloc(struct drm_device *dev, int aligned_size)
328 return backing; 325 return backing;
329 psb_gtt_free_range(dev, backing); 326 psb_gtt_free_range(dev, backing);
330 } 327 }
331 /* Next try using GEM host memory */ 328 return NULL;
332 backing = psb_gtt_alloc_range(dev, aligned_size, "fb(gem)", 0);
333 if (backing == NULL)
334 return NULL;
335
336 /* Now back it with an object */
337 if (drm_gem_object_init(dev, &backing->gem, aligned_size) != 0) {
338 psb_gtt_free_range(dev, backing);
339 return NULL;
340 }
341 return backing;
342} 329}
343 330
344/** 331/**
@@ -422,22 +409,9 @@ static int psbfb_create(struct psb_fbdev *fbdev,
422 info->fix.smem_start = dev->mode_config.fb_base; 409 info->fix.smem_start = dev->mode_config.fb_base;
423 info->fix.smem_len = size; 410 info->fix.smem_len = size;
424 411
425 if (backing->stolen) { 412 /* Accessed stolen memory directly */
426 /* Accessed stolen memory directly */ 413 info->screen_base = (char *)dev_priv->vram_addr +
427 info->screen_base = (char *)dev_priv->vram_addr +
428 backing->offset; 414 backing->offset;
429 } else {
430 /* Pin the pages into the GTT and create a mapping to them */
431 psb_gtt_pin(backing);
432 info->screen_base = vm_map_ram(backing->pages, backing->npage,
433 -1, PAGE_KERNEL);
434 if (info->screen_base == NULL) {
435 psb_gtt_unpin(backing);
436 ret = -ENOMEM;
437 goto out_unref;
438 }
439 psbfb->vm_map = 1;
440 }
441 info->screen_size = size; 415 info->screen_size = size;
442 416
443 if (dev_priv->gtt.stolen_size) { 417 if (dev_priv->gtt.stolen_size) {
@@ -471,11 +445,8 @@ static int psbfb_create(struct psb_fbdev *fbdev,
471out_unref: 445out_unref:
472 if (backing->stolen) 446 if (backing->stolen)
473 psb_gtt_free_range(dev, backing); 447 psb_gtt_free_range(dev, backing);
474 else { 448 else
475 if (psbfb->vm_map)
476 vm_unmap_ram(info->screen_base, backing->npage);
477 drm_gem_object_unreference(&backing->gem); 449 drm_gem_object_unreference(&backing->gem);
478 }
479out_err1: 450out_err1:
480 mutex_unlock(&dev->struct_mutex); 451 mutex_unlock(&dev->struct_mutex);
481 psb_gtt_free_range(dev, backing); 452 psb_gtt_free_range(dev, backing);
@@ -549,13 +520,6 @@ int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
549 520
550 if (fbdev->psb_fb_helper.fbdev) { 521 if (fbdev->psb_fb_helper.fbdev) {
551 info = fbdev->psb_fb_helper.fbdev; 522 info = fbdev->psb_fb_helper.fbdev;
552
553 /* If this is our base framebuffer then kill any virtual map
554 for the framebuffer layer and unpin it */
555 if (psbfb->vm_map) {
556 vm_unmap_ram(info->screen_base, psbfb->gtt->npage);
557 psb_gtt_unpin(psbfb->gtt);
558 }
559 unregister_framebuffer(info); 523 unregister_framebuffer(info);
560 if (info->cmap.len) 524 if (info->cmap.len)
561 fb_dealloc_cmap(&info->cmap); 525 fb_dealloc_cmap(&info->cmap);
@@ -765,7 +729,7 @@ void psb_modeset_init(struct drm_device *dev)
765 dev->mode_config.funcs = (void *) &psb_mode_funcs; 729 dev->mode_config.funcs = (void *) &psb_mode_funcs;
766 730
767 /* set memory base */ 731 /* set memory base */
768 /* MRST and PSB should use BAR 2*/ 732 /* Oaktrail and Poulsbo should use BAR 2*/
769 pci_read_config_dword(dev->pdev, PSB_BSM, (u32 *) 733 pci_read_config_dword(dev->pdev, PSB_BSM, (u32 *)
770 &(dev->mode_config.fb_base)); 734 &(dev->mode_config.fb_base));
771 735
diff --git a/drivers/gpu/drm/gma500/framebuffer.h b/drivers/gpu/drm/gma500/framebuffer.h
index d1b2289447f0..989558a9e6ee 100644
--- a/drivers/gpu/drm/gma500/framebuffer.h
+++ b/drivers/gpu/drm/gma500/framebuffer.h
@@ -32,7 +32,6 @@ struct psb_framebuffer {
32 struct address_space *addr_space; 32 struct address_space *addr_space;
33 struct fb_info *fbdev; 33 struct fb_info *fbdev;
34 struct gtt_range *gtt; 34 struct gtt_range *gtt;
35 bool vm_map; /* True if we must undo a vm_map_ram */
36}; 35};
37 36
38struct psb_fbdev { 37struct psb_fbdev {