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/vsa | |
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/vsa')
-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 |
4 files changed, 139 insertions, 5 deletions
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) { |