From 713ef4585b362f90cd41f6b5e81d4722f98d157c Mon Sep 17 00:00:00 2001 From: starfrost013 Date: Tue, 31 Dec 2024 16:36:24 +0000 Subject: [PATCH] PRMVIO and interrupt fixes. --- src/video/nv/nv3/nv3_core.c | 6 ++++++ src/video/nv/nv3/subsystems/nv3_pgraph.c | 2 +- src/video/nv/nv3/subsystems/nv3_pmc.c | 7 +++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/video/nv/nv3/nv3_core.c b/src/video/nv/nv3/nv3_core.c index e736e0c79..a7caa0b2b 100644 --- a/src/video/nv/nv3/nv3_core.c +++ b/src/video/nv/nv3/nv3_core.c @@ -120,6 +120,8 @@ uint32_t nv3_mmio_read32(uint32_t addr, void* priv) // Write 8-bit MMIO void nv3_mmio_write8(uint32_t addr, uint8_t val, void* priv) { + addr &= 0xFFFFFF; + // This is weitek vga stuff if (addr >= NV3_PRMVIO_START && addr <= NV3_PRMVIO_END) @@ -144,6 +146,8 @@ void nv3_mmio_write8(uint32_t addr, uint8_t val, void* priv) // Write 16-bit MMIO void nv3_mmio_write16(uint32_t addr, uint16_t val, void* priv) { + addr &= 0xFFFFFF; + // This is weitek vga stuff if (addr >= NV3_PRMVIO_START && addr <= NV3_PRMVIO_END) @@ -169,6 +173,8 @@ void nv3_mmio_write16(uint32_t addr, uint16_t val, void* priv) // Write 32-bit MMIO void nv3_mmio_write32(uint32_t addr, uint32_t val, void* priv) { + addr &= 0xFFFFFF; + // This is weitek vga stuff if (addr >= NV3_PRMVIO_START && addr <= NV3_PRMVIO_END) diff --git a/src/video/nv/nv3/subsystems/nv3_pgraph.c b/src/video/nv/nv3/subsystems/nv3_pgraph.c index 9dfca4f00..1d44a3f94 100644 --- a/src/video/nv/nv3/subsystems/nv3_pgraph.c +++ b/src/video/nv/nv3/subsystems/nv3_pgraph.c @@ -231,7 +231,7 @@ void nv3_pgraph_write(uint32_t address, uint32_t value) // Fire a VALID Pgraph interrupt: num is the bit# of the interrupt in the GPU subsystem INTR_EN register. void nv3_pgraph_interrupt_valid(uint32_t num) { - nv3->pgraph.interrupt_enable_0 |= (1 << num); + nv3->pgraph.interrupt_status_0 |= (1 << num); nv3_pmc_handle_interrupts(true); } diff --git a/src/video/nv/nv3/subsystems/nv3_pmc.c b/src/video/nv/nv3/subsystems/nv3_pmc.c index 6b2b51b09..1cc28140c 100644 --- a/src/video/nv/nv3/subsystems/nv3_pmc.c +++ b/src/video/nv/nv3/subsystems/nv3_pmc.c @@ -89,9 +89,12 @@ uint32_t nv3_pmc_handle_interrupts(bool send_now) new_intr_value |= (NV3_PMC_INTERRUPT_PFIFO_PENDING << NV3_PMC_INTERRUPT_PFIFO); // PFB interrupt is VBLANK PGRAPH interrupt...what nvidia...clean this up once we verify it - if (nv3->pgraph.interrupt_status_0 & (1 << 8)) + if (nv3->pgraph.interrupt_status_0 & (1 << 8) + && nv3->pgraph.interrupt_enable_0 & (1 << 8)) new_intr_value |= (NV3_PMC_INTERRUPT_PFB_PENDING << NV3_PMC_INTERRUPT_PFB); - else if (nv3->pgraph.interrupt_status_0 & ~(1 << 8)) // otherwise PGRAPH-0 interurpt + + if (nv3->pgraph.interrupt_status_0 & ~(1 << 8) + && nv3->pgraph.interrupt_enable_0 & ~(1 << 8)) // otherwise PGRAPH-0 interurpt new_intr_value |= (NV3_PMC_INTERRUPT_PGRAPH0_PENDING << NV3_PMC_INTERRUPT_PGRAPH0); // Check second pgraph interrupt register