mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 02:11:36 -04:00
debug/fmv: always-on CD data-ready + CD-IRQ-delivery counters in fmv_state
Add two always-on counters (per the no-printf / ring-buffer rule) to diagnose the MMX5 intro-FMV stall: - cdrom.c: s_dataready_fires — CD INT1 (data-ready) raised per streamed sector, exposed via cdrom_get_dataready_fires(). - interrupts.c: g_cdrom_deliver_count — CD IRQ (IRQ_CDROM) exceptions actually taken by the guest. Both surfaced in the fmv_state debug command (cd_dataready_fires / cd_irq_delivered). These proved CD INT1 + CD-IRQ delivery are NOT the MMX5 FMV blocker (fires=627, delivered=746 during the movie while the STR ring still never commits a frame) — narrowing the bug to the CD-DMA-ch3-completion -> frame-commit path. Harmless observability; no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -892,6 +892,9 @@ static int data_fifo_ready(void) {
|
||||
sector_read_pos < sector_size;
|
||||
}
|
||||
|
||||
static uint64_t s_dataready_fires; /* INT1 (data-ready) raised per streamed sector — FMV dispatch probe */
|
||||
uint64_t cdrom_get_dataready_fires(void) { return s_dataready_fires; }
|
||||
|
||||
static int deliver_read_sector(void) {
|
||||
int delivered = read_sector_at(read_min, read_sec, read_sect);
|
||||
advance_msf(&read_min, &read_sec, &read_sect);
|
||||
@@ -900,6 +903,7 @@ static int deliver_read_sector(void) {
|
||||
response_push(stat_reg);
|
||||
set_irq(CDIRQ_DATA_READY);
|
||||
fire_cdrom_irq();
|
||||
s_dataready_fires++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -9172,6 +9172,8 @@ static void handle_fmv_state(int id, const char *json)
|
||||
extern uint32_t mdec_get_decode_count(void);
|
||||
extern int cdrom_xa_stream_active(void);
|
||||
extern uint16_t sio_get_pad_buttons(void);
|
||||
extern uint64_t cdrom_get_dataready_fires(void);
|
||||
extern uint64_t g_cdrom_deliver_count;
|
||||
int auto_skip = -1; uint32_t total_table = 0, movie_id = 0; const char *cfg = "(null)";
|
||||
debug_get_fmv_config(&auto_skip, &total_table, &movie_id, &cfg);
|
||||
MDECDebugState s; mdec_debug_get_state(&s);
|
||||
@@ -9181,11 +9183,14 @@ static void handle_fmv_state(int id, const char *json)
|
||||
"\"fmv_skip_total_table\":\"0x%08X\",\"fmv_skip_movie_id\":\"0x%08X\","
|
||||
"\"mdec_decode_count\":%u,\"mdec_decode_macroblocks\":%u,\"mdec_dma_out_words\":%u,"
|
||||
"\"xa_stream_active\":%d,"
|
||||
"\"cd_dataready_fires\":%llu,\"cd_irq_delivered\":%llu,"
|
||||
"\"pad1\":\"0x%04X\"}",
|
||||
id, cfg ? cfg : "(null)", auto_skip,
|
||||
total_table, movie_id,
|
||||
mdec_get_decode_count(), s.decode_macroblocks, s.dma_out_words,
|
||||
cdrom_xa_stream_active(),
|
||||
(unsigned long long)cdrom_get_dataready_fires(),
|
||||
(unsigned long long)g_cdrom_deliver_count,
|
||||
(unsigned)(sio_get_pad_buttons() & 0xFFFFu));
|
||||
}
|
||||
|
||||
|
||||
@@ -375,6 +375,7 @@ uint64_t g_nestgate_depth, g_nestgate_rfepend, g_nestgate_escreason, g_nestgate_
|
||||
uint64_t g_vblank_raise_count = 0; /* bit0 set at the cycle-paced raise site */
|
||||
uint64_t g_vblank_deliver_count = 0; /* VBLANK delivered to the guest (exception taken) */
|
||||
uint64_t g_irq_deliver_count = 0; /* ANY hardware interrupt delivered */
|
||||
uint64_t g_cdrom_deliver_count = 0; /* CD IRQ (IRQ_CDROM) delivered to the guest — FMV dispatch probe */
|
||||
extern uint64_t g_vblank_ack_count; /* defined in memory.c */
|
||||
|
||||
/* Blocks of guaranteed main-code forward progress imposed after a CLAIMED
|
||||
@@ -766,6 +767,7 @@ void psx_check_interrupts(CPUState* cpu) {
|
||||
}
|
||||
g_irq_deliver_count++;
|
||||
if ((i_stat & i_mask) & (1u << IRQ_VBLANK)) g_vblank_deliver_count++;
|
||||
if ((i_stat & i_mask) & (1u << IRQ_CDROM)) g_cdrom_deliver_count++;
|
||||
/* IRQ-delivery context ring (MMX6 VSync-vs-CD-DMA hunt). Capture, at every IRQ
|
||||
* delivery, whether the kernel VSync callback-block word at 0x80079D44 is the
|
||||
* clobbered game value AND whether a CD DMA (ch3) is mid-transfer / a DMA is
|
||||
|
||||
Reference in New Issue
Block a user