Move the gallant 12 x 22 font data from a .h to a .c so it doesn't need

to be compiled into every driver making use of it. Use a const instance
of struct gfb_font for this as the font isn't intended to be changed at
run-time and in order to accompany the font data with height and width
info.
This commit is contained in:
Marius Strobl 2007-06-16 21:48:50 +00:00
parent 555f163cd2
commit c54e7ea989
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170840
5 changed files with 31 additions and 6202 deletions

View File

@ -46,6 +46,7 @@ dev/auxio/auxio.c optional auxio sbus | auxio ebus
dev/esp/esp_sbus.c optional esp sbus
dev/fb/creator.c optional creator sc
dev/fb/fb.c optional sc
dev/fb/gallant12x22.c optional sc
dev/fb/machfb.c optional machfb sc
dev/hwpmc/hwpmc_sparc64.c optional hwpmc
dev/kbd/kbd.c optional atkbd | sc | ukbd

View File

@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
#include <dev/fb/fbreg.h>
#include <dev/fb/creatorreg.h>
#include <dev/fb/gallant12x22.h>
#include <dev/fb/gfb.h>
#include <dev/syscons/syscons.h>
#define CREATOR_DRIVER_NAME "creator"
@ -73,7 +73,7 @@ struct creator_softc {
int sc_xmargin;
int sc_ymargin;
u_char *sc_font;
const u_char *sc_font;
int sc_bg_cache;
int sc_fg_cache;
@ -153,6 +153,8 @@ static const struct {
#define CREATOR_FB_MAP_SIZE \
(sizeof(creator_fb_map) / sizeof(creator_fb_map[0]))
extern const struct gfb_font gallant12x22;
static struct creator_softc creator_softc;
static struct bus_space_tag creator_bst_store[FFB_FBC];
@ -486,12 +488,12 @@ creator_init(int unit, video_adapter_t *adp, int flags)
if (OF_getprop(options, "screen-#columns", buf, sizeof(buf)) == -1)
return (ENXIO);
vi->vi_width = strtol(buf, NULL, 10);
vi->vi_cwidth = 12;
vi->vi_cheight = 22;
vi->vi_cwidth = gallant12x22.width;
vi->vi_cheight = gallant12x22.height;
vi->vi_flags = V_INFO_COLOR;
vi->vi_mem_model = V_INFO_MM_OTHER;
sc->sc_font = gallant12x22_data;
sc->sc_font = gallant12x22.data;
sc->sc_xmargin = (sc->sc_width - (vi->vi_width * vi->vi_cwidth)) / 2;
sc->sc_ymargin = (sc->sc_height - (vi->vi_height * vi->vi_cheight)) / 2;
@ -815,7 +817,7 @@ static int
creator_putc(video_adapter_t *adp, vm_offset_t off, u_int8_t c, u_int8_t a)
{
struct creator_softc *sc;
uint16_t *p;
const uint16_t *p;
int row;
int col;
int i;
@ -823,7 +825,7 @@ creator_putc(video_adapter_t *adp, vm_offset_t off, u_int8_t c, u_int8_t a)
sc = (struct creator_softc *)adp;
row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight;
col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth;
p = (uint16_t *)sc->sc_font + (c * adp->va_info.vi_cheight);
p = (const uint16_t *)sc->sc_font + (c * adp->va_info.vi_cheight);
creator_ras_setfg(sc, creator_cmap[a & 0xf]);
creator_ras_setbg(sc, creator_cmap[(a >> 4) & 0xf]);
creator_ras_fifo_wait(sc, 1 + adp->va_info.vi_cheight);

View File

@ -34,11 +34,19 @@
* SUCH DAMAGE.
*
* Derived from: @(#)gallant19.h 8.1 (Berkeley) 6/11/93
*
* $FreeBSD$
*/
static u_char gallant12x22_data[] = {
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <dev/fb/gfb.h>
const struct gfb_font gallant12x22 = {
12,
22,
{
/* 0 0x00 '^@' */
0x00, 0x00, /* ............ */
0x00, 0x00, /* ............ */
@ -6182,4 +6190,5 @@ static u_char gallant12x22_data[] = {
0x00, 0x00, /* ............ */
0x00, 0x00, /* ............ */
0x00, 0x00, /* ............ */
}
};

File diff suppressed because it is too large Load Diff

View File

@ -84,7 +84,7 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <dev/fb/fbreg.h>
#include <dev/fb/gallant12x22.h>
#include <dev/fb/gfb.h>
#include <dev/fb/machfbreg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
@ -135,7 +135,7 @@ struct machfb_softc {
int sc_mclk_post_div;
int sc_mclk_fb_div;
u_char *sc_font;
const u_char *sc_font;
int sc_cbwidth;
vm_offset_t sc_curoff;
@ -253,6 +253,8 @@ static const char *machfb_memtype_names[] = {
"(unknown type)"
};
extern const struct gfb_font gallant12x22;
static struct machfb_softc machfb_softc;
static struct bus_space_tag machfb_bst_store[1];
@ -587,13 +589,13 @@ machfb_init(int unit, video_adapter_t *adp, int flags)
if (OF_getprop(options, "screen-#columns", buf, sizeof(buf)) == -1)
return (ENXIO);
vi->vi_width = strtol(buf, NULL, 10);
vi->vi_cwidth = 12;
vi->vi_cheight = 22;
vi->vi_cwidth = gallant12x22.width;
vi->vi_cheight = gallant12x22.height;
vi->vi_flags = V_INFO_COLOR;
vi->vi_mem_model = V_INFO_MM_OTHER;
sc->sc_font = gallant12x22_data;
sc->sc_cbwidth = howmany(vi->vi_cwidth, 8); /* width in bytes */
sc->sc_font = gallant12x22.data;
sc->sc_cbwidth = howmany(vi->vi_cwidth, NBBY); /* width in bytes */
sc->sc_xmargin = (sc->sc_width - (vi->vi_width * vi->vi_cwidth)) / 2;
sc->sc_ymargin = (sc->sc_height - (vi->vi_height * vi->vi_cheight)) / 2;
@ -1027,7 +1029,7 @@ static int
machfb_putc(video_adapter_t *adp, vm_offset_t off, uint8_t c, uint8_t a)
{
struct machfb_softc *sc;
uint8_t *p;
const uint8_t *p;
int i;
sc = (struct machfb_softc *)adp;