Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Hook up radeondrmkmsfb code.
details: https://anonhg.NetBSD.org/src/rev/49ec61ac7c79
branches: trunk
changeset: 330930:49ec61ac7c79
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Jul 25 12:35:03 2014 +0000
description:
Hook up radeondrmkmsfb code.
Builds, not testable yet.
diffstat:
sys/arch/amd64/conf/DRMKMS | 10 +-
sys/arch/i386/conf/DRMKMS | 6 +
sys/external/bsd/drm2/radeon/files.radeon | 12 +-
sys/external/bsd/drm2/radeon/radeon_pci.c | 292 ++++-----------------
sys/external/bsd/drm2/radeon/radeon_task.h | 55 ++++
sys/external/bsd/drm2/radeon/radeondrmkmsfb.c | 347 ++++++++++++++++++++++++++
sys/external/bsd/drm2/radeon/radeondrmkmsfb.h | 44 +++
7 files changed, 531 insertions(+), 235 deletions(-)
diffs (truncated from 899 to 300 lines):
diff -r cc7225bcdbf8 -r 49ec61ac7c79 sys/arch/amd64/conf/DRMKMS
--- a/sys/arch/amd64/conf/DRMKMS Fri Jul 25 12:18:13 2014 +0000
+++ b/sys/arch/amd64/conf/DRMKMS Fri Jul 25 12:35:03 2014 +0000
@@ -2,11 +2,19 @@
i915drmkms* at pci? dev ? function ?
intelfb* at intelfbbus?
+
+radeondrmkms* at pci? dev ? function ?
+radeondrmkmsfb* at radeonfbbus?
+
#nouveau* at pci? dev ? function ?
-#radeondrmkms* at pci? dev ? function ?
+#nouveaufb* at nouveaufbbus
no options DIAGNOSTIC
options DIAGNOSTIC # expensive kernel consistency check
options DEBUG # expensive debugging checks/support
options LOCKDEBUG # debug locks
makeoptions DEBUG="-g" # compile full symbol table
+
+#options ACPIVERBOSE # verbose ACPI device autoconfig messages
+options PCIVERBOSE # verbose PCI device autoconfig messages
+options USBVERBOSE # verbose USB device autoconfig messages
diff -r cc7225bcdbf8 -r 49ec61ac7c79 sys/arch/i386/conf/DRMKMS
--- a/sys/arch/i386/conf/DRMKMS Fri Jul 25 12:18:13 2014 +0000
+++ b/sys/arch/i386/conf/DRMKMS Fri Jul 25 12:35:03 2014 +0000
@@ -3,6 +3,12 @@
i915drmkms* at pci? dev ? function ?
intelfb* at intelfbbus?
+radeondrmkms* at pci? dev ? function ?
+radeondrmkmsfb* at radeonfbbus?
+
+#nouveau* at pci? dev ? function ?
+#nouveaufb* at nouveaufbbus
+
no options DIAGNOSTIC
options DIAGNOSTIC # expensive kernel consistency check
options DEBUG # expensive debugging checks/support
diff -r cc7225bcdbf8 -r 49ec61ac7c79 sys/external/bsd/drm2/radeon/files.radeon
--- a/sys/external/bsd/drm2/radeon/files.radeon Fri Jul 25 12:18:13 2014 +0000
+++ b/sys/external/bsd/drm2/radeon/files.radeon Fri Jul 25 12:35:03 2014 +0000
@@ -1,10 +1,16 @@
-# $NetBSD: files.radeon,v 1.2 2014/07/17 14:05:12 riastradh Exp $
+# $NetBSD: files.radeon,v 1.3 2014/07/25 12:35:03 riastradh Exp $
-device radeondrmkms: drmkms, drmkms_pci, drmkms_ttm, genfb, wsemuldisplaydev
+define radeonfbbus { }
+device radeondrmkms: drmkms, drmkms_pci, drmkms_ttm, radeonfbbus
attach radeondrmkms at pci
+# XXX Rename this to radeonfb when the legacy radeonfb(4) is gone.
+device radeondrmkmsfb: radeonfbbus, genfb, wsemuldisplaydev
+attach radeondrmkmsfb at radeonfbbus
+
makeoptions radeondrmkms CPPFLAGS+="-I$S/external/bsd/drm2/dist/drm/radeon"
makeoptions radeondrmkms CPPFLAGS+="-I$S/external/bsd/drm2/include/radeon"
+makeoptions radeondrmkms CPPFLAGS+="-I$S/external/bsd/drm2/radeon"
makeoptions radeondrmkms "CWARNFLAGS.atombios_encoders.c"+="-Wno-missing-prototypes"
makeoptions radeondrmkms "CWARNFLAGS.atombios_i2c.c"+="-Wno-missing-prototypes"
@@ -154,3 +160,5 @@
file external/bsd/drm2/radeon/radeon_module.c radeondrmkms
file external/bsd/drm2/radeon/radeon_pci.c radeondrmkms
+
+file external/bsd/drm2/radeon/radeondrmkmsfb.c radeondrmkmsfb
diff -r cc7225bcdbf8 -r 49ec61ac7c79 sys/external/bsd/drm2/radeon/radeon_pci.c
--- a/sys/external/bsd/drm2/radeon/radeon_pci.c Fri Jul 25 12:18:13 2014 +0000
+++ b/sys/external/bsd/drm2/radeon/radeon_pci.c Fri Jul 25 12:35:03 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: radeon_pci.c,v 1.1 2014/07/16 20:59:58 riastradh Exp $ */
+/* $NetBSD: radeon_pci.c,v 1.2 2014/07/25 12:35:03 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.1 2014/07/16 20:59:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.2 2014/07/25 12:35:03 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "vga.h"
@@ -65,25 +65,31 @@
#include <radeon.h>
#include "radeon_drv.h"
+#include "radeon_task.h"
-struct radeon_genfb_work;
-SIMPLEQ_HEAD(radeon_genfb_work_head, radeon_genfb_work);
+SIMPLEQ_HEAD(radeon_task_head, radeon_task);
struct radeon_softc {
device_t sc_dev;
- struct workqueue *sc_genfb_wq;
- struct radeon_genfb_work_head sc_genfb_work;
+ enum {
+ RADEON_TASK_ATTACH,
+ RADEON_TASK_WORKQUEUE,
+ } sc_task_state;
+ union {
+ struct workqueue *workqueue;
+ struct radeon_task_head attach;
+ } sc_task_u;
struct drm_device *sc_drm_dev;
struct pci_dev sc_pci_dev;
};
-struct radeon_genfb_work {
- struct drm_fb_helper *rgw_fb_helper;
- union {
- SIMPLEQ_ENTRY(radeon_genfb_work) queue;
- struct work work;
- } rgw_u;
-};
+struct radeon_device *
+radeon_device_private(device_t self)
+{
+ struct radeon_softc *const sc = device_private(self);
+
+ return sc->sc_drm_dev->dev_private;
+}
static bool radeon_pci_lookup(const struct pci_attach_args *,
unsigned long *);
@@ -92,12 +98,7 @@
static void radeon_attach(device_t, device_t, void *);
static int radeon_detach(device_t, int);
-static void radeon_genfb_defer_set_config(struct drm_fb_helper *);
-static void radeon_genfb_set_config_work(struct work *, void *);
-static void radeon_genfb_set_config(struct radeon_genfb_work *);
-static int radeon_genfb_ioctl(void *, void *, unsigned long, void *,
- int, struct lwp *);
-static paddr_t radeon_genfb_mmap(void *, void *, off_t, int);
+static void radeon_task_work(struct work *, void *);
CFATTACH_DECL_NEW(radeondrmkms, sizeof(struct radeon_softc),
radeon_match, radeon_attach, radeon_detach, NULL);
@@ -162,7 +163,8 @@
pci_aprint_devinfo(pa, NULL);
- SIMPLEQ_INIT(&sc->sc_genfb_work);
+ sc->sc_task_state = RADEON_TASK_ATTACH;
+ SIMPLEQ_INIT(&sc->sc_task_u.attach);
/* XXX errno Linux->NetBSD */
error = -drm_pci_attach(self, pa, &sc->sc_pci_dev, radeon_drm_driver,
@@ -172,20 +174,21 @@
return;
}
- while (!SIMPLEQ_EMPTY(&sc->sc_genfb_work)) {
- struct radeon_genfb_work *const work =
- SIMPLEQ_FIRST(&sc->sc_genfb_work);
+ while (!SIMPLEQ_EMPTY(&sc->sc_task_u.attach)) {
+ struct radeon_task *const task =
+ SIMPLEQ_FIRST(&sc->sc_task_u.attach);
- SIMPLEQ_REMOVE_HEAD(&sc->sc_genfb_work, rgw_u.queue);
- radeon_genfb_set_config(work);
+ SIMPLEQ_REMOVE_HEAD(&sc->sc_task_u.attach, rt_u.queue);
+ (*task->rt_fn)(task);
}
- error = workqueue_create(&sc->sc_genfb_wq, "radeonfb",
- &radeon_genfb_set_config_work, NULL, PRI_NONE, IPL_NONE,
- WQ_MPSAFE);
+ sc->sc_task_state = RADEON_TASK_WORKQUEUE;
+ error = workqueue_create(&sc->sc_task_u.workqueue, "radeonfb",
+ &radeon_task_work, NULL, PRI_NONE, IPL_NONE, WQ_MPSAFE);
if (error) {
aprint_error_dev(self, "unable to create workqueue: %d\n",
error);
+ sc->sc_task_u.workqueue = NULL;
return;
}
}
@@ -201,228 +204,53 @@
if (error)
return error;
- if (sc->sc_genfb_wq == NULL)
+ if (sc->sc_task_state == RADEON_TASK_ATTACH)
return 0;
- workqueue_destroy(sc->sc_genfb_wq);
+ if (sc->sc_task_u.workqueue != NULL) {
+ workqueue_destroy(sc->sc_task_u.workqueue);
+ sc->sc_task_u.workqueue = NULL;
+ }
if (sc->sc_drm_dev == NULL)
return 0;
/* XXX errno Linux->NetBSD */
error = -drm_pci_detach(sc->sc_drm_dev, flags);
if (error)
+ /* XXX Kinda too late to fail now... */
return error;
-
- return 0;
-}
-
-int
-radeon_genfb_attach(struct drm_device *dev, struct drm_fb_helper *helper,
- const struct drm_fb_helper_surface_size *sizes, struct radeon_bo *rbo)
-{
- struct radeon_softc *const sc = container_of(dev->pdev,
- struct radeon_softc, sc_pci_dev);
- static const struct genfb_ops zero_genfb_ops;
- struct genfb_ops genfb_ops = zero_genfb_ops;
- const prop_dictionary_t dict = device_properties(sc->sc_dev);
- enum { CONS_VGA, CONS_GENFB, CONS_NONE } what_was_cons;
- int ret;
-
-#if NVGA > 0
- if (vga_is_console(dev->pdev->pd_pa.pa_iot, -1) ||
- vga_is_console(dev->pdev->pd_pa.pa_iot, -1)) {
- what_was_cons = CONS_VGA;
- prop_dictionary_set_bool(dict, "is_console", true);
- /*
- * There is a window from here until genfb attaches in
- * which kernel messages will go into a black hole,
- * until genfb replays the console. Whattakludge.
- *
- * wsdisplay_cndetach must come first, to clear cn_tab,
- * so that nothing will use it; then vga_cndetach
- * unmaps the bus space that it would have used.
- */
- wsdisplay_cndetach();
- vga_cndetach();
- } else
-#endif
- if (genfb_is_console() && genfb_is_enabled()) {
- what_was_cons = CONS_GENFB;
- prop_dictionary_set_bool(dict, "is_console", true);
- } else {
- what_was_cons = CONS_NONE;
- prop_dictionary_set_bool(dict, "is_console", false);
- }
-
- /* XXX Ugh... Pass these parameters some other way! */
- prop_dictionary_set_uint32(dict, "width", sizes->fb_width);
- prop_dictionary_set_uint32(dict, "height", sizes->fb_height);
- prop_dictionary_set_uint8(dict, "depth", sizes->surface_bpp);
- prop_dictionary_set_uint16(dict, "linebytes",
- roundup2((sizes->fb_width * howmany(sizes->surface_bpp, 8)), 64));
- prop_dictionary_set_uint32(dict, "address", 0); /* XXX >32-bit */
- CTASSERT(sizeof(uintptr_t) <= sizeof(uint64_t));
- prop_dictionary_set_uint64(dict, "virtual_address",
- (uint64_t)(uintptr_t)rbo->kptr);
-
- helper->genfb.sc_dev = sc->sc_dev;
- genfb_init(&helper->genfb);
- genfb_ops.genfb_ioctl = radeon_genfb_ioctl;
- genfb_ops.genfb_mmap = radeon_genfb_mmap;
-
- /* XXX errno NetBSD->Linux */
- ret = -genfb_attach(&helper->genfb, &genfb_ops);
- if (ret) {
- DRM_ERROR("failed to attach genfb: %d\n", ret);
- switch (what_was_cons) { /* XXX Restore console... */
- case CONS_VGA: break;
- case CONS_GENFB: break;
- case CONS_NONE: break;
- default: break;
- }
- return ret;
- }
-
- radeon_genfb_defer_set_config(helper);
+ sc->sc_drm_dev = NULL;
return 0;
}
static void
-radeon_genfb_defer_set_config(struct drm_fb_helper *helper)
+radeon_task_work(struct work *work, void *cookie __unused)
{
- struct drm_device *const dev = helper->dev;
- struct radeon_softc *const sc = container_of(dev->pdev,
- struct radeon_softc, sc_pci_dev);
- struct radeon_genfb_work *work;
-
- /* Really shouldn't sleep here... */
- work = kmem_alloc(sizeof(*work), KM_SLEEP);
- work->rgw_fb_helper = helper;
-
- if (sc->sc_genfb_wq == NULL) /* during attachment */
- SIMPLEQ_INSERT_TAIL(&sc->sc_genfb_work, work, rgw_u.queue);
- else
- workqueue_enqueue(sc->sc_genfb_wq, &work->rgw_u.work, NULL);
-}
-
-static void
Home |
Main Index |
Thread Index |
Old Index