Skip to content

Commit ecfa974

Browse files
committed
Added PVIDEO interrupts to PMC
1 parent a5cfd0d commit ecfa974

4 files changed

Lines changed: 45 additions & 11 deletions

File tree

src/nxbx/hw/video/gpu/pmc.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,14 @@ void pmc::Impl::updateIrq()
244244
m_int_status &= ~(1 << NV_PMC_INTR_0_PGRAPH);
245245
}
246246

247+
// Check for pending PVIDEO interrupts
248+
if (m_pvideo->read32(NV_PVIDEO_INTR) & m_pvideo->read32(NV_PVIDEO_INTR_EN)) {
249+
m_int_status |= (1 << NV_PMC_INTR_0_PVIDEO);
250+
}
251+
else {
252+
m_int_status &= ~(1 << NV_PMC_INTR_0_PVIDEO);
253+
}
254+
247255
switch (m_int_enabled)
248256
{
249257
default:

src/nxbx/hw/video/gpu/pmc.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define NV_PMC_INTR_0 (NV2A_REGISTER_BASE + 0x00000100) // Pending interrupts of all engines
2222
#define NV_PMC_INTR_0_PFIFO 8
2323
#define NV_PMC_INTR_0_PGRAPH 12
24+
#define NV_PMC_INTR_0_PVIDEO 16
2425
#define NV_PMC_INTR_0_PTIMER 20
2526
#define NV_PMC_INTR_0_PCRTC 24
2627
#define NV_PMC_INTR_0_SOFTWARE 31

src/nxbx/hw/video/gpu/pvideo.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class pvideo::Impl
3131
// connected devices
3232
pmc *m_pmc;
3333
cpu_t *m_lc86cpu;
34+
// atomic registers
35+
std::atomic_uint32_t m_int_status;
36+
std::atomic_uint32_t m_int_enabled;
3437
// registers
3538
uint32_t debug[11];
3639
uint32_t m_regs[24];
@@ -87,6 +90,16 @@ void pvideo::Impl::write32(uint32_t addr, const uint32_t value)
8790
debug[(addr - NV_PVIDEO_DEBUG_0) >> 2] = value;
8891
break;
8992

93+
case NV_PVIDEO_INTR:
94+
m_int_status &= ~value;
95+
m_pmc->updateIrq();
96+
break;
97+
98+
case NV_PVIDEO_INTR_EN:
99+
m_int_enabled = value;
100+
m_pmc->updateIrq();
101+
break;
102+
90103
case NV_PVIDEO_LUMINANCE(0):
91104
case NV_PVIDEO_LUMINANCE(1):
92105
case NV_PVIDEO_CHROMINANCE(0):
@@ -132,6 +145,14 @@ uint32_t pvideo::Impl::read32(uint32_t addr)
132145
value = debug[(addr - NV_PVIDEO_DEBUG_0) >> 2];
133146
break;
134147

148+
case NV_PVIDEO_INTR:
149+
value = m_int_status;
150+
break;
151+
152+
case NV_PVIDEO_INTR_EN:
153+
value = m_int_enabled;
154+
break;
155+
135156
case NV_PVIDEO_LUMINANCE(0):
136157
case NV_PVIDEO_LUMINANCE(1):
137158
case NV_PVIDEO_CHROMINANCE(0):
@@ -207,6 +228,8 @@ void pvideo::Impl::updateIo(bool is_update)
207228
void
208229
pvideo::Impl::reset()
209230
{
231+
m_int_status = 0;
232+
m_int_enabled = 0;
210233
// Values dumped from a Retail 1.0 xbox
211234
debug[0] = 0x00000010;
212235
debug[1] = 0x00000064;

src/nxbx/hw/video/gpu/pvideo.hpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@
1111
#define NV_PVIDEO_MMIO_BASE (NV2A_REGISTER_BASE + NV_PVIDEO)
1212
#define NV_PVIDEO_SIZE 0x1000
1313

14-
#define NV_PVIDEO_DEBUG_0 (NV2A_REGISTER_BASE + 0x00008080) // Unknown
15-
#define NV_PVIDEO_DEBUG_1 (NV2A_REGISTER_BASE + 0x00008084) // Unknown
16-
#define NV_PVIDEO_DEBUG_2 (NV2A_REGISTER_BASE + 0x00008088) // Unknown
17-
#define NV_PVIDEO_DEBUG_3 (NV2A_REGISTER_BASE + 0x0000808C) // Unknown
18-
#define NV_PVIDEO_DEBUG_4 (NV2A_REGISTER_BASE + 0x00008090) // Unknown
19-
#define NV_PVIDEO_DEBUG_5 (NV2A_REGISTER_BASE + 0x00008094) // Unknown
20-
#define NV_PVIDEO_DEBUG_6 (NV2A_REGISTER_BASE + 0x00008098) // Unknown
21-
#define NV_PVIDEO_DEBUG_7 (NV2A_REGISTER_BASE + 0x0000809C) // Unknown
22-
#define NV_PVIDEO_DEBUG_8 (NV2A_REGISTER_BASE + 0x000080A0) // Unknown
23-
#define NV_PVIDEO_DEBUG_9 (NV2A_REGISTER_BASE + 0x000080A4) // Unknown
24-
#define NV_PVIDEO_DEBUG_10 (NV2A_REGISTER_BASE + 0x000080A8) // Unknown
14+
#define NV_PVIDEO_DEBUG_0 (NV2A_REGISTER_BASE + 0x00008080) // debug flags 0
15+
#define NV_PVIDEO_DEBUG_1 (NV2A_REGISTER_BASE + 0x00008084) // debug flags 1
16+
#define NV_PVIDEO_DEBUG_2 (NV2A_REGISTER_BASE + 0x00008088) // debug flags 2
17+
#define NV_PVIDEO_DEBUG_3 (NV2A_REGISTER_BASE + 0x0000808C) // debug flags 3
18+
#define NV_PVIDEO_DEBUG_4 (NV2A_REGISTER_BASE + 0x00008090) // debug flags 4
19+
#define NV_PVIDEO_DEBUG_5 (NV2A_REGISTER_BASE + 0x00008094) // debug flags 5
20+
#define NV_PVIDEO_DEBUG_6 (NV2A_REGISTER_BASE + 0x00008098) // debug flags 6
21+
#define NV_PVIDEO_DEBUG_7 (NV2A_REGISTER_BASE + 0x0000809C) // debug flags 7
22+
#define NV_PVIDEO_DEBUG_8 (NV2A_REGISTER_BASE + 0x000080A0) // debug flags 8
23+
#define NV_PVIDEO_DEBUG_9 (NV2A_REGISTER_BASE + 0x000080A4) // debug flags 9
24+
#define NV_PVIDEO_DEBUG_10 (NV2A_REGISTER_BASE + 0x000080A8) // debug flags 10
25+
#define NV_PVIDEO_INTR (NV2A_REGISTER_BASE + 0x00008100) // Pending pvideo interrupts. Writing a 0 has no effect, and writing a 1 clears the interrupt
26+
#define NV_PVIDEO_INTR_EN (NV2A_REGISTER_BASE + 0x00008140) // Enable/disable pvideo interrupts
2527
#define NV_PVIDEO_BASE(i) (NV2A_REGISTER_BASE + 0x00008900 + (i) * 4) // TODO
2628
#define NV_PVIDEO_LUMINANCE(i) (NV2A_REGISTER_BASE + 0x00008910 + (i) * 4) // Unknown
2729
#define NV_PVIDEO_CHROMINANCE(i) (NV2A_REGISTER_BASE + 0x00008918 + (i) * 4) // Unknown

0 commit comments

Comments
 (0)