These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / gpu / drm / cirrus / cirrus_fbdev.c
index 13ddf1c..589103b 100644 (file)
@@ -98,7 +98,7 @@ static void cirrus_fillrect(struct fb_info *info,
                         const struct fb_fillrect *rect)
 {
        struct cirrus_fbdev *afbdev = info->par;
-       sys_fillrect(info, rect);
+       drm_fb_helper_sys_fillrect(info, rect);
        cirrus_dirty_update(afbdev, rect->dx, rect->dy, rect->width,
                         rect->height);
 }
@@ -107,7 +107,7 @@ static void cirrus_copyarea(struct fb_info *info,
                         const struct fb_copyarea *area)
 {
        struct cirrus_fbdev *afbdev = info->par;
-       sys_copyarea(info, area);
+       drm_fb_helper_sys_copyarea(info, area);
        cirrus_dirty_update(afbdev, area->dx, area->dy, area->width,
                         area->height);
 }
@@ -116,7 +116,7 @@ static void cirrus_imageblit(struct fb_info *info,
                          const struct fb_image *image)
 {
        struct cirrus_fbdev *afbdev = info->par;
-       sys_imageblit(info, image);
+       drm_fb_helper_sys_imageblit(info, image);
        cirrus_dirty_update(afbdev, image->dx, image->dy, image->width,
                         image->height);
 }
@@ -165,12 +165,10 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
 {
        struct cirrus_fbdev *gfbdev =
                container_of(helper, struct cirrus_fbdev, helper);
-       struct drm_device *dev = gfbdev->helper.dev;
        struct cirrus_device *cdev = gfbdev->helper.dev->dev_private;
        struct fb_info *info;
        struct drm_framebuffer *fb;
        struct drm_mode_fb_cmd2 mode_cmd;
-       struct device *device = &dev->pdev->dev;
        void *sysram;
        struct drm_gem_object *gobj = NULL;
        struct cirrus_bo *bo = NULL;
@@ -195,9 +193,9 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
        if (!sysram)
                return -ENOMEM;
 
-       info = framebuffer_alloc(0, device);
-       if (info == NULL)
-               return -ENOMEM;
+       info = drm_fb_helper_alloc_fbi(helper);
+       if (IS_ERR(info))
+               return PTR_ERR(info);
 
        info->par = gfbdev;
 
@@ -216,11 +214,9 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
 
        /* setup helper */
        gfbdev->helper.fb = fb;
-       gfbdev->helper.fbdev = info;
 
        strcpy(info->fix.id, "cirrusdrmfb");
 
-
        info->flags = FBINFO_DEFAULT;
        info->fbops = &cirrusfb_ops;
 
@@ -229,11 +225,6 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
                               sizes->fb_height);
 
        /* setup aperture base/size for vesafb takeover */
-       info->apertures = alloc_apertures(1);
-       if (!info->apertures) {
-               ret = -ENOMEM;
-               goto out_iounmap;
-       }
        info->apertures->ranges[0].base = cdev->dev->mode_config.fb_base;
        info->apertures->ranges[0].size = cdev->mc.vram_size;
 
@@ -246,13 +237,6 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
        info->fix.mmio_start = 0;
        info->fix.mmio_len = 0;
 
-       ret = fb_alloc_cmap(&info->cmap, 256, 0);
-       if (ret) {
-               DRM_ERROR("%s: can't allocate color map\n", info->fix.id);
-               ret = -ENOMEM;
-               goto out_iounmap;
-       }
-
        DRM_INFO("fb mappable at 0x%lX\n", info->fix.smem_start);
        DRM_INFO("vram aper at 0x%lX\n", (unsigned long)info->fix.smem_start);
        DRM_INFO("size %lu\n", (unsigned long)info->fix.smem_len);
@@ -260,24 +244,15 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
        DRM_INFO("   pitch is %d\n", fb->pitches[0]);
 
        return 0;
-out_iounmap:
-       return ret;
 }
 
 static int cirrus_fbdev_destroy(struct drm_device *dev,
                                struct cirrus_fbdev *gfbdev)
 {
-       struct fb_info *info;
        struct cirrus_framebuffer *gfb = &gfbdev->gfb;
 
-       if (gfbdev->helper.fbdev) {
-               info = gfbdev->helper.fbdev;
-
-               unregister_framebuffer(info);
-               if (info->cmap.len)
-                       fb_dealloc_cmap(&info->cmap);
-               framebuffer_release(info);
-       }
+       drm_fb_helper_unregister_fbi(&gfbdev->helper);
+       drm_fb_helper_release_fbi(&gfbdev->helper);
 
        if (gfb->obj) {
                drm_gem_object_unreference_unlocked(gfb->obj);