aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_fbdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_fbdev.c')
-rw-r--r--drivers/gpu/drm/i915/intel_fbdev.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 088fe9378a4c..f475414671d8 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -43,10 +43,36 @@
43#include <drm/i915_drm.h> 43#include <drm/i915_drm.h>
44#include "i915_drv.h" 44#include "i915_drv.h"
45 45
46static int intel_fbdev_set_par(struct fb_info *info)
47{
48 struct drm_fb_helper *fb_helper = info->par;
49 struct intel_fbdev *ifbdev =
50 container_of(fb_helper, struct intel_fbdev, helper);
51 int ret;
52
53 ret = drm_fb_helper_set_par(info);
54
55 if (ret == 0) {
56 /*
57 * FIXME: fbdev presumes that all callbacks also work from
58 * atomic contexts and relies on that for emergency oops
59 * printing. KMS totally doesn't do that and the locking here is
60 * by far not the only place this goes wrong. Ignore this for
61 * now until we solve this for real.
62 */
63 mutex_lock(&fb_helper->dev->struct_mutex);
64 ret = i915_gem_object_set_to_gtt_domain(ifbdev->fb->obj,
65 true);
66 mutex_unlock(&fb_helper->dev->struct_mutex);
67 }
68
69 return ret;
70}
71
46static struct fb_ops intelfb_ops = { 72static struct fb_ops intelfb_ops = {
47 .owner = THIS_MODULE, 73 .owner = THIS_MODULE,
48 .fb_check_var = drm_fb_helper_check_var, 74 .fb_check_var = drm_fb_helper_check_var,
49 .fb_set_par = drm_fb_helper_set_par, 75 .fb_set_par = intel_fbdev_set_par,
50 .fb_fillrect = cfb_fillrect, 76 .fb_fillrect = cfb_fillrect,
51 .fb_copyarea = cfb_copyarea, 77 .fb_copyarea = cfb_copyarea,
52 .fb_imageblit = cfb_imageblit, 78 .fb_imageblit = cfb_imageblit,
@@ -81,7 +107,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
81 sizes->surface_depth); 107 sizes->surface_depth);
82 108
83 size = mode_cmd.pitches[0] * mode_cmd.height; 109 size = mode_cmd.pitches[0] * mode_cmd.height;
84 size = ALIGN(size, PAGE_SIZE); 110 size = PAGE_ALIGN(size);
85 obj = i915_gem_object_create_stolen(dev, size); 111 obj = i915_gem_object_create_stolen(dev, size);
86 if (obj == NULL) 112 if (obj == NULL)
87 obj = i915_gem_alloc_object(dev, size); 113 obj = i915_gem_alloc_object(dev, size);
@@ -417,7 +443,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
417 } 443 }
418 crtcs[i] = new_crtc; 444 crtcs[i] = new_crtc;
419 445
420 DRM_DEBUG_KMS("connector %s on pipe %d [CRTC:%d]: %dx%d%s\n", 446 DRM_DEBUG_KMS("connector %s on pipe %c [CRTC:%d]: %dx%d%s\n",
421 connector->name, 447 connector->name,
422 pipe_name(to_intel_crtc(encoder->crtc)->pipe), 448 pipe_name(to_intel_crtc(encoder->crtc)->pipe),
423 encoder->crtc->base.id, 449 encoder->crtc->base.id,
@@ -452,7 +478,7 @@ out:
452 return true; 478 return true;
453} 479}
454 480
455static struct drm_fb_helper_funcs intel_fb_helper_funcs = { 481static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
456 .initial_config = intel_fb_initial_config, 482 .initial_config = intel_fb_initial_config,
457 .gamma_set = intel_crtc_fb_gamma_set, 483 .gamma_set = intel_crtc_fb_gamma_set,
458 .gamma_get = intel_crtc_fb_gamma_get, 484 .gamma_get = intel_crtc_fb_gamma_get,
@@ -623,7 +649,8 @@ int intel_fbdev_init(struct drm_device *dev)
623 if (ifbdev == NULL) 649 if (ifbdev == NULL)
624 return -ENOMEM; 650 return -ENOMEM;
625 651
626 ifbdev->helper.funcs = &intel_fb_helper_funcs; 652 drm_fb_helper_prepare(dev, &ifbdev->helper, &intel_fb_helper_funcs);
653
627 if (!intel_fbdev_init_bios(dev, ifbdev)) 654 if (!intel_fbdev_init_bios(dev, ifbdev))
628 ifbdev->preferred_bpp = 32; 655 ifbdev->preferred_bpp = 32;
629 656