summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-03-30 05:34:18 +0000
committerDave Airlie <airlied@redhat.com>2010-04-07 10:30:38 +1000
commit4abe35204af82a018ca3ce6db4102aa09719698e (patch)
treefcc91e2e109fe311a673d5b99dc758aba3bb4a79 /drivers/gpu/drm/i915
parent5c4426a782bc9509573fc7958a786ebd14fafdf3 (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')
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c1
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h2
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c42
3 files changed, 26 insertions, 19 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 5388354da0d..fdf08f22290 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -266,6 +266,7 @@ static void i915_hotplug_work_func(struct work_struct *work)
}
}
/* Just fire off a uevent and let userspace tell us what to do */
+ intelfb_hotplug(dev, false);
drm_sysfs_hotplug_event(dev);
}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 9ffb9f2c9ab..11fce595882 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -228,4 +228,6 @@ extern int intel_overlay_put_image(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int intel_overlay_attrs(struct drm_device *dev, void *data,
struct drm_file *file_priv);
+
+void intelfb_hotplug(struct drm_device *dev, bool polled);
#endif /* __INTEL_DRV_H__ */
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 8f7a7c47609..cc726ff0a02 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;
}