Module Name: src
Committed By: chs
Date: Wed Nov 12 16:07:17 UTC 2014
Modified Files:
src/sys/external/bsd/drm2/radeon: radeondrmkmsfb.c
Log Message:
apply several changes from intelfb.c revs 1.7 through 1.9:
- provide a setmode callback for genfb
- add a pmf shutdown handler to switch genfb into polling mode
- no need to call drm_fb_helper_set_config after genfb attaches,
as the setmode callback is called by genfb_attach
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c
diff -u src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c:1.3 src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c:1.4
--- src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c:1.3 Sat Jul 26 07:02:13 2014
+++ src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c Wed Nov 12 16:07:17 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: radeondrmkmsfb.c,v 1.3 2014/07/26 07:02:13 riastradh Exp $ */
+/* $NetBSD: radeondrmkmsfb.c,v 1.4 2014/11/12 16:07:17 chs Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeondrmkmsfb.c,v 1.3 2014/07/26 07:02:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeondrmkmsfb.c,v 1.4 2014/11/12 16:07:17 chs Exp $");
#ifdef _KERNEL_OPT
#include "vga.h"
@@ -88,6 +88,12 @@ static int radeonfb_genfb_ioctl(void *,
static paddr_t radeonfb_genfb_mmap(void *, void *, off_t, int);
static int radeonfb_genfb_enable_polling(void *);
static int radeonfb_genfb_disable_polling(void *);
+static bool radeonfb_genfb_shutdown(device_t, int);
+static bool radeonfb_genfb_setmode(struct genfb_softc *, int);
+
+static const struct genfb_mode_callback radeonfb_genfb_mode_callback = {
+ .gmc_setmode = radeonfb_genfb_setmode,
+};
CFATTACH_DECL_NEW(radeondrmkmsfb, sizeof(struct radeonfb_softc),
radeonfb_match, radeonfb_attach, radeonfb_detach, NULL);
@@ -172,6 +178,9 @@ radeonfb_setconfig_task(struct radeon_ta
prop_dictionary_set_uint64(dict, "virtual_address",
(uint64_t)(uintptr_t)rfa->rfa_fb_ptr);
+ prop_dictionary_set_uint64(dict, "mode_callback",
+ (uint64_t)(uintptr_t)&radeonfb_genfb_mode_callback);
+
/* XXX Whattakludge! */
#if NVGA > 0
if (vga_is_console(rfa->rfa_fb_helper->dev->pdev->pd_pa.pa_iot, -1)) {
@@ -203,7 +212,8 @@ radeonfb_setconfig_task(struct radeon_ta
}
sc->sc_attached = true;
- drm_fb_helper_set_config(sc->sc_rfa.rfa_fb_helper);
+ pmf_device_register1(sc->sc_dev, NULL, NULL,
+ radeonfb_genfb_shutdown);
/* Success! */
sc->sc_scheduled = false;
@@ -344,3 +354,22 @@ radeonfb_genfb_disable_polling(void *coo
return drm_fb_helper_debug_leave_fb(sc->sc_rfa.rfa_fb_helper);
}
+
+static bool
+radeonfb_genfb_shutdown(device_t self, int flags)
+{
+ genfb_enable_polling(self);
+ return true;
+}
+
+static bool
+radeonfb_genfb_setmode(struct genfb_softc *genfb, int mode)
+{
+ struct radeonfb_softc *sc = (struct radeonfb_softc *)genfb;
+
+ if (mode == WSDISPLAYIO_MODE_EMUL) {
+ drm_fb_helper_set_config(sc->sc_rfa.rfa_fb_helper);
+ }
+
+ return true;
+}