Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jul 2016 00:03:30 +0000 (UTC)
From:      Peter Grehan <grehan@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r303352 - head/usr.sbin/bhyve
Message-ID:  <201607270003.u6R03UAI030047@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: grehan
Date: Wed Jul 27 00:03:29 2016
New Revision: 303352
URL: https://svnweb.freebsd.org/changeset/base/303352

Log:
  - Change the fbuf "vga" parameter to "vga=on|io|off".
     "io" is the default, and allows VGA i/o registers to be
     accessed. This is required by Win7/2k8 graphics guests that
     use a combination of BIOS int10 and UEFI.
     "off" disables all VGA i/o and mem accesses.
     "on" is not yet hooked up, but will enable full VGA rendering.
  
     OpenBSD/UEFI >= 5.9 graphics guests can be booted using "vga=off"
  
  - Allow "rfb" to be used instead of "tcp" for the fbuf VNC
    description. "tcp" will be removed at a future point and is
    kept as an alias.
  
  Discussed with:	Leon Dang
  MFC after:	3 days

Modified:
  head/usr.sbin/bhyve/pci_fbuf.c

Modified: head/usr.sbin/bhyve/pci_fbuf.c
==============================================================================
--- head/usr.sbin/bhyve/pci_fbuf.c	Wed Jul 27 00:03:18 2016	(r303351)
+++ head/usr.sbin/bhyve/pci_fbuf.c	Wed Jul 27 00:03:29 2016	(r303352)
@@ -95,7 +95,8 @@ struct pci_fbuf_softc {
 	char      *rfb_host;
 	int       rfb_port;
 	int       rfb_wait;
-	int       use_vga;
+	int       vga_enabled;
+	int	  vga_full;
 
 	uint32_t  fbaddr;
 	char      *fb_base;
@@ -114,7 +115,7 @@ pci_fbuf_usage(char *opt)
 {
 
 	fprintf(stderr, "Invalid fbuf emulation \"%s\"\r\n", opt);
-	fprintf(stderr, "fbuf: {wait,}tcp=<ip>:port\r\n");
+	fprintf(stderr, "fbuf: {wait,}{vga=on|io|off,}rfb=<ip>:port\r\n");
 }
 
 static void
@@ -234,13 +235,6 @@ pci_fbuf_parse_opts(struct pci_fbuf_soft
 			continue;
 		}
 
-#if 0 /* notyet */		
-		if (strcmp(xopts, "vga") == 0) {
-			sc->use_vga = 1;
-			continue;
-		}
-#endif
-
 		if ((config = strchr(xopts, '=')) == NULL) {
 			pci_fbuf_usage(xopts);
 			ret = -1;
@@ -252,17 +246,31 @@ pci_fbuf_parse_opts(struct pci_fbuf_soft
 		DPRINTF(DEBUG_VERBOSE, ("pci_fbuf option %s = %s\r\n",
 		   xopts, config));
 
-		if (!strcmp(xopts, "tcp")) {
+		if (!strcmp(xopts, "tcp") || !strcmp(xopts, "rfb")) {
 			/* parse host-ip:port */
-			tmpstr = strsep(&config, ":");
+		        tmpstr = strsep(&config, ":");
 			if (!config)
 				sc->rfb_port = atoi(tmpstr);
 			else {
 				sc->rfb_port = atoi(config);
 				sc->rfb_host = tmpstr;
 			}
-		} else if (!strcmp(xopts, "w")) {
-			sc->memregs.width = atoi(config);
+	        } else if (!strcmp(xopts, "vga")) {
+			if (!strcmp(config, "off")) {
+				sc->vga_enabled = 0;
+			} else if (!strcmp(config, "io")) {
+				sc->vga_enabled = 1;
+				sc->vga_full = 0;
+			} else if (!strcmp(config, "on")) {
+				sc->vga_enabled = 1;
+				sc->vga_full = 1;
+			} else {
+				pci_fbuf_usage(opts);
+				ret = -1;
+				goto done;
+			}
+	        } else if (!strcmp(xopts, "w")) {
+		        sc->memregs.width = atoi(config);
 			if (sc->memregs.width > COLS_MAX) {
 				pci_fbuf_usage(xopts);
 				ret = -1;
@@ -299,7 +307,7 @@ pci_fbuf_render(struct bhyvegc *gc, void
 
 	sc = arg;
 
-	if (sc->use_vga && sc->gc_image->vgamode) {
+	if (sc->vga_full && sc->gc_image->vgamode) {
 		/* TODO: mode switching to vga and vesa should use the special
 		 *      EFI-bhyve protocol port.
 		 */
@@ -352,12 +360,21 @@ pci_fbuf_init(struct vmctx *ctx, struct 
 	sc->memregs.height = ROWS_DEFAULT;
 	sc->memregs.depth  = 32;
 
+	sc->vga_enabled = 1;
+	sc->vga_full = 0;
+
 	sc->fsc_pi = pi;
 
 	error = pci_fbuf_parse_opts(sc, opts);
 	if (error != 0)
 		goto done;
 
+	/* XXX until VGA rendering is enabled */
+	if (sc->vga_full != 0) {
+		fprintf(stderr, "pci_fbuf: VGA rendering not enabled");
+		goto done;
+	}
+
 	sc->fb_base = vm_create_devmem(ctx, VM_FRAMEBUFFER, "framebuffer", FB_SIZE);
 	if (sc->fb_base == MAP_FAILED) {
 		error = -1;
@@ -382,7 +399,8 @@ pci_fbuf_init(struct vmctx *ctx, struct 
 	console_init(sc->memregs.width, sc->memregs.height, sc->fb_base);
 	console_fb_register(pci_fbuf_render, sc);
 
-	sc->vgasc = vga_init(!sc->use_vga);
+	if (sc->vga_enabled)
+		sc->vgasc = vga_init(!sc->vga_full);
 	sc->gc_image = console_get_image();
 
 	fbuf_sc = sc;



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