OMAPFB: use dma_alloc_attrs to allocate memory
[pandora-kernel.git] / drivers / video / omap2 / omapfb / omapfb-ioctl.c
index df7bcce..233aab0 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <video/omapdss.h>
 #include <plat/vrfb.h>
-#include <plat/vram.h>
 
 #include "omapfb.h"
 
@@ -70,7 +69,7 @@ static int omapfb_setup_plane(struct fb_info *fbi, struct omapfb_plane_info *pi)
 
        DBG("omapfb_setup_plane\n");
 
-       if (ofbi->num_overlays != 1) {
+       if (ofbi->num_overlays == 0) {
                r = -EINVAL;
                goto out;
        }
@@ -185,7 +184,7 @@ static int omapfb_query_plane(struct fb_info *fbi, struct omapfb_plane_info *pi)
 {
        struct omapfb_info *ofbi = FB2OFB(fbi);
 
-       if (ofbi->num_overlays != 1) {
+       if (ofbi->num_overlays == 0) {
                memset(pi, 0, sizeof(*pi));
        } else {
                struct omap_overlay *ovl;
@@ -225,6 +224,9 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
        down_write_nested(&rg->lock, rg->id);
        atomic_inc(&rg->lock_count);
 
+       if (rg->size == size && rg->type == mi->type)
+               goto out;
+
        if (atomic_read(&rg->map_count)) {
                r = -EBUSY;
                goto out;
@@ -245,12 +247,10 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
                }
        }
 
-       if (rg->size != size || rg->type != mi->type) {
-               r = omapfb_realloc_fbmem(fbi, size, mi->type);
-               if (r) {
-                       dev_err(fbdev->dev, "realloc fbmem failed\n");
-                       goto out;
-               }
+       r = omapfb_realloc_fbmem(fbi, size, mi->type);
+       if (r) {
+               dev_err(fbdev->dev, "realloc fbmem failed\n");
+               goto out;
        }
 
  out:
@@ -847,14 +847,15 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
                break;
 
        case OMAPFB_GET_VRAM_INFO: {
-               unsigned long vram, free, largest;
-
                DBG("ioctl GET_VRAM_INFO\n");
 
-               omap_vram_get_info(&vram, &free, &largest);
-               p.vram_info.total = vram;
-               p.vram_info.free = free;
-               p.vram_info.largest_free_block = largest;
+               /*
+                * We don't have the ability to get this vram info anymore.
+                * Fill in something that should keep the applications working.
+                */
+               p.vram_info.total = SZ_1M * 64;
+               p.vram_info.free = SZ_1M * 64;
+               p.vram_info.largest_free_block = SZ_1M * 64;
 
                if (copy_to_user((void __user *)arg, &p.vram_info,
                                        sizeof(p.vram_info)))