vga: some cirrus fixes.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTv7CYAAoJEEy22O7T6HE4yC0QALjHJKFT3Y3Fw9JguQdVJvsm
 Dam6p0OhaYLQn11Uh2KvR5vGUGDCZ0z0Y4PGTfWT2PpmRhR8Vxj7RG7FL3cVmcva
 unq88nKcUWK45rInZ1buzDTSZrL5YZXy00wfiBmQ/pGQ4yQ69drkhV0T1QQSCs5g
 +LAENT6DqJgk/6s9T0CmeN7itTMm9O6iOqqw/d13ziHWoHtT2+pAMM3btlyQLaIE
 qRhzOwaBi7+jPZp53xH6GI09aDQrlE71f//R47yKFCbhEsRYMAxwm/uD3rewb+vi
 x/U2tpg77xqelYchHgtb50r5gj4Mur74mqZAKTjqwM49GRhQoJTEMRt8WaZEHFzd
 NeldDea619M5BmuH7XjLvEfNC+bS2EaO80LGBmvkBpP0gZbcIRX2BUZND49+z5Ys
 rSA6KzNJQj+wo52xfteoxIvOSeItuuTt32BeflRNvUVpJXU4FBr7zTq+vlP+Z3dW
 NaM8QDKa8ikWFtzLHRywTrYY97z0FldN0scnsUZObmEzBrN2amEnEgHf2w/pkyd6
 gS1zq6OL8iOZb4T3LWXItbgflqJscuD2eHW9ZH6BRXS6Ejlp5xPAb1Vtvw9Iyo7A
 O1dzDOcyFypCQZrud4kd6/pPiCPp8xDoZN9P+g3sPqQfRDHiPU6fGAftDTPKd2A5
 8gkOX+K9g5RD5jlFxlm6
 =gpXl
 -----END PGP SIGNATURE-----

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

vga: some cirrus fixes.

# gpg: Signature made Fri 11 Jul 2014 10:38:32 BST using RSA key ID D3E87138
# 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>"

* remotes/kraxel/tags/pull-vga-20140711-1:
  cirrus: Fix host CPU blits
  cirrus: Fix build of debug code
  cirrus_vga: adding sanity check for vram size

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-07-11 17:50:38 +01:00
commit ab6d3749c4
2 changed files with 21 additions and 6 deletions

View File

@ -2059,7 +2059,7 @@ static void cirrus_vga_mem_write(void *opaque,
}
} else {
#ifdef DEBUG_CIRRUS
printf("cirrus: mem_writeb " TARGET_FMT_plx " value %02x\n", addr,
printf("cirrus: mem_writeb " TARGET_FMT_plx " value 0x%02" PRIu64 "\n", addr,
mem_value);
#endif
}
@ -2594,7 +2594,7 @@ static void cirrus_vga_ioport_write(void *opaque, hwaddr addr, uint64_t val,
break;
case 0x3c5:
#ifdef DEBUG_VGA_REG
printf("vga: write SR%x = 0x%02x\n", s->sr_index, val);
printf("vga: write SR%x = 0x%02" PRIu64 "\n", s->sr_index, val);
#endif
cirrus_vga_write_sr(c, val);
break;
@ -2619,7 +2619,7 @@ static void cirrus_vga_ioport_write(void *opaque, hwaddr addr, uint64_t val,
break;
case 0x3cf:
#ifdef DEBUG_VGA_REG
printf("vga: write GR%x = 0x%02x\n", s->gr_index, val);
printf("vga: write GR%x = 0x%02" PRIu64 "\n", s->gr_index, val);
#endif
cirrus_vga_write_gr(c, s->gr_index, val);
break;
@ -2630,7 +2630,7 @@ static void cirrus_vga_ioport_write(void *opaque, hwaddr addr, uint64_t val,
case 0x3b5:
case 0x3d5:
#ifdef DEBUG_VGA_REG
printf("vga: write CR%x = 0x%02x\n", s->cr_index, val);
printf("vga: write CR%x = 0x%02"PRIu64"\n", s->cr_index, val);
#endif
cirrus_vga_write_cr(c, val);
break;
@ -2911,6 +2911,14 @@ static void isa_cirrus_vga_realizefn(DeviceState *dev, Error **errp)
ISACirrusVGAState *d = ISA_CIRRUS_VGA(dev);
VGACommonState *s = &d->cirrus_vga.vga;
/* follow real hardware, cirrus card emulated has 4 MB video memory.
Also accept 8 MB/16 MB for backward compatibility. */
if (s->vram_size_mb != 4 && s->vram_size_mb != 8 &&
s->vram_size_mb != 16) {
error_setg(errp, "Invalid cirrus_vga ram size '%u'",
s->vram_size_mb);
return;
}
vga_common_init(s, OBJECT(dev), true);
cirrus_init_common(&d->cirrus_vga, OBJECT(dev), CIRRUS_ID_CLGD5430, 0,
isa_address_space(isadev),
@ -2957,6 +2965,14 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
int16_t device_id = pc->device_id;
/* follow real hardware, cirrus card emulated has 4 MB video memory.
Also accept 8 MB/16 MB for backward compatibility. */
if (s->vga.vram_size_mb != 4 && s->vga.vram_size_mb != 8 &&
s->vga.vram_size_mb != 16) {
error_report("Invalid cirrus_vga ram size '%u'",
s->vga.vram_size_mb);
return -1;
}
/* setup VGA */
vga_common_init(&s->vga, OBJECT(dev), true);
cirrus_init_common(s, OBJECT(dev), device_id, 1, pci_address_space(dev),

View File

@ -52,8 +52,7 @@ glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(CirrusVGAState *s,
dstpitch -= bltwidth;
srcpitch -= bltwidth;
if (dstpitch < 0 || srcpitch < 0) {
/* is 0 valid? srcpitch == 0 could be useful */
if (bltheight > 1 && (dstpitch < 0 || srcpitch < 0)) {
return;
}