[PATCH] Turn shadowfb off on virtualized hardware

Adam Jackson ajax at redhat.com
Thu Feb 17 08:08:31 PST 2011


There's no benefit to shadowfb, since the framebuffer is in the same
memory domain as host memory; all you're doing is adding extra copies.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 src/vesa.c |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/src/vesa.c b/src/vesa.c
index 61d3550..9fd166f 100644
--- a/src/vesa.c
+++ b/src/vesa.c
@@ -841,9 +841,37 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
     memcpy(pVesa->Options, VESAOptions, sizeof(VESAOptions));
     xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pVesa->Options);
 
-    /* Use shadow by default */
-    if (xf86ReturnOptValBool(pVesa->Options, OPTION_SHADOW_FB, TRUE)) 
-	pVesa->shadowFB = TRUE;
+    /* Use shadow by default, for non-virt hardware */
+    if (!xf86GetOptValBool(pVesa->Options, OPTION_SHADOW_FB, &pVesa->shadowFB))
+    {
+	switch (pVesa->pciInfo->vendor_id) {
+	    case 0x1234: /* bochs vga (not in pci.ids) */
+	    case 0x15ad: /* vmware */
+	    case 0x1b36: /* qemu qxl */
+	    case 0x80ee: /* virtualbox */
+	    case 0xaaaa: /* parallels (not in pci.ids) */
+		pVesa->shadowFB = FALSE;
+		break;
+
+	    case 0x1013: /* qemu's cirrus emulation */
+		if (pVesa->pciInfo->subvendor_id == 0x1af4)
+		    pVesa->shadowFB = FALSE;
+		else
+		    pVesa->shadowFB = TRUE;
+		break;
+
+	    case 0x1414: /* microsoft hyper-v */
+		if (pVesa->pciInfo->device_id == 0x5353)
+		    pVesa->shadowFB = FALSE;
+		else
+		    pVesa->shadowFB = TRUE;
+		break;
+
+	    default:
+		pVesa->shadowFB = TRUE;
+		break;
+	}	    
+    }
 
     if (xf86ReturnOptValBool(pVesa->Options, OPTION_DFLT_REFRESH, FALSE))
 	pVesa->defaultRefresh = TRUE;
-- 
1.7.3.5



More information about the xorg-devel mailing list