mirror of https://github.com/xemu-project/xemu.git
vga: bugfixes for 2.11
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJaBakGAAoJEEy22O7T6HE4BvAQAKyFKukXChjmiM1+DLI/k1L2 sVlu1yFECNnXfm5oSHF9SWIoZliD7PG3KbAoiwaba8bPKXN8oaCajptyWwTciWrD jj1ZUrq13Uz2oVMPciLT4UuEwrBogCMAiCn+QJdBoQZsK85O1mKmdUhH8kyYejtB NrmBJKy6xGTeFd2DJGB2MTqdLv9tx+BSxo/X9quWjxZCVE1pXsEez90ECjTqL6pt JEJLVhQgmoZ+F+P48tmGtIq4vdnqFNSIn8aMSemOxHixabtEO+YJTRwuZfh0+pnR UxKfabYuInG9YArva4p6dvlCFx8f1tKNkIi96BX0UQ+HPeAzgcZG1ygF7PJqqDla whOLRdv/+IwtZxbcbaEh/tkcNzXhNFF18meglG9ncnkRUPNupaWBxbuT3KDLPiSW 3DXqBYZMBht29UukU0tyB6tBAJm48NIJX0+S6PhjtpM5CDB9bgAIOycFTQxYTBCf M24PPM8mMoG5jJo2NRcAbkwI63XQwPJuPToWxfCNPWQSncDutD2/IH753Rt3CTAV JQjgBHE90gTl99a03tGZ6R8jtYBd2Eahkpvrix9b16YduqyP7t8uhuw9VRFmsAaE guhIFV/BA0yOueo1PapKuATN4QowMclQVw/ZGXirDkZ7/HRRFxp8Dpck2vO1eX4S gTaiMDTMjuLyIDw6VfuJ =VUIS -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/vga-20171110-pull-request' into staging vga: bugfixes for 2.11 # gpg: Signature made Fri 10 Nov 2017 13:26:30 GMT # gpg: using RSA key 0x4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/vga-20171110-pull-request: vmsvga: use ARRAY_SIZE macro vga: fix region checks in wraparound case virtio-gpu: fix bug in host memory calculation. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
4e8a737c09
|
@ -1666,9 +1666,9 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
|
|||
/* scanline wraps from end of video memory to the start */
|
||||
assert(force_shadow);
|
||||
update = memory_region_snapshot_get_dirty(&s->vram, snap,
|
||||
page0, 0);
|
||||
page0, s->vbe_size - page0);
|
||||
update |= memory_region_snapshot_get_dirty(&s->vram, snap,
|
||||
page1, 0);
|
||||
0, page1);
|
||||
} else {
|
||||
update = memory_region_snapshot_get_dirty(&s->vram, snap,
|
||||
page0, page1 - page0);
|
||||
|
|
|
@ -322,6 +322,18 @@ static pixman_format_code_t get_pixman_format(uint32_t virtio_gpu_format)
|
|||
}
|
||||
}
|
||||
|
||||
static uint32_t calc_image_hostmem(pixman_format_code_t pformat,
|
||||
uint32_t width, uint32_t height)
|
||||
{
|
||||
/* Copied from pixman/pixman-bits-image.c, skip integer overflow check.
|
||||
* pixman_image_create_bits will fail in case it overflow.
|
||||
*/
|
||||
|
||||
int bpp = PIXMAN_FORMAT_BPP(pformat);
|
||||
int stride = ((width * bpp + 0x1f) >> 5) * sizeof(uint32_t);
|
||||
return height * stride;
|
||||
}
|
||||
|
||||
static void virtio_gpu_resource_create_2d(VirtIOGPU *g,
|
||||
struct virtio_gpu_ctrl_command *cmd)
|
||||
{
|
||||
|
@ -366,7 +378,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g,
|
|||
return;
|
||||
}
|
||||
|
||||
res->hostmem = PIXMAN_FORMAT_BPP(pformat) * c2d.width * c2d.height;
|
||||
res->hostmem = calc_image_hostmem(pformat, c2d.width, c2d.height);
|
||||
if (res->hostmem + g->hostmem < g->conf.max_hostmem) {
|
||||
res->image = pixman_image_create_bits(pformat,
|
||||
c2d.width,
|
||||
|
@ -1087,7 +1099,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
res->hostmem = PIXMAN_FORMAT_BPP(pformat) * res->width * res->height;
|
||||
res->hostmem = calc_image_hostmem(pformat, res->width, res->height);
|
||||
|
||||
res->addrs = g_new(uint64_t, res->iov_cnt);
|
||||
res->iov = g_new(struct iovec, res->iov_cnt);
|
||||
|
|
|
@ -679,10 +679,9 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
|
|||
if (cursor.width > 256
|
||||
|| cursor.height > 256
|
||||
|| cursor.bpp > 32
|
||||
|| SVGA_BITMAP_SIZE(x, y)
|
||||
> sizeof(cursor.mask) / sizeof(cursor.mask[0])
|
||||
|| SVGA_BITMAP_SIZE(x, y) > ARRAY_SIZE(cursor.mask)
|
||||
|| SVGA_PIXMAP_SIZE(x, y, cursor.bpp)
|
||||
> sizeof(cursor.image) / sizeof(cursor.image[0])) {
|
||||
> ARRAY_SIZE(cursor.image)) {
|
||||
goto badcmd;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue