svn commit: r270431 - in head/sys: dev/fb dev/vt dev/vt/hw/efifb dev/vt/hw/fb dev/vt/hw/ofwfb dev/vt/hw/vga powerpc/ps3
Jean-Sebastien Pedron
dumbbell at FreeBSD.org
Sat Aug 23 20:35:36 UTC 2014
Author: dumbbell
Date: Sat Aug 23 20:35:33 2014
New Revision: 270431
URL: http://svnweb.freebsd.org/changeset/base/270431
Log:
vt(4): Add vd_bitblt_bmp_t callback
The code was already there in all backends, we just expose it. This is
used to display the splash screen.
MFC after: 1 week
Modified:
head/sys/dev/fb/creator_vt.c
head/sys/dev/vt/hw/efifb/efifb.c
head/sys/dev/vt/hw/fb/vt_early_fb.c
head/sys/dev/vt/hw/fb/vt_fb.c
head/sys/dev/vt/hw/fb/vt_fb.h
head/sys/dev/vt/hw/ofwfb/ofwfb.c
head/sys/dev/vt/hw/vga/vt_vga.c
head/sys/dev/vt/vt.h
head/sys/dev/vt/vt_core.c
head/sys/powerpc/ps3/ps3_syscons.c
Modified: head/sys/dev/fb/creator_vt.c
==============================================================================
--- head/sys/dev/fb/creator_vt.c Sat Aug 23 18:55:51 2014 (r270430)
+++ head/sys/dev/fb/creator_vt.c Sat Aug 23 20:35:33 2014 (r270431)
@@ -46,6 +46,7 @@ static vd_probe_t creatorfb_probe;
static vd_init_t creatorfb_init;
static vd_blank_t creatorfb_blank;
static vd_bitblt_text_t creatorfb_bitblt_text;
+static vd_bitblt_bmp_t creatorfb_bitblt_bitmap;
static const struct vt_driver vt_creatorfb_driver = {
.vd_name = "creatorfb",
@@ -53,6 +54,7 @@ static const struct vt_driver vt_creator
.vd_init = creatorfb_init,
.vd_blank = creatorfb_blank,
.vd_bitblt_text = creatorfb_bitblt_text,
+ .vd_bitblt_bmp = creatorfb_bitblt_bitmap,
.vd_fb_ioctl = vt_fb_ioctl,
.vd_fb_mmap = vt_fb_mmap,
.vd_priority = VD_PRIORITY_SPECIFIC
Modified: head/sys/dev/vt/hw/efifb/efifb.c
==============================================================================
--- head/sys/dev/vt/hw/efifb/efifb.c Sat Aug 23 18:55:51 2014 (r270430)
+++ head/sys/dev/vt/hw/efifb/efifb.c Sat Aug 23 20:35:33 2014 (r270431)
@@ -61,6 +61,7 @@ static struct vt_driver vt_efifb_driver
.vd_init = vt_efifb_init,
.vd_blank = vt_fb_blank,
.vd_bitblt_text = vt_fb_bitblt_text,
+ .vd_bitblt_bmp = vt_fb_bitblt_bitmap,
.vd_fb_ioctl = vt_fb_ioctl,
.vd_fb_mmap = vt_fb_mmap,
/* Better than VGA, but still generic driver. */
Modified: head/sys/dev/vt/hw/fb/vt_early_fb.c
==============================================================================
--- head/sys/dev/vt/hw/fb/vt_early_fb.c Sat Aug 23 18:55:51 2014 (r270430)
+++ head/sys/dev/vt/hw/fb/vt_early_fb.c Sat Aug 23 20:35:33 2014 (r270431)
@@ -60,6 +60,7 @@ static struct vt_driver vt_fb_early_driv
.vd_init = vt_efb_init,
.vd_blank = vt_fb_blank,
.vd_bitblt_text = vt_fb_bitblt_text,
+ .vd_bitblt_bmp = vt_fb_bitblt_bitmap,
.vd_priority = VD_PRIORITY_GENERIC,
};
Modified: head/sys/dev/vt/hw/fb/vt_fb.c
==============================================================================
--- head/sys/dev/vt/hw/fb/vt_fb.c Sat Aug 23 18:55:51 2014 (r270430)
+++ head/sys/dev/vt/hw/fb/vt_fb.c Sat Aug 23 20:35:33 2014 (r270431)
@@ -49,6 +49,7 @@ static struct vt_driver vt_fb_driver = {
.vd_init = vt_fb_init,
.vd_blank = vt_fb_blank,
.vd_bitblt_text = vt_fb_bitblt_text,
+ .vd_bitblt_bmp = vt_fb_bitblt_bitmap,
.vd_drawrect = vt_fb_drawrect,
.vd_setpixel = vt_fb_setpixel,
.vd_postswitch = vt_fb_postswitch,
@@ -242,7 +243,7 @@ vt_fb_blank(struct vt_device *vd, term_c
}
}
-static void
+void
vt_fb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw,
const uint8_t *pattern, const uint8_t *mask,
unsigned int width, unsigned int height,
Modified: head/sys/dev/vt/hw/fb/vt_fb.h
==============================================================================
--- head/sys/dev/vt/hw/fb/vt_fb.h Sat Aug 23 18:55:51 2014 (r270430)
+++ head/sys/dev/vt/hw/fb/vt_fb.h Sat Aug 23 20:35:33 2014 (r270431)
@@ -39,6 +39,7 @@ void vt_fb_suspend(void);
vd_init_t vt_fb_init;
vd_blank_t vt_fb_blank;
vd_bitblt_text_t vt_fb_bitblt_text;
+vd_bitblt_bmp_t vt_fb_bitblt_bitmap;
vd_postswitch_t vt_fb_postswitch;
vd_fb_ioctl_t vt_fb_ioctl;
vd_fb_mmap_t vt_fb_mmap;
Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c
==============================================================================
--- head/sys/dev/vt/hw/ofwfb/ofwfb.c Sat Aug 23 18:55:51 2014 (r270430)
+++ head/sys/dev/vt/hw/ofwfb/ofwfb.c Sat Aug 23 20:35:33 2014 (r270431)
@@ -59,6 +59,7 @@ struct ofwfb_softc {
static vd_probe_t ofwfb_probe;
static vd_init_t ofwfb_init;
static vd_bitblt_text_t ofwfb_bitblt_text;
+static vd_bitblt_bmp_t ofwfb_bitblt_bitmap;
static const struct vt_driver vt_ofwfb_driver = {
.vd_name = "ofwfb",
@@ -66,6 +67,7 @@ static const struct vt_driver vt_ofwfb_d
.vd_init = ofwfb_init,
.vd_blank = vt_fb_blank,
.vd_bitblt_text = ofwfb_bitblt_text,
+ .vd_bitblt_bmp = ofwfb_bitblt_bitmap,
.vd_fb_ioctl = vt_fb_ioctl,
.vd_fb_mmap = vt_fb_mmap,
.vd_priority = VD_PRIORITY_GENERIC+1,
Modified: head/sys/dev/vt/hw/vga/vt_vga.c
==============================================================================
--- head/sys/dev/vt/hw/vga/vt_vga.c Sat Aug 23 18:55:51 2014 (r270430)
+++ head/sys/dev/vt/hw/vga/vt_vga.c Sat Aug 23 20:35:33 2014 (r270431)
@@ -89,6 +89,7 @@ static vd_probe_t vga_probe;
static vd_init_t vga_init;
static vd_blank_t vga_blank;
static vd_bitblt_text_t vga_bitblt_text;
+static vd_bitblt_bmp_t vga_bitblt_bitmap;
static vd_drawrect_t vga_drawrect;
static vd_setpixel_t vga_setpixel;
static vd_postswitch_t vga_postswitch;
@@ -99,6 +100,7 @@ static const struct vt_driver vt_vga_dri
.vd_init = vga_init,
.vd_blank = vga_blank,
.vd_bitblt_text = vga_bitblt_text,
+ .vd_bitblt_bmp = vga_bitblt_bitmap,
.vd_drawrect = vga_drawrect,
.vd_setpixel = vga_setpixel,
.vd_postswitch = vga_postswitch,
@@ -828,6 +830,52 @@ vga_bitblt_text(struct vt_device *vd, co
}
static void
+vga_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw,
+ const uint8_t *pattern, const uint8_t *mask,
+ unsigned int width, unsigned int height,
+ unsigned int x, unsigned int y, term_color_t fg, term_color_t bg)
+{
+ unsigned int x1, y1, x2, y2, i, j, src_x, dst_x, x_count;
+ uint8_t pattern_2colors, pattern_ncolors;
+
+ /* Align coordinates with the 8-pxels grid. */
+ x1 = x / VT_VGA_PIXELS_BLOCK * VT_VGA_PIXELS_BLOCK;
+ y1 = y;
+
+ x2 = (x + width + VT_VGA_PIXELS_BLOCK - 1) /
+ VT_VGA_PIXELS_BLOCK * VT_VGA_PIXELS_BLOCK;
+ y2 = y + height;
+ x2 = min(x2, vd->vd_width - 1);
+ y2 = min(y2, vd->vd_height - 1);
+
+ pattern_ncolors = 0;
+
+ for (j = y1; j < y2; ++j) {
+ src_x = 0;
+ dst_x = x - x1;
+ x_count = VT_VGA_PIXELS_BLOCK - dst_x;
+
+ for (i = x1; i < x2; i += VT_VGA_MEMSIZE) {
+ pattern_2colors = 0;
+
+ vga_copy_bitmap_portion(
+ &pattern_2colors, &pattern_ncolors,
+ pattern, mask, width,
+ src_x, dst_x, x_count,
+ j - y1, 0, 1, fg, bg, 0);
+
+ vga_bitblt_pixels_block_2colors(vd,
+ &pattern_2colors, fg, bg,
+ i, j, 1);
+
+ src_x += x_count;
+ dst_x = (dst_x + x_count) % VT_VGA_PIXELS_BLOCK;
+ x_count = min(x + width - i, VT_VGA_PIXELS_BLOCK);
+ }
+ }
+}
+
+static void
vga_initialize_graphics(struct vt_device *vd)
{
struct vga_softc *sc = vd->vd_softc;
Modified: head/sys/dev/vt/vt.h
==============================================================================
--- head/sys/dev/vt/vt.h Sat Aug 23 18:55:51 2014 (r270430)
+++ head/sys/dev/vt/vt.h Sat Aug 23 20:35:33 2014 (r270431)
@@ -305,6 +305,10 @@ typedef void vd_putchar_t(struct vt_devi
vt_axis_t top, vt_axis_t left, term_color_t fg, term_color_t bg);
typedef void vd_bitblt_text_t(struct vt_device *vd, const struct vt_window *vw,
const term_rect_t *area);
+typedef void vd_bitblt_bmp_t(struct vt_device *vd, const struct vt_window *vw,
+ const uint8_t *pattern, const uint8_t *mask,
+ unsigned int width, unsigned int height,
+ unsigned int x, unsigned int y, term_color_t fg, term_color_t bg);
typedef int vd_fb_ioctl_t(struct vt_device *, u_long, caddr_t, struct thread *);
typedef int vd_fb_mmap_t(struct vt_device *, vm_ooffset_t, vm_paddr_t *, int,
vm_memattr_t *);
@@ -324,6 +328,7 @@ struct vt_driver {
vd_drawrect_t *vd_drawrect;
vd_setpixel_t *vd_setpixel;
vd_bitblt_text_t *vd_bitblt_text;
+ vd_bitblt_bmp_t *vd_bitblt_bmp;
/* Framebuffer ioctls, if present. */
vd_fb_ioctl_t *vd_fb_ioctl;
Modified: head/sys/dev/vt/vt_core.c
==============================================================================
--- head/sys/dev/vt/vt_core.c Sat Aug 23 18:55:51 2014 (r270430)
+++ head/sys/dev/vt/vt_core.c Sat Aug 23 20:35:33 2014 (r270431)
@@ -1087,8 +1087,9 @@ vtterm_splash(struct vt_device *vd)
switch (vt_logo_depth) {
case 1:
/* XXX: Unhardcode colors! */
- vd->vd_driver->vd_bitbltchr(vd, vt_logo_image, NULL, 0,
- top, left, vt_logo_width, vt_logo_height, 0xf, 0x0);
+ vd->vd_driver->vd_bitblt_bmp(vd, vd->vd_curwindow,
+ vt_logo_image, NULL, vt_logo_width, vt_logo_height,
+ top, left, TC_WHITE, TC_BLACK);
}
vd->vd_flags |= VDF_SPLASH;
}
Modified: head/sys/powerpc/ps3/ps3_syscons.c
==============================================================================
--- head/sys/powerpc/ps3/ps3_syscons.c Sat Aug 23 18:55:51 2014 (r270430)
+++ head/sys/powerpc/ps3/ps3_syscons.c Sat Aug 23 20:35:33 2014 (r270431)
@@ -77,6 +77,7 @@ static struct vt_driver vt_ps3fb_driver
.vd_init = ps3fb_init,
.vd_blank = vt_fb_blank,
.vd_bitblt_text = vt_fb_bitblt_text,
+ .vd_bitblt_bmp = vt_fb_bitblt_bitmap,
.vd_fb_ioctl = vt_fb_ioctl,
.vd_fb_mmap = vt_fb_mmap,
/* Better than VGA, but still generic driver. */
More information about the svn-src-head
mailing list