gfx: drv: Check the kernel fb size against the stolen vram size
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 20 Mar 2012 14:46:19 +0000 (16:46 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:30:43 +0000 (12:30 +0300)
Make sure we have anough stolen vram to house the kernel framebuffer.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
drivers/staging/mrst/drv/psb_fb.c

index 7ce5563..789f25b 100644 (file)
@@ -401,6 +401,11 @@ static int psbfb_create(struct psb_fbdev * fbdev, struct drm_fb_helper_surface_s
        size = mode_cmd.pitches[0] * mode_cmd.height;
        aligned_size = ALIGN(size, PAGE_SIZE);
 
+       if (aligned_size > pg->vram_stolen_size) {
+               DRM_ERROR("not enough stolen memory for fb.\n");
+               return -ENOMEM;
+       }
+
        mutex_lock(&dev->struct_mutex);
         fb = psb_framebuffer_create(dev, &mode_cmd, NULL);
         if (!fb) {