qxl: fix flickering.

cirrus: avoid devision by zero.
 virtio-gpu: fix two leaks.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJYRUexAAoJEEy22O7T6HE4qUcQAJVIgTcP1BjPep0nRWo0+/y3
 +4O3x65CeTRNnfKhWyIPtFguc6qONWpp8zzZF6QVjx40on6qfgx2oXI9dUO30E5L
 s3Kzh+6OksWvBbWPxzTJk5IY0hWSwx+8T/4z+XaRwgt42vJwwojPetEMXamB66lA
 ElyH6ch8nBfnemBYOFbcNl4OVle8FA1S9VllBmsTAPIEeVt4C4Vp/8v/Fp+ntO2h
 YfpJgzxbW5ANaYdUEjLeyk++s7uD6y3drPcCeqvAbxS/bGiRzIA30bRAy4Wt0p8P
 /rU7Imk5aYK2/3ER7pxEZZD2/uj7XeIt9d1mNPyt6hoKDvR6PkERVIBb3h4B9MBq
 Yw/jFncYfe5lTeozgdow4iSTAKD7gAp0C9wuuFfB4CGRVXW2PZOjTKcZ5F9vlv9/
 vept0CiLI8gup34HZlxalU04EIOIgqywh3DU/Wo1QSchtlAEvQZwSL1n6pb7RlCE
 SmRvGClPwHg/bCDcR+yCZOUjJv0ULXW5gnf8JTDJiHppaZ/ZhSVlV0P7hEqZLz3n
 eWKWfNmqbhb7Y4ubrpuMbuzi13OTga7+TnXuquh7NpI+uu1buZ53jcGMF1SjKuxq
 b2ZalyMb2TE+86Fwjr5OmdPpfzLZqlTLa6e+Zw4iGSkdylR+XEogmiG5H+JMDDmX
 /F6kvG/LpC6ekfYn+2id
 =CU8H
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'kraxel/tags/pull-vga-20161205-1' into staging

qxl: fix flickering.
cirrus: avoid devision by zero.
virtio-gpu: fix two leaks.

# gpg: Signature made Mon 05 Dec 2016 10:55:45 AM 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

* kraxel/tags/pull-vga-20161205-1:
  display: cirrus: check vga bits per pixel(bpp) value
  virtio-gpu: fix memory leak in update_cursor_data_virgl
  virtio-gpu: fix information leak in getting capset info dispatch
  qxl: Only emit QXL_INTERRUPT_CLIENT_MONITORS_CONFIG on config changes

Message-id: 1480935840-3961-1-git-send-email-kraxel@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2016-12-06 09:38:39 +00:00
commit e24f095e44
4 changed files with 48 additions and 5 deletions

View file

@ -272,6 +272,9 @@ static void cirrus_update_memory_access(CirrusVGAState *s);
static bool blit_region_is_unsafe(struct CirrusVGAState *s,
int32_t pitch, int32_t addr)
{
if (!pitch) {
return true;
}
if (pitch < 0) {
int64_t min = addr
+ ((int64_t)s->cirrus_blt_height-1) * pitch;
@ -715,7 +718,7 @@ static int cirrus_bitblt_videotovideo_patterncopy(CirrusVGAState * s)
s->cirrus_addr_mask));
}
static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
{
int sx = 0, sy = 0;
int dx = 0, dy = 0;
@ -729,6 +732,9 @@ static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
int width, height;
depth = s->vga.get_bpp(&s->vga) / 8;
if (!depth) {
return 0;
}
s->vga.get_resolution(&s->vga, &width, &height);
/* extra x, y */
@ -783,6 +789,8 @@ static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,
s->cirrus_blt_dstpitch, s->cirrus_blt_width,
s->cirrus_blt_height);
return 1;
}
static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s)
@ -790,11 +798,9 @@ static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s)
if (blit_is_unsafe(s))
return 0;
cirrus_do_copy(s, s->cirrus_blt_dstaddr - s->vga.start_addr,
return cirrus_do_copy(s, s->cirrus_blt_dstaddr - s->vga.start_addr,
s->cirrus_blt_srcaddr - s->vga.start_addr,
s->cirrus_blt_width, s->cirrus_blt_height);
return 1;
}
/***************************************

View file

@ -992,6 +992,34 @@ static uint32_t qxl_crc32(const uint8_t *p, unsigned len)
return crc32(0xffffffff, p, len) ^ 0xffffffff;
}
static bool qxl_rom_monitors_config_changed(QXLRom *rom,
VDAgentMonitorsConfig *monitors_config,
unsigned int max_outputs)
{
int i;
unsigned int monitors_count;
monitors_count = MIN(monitors_config->num_of_monitors, max_outputs);
if (rom->client_monitors_config.count != monitors_count) {
return true;
}
for (i = 0 ; i < rom->client_monitors_config.count ; ++i) {
VDAgentMonConfig *monitor = &monitors_config->monitors[i];
QXLURect *rect = &rom->client_monitors_config.heads[i];
/* monitor->depth ignored */
if ((rect->left != monitor->x) ||
(rect->top != monitor->y) ||
(rect->right != monitor->x + monitor->width) ||
(rect->bottom != monitor->y + monitor->height)) {
return true;
}
}
return false;
}
/* called from main context only */
static int interface_client_monitors_config(QXLInstance *sin,
VDAgentMonitorsConfig *monitors_config)
@ -1000,6 +1028,7 @@ static int interface_client_monitors_config(QXLInstance *sin,
QXLRom *rom = memory_region_get_ram_ptr(&qxl->rom_bar);
int i;
unsigned max_outputs = ARRAY_SIZE(rom->client_monitors_config.heads);
bool config_changed = false;
if (qxl->revision < 4) {
trace_qxl_client_monitors_config_unsupported_by_device(qxl->id,
@ -1030,6 +1059,10 @@ static int interface_client_monitors_config(QXLInstance *sin,
}
#endif
config_changed = qxl_rom_monitors_config_changed(rom,
monitors_config,
max_outputs);
memset(&rom->client_monitors_config, 0,
sizeof(rom->client_monitors_config));
rom->client_monitors_config.count = monitors_config->num_of_monitors;
@ -1059,7 +1092,9 @@ static int interface_client_monitors_config(QXLInstance *sin,
trace_qxl_interrupt_client_monitors_config(qxl->id,
rom->client_monitors_config.count,
rom->client_monitors_config.heads);
qxl_send_events(qxl, QXL_INTERRUPT_CLIENT_MONITORS_CONFIG);
if (config_changed) {
qxl_send_events(qxl, QXL_INTERRUPT_CLIENT_MONITORS_CONFIG);
}
return 1;
}

View file

@ -347,6 +347,7 @@ static void virgl_cmd_get_capset_info(VirtIOGPU *g,
VIRTIO_GPU_FILL_CMD(info);
memset(&resp, 0, sizeof(resp));
if (info.capset_index == 0) {
resp.capset_id = VIRTIO_GPU_CAPSET_VIRGL;
virgl_renderer_get_cap_set(resp.capset_id,

View file

@ -84,6 +84,7 @@ static void update_cursor_data_virgl(VirtIOGPU *g,
if (width != s->current_cursor->width ||
height != s->current_cursor->height) {
free(data);
return;
}