diff options
author | Frediano Ziglio <frediano.ziglio@citrix.com> | 2012-05-07 13:38:57 +0100 |
---|---|---|
committer | Frediano Ziglio <frediano.ziglio@citrix.com> | 2012-05-07 13:38:57 +0100 |
commit | e7ee11ad729ae8cd59241e52fd4bc3e2f90b7918 (patch) | |
tree | 47365b6ef58978b296dae0b9810bbe3639ee33b2 | |
parent | 4da31be1202e9d82f4a0c5b7cb79ec36a941598c (diff) | |
download | xen-e7ee11ad729ae8cd59241e52fd4bc3e2f90b7918.tar.gz xen-e7ee11ad729ae8cd59241e52fd4bc3e2f90b7918.tar.bz2 xen-e7ee11ad729ae8cd59241e52fd4bc3e2f90b7918.zip |
vgabios: Check if mode is currently supported as vesa specifications
Vesa specification require that mode information return if a given
mode is supported or not so test if we can support it checking
required memory and set correctly supported bit.
Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
-rw-r--r-- | tools/firmware/vgabios/vbe.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/firmware/vgabios/vbe.c b/tools/firmware/vgabios/vbe.c index 15f44a8491..9625112573 100644 --- a/tools/firmware/vgabios/vbe.c +++ b/tools/firmware/vgabios/vbe.c @@ -928,10 +928,22 @@ Bit16u *AX;Bit16u CX; Bit16u ES;Bit16u DI; if (cur_info != 0) { + Bit16u max_bpp = dispi_get_max_bpp(); + Bit16u size_64k; + Bit16u totalMemory; + + outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VIDEO_MEMORY_64K); + totalMemory = inw(VBE_DISPI_IOPORT_DATA); #ifdef DEBUG printf("VBE found mode %x\n",CX); #endif memcpyb(ss, &info, 0xc000, &(cur_info->info), sizeof(ModeInfoBlockCompact)); + size_64k = size64(info.XResolution, info.YResolution, info.BitsPerPixel); + if ((info.XResolution > dispi_get_max_xres()) || + (info.BitsPerPixel > max_bpp) || + (size_64k > totalMemory)) + info.ModeAttributes &= ~VBE_MODE_ATTRIBUTE_SUPPORTED; + if (using_lfb) { info.NumberOfBanks = 1; } |