summaryrefslogtreecommitdiffstats
path: root/sys/dev/vt
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2015-08-25 15:14:50 +0000
committermarcel <marcel@FreeBSD.org>2015-08-25 15:14:50 +0000
commit966727ca3ba32903fe967452a5d4fbbd3dd565ff (patch)
tree62b526bb7faa157f2ff023d3b229acec41260159 /sys/dev/vt
parent87b09c366d87c98fd8a35cb0883c973290b0858b (diff)
downloadFreeBSD-src-966727ca3ba32903fe967452a5d4fbbd3dd565ff.zip
FreeBSD-src-966727ca3ba32903fe967452a5d4fbbd3dd565ff.tar.gz
MFC r286808, r286809, r286867, r286868
- Improve support for Macs that have a stride not equal to the horizonal resolution (width). - Support frame buffers that are larger than the default screen size. - Support large frame buffers: add 24 more page table pages we allocate on boot-up. PR: 193745
Diffstat (limited to 'sys/dev/vt')
-rw-r--r--sys/dev/vt/hw/efifb/efifb.c26
-rw-r--r--sys/dev/vt/hw/fb/vt_fb.c10
-rw-r--r--sys/dev/vt/vt.h1
-rw-r--r--sys/dev/vt/vt_core.c5
4 files changed, 18 insertions, 24 deletions
diff --git a/sys/dev/vt/hw/efifb/efifb.c b/sys/dev/vt/hw/efifb/efifb.c
index 35f1cd3..2451277 100644
--- a/sys/dev/vt/hw/efifb/efifb.c
+++ b/sys/dev/vt/hw/efifb/efifb.c
@@ -98,7 +98,6 @@ vt_efifb_probe(struct vt_device *vd)
static int
vt_efifb_init(struct vt_device *vd)
{
- int depth, d;
struct fb_info *info;
struct efi_fb *efifb;
caddr_t kmdp;
@@ -118,16 +117,13 @@ vt_efifb_init(struct vt_device *vd)
info->fb_height = efifb->fb_height;
info->fb_width = efifb->fb_width;
- depth = fls(efifb->fb_mask_red);
- d = fls(efifb->fb_mask_green);
- depth = d > depth ? d : depth;
- d = fls(efifb->fb_mask_blue);
- depth = d > depth ? d : depth;
- d = fls(efifb->fb_mask_reserved);
- depth = d > depth ? d : depth;
- info->fb_depth = depth;
+ info->fb_depth = fls(efifb->fb_mask_red | efifb->fb_mask_green |
+ efifb->fb_mask_blue | efifb->fb_mask_reserved);
+ /* Round to a multiple of the bits in a byte. */
+ info->fb_bpp = (info->fb_depth + NBBY - 1) & ~(NBBY - 1);
- info->fb_stride = efifb->fb_stride * (depth / 8);
+ /* Stride in bytes, not pixels */
+ info->fb_stride = efifb->fb_stride * (info->fb_bpp / NBBY);
vt_generate_cons_palette(info->fb_cmap, COLOR_FORMAT_RGB,
efifb->fb_mask_red, ffs(efifb->fb_mask_red) - 1,
@@ -139,16 +135,6 @@ vt_efifb_init(struct vt_device *vd)
info->fb_vbase = (intptr_t)pmap_mapdev_attr(info->fb_pbase,
info->fb_size, VM_MEMATTR_WRITE_COMBINING);
- /* Get pixel storage size. */
- info->fb_bpp = info->fb_stride / info->fb_width * 8;
-
- /*
- * Early FB driver work with static window buffer, so reduce to minimal
- * size, buffer or screen.
- */
- info->fb_width = MIN(info->fb_width, VT_FB_DEFAULT_WIDTH);
- info->fb_height = MIN(info->fb_height, VT_FB_DEFAULT_HEIGHT);
-
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 9028fb0..ff36d18 100644
--- a/sys/dev/vt/hw/fb/vt_fb.c
+++ b/sys/dev/vt/hw/fb/vt_fb.c
@@ -280,6 +280,7 @@ vt_fb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw,
if (mask != NULL && (mask[byte] & bit) == 0)
continue;
o = (y + yi) * info->fb_stride + (x + xi) * bpp;
+ o += vd->vd_transpose;
cc = pattern[byte] & bit ? fgc : bgc;
switch(bpp) {
@@ -397,11 +398,16 @@ int
vt_fb_init(struct vt_device *vd)
{
struct fb_info *info;
+ u_int margin;
int err;
info = vd->vd_softc;
- vd->vd_height = info->fb_height;
- vd->vd_width = info->fb_width;
+ vd->vd_height = MIN(VT_FB_DEFAULT_HEIGHT, info->fb_height);
+ margin = (info->fb_height - vd->vd_height) >> 1;
+ vd->vd_transpose = margin * info->fb_stride;
+ vd->vd_width = MIN(VT_FB_DEFAULT_WIDTH, info->fb_width);
+ margin = (info->fb_width - vd->vd_width) >> 1;
+ vd->vd_transpose += margin * (info->fb_bpp / NBBY);
if (info->fb_size == 0)
return (CN_DEAD);
diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h
index 31211c8..8d76992 100644
--- a/sys/dev/vt/vt.h
+++ b/sys/dev/vt/vt.h
@@ -138,6 +138,7 @@ struct vt_device {
uint32_t vd_mstate; /* (?) Mouse state. */
vt_axis_t vd_width; /* (?) Screen width. */
vt_axis_t vd_height; /* (?) Screen height. */
+ size_t vd_transpose; /* (?) Screen offset in FB */
struct mtx vd_lock; /* Per-device lock. */
struct cv vd_winswitch; /* (d) Window switch notify. */
struct callout vd_timer; /* (d) Display timer. */
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index 3ed36b3..b661a0f 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -251,8 +251,9 @@ vt_update_static(void *dummy)
if (!vty_enabled(VTY_VT))
return;
if (main_vd->vd_driver != NULL)
- printf("VT: running with driver \"%s\".\n",
- main_vd->vd_driver->vd_name);
+ printf("VT(%s): %s %ux%u\n", main_vd->vd_driver->vd_name,
+ (main_vd->vd_flags & VDF_TEXTMODE) ? "text" : "resolution",
+ main_vd->vd_width, main_vd->vd_height);
else
printf("VT: init without driver.\n");
OpenPOWER on IntegriCloud