[Spice-devel] [PATCH xf86-drv-qxl F14-branch] limit calculated virtual size to fit within the framebuffer
Hans de Goede
hdegoede at redhat.com
Sun Oct 10 07:26:43 PDT 2010
When running inside a vm with a qxl device with a 8MB framebuffer the
code, for automatically setting the virtualsize to the largest
width and height seen in the resolution list, would lead to a too
large virtual size. The 8MB list has both 1920x1080 and 1600x1200
resolution which lead to a virtualsize of 1920x1200 which does not fit.
---
src/qxl_driver.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index e5d7c34..6d99430 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -1562,8 +1562,17 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
}
if (pScrn->display->virtualX == 0 && pScrn->display->virtualY == 0) {
+ /* It is possible for the largest x + largest y size combined leading
+ to a virtual size which will not fit into the framebuffer when this
+ happens we prefer max width and make height as large as possible */
+ if (max_x * max_y * (pScrn->bitsPerPixel / 8) >
+ qxl->rom->surface0_area_size)
+ pScrn->display->virtualY = qxl->rom->surface0_area_size /
+ (max_x * (pScrn->bitsPerPixel / 8));
+ else
+ pScrn->display->virtualY = max_y;
+
pScrn->display->virtualX = max_x;
- pScrn->display->virtualY = max_y;
}
if (0 >= xf86ValidateModes(pScrn, pScrn->monitor->Modes,
--
1.7.2.2
More information about the Spice-devel
mailing list