Don't forget to substract monitors_config area. Memory map of qxl RAM looks something like the following: --------------------- | | | Surface0 Area | | | --------------------- | | | | | Video Pages | | | | | --------------------- | Monitors Config | --------------------- | RAM Header | --------------------- --- src/qxl_driver.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/src/qxl_driver.c b/src/qxl_driver.c index e289c70..1a253d2 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -2453,7 +2453,13 @@ qxl_pre_init (ScrnInfoPtr pScrn, int flags) #else xspice_init_qxl_ram (qxl); /* initialize the rings */ #endif - pScrn->videoRam = (qxl->rom->num_pages * 4096) / 1024; + +#define DIV_ROUND_UP(n, a) (((n) + (a) - 1) / (a)) +#define BYTES_TO_KB(bytes) DIV_ROUND_UP(bytes, 1024) +#define PAGES_TO_KB(pages) ((pages) * getpagesize() / 1024) + + pScrn->videoRam = PAGES_TO_KB(qxl->rom->num_pages) + - BYTES_TO_KB(qxl->monitors_config_size); xf86DrvMsg (scrnIndex, X_INFO, "%d KB of video RAM\n", pScrn->videoRam); xf86DrvMsg (scrnIndex, X_INFO, "%d surfaces\n", qxl->rom->n_surfaces); -- 1.7.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel