]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/gpu/drm/i915/intel_fbdev.c
Merge remote-tracking branch 'asoc/topic/core' into asoc-next
[karo-tx-linux.git] / drivers / gpu / drm / i915 / intel_fbdev.c
index 7eff33ff84f69de52839817ac8d57ac219da5b53..8c6a6fa460057d38c71fe8f01986cde39f234442 100644 (file)
@@ -55,13 +55,6 @@ static int intel_fbdev_set_par(struct fb_info *info)
        ret = drm_fb_helper_set_par(info);
 
        if (ret == 0) {
-               /*
-                * FIXME: fbdev presumes that all callbacks also work from
-                * atomic contexts and relies on that for emergency oops
-                * printing. KMS totally doesn't do that and the locking here is
-                * by far not the only place this goes wrong.  Ignore this for
-                * now until we solve this for real.
-                */
                mutex_lock(&fb_helper->dev->struct_mutex);
                intel_fb_obj_invalidate(ifbdev->fb->obj, ORIGIN_GTT);
                mutex_unlock(&fb_helper->dev->struct_mutex);
@@ -80,13 +73,6 @@ static int intel_fbdev_blank(int blank, struct fb_info *info)
        ret = drm_fb_helper_blank(blank, info);
 
        if (ret == 0) {
-               /*
-                * FIXME: fbdev presumes that all callbacks also work from
-                * atomic contexts and relies on that for emergency oops
-                * printing. KMS totally doesn't do that and the locking here is
-                * by far not the only place this goes wrong.  Ignore this for
-                * now until we solve this for real.
-                */
                mutex_lock(&fb_helper->dev->struct_mutex);
                intel_fb_obj_invalidate(ifbdev->fb->obj, ORIGIN_GTT);
                mutex_unlock(&fb_helper->dev->struct_mutex);
@@ -106,13 +92,6 @@ static int intel_fbdev_pan_display(struct fb_var_screeninfo *var,
        ret = drm_fb_helper_pan_display(var, info);
 
        if (ret == 0) {
-               /*
-                * FIXME: fbdev presumes that all callbacks also work from
-                * atomic contexts and relies on that for emergency oops
-                * printing. KMS totally doesn't do that and the locking here is
-                * by far not the only place this goes wrong.  Ignore this for
-                * now until we solve this for real.
-                */
                mutex_lock(&fb_helper->dev->struct_mutex);
                intel_fb_obj_invalidate(ifbdev->fb->obj, ORIGIN_GTT);
                mutex_unlock(&fb_helper->dev->struct_mutex);
@@ -125,9 +104,9 @@ static struct fb_ops intelfb_ops = {
        .owner = THIS_MODULE,
        .fb_check_var = drm_fb_helper_check_var,
        .fb_set_par = intel_fbdev_set_par,
-       .fb_fillrect = cfb_fillrect,
-       .fb_copyarea = cfb_copyarea,
-       .fb_imageblit = cfb_imageblit,
+       .fb_fillrect = drm_fb_helper_cfb_fillrect,
+       .fb_copyarea = drm_fb_helper_cfb_copyarea,
+       .fb_imageblit = drm_fb_helper_cfb_imageblit,
        .fb_pan_display = intel_fbdev_pan_display,
        .fb_blank = intel_fbdev_blank,
        .fb_setcmap = drm_fb_helper_setcmap,
@@ -236,9 +215,9 @@ static int intelfb_create(struct drm_fb_helper *helper,
        obj = intel_fb->obj;
        size = obj->base.size;
 
-       info = framebuffer_alloc(0, &dev->pdev->dev);
-       if (!info) {
-               ret = -ENOMEM;
+       info = drm_fb_helper_alloc_fbi(helper);
+       if (IS_ERR(info)) {
+               ret = PTR_ERR(info);
                goto out_unpin;
        }
 
@@ -247,24 +226,13 @@ static int intelfb_create(struct drm_fb_helper *helper,
        fb = &ifbdev->fb->base;
 
        ifbdev->helper.fb = fb;
-       ifbdev->helper.fbdev = info;
 
        strcpy(info->fix.id, "inteldrmfb");
 
        info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
        info->fbops = &intelfb_ops;
 
-       ret = fb_alloc_cmap(&info->cmap, 256, 0);
-       if (ret) {
-               ret = -ENOMEM;
-               goto out_unpin;
-       }
        /* setup aperture base/size for vesafb takeover */
-       info->apertures = alloc_apertures(1);
-       if (!info->apertures) {
-               ret = -ENOMEM;
-               goto out_unpin;
-       }
        info->apertures->ranges[0].base = dev->mode_config.fb_base;
        info->apertures->ranges[0].size = dev_priv->gtt.mappable_end;
 
@@ -276,7 +244,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
                           size);
        if (!info->screen_base) {
                ret = -ENOSPC;
-               goto out_unpin;
+               goto out_destroy_fbi;
        }
        info->screen_size = size;
 
@@ -303,6 +271,8 @@ static int intelfb_create(struct drm_fb_helper *helper,
        vga_switcheroo_client_fb_set(dev->pdev, info);
        return 0;
 
+out_destroy_fbi:
+       drm_fb_helper_release_fbi(helper);
 out_unpin:
        i915_gem_object_ggtt_unpin(obj);
        drm_gem_object_unreference(&obj->base);
@@ -544,16 +514,9 @@ static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
 static void intel_fbdev_destroy(struct drm_device *dev,
                                struct intel_fbdev *ifbdev)
 {
-       if (ifbdev->helper.fbdev) {
-               struct fb_info *info = ifbdev->helper.fbdev;
 
-               unregister_framebuffer(info);
-               iounmap(info->screen_base);
-               if (info->cmap.len)
-                       fb_dealloc_cmap(&info->cmap);
-
-               framebuffer_release(info);
-       }
+       drm_fb_helper_unregister_fbi(&ifbdev->helper);
+       drm_fb_helper_release_fbi(&ifbdev->helper);
 
        drm_fb_helper_fini(&ifbdev->helper);
 
@@ -802,7 +765,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous
        if (state == FBINFO_STATE_RUNNING && ifbdev->fb->obj->stolen)
                memset_io(info->screen_base, 0, info->screen_size);
 
-       fb_set_suspend(info, state);
+       drm_fb_helper_set_suspend(&ifbdev->helper, state);
        console_unlock();
 }