Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Aug 2015 15:14:51 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r287128 - in stable/10/sys: amd64/amd64 dev/vt dev/vt/hw/efifb dev/vt/hw/fb
Message-ID:  <201508251514.t7PFEpXX092012@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Tue Aug 25 15:14:50 2015
New Revision: 287128
URL: https://svnweb.freebsd.org/changeset/base/287128

Log:
  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

Modified:
  stable/10/sys/amd64/amd64/pmap.c
  stable/10/sys/dev/vt/hw/efifb/efifb.c
  stable/10/sys/dev/vt/hw/fb/vt_fb.c
  stable/10/sys/dev/vt/vt.h
  stable/10/sys/dev/vt/vt_core.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/10/sys/amd64/amd64/pmap.c	Tue Aug 25 14:49:11 2015	(r287127)
+++ stable/10/sys/amd64/amd64/pmap.c	Tue Aug 25 15:14:50 2015	(r287128)
@@ -701,8 +701,14 @@ nkpt_init(vm_paddr_t addr)
 	 * pmap_growkernel() will need to allocate page table pages to map
 	 * the entire 512GB of KVA space which is an unnecessary tax on
 	 * physical memory.
+	 *
+	 * Secondly, device memory mapped as part of setting up the low-
+	 * level console(s) is taken from KVA, starting at virtual_avail.
+	 * This is because cninit() is called after pmap_bootstrap() but
+	 * before vm_init() and pmap_init(). 20MB for a frame buffer is
+	 * not uncommon.
 	 */
-	pt_pages += 8;		/* 16MB additional slop for kernel modules */
+	pt_pages += 32;		/* 64MB additional slop. */
 #endif
 	nkpt = pt_pages;
 }

Modified: stable/10/sys/dev/vt/hw/efifb/efifb.c
==============================================================================
--- stable/10/sys/dev/vt/hw/efifb/efifb.c	Tue Aug 25 14:49:11 2015	(r287127)
+++ stable/10/sys/dev/vt/hw/efifb/efifb.c	Tue Aug 25 15:14:50 2015	(r287128)
@@ -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);

Modified: stable/10/sys/dev/vt/hw/fb/vt_fb.c
==============================================================================
--- stable/10/sys/dev/vt/hw/fb/vt_fb.c	Tue Aug 25 14:49:11 2015	(r287127)
+++ stable/10/sys/dev/vt/hw/fb/vt_fb.c	Tue Aug 25 15:14:50 2015	(r287128)
@@ -280,6 +280,7 @@ vt_fb_bitblt_bitmap(struct vt_device *vd
 			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);

Modified: stable/10/sys/dev/vt/vt.h
==============================================================================
--- stable/10/sys/dev/vt/vt.h	Tue Aug 25 14:49:11 2015	(r287127)
+++ stable/10/sys/dev/vt/vt.h	Tue Aug 25 15:14:50 2015	(r287128)
@@ -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. */

Modified: stable/10/sys/dev/vt/vt_core.c
==============================================================================
--- stable/10/sys/dev/vt/vt_core.c	Tue Aug 25 14:49:11 2015	(r287127)
+++ stable/10/sys/dev/vt/vt_core.c	Tue Aug 25 15:14:50 2015	(r287128)
@@ -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");
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508251514.t7PFEpXX092012>