diff options
author | Dave Airlie <airlied@redhat.com> | 2010-03-30 05:34:18 +0000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-04-07 10:30:38 +1000 |
commit | 4abe35204af82a018ca3ce6db4102aa09719698e (patch) | |
tree | fcc91e2e109fe311a673d5b99dc758aba3bb4a79 /drivers/gpu/drm/i915/intel_fb.c | |
parent | 5c4426a782bc9509573fc7958a786ebd14fafdf3 (diff) |
drm/kms/fb: use slow work mechanism for normal hotplug also.
a) slow work is always used now for any fbcon hotplug, as its not
a fast task and is more suited to being ran under slow work.
b) attempt to not do any fbdev changes when X is running as we'll
just mess it up. This hooks set_par to hopefully do the changes
once X hands control to fbdev.
This also adds the nouveau/intel hotplug support.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_fb.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_fb.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 8f7a7c476098..cc726ff0a02d 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c @@ -65,12 +65,6 @@ static struct fb_ops intelfb_ops = { .fb_setcmap = drm_fb_helper_setcmap, }; -static struct drm_fb_helper_funcs intel_fb_helper_funcs = { - .gamma_set = intel_crtc_fb_gamma_set, - .gamma_get = intel_crtc_fb_gamma_get, -}; - - static int intelfb_create(struct intel_fbdev *ifbdev, struct drm_fb_helper_surface_size *sizes) { @@ -129,7 +123,6 @@ static int intelfb_create(struct intel_fbdev *ifbdev, ifbdev->helper.fb = fb; ifbdev->helper.fbdev = info; - ifbdev->helper.funcs = &intel_fb_helper_funcs; strcpy(info->fix.id, "inteldrmfb"); @@ -154,6 +147,12 @@ static int intelfb_create(struct intel_fbdev *ifbdev, ret = -ENOSPC; goto out_unpin; } + + ret = fb_alloc_cmap(&info->cmap, 256, 0); + if (ret) { + ret = -ENOMEM; + goto out_unpin; + } info->screen_size = size; // memset(info->screen_base, 0, size); @@ -205,15 +204,18 @@ static int intel_fb_find_or_create_single(struct drm_fb_helper *helper, return new_fb; } -static int intelfb_probe(struct intel_fbdev *ifbdev) +void intelfb_hotplug(struct drm_device *dev, bool polled) { - int ret; - - DRM_DEBUG_KMS("\n"); - ret = drm_fb_helper_single_fb_probe(&ifbdev->helper, 32); - return ret; + drm_i915_private_t *dev_priv = dev->dev_private; + drm_helper_fb_hpd_irq_event(&dev_priv->fbdev->helper); } +static struct drm_fb_helper_funcs intel_fb_helper_funcs = { + .gamma_set = intel_crtc_fb_gamma_set, + .gamma_get = intel_crtc_fb_gamma_get, + .fb_probe = intel_fb_find_or_create_single, +}; + int intel_fbdev_destroy(struct drm_device *dev, struct intel_fbdev *ifbdev) { @@ -224,10 +226,12 @@ int intel_fbdev_destroy(struct drm_device *dev, 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_free(&ifbdev->helper); + drm_fb_helper_fini(&ifbdev->helper); drm_framebuffer_cleanup(&ifb->base); if (ifb->obj) @@ -246,13 +250,13 @@ int intel_fbdev_init(struct drm_device *dev) return -ENOMEM; dev_priv->fbdev = ifbdev; + ifbdev->helper.funcs = &intel_fb_helper_funcs; + + drm_fb_helper_init(dev, &ifbdev->helper, 2, + INTELFB_CONN_LIMIT, false); - drm_fb_helper_init_crtc_count(dev, &ifbdev->helper, 2, - INTELFB_CONN_LIMIT); drm_fb_helper_single_add_all_connectors(&ifbdev->helper); - ifbdev->helper.fb_probe = intel_fb_find_or_create_single; - drm_fb_helper_initial_config(&ifbdev->helper); - intelfb_probe(ifbdev); + drm_fb_helper_initial_config(&ifbdev->helper, 32); return 0; } |