summaryrefslogtreecommitdiffstats
path: root/sys/dev/vt
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2014-09-04 18:43:40 +0000
committeremaste <emaste@FreeBSD.org>2014-09-04 18:43:40 +0000
commitd3502c5201c3953f761c2abc08d154325cd8b335 (patch)
tree6fabcc945fa648c829f839c3feb4fe114586165b /sys/dev/vt
parent2a3f3e6567ab84c11e17e3cc87e2418f2dafda27 (diff)
downloadFreeBSD-src-d3502c5201c3953f761c2abc08d154325cd8b335.zip
FreeBSD-src-d3502c5201c3953f761c2abc08d154325cd8b335.tar.gz
MFC fbd(4) and vt_fb disentanglement:
r268472 (ray): Should check fb_read method presence instead of double check for fb_write. r269620 (nwhitehorn): Retire various intertwined bits of fbd(4) and vt_fb, in particular the pixel modification indirection. No actual drivers use it and those that might (e.g. creatorfb) use custom implementations of vd_bitbltchr(). Relnotes: No Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/dev/vt')
-rw-r--r--sys/dev/vt/hw/efifb/efifb.c4
-rw-r--r--sys/dev/vt/hw/fb/vt_early_fb.c1
-rw-r--r--sys/dev/vt/hw/fb/vt_fb.c86
-rw-r--r--sys/dev/vt/hw/fb/vt_fb.h2
-rw-r--r--sys/dev/vt/hw/ofwfb/ofwfb.c1
5 files changed, 62 insertions, 32 deletions
diff --git a/sys/dev/vt/hw/efifb/efifb.c b/sys/dev/vt/hw/efifb/efifb.c
index b6ea1db..546bbf6 100644
--- a/sys/dev/vt/hw/efifb/efifb.c
+++ b/sys/dev/vt/hw/efifb/efifb.c
@@ -154,12 +154,8 @@ vt_efifb_init(struct vt_device *vd)
info->fb_width = MIN(info->fb_width, VT_FB_DEFAULT_WIDTH);
info->fb_height = MIN(info->fb_height, VT_FB_DEFAULT_HEIGHT);
- fb_probe(info);
vt_fb_init(vd);
- /* Clear the screen. */
- vt_fb_blank(vd, TC_BLACK);
-
return (CN_INTERNAL);
}
diff --git a/sys/dev/vt/hw/fb/vt_early_fb.c b/sys/dev/vt/hw/fb/vt_early_fb.c
index 5e818f7..a618ca3 100644
--- a/sys/dev/vt/hw/fb/vt_early_fb.c
+++ b/sys/dev/vt/hw/fb/vt_early_fb.c
@@ -296,7 +296,6 @@ vt_efb_init(struct vt_device *vd)
#else
vt_efb_initialize(info);
#endif
- fb_probe(info);
vt_fb_init(vd);
return (CN_INTERNAL);
diff --git a/sys/dev/vt/hw/fb/vt_fb.c b/sys/dev/vt/hw/fb/vt_fb.c
index 6154513..1c4b9a7 100644
--- a/sys/dev/vt/hw/fb/vt_fb.c
+++ b/sys/dev/vt/hw/fb/vt_fb.c
@@ -61,6 +61,30 @@ static struct vt_driver vt_fb_driver = {
VT_DRIVER_DECLARE(vt_fb, vt_fb_driver);
+static void
+vt_fb_mem_wr1(struct fb_info *sc, uint32_t o, uint8_t v)
+{
+
+ KASSERT((o < sc->fb_size), ("Offset %#08x out of fb size", o));
+ *(uint8_t *)(sc->fb_vbase + o) = v;
+}
+
+static void
+vt_fb_mem_wr2(struct fb_info *sc, uint32_t o, uint16_t v)
+{
+
+ KASSERT((o < sc->fb_size), ("Offset %#08x out of fb size", o));
+ *(uint16_t *)(sc->fb_vbase + o) = v;
+}
+
+static void
+vt_fb_mem_wr4(struct fb_info *sc, uint32_t o, uint32_t v)
+{
+
+ KASSERT((o < sc->fb_size), ("Offset %#08x out of fb size", o));
+ *(uint32_t *)(sc->fb_vbase + o) = v;
+}
+
int
vt_fb_ioctl(struct vt_device *vd, u_long cmd, caddr_t data, struct thread *td)
{
@@ -134,20 +158,22 @@ vt_fb_setpixel(struct vt_device *vd, int x, int y, term_color_t color)
c = info->fb_cmap[color];
o = info->fb_stride * y + x * FBTYPE_GET_BYTESPP(info);
+ KASSERT((info->fb_vbase != 0), ("Unmapped framebuffer"));
+
switch (FBTYPE_GET_BYTESPP(info)) {
case 1:
- info->wr1(info, o, c);
+ vt_fb_mem_wr1(info, o, c);
break;
case 2:
- info->wr2(info, o, c);
+ vt_fb_mem_wr2(info, o, c);
break;
case 3:
- info->wr1(info, o, (c >> 16) & 0xff);
- info->wr1(info, o + 1, (c >> 8) & 0xff);
- info->wr1(info, o + 2, c & 0xff);
+ vt_fb_mem_wr1(info, o, (c >> 16) & 0xff);
+ vt_fb_mem_wr1(info, o + 1, (c >> 8) & 0xff);
+ vt_fb_mem_wr1(info, o + 2, c & 0xff);
break;
case 4:
- info->wr4(info, o, c);
+ vt_fb_mem_wr4(info, o, c);
break;
default:
/* panic? */
@@ -183,32 +209,34 @@ vt_fb_blank(struct vt_device *vd, term_color_t color)
info = vd->vd_softc;
c = info->fb_cmap[color];
+ KASSERT((info->fb_vbase != 0), ("Unmapped framebuffer"));
+
switch (FBTYPE_GET_BYTESPP(info)) {
case 1:
for (h = 0; h < info->fb_height; h++)
for (o = 0; o < info->fb_stride; o++)
- info->wr1(info, h*info->fb_stride + o, c);
+ vt_fb_mem_wr1(info, h*info->fb_stride + o, c);
break;
case 2:
for (h = 0; h < info->fb_height; h++)
for (o = 0; o < info->fb_stride; o += 2)
- info->wr2(info, h*info->fb_stride + o, c);
+ vt_fb_mem_wr2(info, h*info->fb_stride + o, c);
break;
case 3:
for (h = 0; h < info->fb_height; h++)
for (o = 0; o < info->fb_stride; o += 3) {
- info->wr1(info, h*info->fb_stride + o,
+ vt_fb_mem_wr1(info, h*info->fb_stride + o,
(c >> 16) & 0xff);
- info->wr1(info, h*info->fb_stride + o + 1,
+ vt_fb_mem_wr1(info, h*info->fb_stride + o + 1,
(c >> 8) & 0xff);
- info->wr1(info, h*info->fb_stride + o + 2,
+ vt_fb_mem_wr1(info, h*info->fb_stride + o + 2,
c & 0xff);
}
break;
case 4:
for (h = 0; h < info->fb_height; h++)
for (o = 0; o < info->fb_stride; o += 4)
- info->wr4(info, h*info->fb_stride + o, c);
+ vt_fb_mem_wr4(info, h*info->fb_stride + o, c);
break;
default:
/* panic? */
@@ -241,6 +269,8 @@ vt_fb_bitbltchr(struct vt_device *vd, const uint8_t *src, const uint8_t *mask,
info->fb_height))
return;
+ KASSERT((info->fb_vbase != 0), ("Unmapped framebuffer"));
+
line = (info->fb_stride * top) + (left * bpp);
for (l = 0; l < height; l++) {
ch = src;
@@ -254,19 +284,19 @@ vt_fb_bitbltchr(struct vt_device *vd, const uint8_t *src, const uint8_t *mask,
switch(bpp) {
case 1:
- info->wr1(info, o, cc);
+ vt_fb_mem_wr1(info, o, cc);
break;
case 2:
- info->wr2(info, o, cc);
+ vt_fb_mem_wr2(info, o, cc);
break;
case 3:
/* Packed mode, so unaligned. Byte access. */
- info->wr1(info, o, (cc >> 16) & 0xff);
- info->wr1(info, o + 1, (cc >> 8) & 0xff);
- info->wr1(info, o + 2, cc & 0xff);
+ vt_fb_mem_wr1(info, o, (cc >> 16) & 0xff);
+ vt_fb_mem_wr1(info, o + 1, (cc >> 8) & 0xff);
+ vt_fb_mem_wr1(info, o + 2, cc & 0xff);
break;
case 4:
- info->wr4(info, o, cc);
+ vt_fb_mem_wr4(info, o, cc);
break;
default:
/* panic? */
@@ -303,6 +333,8 @@ vt_fb_maskbitbltchr(struct vt_device *vd, const uint8_t *src, const uint8_t *mas
info->fb_height))
return;
+ KASSERT((info->fb_vbase != 0), ("Unmapped framebuffer"));
+
line = (info->fb_stride * top) + (left * bpp);
for (l = 0; l < height; l++) {
ch = src;
@@ -325,19 +357,19 @@ vt_fb_maskbitbltchr(struct vt_device *vd, const uint8_t *src, const uint8_t *mas
switch(bpp) {
case 1:
- info->wr1(info, o, cc);
+ vt_fb_mem_wr1(info, o, cc);
break;
case 2:
- info->wr2(info, o, cc);
+ vt_fb_mem_wr2(info, o, cc);
break;
case 3:
/* Packed mode, so unaligned. Byte access. */
- info->wr1(info, o, (cc >> 16) & 0xff);
- info->wr1(info, o + 1, (cc >> 8) & 0xff);
- info->wr1(info, o + 2, cc & 0xff);
+ vt_fb_mem_wr1(info, o, (cc >> 16) & 0xff);
+ vt_fb_mem_wr1(info, o + 1, (cc >> 8) & 0xff);
+ vt_fb_mem_wr1(info, o + 2, cc & 0xff);
break;
case 4:
- info->wr4(info, o, cc);
+ vt_fb_mem_wr4(info, o, cc);
break;
default:
/* panic? */
@@ -393,6 +425,12 @@ vt_fb_init(struct vt_device *vd)
vd->vd_height = info->fb_height;
vd->vd_width = info->fb_width;
+ if (info->fb_size == 0)
+ return (CN_DEAD);
+
+ if (info->fb_pbase == 0)
+ info->fb_flags |= FB_FLAG_NOMMAP;
+
if (info->fb_cmsize <= 0) {
err = vt_fb_init_cmap(info->fb_cmap, FBTYPE_GET_BPP(info));
if (err)
diff --git a/sys/dev/vt/hw/fb/vt_fb.h b/sys/dev/vt/hw/fb/vt_fb.h
index 1ffb250..9b1d56b 100644
--- a/sys/dev/vt/hw/fb/vt_fb.h
+++ b/sys/dev/vt/hw/fb/vt_fb.h
@@ -36,8 +36,6 @@ int vt_fb_attach(struct fb_info *info);
void vt_fb_resume(void);
void vt_fb_suspend(void);
-int fb_probe(struct fb_info *info);
-
vd_init_t vt_fb_init;
vd_blank_t vt_fb_blank;
vd_bitbltchr_t vt_fb_bitbltchr;
diff --git a/sys/dev/vt/hw/ofwfb/ofwfb.c b/sys/dev/vt/hw/ofwfb/ofwfb.c
index c7c50e1..bec89e4 100644
--- a/sys/dev/vt/hw/ofwfb/ofwfb.c
+++ b/sys/dev/vt/hw/ofwfb/ofwfb.c
@@ -399,7 +399,6 @@ ofwfb_init(struct vt_device *vd)
sc->fb.fb_pbase = fb_phys;
ofwfb_initialize(vd);
- fb_probe(&sc->fb);
vt_fb_init(vd);
return (CN_INTERNAL);
OpenPOWER on IntegriCloud