summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-10-21 10:36:27 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-10-21 10:36:27 +0000
commit22a7a58bc34bd99e322e4e872add0cd82855128a (patch)
tree3571a1fe1f892c698c714629e9ccd90e1fc13156 /sys/dev
parentceead45789cad670a4e79b8e53502af204c5f1ad (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/dev')
-rw-r--r--sys/dev/pci/drm/i915/i915_drv.c24
-rw-r--r--sys/dev/pci/drm/radeon/radeon_kms.c24
-rw-r--r--sys/dev/pci/tga.c74
-rw-r--r--sys/dev/pcmcia/cfxga.c30
-rw-r--r--sys/dev/usb/udl.c24
5 files changed, 166 insertions, 10 deletions
diff --git a/sys/dev/pci/drm/i915/i915_drv.c b/sys/dev/pci/drm/i915/i915_drv.c
index 6e14a849aff..b3f668be446 100644
--- a/sys/dev/pci/drm/i915/i915_drv.c
+++ b/sys/dev/pci/drm/i915/i915_drv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i915_drv.c,v 1.41 2013/10/20 20:07:29 miod Exp $ */
+/* $OpenBSD: i915_drv.c,v 1.42 2013/10/21 10:36:24 miod Exp $ */
/*
* Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -586,6 +586,8 @@ void inteldrm_free_screen(void *, void *);
int inteldrm_show_screen(void *, void *, int,
void (*)(void *, int, int), void *);
void inteldrm_doswitch(void *, void *);
+int inteldrm_load_font(void *, void *, struct wsdisplay_font *);
+int inteldrm_list_font(void *, struct wsdisplay_font *);
int inteldrm_getchar(void *, int, int, struct wsdisplay_charcell *);
void inteldrm_burner(void *, u_int, u_int);
@@ -613,6 +615,8 @@ struct wsdisplay_accessops inteldrm_accessops = {
.free_screen = inteldrm_free_screen,
.show_screen = inteldrm_show_screen,
.getchar = inteldrm_getchar,
+ .load_font = inteldrm_load_font,
+ .list_font = inteldrm_list_font,
.burn_screen = inteldrm_burner
};
@@ -729,6 +733,24 @@ inteldrm_getchar(void *v, int row, int col, struct wsdisplay_charcell *cell)
return rasops_getchar(ri, row, col, cell);
}
+int
+inteldrm_load_font(void *v, void *cookie, struct wsdisplay_font *font)
+{
+ struct inteldrm_softc *dev_priv = v;
+ struct rasops_info *ri = &dev_priv->ro;
+
+ return rasops_load_font(ri, cookie, font);
+}
+
+int
+inteldrm_list_font(void *v, struct wsdisplay_font *font)
+{
+ struct inteldrm_softc *dev_priv = v;
+ struct rasops_info *ri = &dev_priv->ro;
+
+ return rasops_list_font(ri, font);
+}
+
void
inteldrm_burner(void *v, u_int on, u_int flags)
{
diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c
index 49793debd55..00234866937 100644
--- a/sys/dev/pci/drm/radeon/radeon_kms.c
+++ b/sys/dev/pci/drm/radeon/radeon_kms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_kms.c,v 1.9 2013/10/20 20:07:29 miod Exp $ */
+/* $OpenBSD: radeon_kms.c,v 1.10 2013/10/21 10:36:24 miod Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -297,6 +297,8 @@ void radeondrm_free_screen(void *, void *);
int radeondrm_show_screen(void *, void *, int,
void (*)(void *, int, int), void *);
void radeondrm_doswitch(void *, void *);
+int radeondrm_load_font(void *, void *, struct wsdisplay_font *);
+int radeondrm_list_font(void *, struct wsdisplay_font *);
int radeondrm_getchar(void *, int, int, struct wsdisplay_charcell *);
struct wsscreen_descr radeondrm_stdscreen = {
@@ -323,6 +325,8 @@ struct wsdisplay_accessops radeondrm_accessops = {
.free_screen = radeondrm_free_screen,
.show_screen = radeondrm_show_screen,
.getchar = radeondrm_getchar,
+ .load_font = radeondrm_load_font,
+ .list_font = radeondrm_list_font,
.burn_screen = radeondrm_burner
};
@@ -410,6 +414,24 @@ radeondrm_doswitch(void *v, void *cookie)
}
int
+radeondrm_load_font(void *v, void *cookie, struct wsdisplay_font *font)
+{
+ struct radeon_device *rdev = v;
+ struct rasops_info *ri = &rdev->ro;
+
+ return rasops_load_font(ri, cookie, font);
+}
+
+int
+radeondrm_list_font(void *v, struct wsdisplay_font *font)
+{
+ struct radeon_device *rdev = v;
+ struct rasops_info *ri = &rdev->ro;
+
+ return rasops_list_font(ri, font);
+}
+
+int
radeondrm_getchar(void *v, int row, int col, struct wsdisplay_charcell *cell)
{
struct radeon_device *rdev = v;
diff --git a/sys/dev/pci/tga.c b/sys/dev/pci/tga.c
index 66a132cbf83..94bad789fe5 100644
--- a/sys/dev/pci/tga.c
+++ b/sys/dev/pci/tga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tga.c,v 1.37 2013/10/20 20:07:30 miod Exp $ */
+/* $OpenBSD: tga.c,v 1.38 2013/10/21 10:36:23 miod Exp $ */
/* $NetBSD: tga.c,v 1.40 2002/03/13 15:05:18 ad Exp $ */
/*
@@ -88,21 +88,25 @@ struct tga_devconfig tga_console_dc;
int tga_ioctl(void *, u_long, caddr_t, int, struct proc *);
paddr_t tga_mmap(void *, off_t, int);
-int tga_copyrows(void *, int, int, int);
-int tga_copycols(void *, int, int, int, int);
int tga_alloc_screen(void *, const struct wsscreen_descr *,
void **, int *, int *, long *);
void tga_free_screen(void *, void *);
int tga_show_screen(void *, void *, int,
void (*) (void *, int, int), void *);
+int tga_load_font(void *, void *, struct wsdisplay_font *);
+int tga_list_font(void *, struct wsdisplay_font *);
void tga_burner(void *, u_int, u_int);
+
+int tga_copyrows(void *, int, int, int);
+int tga_copycols(void *, int, int, int, int);
+int tga_eraserows(void *, int, int, long);
+int tga_erasecols(void *, int, int, int, long);
+int tga_putchar(void *c, int row, int col, u_int uc, long attr);
+
int tga_rop(struct rasops_info *, int, int, int, int,
struct rasops_info *, int, int);
int tga_rop_vtov(struct rasops_info *, int, int, int,
int, struct rasops_info *, int, int );
-int tga_putchar(void *c, int row, int col, u_int uc, long attr);
-int tga_eraserows(void *, int, int, long);
-int tga_erasecols(void *, int, int, int, long);
void tga2_init(struct tga_devconfig *);
void tga_config_interrupts(struct device *);
@@ -158,6 +162,8 @@ struct wsdisplay_accessops tga_accessops = {
.alloc_screen = tga_alloc_screen,
.free_screen = tga_free_screen,
.show_screen = tga_show_screen,
+ .load_font = tga_load_font,
+ .list_font = tga_list_font,
.burn_screen = tga_burner
};
@@ -769,6 +775,62 @@ tga_show_screen(v, cookie, waitok, cb, cbarg)
}
int
+tga_load_font(void *v, void *emulcookie, struct wsdisplay_font *font)
+{
+ struct tga_softc *sc = v;
+ struct tga_devconfig *dc = sc->sc_dc;
+ struct rasops_info *ri = &dc->dc_rinfo;
+ 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.
+ */
+
+ 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;
+
+ return 0;
+}
+
+int
+tga_list_font(void *v, struct wsdisplay_font *font)
+{
+ struct tga_softc *sc = v;
+ struct tga_devconfig *dc = sc->sc_dc;
+ struct rasops_info *ri = &dc->dc_rinfo;
+
+ return rasops_list_font(ri, font);
+}
+
+int
tga_cnattach(iot, memt, pc, bus, device, function)
bus_space_tag_t iot, memt;
pci_chipset_tag_t pc;
diff --git a/sys/dev/pcmcia/cfxga.c b/sys/dev/pcmcia/cfxga.c
index 6be8d59828d..e6af4eb20fd 100644
--- a/sys/dev/pcmcia/cfxga.c
+++ b/sys/dev/pcmcia/cfxga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfxga.c,v 1.24 2013/10/20 20:07:30 miod Exp $ */
+/* $OpenBSD: cfxga.c,v 1.25 2013/10/21 10:36:25 miod Exp $ */
/*
* Copyright (c) 2005, 2006, Matthieu Herrb and Miodrag Vallat
@@ -114,6 +114,8 @@ void cfxga_burner(void *, u_int, u_int);
void cfxga_free_screen(void *, void *);
int cfxga_ioctl(void *, u_long, caddr_t, int, struct proc *);
paddr_t cfxga_mmap(void *, off_t, int);
+int cfxga_load_font(void *, void *, struct wsdisplay_font *);
+int cfxga_list_font(void *, struct wsdisplay_font *);
int cfxga_show_screen(void *, void *, int, void (*)(void *, int, int),
void *);
@@ -123,6 +125,8 @@ struct wsdisplay_accessops cfxga_accessops = {
.alloc_screen = cfxga_alloc_screen,
.free_screen = cfxga_free_screen,
.show_screen = cfxga_show_screen,
+ .load_font = cfxga_load_font,
+ .list_font = cfxga_list_font,
.burn_screen = cfxga_burner
};
@@ -660,6 +664,30 @@ cfxga_show_screen(void *v, void *cookie, int waitok,
return (0);
}
+int
+cfxga_load_font(void *v, void *emulcookie, struct wsdisplay_font *font)
+{
+ struct cfxga_softc *sc = v;
+ struct cfxga_screen *scr = sc->sc_active;
+
+ if (scr == NULL)
+ return ENXIO;
+
+ return rasops_load_font(&scr->scr_ri, emulcookie, font);
+}
+
+int
+cfxga_list_font(void *v, struct wsdisplay_font *font)
+{
+ struct cfxga_softc *sc = v;
+ struct cfxga_screen *scr = sc->sc_active;
+
+ if (scr == NULL)
+ return ENXIO;
+
+ return rasops_list_font(&scr->scr_ri, font);
+}
+
/*
* Real frame buffer operations
*/
diff --git a/sys/dev/usb/udl.c b/sys/dev/usb/udl.c
index b26c2398dc8..cf00953178a 100644
--- a/sys/dev/usb/udl.c
+++ b/sys/dev/usb/udl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udl.c,v 1.77 2013/10/20 20:07:31 miod Exp $ */
+/* $OpenBSD: udl.c,v 1.78 2013/10/21 10:36:26 miod Exp $ */
/*
* Copyright (c) 2009 Marcus Glocker <mglocker@openbsd.org>
@@ -85,6 +85,8 @@ int udl_alloc_screen(void *, const struct wsscreen_descr *,
void udl_free_screen(void *, void *);
int udl_show_screen(void *, void *, int,
void (*)(void *, int, int), void *);
+int udl_load_font(void *, void *, struct wsdisplay_font *);
+int udl_list_font(void *, struct wsdisplay_font *);
void udl_burner(void *, u_int, u_int);
int udl_copycols(void *, int, int, int, int);
@@ -217,6 +219,8 @@ struct wsdisplay_accessops udl_accessops = {
.alloc_screen = udl_alloc_screen,
.free_screen = udl_free_screen,
.show_screen = udl_show_screen,
+ .load_font = udl_load_font,
+ .list_font = udl_list_font,
.burn_screen = udl_burner
};
@@ -695,6 +699,24 @@ udl_show_screen(void *v, void *cookie, int waitok,
return (0);
}
+int
+udl_load_font(void *v, void *emulcookie, struct wsdisplay_font *font)
+{
+ struct udl_softc *sc = v;
+ struct rasops_info *ri = &sc->sc_ri;
+
+ return rasops_load_font(ri, emulcookie, font);
+}
+
+int
+udl_list_font(void *v, struct wsdisplay_font *font)
+{
+ struct udl_softc *sc = v;
+ struct rasops_info *ri = &sc->sc_ri;
+
+ return rasops_list_font(ri, font);
+}
+
void
udl_burner(void *v, u_int on, u_int flags)
{