Fix GPU freeze
This commit is contained in:
parent
97b0dbe007
commit
dcf8d1df68
|
@ -63,7 +63,6 @@ namespace JabyEngine {
|
||||||
void enable_CDXA(bool double_speed);
|
void enable_CDXA(bool double_speed);
|
||||||
|
|
||||||
static void pause() {
|
static void pause() {
|
||||||
CD_IO::PortIndex0::change_to();
|
|
||||||
Command::send<CD_IO::PortIndex0>(CD_IO::Command::Pause);
|
Command::send<CD_IO::PortIndex0>(CD_IO::Command::Pause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,6 @@ namespace JabyEngine {
|
||||||
struct XASectorHeader {
|
struct XASectorHeader {
|
||||||
Header header;
|
Header header;
|
||||||
SubHeader sub_header;
|
SubHeader sub_header;
|
||||||
SubHeader copy_subheader;
|
|
||||||
uint32_t part_data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SectorBufferAllocator {
|
class SectorBufferAllocator {
|
||||||
|
|
|
@ -87,8 +87,10 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_sector_to(uint32_t* dst, size_t bytes) {
|
static void read_sector_to(uint32_t* dst, size_t bytes) {
|
||||||
CD_IO::PortIndex0::change_to();
|
|
||||||
CD_IO::PortIndex0::Request.write(CD_IO::Request::want_data());
|
CD_IO::PortIndex0::Request.write(CD_IO::Request::want_data());
|
||||||
|
CD_IO::PortIndex1::change_to();
|
||||||
|
CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlag);
|
||||||
|
CD_IO::PortIndex0::change_to();
|
||||||
|
|
||||||
// We only support DMA rn
|
// We only support DMA rn
|
||||||
read_sector_dma(dst, bytes);
|
read_sector_dma(dst, bytes);
|
||||||
|
@ -125,7 +127,7 @@ namespace JabyEngine {
|
||||||
|
|
||||||
CD_IO::PortIndex1::change_to();
|
CD_IO::PortIndex1::change_to();
|
||||||
const auto cur_irq = CD_IO::Interrupt::get_type(CD_IO::PortIndex1::InterruptFlag);
|
const auto cur_irq = CD_IO::Interrupt::get_type(CD_IO::PortIndex1::InterruptFlag);
|
||||||
CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlag);
|
CD_IO::PortIndex0::change_to();
|
||||||
|
|
||||||
cmd_interrupt_bit = bit::clear(cmd_interrupt_bit, cur_irq);
|
cmd_interrupt_bit = bit::clear(cmd_interrupt_bit, cur_irq);
|
||||||
|
|
||||||
|
@ -142,6 +144,8 @@ namespace JabyEngine {
|
||||||
current_state = State::Done;
|
current_state = State::Done;
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
goto skip_ack;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
@ -172,6 +176,7 @@ namespace JabyEngine {
|
||||||
resume_at(cur_cfg.xa.start_time);
|
resume_at(cur_cfg.xa.start_time);
|
||||||
Command::send<CD_IO::PortIndex0>(CD_IO::Command::ReadS);
|
Command::send<CD_IO::PortIndex0>(CD_IO::Command::ReadS);
|
||||||
}
|
}
|
||||||
|
goto skip_ack;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case CD_IO::Interrupt::DiskError: {
|
case CD_IO::Interrupt::DiskError: {
|
||||||
|
@ -180,6 +185,11 @@ namespace JabyEngine {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CD_IO::PortIndex1::change_to();
|
||||||
|
CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlag);
|
||||||
|
skip_ack:
|
||||||
|
CD_IO::PortIndex0::change_to();
|
||||||
|
|
||||||
// No masking required because we can only write bit 0 - 2
|
// No masking required because we can only write bit 0 - 2
|
||||||
CD_IO::IndexStatus.write(old_status);
|
CD_IO::IndexStatus.write(old_status);
|
||||||
Interrupt::ack_irq(Interrupt::CDROM);
|
Interrupt::ack_irq(Interrupt::CDROM);
|
||||||
|
@ -193,7 +203,6 @@ namespace JabyEngine {
|
||||||
sector_allocator = buffer_allocator;
|
sector_allocator = buffer_allocator;
|
||||||
|
|
||||||
Command::wait_completed();
|
Command::wait_completed();
|
||||||
CD_IO::PortIndex0::change_to();
|
|
||||||
Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetMode, DataSectorMode);
|
Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetMode, DataSectorMode);
|
||||||
|
|
||||||
send_read_n(cur_cfg.file.cur_lba);
|
send_read_n(cur_cfg.file.cur_lba);
|
||||||
|
@ -235,7 +244,6 @@ namespace JabyEngine {
|
||||||
|
|
||||||
void enable_CDDA() {
|
void enable_CDDA() {
|
||||||
Command::wait_completed();
|
Command::wait_completed();
|
||||||
CD_IO::PortIndex0::change_to();
|
|
||||||
Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetMode, AudioSectorMode);
|
Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetMode, AudioSectorMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +254,6 @@ namespace JabyEngine {
|
||||||
const uint8_t mode = XAAudioSectorMode.raw | (double_speed ? DoubleSpeedBit : SingleSpeedBit);
|
const uint8_t mode = XAAudioSectorMode.raw | (double_speed ? DoubleSpeedBit : SingleSpeedBit);
|
||||||
|
|
||||||
Command::wait_completed();
|
Command::wait_completed();
|
||||||
CD_IO::PortIndex0::change_to();
|
|
||||||
Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetMode, mode);
|
Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetMode, mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue