Index: sys/dev/wscons/wsconsio.h =================================================================== RCS file: /cvsroot/src/sys/dev/wscons/wsconsio.h,v retrieving revision 1.127 diff -p -u -r1.127 wsconsio.h --- sys/dev/wscons/wsconsio.h 20 Jan 2024 00:23:12 -0000 1.127 +++ sys/dev/wscons/wsconsio.h 21 Apr 2024 10:07:41 -0000 @@ -367,6 +367,7 @@ struct wsmouse_parameters { #define WSDISPLAY_TYPE_PLFB 65 /* ARM PrimeCell PL11x */ #define WSDISPLAY_TYPE_SSDFB 66 /* ssdfb(4) */ #define WSDISPLAY_TYPE_HOLLYWOOD 67 /* Nintendo Wii "Hollywood" SoC */ +#define WSDISPLAY_TYPE_VC6 68 /* Broadcom VideoCore 6 */ /* Basic display information. Not applicable to all display types. */ struct wsdisplay_fbinfo { @@ -729,4 +730,20 @@ struct wsdisplayio_fontinfo { #define WSDISPLAYIO_LISTFONTS _IOWR('W', 107, struct wsdisplayio_fontinfo) +struct wsdisplay_getfont { + char *gf_name; + uint32_t gf_size; + uint32_t gf_actual; +}; + +/* + * return currently active font + * + * gf_name points to a buffer of gf_size bytes, the result may be truncated + * and NUL-terminated. + * gf_actual is set to the size of full name. + */ + +#define WSDISPLAYIO_GFONT _IOWR('W', 108, struct wsdisplay_getfont) + #endif /* _DEV_WSCONS_WSCONSIO_H_ */ Index: sys/dev/wscons/wsdisplay.c =================================================================== RCS file: /cvsroot/src/sys/dev/wscons/wsdisplay.c,v retrieving revision 1.166 diff -p -u -r1.166 wsdisplay.c --- sys/dev/wscons/wsdisplay.c 1 Mar 2023 08:42:33 -0000 1.166 +++ sys/dev/wscons/wsdisplay.c 21 Apr 2024 10:07:42 -0000 @@ -129,7 +129,7 @@ static void wsdisplay_addscreen_print(st static void wsdisplay_closescreen(struct wsdisplay_softc *, struct wsscreen *); static int wsdisplay_delscreen(struct wsdisplay_softc *, int, int); -#define WSDISPLAY_MAXSCREEN 8 +#define WSDISPLAY_MAXSCREEN 12 struct wsdisplay_softc { device_t sc_dev; @@ -182,13 +182,15 @@ static void wsdisplay_emul_attach(device static int wsdisplay_emul_detach(device_t, int); static int wsdisplay_noemul_match(device_t, cfdata_t, void *); static void wsdisplay_noemul_attach(device_t, device_t, void *); +static int wsdisplay_noemul_detach(device_t, int); static bool wsdisplay_suspend(device_t, const pmf_qual_t *); CFATTACH_DECL_NEW(wsdisplay_emul, sizeof (struct wsdisplay_softc), wsdisplay_emul_match, wsdisplay_emul_attach, wsdisplay_emul_detach, NULL); CFATTACH_DECL_NEW(wsdisplay_noemul, sizeof (struct wsdisplay_softc), - wsdisplay_noemul_match, wsdisplay_noemul_attach, NULL, NULL); + wsdisplay_noemul_match, wsdisplay_noemul_attach, wsdisplay_noemul_detach, + NULL); dev_type_open(wsdisplayopen); dev_type_close(wsdisplayclose); @@ -233,6 +235,7 @@ static void wsdisplay_common_attach(stru int console, int kbdmux, const struct wsscreen_list *, const struct wsdisplay_accessops *accessops, void *accesscookie); +static int wsdisplay_common_detach(struct wsdisplay_softc *sc, int how); #ifdef WSDISPLAY_COMPAT_RAWKBD int wsdisplay_update_rawkbd(struct wsdisplay_softc *, @@ -657,6 +660,14 @@ wsdisplay_emul_attach(device_t parent, d } } +int +wsdisplay_emul_detach(device_t dev, int how) +{ + struct wsdisplay_softc *sc = device_private(dev); + + return wsdisplay_common_detach(sc, how); +} + /* Print function (for parent devices). */ int wsemuldisplaydevprint(void *aux, const char *pnp) @@ -675,25 +686,6 @@ wsemuldisplaydevprint(void *aux, const c } int -wsdisplay_emul_detach(device_t dev, int how) -{ - struct wsdisplay_softc *sc = device_private(dev); - int flag, i, res; - - flag = (how & DETACH_FORCE ? WSDISPLAY_DELSCR_FORCE : 0); - for (i = 0; i < WSDISPLAY_MAXSCREEN; i++) - if (sc->sc_scr[i]) { - res = wsdisplay_delscreen(sc, i, flag); - if (res) - return res; - } - - cv_destroy(&sc->sc_flagscv); - mutex_destroy(&sc->sc_flagsmtx); - return 0; -} - -int wsdisplay_noemul_match(device_t parent, cfdata_t match, void *aux) { #if 0 /* -Wunused */ @@ -717,6 +709,14 @@ wsdisplay_noemul_attach(device_t parent, ap->accessops, ap->accesscookie); } +int +wsdisplay_noemul_detach(device_t dev, int how) +{ + struct wsdisplay_softc *sc = device_private(dev); + + return wsdisplay_common_detach(sc, how); +} + static void wsdisplay_swdone_cb(void *arg, int error, int waitok) { @@ -917,6 +917,27 @@ wsdisplay_common_attach(struct wsdisplay "couldn't establish power handler\n"); } +static int +wsdisplay_common_detach(struct wsdisplay_softc *sc, int how) +{ + int flag, i, res; + + pmf_device_deregister(sc->sc_dev); + + flag = (how & DETACH_FORCE ? WSDISPLAY_DELSCR_FORCE : 0); + for (i = 0; i < WSDISPLAY_MAXSCREEN; i++) + if (sc->sc_scr[i]) { + res = wsdisplay_delscreen(sc, i, flag); + if (res) + return res; + } + + cv_destroy(&sc->sc_flagscv); + mutex_destroy(&sc->sc_flagsmtx); + + return 0; +} + void wsdisplay_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol, int crow, long defattr) @@ -1440,6 +1461,12 @@ wsdisplay_internal_ioctl(struct wsdispla return error; #undef d + case WSDISPLAYIO_GFONT: + error = (*sc->sc_accessops->ioctl)(sc->sc_accesscookie, + scr->scr_dconf->emulcookie, cmd, data, flag, l); + + return error; + #ifdef WSDISPLAY_CUSTOM_OUTPUT case WSDISPLAYIO_GMSGATTRS: #define d ((struct wsdisplay_msgattrs *)data) Index: sys/dev/wscons/wsdisplay_vcons.c =================================================================== RCS file: /cvsroot/src/sys/dev/wscons/wsdisplay_vcons.c,v retrieving revision 1.68 diff -p -u -r1.68 wsdisplay_vcons.c --- sys/dev/wscons/wsdisplay_vcons.c 9 Feb 2024 22:08:37 -0000 1.68 +++ sys/dev/wscons/wsdisplay_vcons.c 21 Apr 2024 10:07:42 -0000 @@ -215,7 +215,7 @@ vcons_init_common(struct vcons_data *vd, vdp->wanted = NULL; vdp->currenttype = def; vdp->defaulttype = def; - callout_init(&vdp->switch_callout, 0); + callout_init(&vdp->switch_callout, CALLOUT_MPSAFE); callout_setfunc(&vdp->switch_callout, vcons_do_switch, vd); #ifdef VCONS_DRAW_INTR vdp->cells = 0; @@ -234,7 +234,8 @@ vcons_init_common(struct vcons_data *vd, #endif #ifdef VCONS_DRAW_INTR if (enable_intr) { - vdp->intr_softint = softint_establish(SOFTINT_SERIAL, + vdp->intr_softint = softint_establish( + SOFTINT_SERIAL | SOFTINT_MPSAFE, vcons_softintr, vd); callout_init(&vdp->intr, CALLOUT_MPSAFE); callout_setfunc(&vdp->intr, vcons_intr, vd); @@ -753,8 +754,8 @@ void vcons_update_screen(struct vcons_screen *scr) { #ifdef VCONS_DRAW_INTR - uint32_t *charptr = scr->scr_chars; - long *attrptr = scr->scr_attrs; + uint32_t *charptr = scr->scr_chars, c; + long *attrptr = scr->scr_attrs, a; struct rasops_info *ri = &scr->scr_ri; struct vcons_data *vd = scr->scr_vd; struct vcons_data_private *vdp = vd->private; @@ -786,12 +787,14 @@ vcons_update_screen(struct vcons_screen * and we already made sure the screen we're * working on is visible */ - if ((vdp->chars[boffset] != charptr[offset]) || - (vdp->attrs[boffset] != attrptr[offset])) { - scr->putchar(ri, i, j, - charptr[offset], attrptr[offset]); - vdp->chars[boffset] = charptr[offset]; - vdp->attrs[boffset] = attrptr[offset]; + c = charptr[offset]; + a = attrptr[offset]; + + if ((vdp->chars[boffset] != c) || + (vdp->attrs[boffset] != a)) { + scr->putchar(ri, i, j, c, a); + vdp->chars[boffset] = c; + vdp->attrs[boffset] = a; } offset++; boffset++; @@ -841,6 +844,20 @@ vcons_ioctl(void *v, void *vs, u_long cm } break; + case WSDISPLAYIO_GFONT: { + struct wsdisplay_getfont *gf = data; + size_t actual; + struct wsdisplay_font *font; + const char *fontname; + + font = ((struct vcons_screen *)vs)->scr_ri.ri_font; + fontname = font && font->name ? font->name : ""; + error = copyoutstr(fontname, gf->gf_name, gf->gf_size, &actual); + if (!error) + gf->gf_actual = actual; + } + break; + default: if (vdp->ioctl != NULL) error = (*vdp->ioctl)(v, vs, cmd, data, flag, l); Index: sys/dev/wscons/wsksymdef.h =================================================================== RCS file: /cvsroot/src/sys/dev/wscons/wsksymdef.h,v retrieving revision 1.78 diff -p -u -r1.78 wsksymdef.h --- sys/dev/wscons/wsksymdef.h 11 Dec 2023 13:38:13 -0000 1.78 +++ sys/dev/wscons/wsksymdef.h 21 Apr 2024 10:07:42 -0000 @@ -564,6 +564,8 @@ #define KS_Cmd_Screen7 0xf407 #define KS_Cmd_Screen8 0xf408 #define KS_Cmd_Screen9 0xf409 +#define KS_Cmd_Screen10 0xf40a +#define KS_Cmd_Screen11 0xf40b #define KS_Cmd_Debugger 0xf420 #define KS_Cmd_ResetEmul 0xf421 #define KS_Cmd_ResetClose 0xf422