@samitouri / QOSamiQemu / commits / 12ea77b4c2

ati-vga: Fix DST_PITCH and SRC_PITCH reads

Reading DST_PITCH and SRC_PITCH on the Rage 128 is broken. The read handlers attempt to construct the value from pitch and tile bits in the register state but mistakenly AND them instead of ORing them. This means the pitch is always zero on read. Signed-off-by: Chad Jablonski <chad@jablonski.xyz> Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu> Message-ID: <20260303024730.1489136-3-chad@jablonski.xyz> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Chad Jablonski committed Mar 2, 2026 at 21:47 UTC 12ea77b4c25b8d2c0835cccd6c1719381a1f25ef
1 file changed +2 -2
hw/display/ati.c
+2 -2
@@ -438,7 +438,7 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, unsigned int size)
438 case DST_PITCH:
439 val = s->regs.dst_pitch;
440 if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) {
441 - val &= s->regs.dst_tile << 16;
441 + val |= s->regs.dst_tile << 16;
442 }
443 break;
444 case DST_WIDTH:
@@ -468,7 +468,7 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, unsigned int size)
468 case SRC_PITCH:
469 val = s->regs.src_pitch;
470 if (s->dev_id == PCI_DEVICE_ID_ATI_RAGE128_PF) {
471 - val &= s->regs.src_tile << 16;
471 + val |= s->regs.src_tile << 16;
472 }
473 break;
474 case DP_BRUSH_BKGD_CLR: