b6cccf3
From 5abddb02644d2a63d5dff21c936374d6ac3df31e Mon Sep 17 00:00:00 2001
b6cccf3
From: Adam Jackson <ajax@redhat.com>
b6cccf3
Date: Wed, 16 Feb 2011 17:19:00 -0500
b6cccf3
Subject: [PATCH] Turn shadowfb off on virtualized hardware
b6cccf3
b6cccf3
There's no benefit to shadowfb, since the framebuffer is in the same
b6cccf3
memory domain as host memory; all you're doing is adding extra copies.
b6cccf3
b6cccf3
Signed-off-by: Adam Jackson <ajax@redhat.com>
b6cccf3
---
b6cccf3
 src/vesa.c |   34 +++++++++++++++++++++++++++++++---
b6cccf3
 1 files changed, 31 insertions(+), 3 deletions(-)
b6cccf3
b6cccf3
diff --git a/src/vesa.c b/src/vesa.c
b6cccf3
index 61d3550..9fd166f 100644
b6cccf3
--- a/src/vesa.c
b6cccf3
+++ b/src/vesa.c
b6cccf3
@@ -841,9 +841,37 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
b6cccf3
     memcpy(pVesa->Options, VESAOptions, sizeof(VESAOptions));
b6cccf3
     xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pVesa->Options);
b6cccf3
 
b6cccf3
-    /* Use shadow by default */
b6cccf3
-    if (xf86ReturnOptValBool(pVesa->Options, OPTION_SHADOW_FB, TRUE)) 
b6cccf3
-	pVesa->shadowFB = TRUE;
b6cccf3
+    /* Use shadow by default, for non-virt hardware */
b6cccf3
+    if (!xf86GetOptValBool(pVesa->Options, OPTION_SHADOW_FB, &pVesa->shadowFB))
b6cccf3
+    {
b6cccf3
+	switch (pVesa->pciInfo->vendor_id) {
b6cccf3
+	    case 0x1234: /* bochs vga (not in pci.ids) */
b6cccf3
+	    case 0x15ad: /* vmware */
b6cccf3
+	    case 0x1b36: /* qemu qxl */
b6cccf3
+	    case 0x80ee: /* virtualbox */
b6cccf3
+	    case 0xaaaa: /* parallels (not in pci.ids) */
b6cccf3
+		pVesa->shadowFB = FALSE;
b6cccf3
+		break;
b6cccf3
+
b6cccf3
+	    case 0x1013: /* qemu's cirrus emulation */
b6cccf3
+		if (pVesa->pciInfo->subvendor_id == 0x1af4)
b6cccf3
+		    pVesa->shadowFB = FALSE;
b6cccf3
+		else
b6cccf3
+		    pVesa->shadowFB = TRUE;
b6cccf3
+		break;
b6cccf3
+
b6cccf3
+	    case 0x1414: /* microsoft hyper-v */
b6cccf3
+		if (pVesa->pciInfo->device_id == 0x5353)
b6cccf3
+		    pVesa->shadowFB = FALSE;
b6cccf3
+		else
b6cccf3
+		    pVesa->shadowFB = TRUE;
b6cccf3
+		break;
b6cccf3
+
b6cccf3
+	    default:
b6cccf3
+		pVesa->shadowFB = TRUE;
b6cccf3
+		break;
b6cccf3
+	}	    
b6cccf3
+    }
b6cccf3
 
b6cccf3
     if (xf86ReturnOptValBool(pVesa->Options, OPTION_DFLT_REFRESH, FALSE))
b6cccf3
 	pVesa->defaultRefresh = TRUE;
b6cccf3
-- 
b6cccf3
1.7.3.5
b6cccf3