diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2013-10-21 10:36:27 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2013-10-21 10:36:27 +0000 |
commit | 22a7a58bc34bd99e322e4e872add0cd82855128a (patch) | |
tree | 3571a1fe1f892c698c714629e9ccd90e1fc13156 /sys/arch/vax | |
parent | ceead45789cad670a4e79b8e53502af204c5f1ad (diff) |
Add load_font and list_font accessops to all rasops-based wsdisplay drivers.
Trivial except for tga(4) and gpx(4/vax) which need a bit more care setting
up a new font.
Diffstat (limited to 'sys/arch/vax')
-rw-r--r-- | sys/arch/vax/mbus/legss.c | 28 | ||||
-rw-r--r-- | sys/arch/vax/vsa/gpx.c | 64 | ||||
-rw-r--r-- | sys/arch/vax/vsa/lcg.c | 26 | ||||
-rw-r--r-- | sys/arch/vax/vsa/lcspx.c | 28 | ||||
-rw-r--r-- | sys/arch/vax/vsa/smg.c | 26 |
5 files changed, 165 insertions, 7 deletions
diff --git a/sys/arch/vax/mbus/legss.c b/sys/arch/vax/mbus/legss.c index 604fb73fd14..7fcb5adef35 100644 --- a/sys/arch/vax/mbus/legss.c +++ b/sys/arch/vax/mbus/legss.c @@ -1,4 +1,4 @@ -/* $OpenBSD: legss.c,v 1.5 2013/10/20 20:07:28 miod Exp $ */ +/* $OpenBSD: legss.c,v 1.6 2013/10/21 10:36:20 miod Exp $ */ /* * Copyright (c) 2008 Miodrag Vallat. @@ -147,13 +147,17 @@ int legss_alloc_screen(void *, const struct wsscreen_descr *, void legss_free_screen(void *, void *); int legss_show_screen(void *, void *, int, void (*) (void *, int, int), void *); +int legss_load_font(void *, void *, struct wsdisplay_font *); +int legss_list_font(void *, struct wsdisplay_font *); const struct wsdisplay_accessops legss_accessops = { .ioctl = legss_ioctl, .mmap = legss_mmap, .alloc_screen = legss_alloc_screen, .free_screen = legss_free_screen, - .show_screen = legss_show_screen + .show_screen = legss_show_screen, + .load_font = legss_load_font, + .list_font = legss_list_font }; int legss_setup_screen(struct legss_screen *); @@ -337,6 +341,26 @@ legss_show_screen(void *v, void *cookie, int waitok, } int +legss_load_font(void *v, void *emulcookie, struct wsdisplay_font *font) +{ + struct legss_softc *sc = v; + struct legss_screen *ss = sc->sc_scr; + struct rasops_info *ri = &ss->ss_ri; + + return rasops_load_font(ri, emulcookie, font); +} + +int +legss_list_font(void *v, struct wsdisplay_font *font) +{ + struct legss_softc *sc = v; + struct legss_screen *ss = sc->sc_scr; + struct rasops_info *ri = &ss->ss_ri; + + return rasops_list_font(ri, font); +} + +int legss_setup_screen(struct legss_screen *ss) { struct rasops_info *ri = &ss->ss_ri; diff --git a/sys/arch/vax/vsa/gpx.c b/sys/arch/vax/vsa/gpx.c index 20799080990..fca9d006ed4 100644 --- a/sys/arch/vax/vsa/gpx.c +++ b/sys/arch/vax/vsa/gpx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpx.c,v 1.22 2013/10/20 20:07:28 miod Exp $ */ +/* $OpenBSD: gpx.c,v 1.23 2013/10/21 10:36:20 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -193,6 +193,8 @@ int gpx_alloc_screen(void *, const struct wsscreen_descr *, void gpx_free_screen(void *, void *); int gpx_show_screen(void *, void *, int, void (*) (void *, int, int), void *); +int gpx_load_font(void *, void *, struct wsdisplay_font *); +int gpx_list_font(void *, struct wsdisplay_font *); void gpx_burner(void *, u_int, u_int); const struct wsdisplay_accessops gpx_accessops = { @@ -201,6 +203,8 @@ const struct wsdisplay_accessops gpx_accessops = { .alloc_screen = gpx_alloc_screen, .free_screen = gpx_free_screen, .show_screen = gpx_show_screen, + .load_font = gpx_load_font, + .list_font = gpx_list_font, .burn_screen = gpx_burner }; @@ -476,6 +480,64 @@ gpx_show_screen(void *v, void *cookie, int waitok, return (0); } +int +gpx_load_font(void *v, void *emulcookie, struct wsdisplay_font *font) +{ + struct gpx_softc *sc = v; + struct gpx_screen *ss = sc->sc_scr; + struct rasops_info *ri = &ss->ss_ri; + int wsfcookie; + struct wsdisplay_font *wsf; + const char *name; + + /* + * We can't use rasops_load_font() directly, as we need to make + * sure that, when switching fonts, the font bits are set up in + * the correct bit order, and uploaded off-screen. + */ + + if (font->data != NULL) + return rasops_load_font(ri, emulcookie, font); + + /* allow an empty font name to revert to the initial font choice */ + name = font->name; + if (*name == '\0') + name = NULL; + + wsfcookie = wsfont_find(name, ri->ri_font->fontwidth, + ri->ri_font->fontheight, 0); + if (wsfcookie < 0) { + wsfcookie = wsfont_find(name, 0, 0, 0); + if (wsfcookie < 0) + return ENOENT; + else + return EINVAL; + } + if (wsfont_lock(wsfcookie, &wsf, + WSDISPLAY_FONTORDER_R2L, WSDISPLAY_FONTORDER_L2R) <= 0) + return EINVAL; + + /* if (ri->ri_wsfcookie >= 0) */ + wsfont_unlock(ri->ri_wsfcookie); + ri->ri_wsfcookie = wsfcookie; + ri->ri_font = wsf; + ri->ri_fontscale = ri->ri_font->fontheight * ri->ri_font->stride; + + gpx_upload_font(ss); + + return 0; +} + +int +gpx_list_font(void *v, struct wsdisplay_font *font) +{ + struct gpx_softc *sc = v; + struct gpx_screen *ss = sc->sc_scr; + struct rasops_info *ri = &ss->ss_ri; + + return rasops_list_font(ri, font); +} + void gpx_burner(void *v, u_int on, u_int flags) { diff --git a/sys/arch/vax/vsa/lcg.c b/sys/arch/vax/vsa/lcg.c index 596eeb040a3..26d27a9fab8 100644 --- a/sys/arch/vax/vsa/lcg.c +++ b/sys/arch/vax/vsa/lcg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lcg.c,v 1.20 2013/10/20 20:07:28 miod Exp $ */ +/* $OpenBSD: lcg.c,v 1.21 2013/10/21 10:36:21 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -125,6 +125,8 @@ int lcg_alloc_screen(void *, const struct wsscreen_descr *, void lcg_free_screen(void *, void *); int lcg_show_screen(void *, void *, int, void (*) (void *, int, int), void *); +int lcg_load_font(void *, void *, struct wsdisplay_font *); +int lcg_list_font(void *, struct wsdisplay_font *); void lcg_burner(void *, u_int, u_int); const struct wsdisplay_accessops lcg_accessops = { @@ -133,6 +135,8 @@ const struct wsdisplay_accessops lcg_accessops = { .alloc_screen = lcg_alloc_screen, .free_screen = lcg_free_screen, .show_screen = lcg_show_screen, + .load_font = lcg_load_font, + .list_font = lcg_list_font, .burn_screen = lcg_burner }; @@ -527,6 +531,26 @@ lcg_show_screen(void *v, void *cookie, int waitok, return (0); } +int +lcg_load_font(void *v, void *emulcookie, struct wsdisplay_font *font) +{ + struct lcg_softc *sc = v; + struct lcg_screen *ss = sc->sc_scr; + struct rasops_info *ri = &ss->ss_ri; + + return rasops_load_font(ri, emulcookie, font); +} + +int +lcg_list_font(void *v, struct wsdisplay_font *font) +{ + struct lcg_softc *sc = v; + struct lcg_screen *ss = sc->sc_scr; + struct rasops_info *ri = &ss->ss_ri; + + return rasops_list_font(ri, font); +} + void lcg_burner(void *v, u_int on, u_int flags) { diff --git a/sys/arch/vax/vsa/lcspx.c b/sys/arch/vax/vsa/lcspx.c index 6a39517715b..90a1b43b72b 100644 --- a/sys/arch/vax/vsa/lcspx.c +++ b/sys/arch/vax/vsa/lcspx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lcspx.c,v 1.18 2013/10/20 20:07:28 miod Exp $ */ +/* $OpenBSD: lcspx.c,v 1.19 2013/10/21 10:36:21 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -140,13 +140,17 @@ int lcspx_alloc_screen(void *, const struct wsscreen_descr *, void lcspx_free_screen(void *, void *); int lcspx_show_screen(void *, void *, int, void (*) (void *, int, int), void *); +int lcspx_load_font(void *, void *, struct wsdisplay_font *); +int lcspx_list_font(void *, struct wsdisplay_font *); const struct wsdisplay_accessops lcspx_accessops = { .ioctl = lcspx_ioctl, .mmap = lcspx_mmap, .alloc_screen = lcspx_alloc_screen, .free_screen = lcspx_free_screen, - .show_screen = lcspx_show_screen + .show_screen = lcspx_show_screen, + .load_font = lcspx_load_font, + .list_font = lcspx_list_font }; int lcspx_getcmap(struct lcspx_screen *, struct wsdisplay_cmap *); @@ -515,6 +519,26 @@ lcspx_show_screen(void *v, void *cookie, int waitok, return (0); } +int +lcspx_load_font(void *v, void *emulcookie, struct wsdisplay_font *font) +{ + struct lcspx_softc *sc = v; + struct lcspx_screen *ss = sc->sc_scr; + struct rasops_info *ri = &ss->ss_ri; + + return rasops_load_font(ri, emulcookie, font); +} + +int +lcspx_list_font(void *v, struct wsdisplay_font *font) +{ + struct lcspx_softc *sc = v; + struct lcspx_screen *ss = sc->sc_scr; + struct rasops_info *ri = &ss->ss_ri; + + return rasops_list_font(ri, font); +} + /* * Colormap handling routines */ diff --git a/sys/arch/vax/vsa/smg.c b/sys/arch/vax/vsa/smg.c index 6083ee60720..8b24196b465 100644 --- a/sys/arch/vax/vsa/smg.c +++ b/sys/arch/vax/vsa/smg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smg.c,v 1.25 2013/10/20 20:07:28 miod Exp $ */ +/* $OpenBSD: smg.c,v 1.26 2013/10/21 10:36:21 miod Exp $ */ /* $NetBSD: smg.c,v 1.21 2000/03/23 06:46:44 thorpej Exp $ */ /* * Copyright (c) 2006, Miodrag Vallat @@ -179,6 +179,8 @@ int smg_alloc_screen(void *, const struct wsscreen_descr *, void smg_free_screen(void *, void *); int smg_show_screen(void *, void *, int, void (*) (void *, int, int), void *); +int smg_load_font(void *, void *, struct wsdisplay_font *); +int smg_list_font(void *, struct wsdisplay_font *); void smg_burner(void *, u_int, u_int); const struct wsdisplay_accessops smg_accessops = { @@ -187,6 +189,8 @@ const struct wsdisplay_accessops smg_accessops = { .alloc_screen = smg_alloc_screen, .free_screen = smg_free_screen, .show_screen = smg_show_screen, + .load_font = smg_load_font, + .list_font = smg_list_font, .burn_screen = smg_burner }; @@ -469,6 +473,26 @@ smg_show_screen(void *v, void *cookie, int waitok, return (0); } +int +smg_load_font(void *v, void *emulcookie, struct wsdisplay_font *font) +{ + struct smg_softc *sc = v; + struct smg_screen *ss = sc->sc_scr; + struct rasops_info *ri = &ss->ss_ri; + + return rasops_load_font(ri, emulcookie, font); +} + +int +smg_list_font(void *v, struct wsdisplay_font *font) +{ + struct smg_softc *sc = v; + struct smg_screen *ss = sc->sc_scr; + struct rasops_info *ri = &ss->ss_ri; + + return rasops_list_font(ri, font); +} + void smg_burner(void *v, u_int on, u_int flags) { |