summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2015-09-27 21:28:15 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2015-09-27 21:28:15 +0000
commit03ca7d0554a804d6a4d79dbfa5512d13fed04f1c (patch)
treefe75a793c6e0d1a7d7d38c607578f5b473d0575d /sys/dev/pci/drm
parent91863fde2996a83155c02a4be5c416c74d9ec781 (diff)
Enable monitor hot plugging for the framebuffer console.
Tested on the VGA port of a Radeon 7500 and Radeon 9250 (aka 9200 PRO). Hopefully this works on Intel Graphics as well.
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r--sys/dev/pci/drm/drm_fb_helper.c31
-rw-r--r--sys/dev/pci/drm/drm_linux.h14
-rw-r--r--sys/dev/pci/drm/i915/intel_fbdev.c8
-rw-r--r--sys/dev/pci/drm/radeon/radeon_fb.c9
4 files changed, 25 insertions, 37 deletions
diff --git a/sys/dev/pci/drm/drm_fb_helper.c b/sys/dev/pci/drm/drm_fb_helper.c
index c80740e25e1..2f743b7335a 100644
--- a/sys/dev/pci/drm/drm_fb_helper.c
+++ b/sys/dev/pci/drm/drm_fb_helper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_fb_helper.c,v 1.10 2015/09/23 23:12:11 kettenis Exp $ */
+/* $OpenBSD: drm_fb_helper.c,v 1.11 2015/09/27 21:28:14 kettenis Exp $ */
/*
* Copyright (c) 2006-2009 Red Hat Inc.
* Copyright (c) 2006-2008 Intel Corporation
@@ -308,6 +308,7 @@ bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)
}
EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode);
+#ifdef __linux__
/*
* restore fbcon display for all kms driver's using this helper, used for sysrq
* and panic handling.
@@ -333,7 +334,6 @@ static bool drm_fb_helper_force_kernel_mode(void)
return error;
}
-#if 0
static int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed,
void *panic_str)
{
@@ -379,21 +379,7 @@ static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
return true;
}
-/**
- * drm_fb_helper_restore - restore the framebuffer console (kernel) config
- *
- * Restore's the kernel's fbcon mode, used for lastclose & panic paths.
- */
-void drm_fb_helper_restore(void)
-{
- bool ret;
- ret = drm_fb_helper_force_kernel_mode();
- if (ret == true)
- DRM_ERROR("Failed to restore crtc configuration\n");
-}
-EXPORT_SYMBOL(drm_fb_helper_restore);
-
-#if 0
+#ifdef __linux__
#ifdef CONFIG_MAGIC_SYSRQ
static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
{
@@ -817,6 +803,7 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
return 0;
}
EXPORT_SYMBOL(drm_fb_helper_check_var);
+#endif
/**
* drm_fb_helper_set_par - implementation for ->fb_set_par
@@ -857,6 +844,7 @@ int drm_fb_helper_set_par(struct fb_info *info)
}
EXPORT_SYMBOL(drm_fb_helper_set_par);
+#ifdef __linux__
/**
* drm_fb_helper_pan_display - implementation for ->fb_pan_display
* @var: updated screen information
@@ -908,9 +896,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
int ret = 0;
int crtc_count = 0;
int i;
-#if 0
struct fb_info *info;
-#endif
struct drm_fb_helper_surface_size sizes;
int gamma_size = 0;
@@ -989,9 +975,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
if (ret < 0)
return ret;
-#if 0
info = fb_helper->fbdev;
-#endif
/*
* Set the fb pointer - usually drm_setup_crtcs does this for hotplug
@@ -1004,8 +988,9 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
if (fb_helper->crtc_info[i].mode_set.num_connectors)
fb_helper->crtc_info[i].mode_set.fb = fb_helper->fb;
-#if 0
+
info->var.pixclock = 0;
+#ifdef __linux__
if (register_framebuffer(info) < 0)
return -EINVAL;
@@ -1628,9 +1613,7 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
drm_modeset_lock_all(dev);
drm_setup_crtcs(fb_helper);
drm_modeset_unlock_all(dev);
-#if 0
drm_fb_helper_set_par(fb_helper->fbdev);
-#endif
return 0;
}
diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h
index debd16404c2..4021be08c75 100644
--- a/sys/dev/pci/drm/drm_linux.h
+++ b/sys/dev/pci/drm/drm_linux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.h,v 1.40 2015/09/27 11:09:26 jsg Exp $ */
+/* $OpenBSD: drm_linux.h,v 1.41 2015/09/27 21:28:14 kettenis Exp $ */
/*
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
*
@@ -1343,3 +1343,15 @@ __copy_from_user_inatomic_nocache(void *to, const void *from, unsigned len)
}
#endif
+
+struct fb_var_screeninfo {
+ int pixclock;
+};
+
+struct fb_info {
+ struct fb_var_screeninfo var;
+ void *par;
+};
+
+#define framebuffer_alloc(flags, device) \
+ kzalloc(sizeof(struct fb_info), GFP_KERNEL)
diff --git a/sys/dev/pci/drm/i915/intel_fbdev.c b/sys/dev/pci/drm/i915/intel_fbdev.c
index 98472873c57..537b82f75c1 100644
--- a/sys/dev/pci/drm/i915/intel_fbdev.c
+++ b/sys/dev/pci/drm/i915/intel_fbdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intel_fbdev.c,v 1.1 2015/09/23 23:12:12 kettenis Exp $ */
+/* $OpenBSD: intel_fbdev.c,v 1.2 2015/09/27 21:28:14 kettenis Exp $ */
/*
* Copyright © 2007 David Airlie
*
@@ -112,7 +112,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
struct intel_framebuffer *intel_fb = &ifbdev->ifb;
struct drm_device *dev = helper->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
-// struct fb_info *info;
+ struct fb_info *info;
struct drm_framebuffer *fb;
struct drm_i915_gem_object *obj;
int size, ret;
@@ -133,7 +133,6 @@ static int intelfb_create(struct drm_fb_helper *helper,
obj = intel_fb->obj;
size = obj->base.size;
-#ifdef __linux__
info = framebuffer_alloc(0, &dev->pdev->dev);
if (!info) {
ret = -ENOMEM;
@@ -141,14 +140,13 @@ static int intelfb_create(struct drm_fb_helper *helper,
}
info->par = helper;
-#endif
fb = &ifbdev->ifb.base;
ifbdev->helper.fb = fb;
-#ifdef __linux__
ifbdev->helper.fbdev = info;
+#ifdef __linux__
strcpy(info->fix.id, "inteldrmfb");
info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
diff --git a/sys/dev/pci/drm/radeon/radeon_fb.c b/sys/dev/pci/drm/radeon/radeon_fb.c
index d87e0658fdf..e318c825d94 100644
--- a/sys/dev/pci/drm/radeon/radeon_fb.c
+++ b/sys/dev/pci/drm/radeon/radeon_fb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_fb.c,v 1.8 2015/04/06 07:38:49 jsg Exp $ */
+/* $OpenBSD: radeon_fb.c,v 1.9 2015/09/27 21:28:14 kettenis Exp $ */
/*
* Copyright © 2007 David Airlie
*
@@ -190,11 +190,8 @@ static int radeonfb_create(struct radeon_fbdev *rfbdev,
struct drm_fb_helper_surface_size *sizes)
{
struct radeon_device *rdev = rfbdev->rdev;
-#if 0
struct fb_info *info;
-#else
struct rasops_info *ri = &rdev->ro;
-#endif
struct drm_framebuffer *fb = NULL;
struct drm_mode_fb_cmd2 mode_cmd;
struct drm_gem_object *gobj = NULL;
@@ -225,7 +222,6 @@ static int radeonfb_create(struct radeon_fbdev *rfbdev,
rbo = gem_to_radeon_bo(gobj);
-#ifdef notyet
/* okay we have an object now allocate the framebuffer */
info = framebuffer_alloc(0, device);
if (info == NULL) {
@@ -234,7 +230,6 @@ static int radeonfb_create(struct radeon_fbdev *rfbdev,
}
info->par = rfbdev;
-#endif
ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj);
if (ret) {
@@ -246,9 +241,9 @@ static int radeonfb_create(struct radeon_fbdev *rfbdev,
/* setup helper */
rfbdev->helper.fb = fb;
-#ifdef notyet
rfbdev->helper.fbdev = info;
+#ifdef notyet
memset_io(rbo->kptr, 0x0, radeon_bo_size(rbo));
strcpy(info->fix.id, "radeondrmfb");