Kernel: Don't stop audio processing after each entry in AC97
This commit is contained in:
parent
d1c814cf9d
commit
7ad3f967db
|
@ -28,7 +28,7 @@ namespace Kernel
|
|||
BAN::ErrorOr<void> initialize_bld();
|
||||
BAN::ErrorOr<void> initialize_interrupts();
|
||||
|
||||
void queue_samples_to_bld();
|
||||
bool queue_samples_to_bld();
|
||||
|
||||
private:
|
||||
static constexpr size_t m_bdl_entries = 32;
|
||||
|
|
|
@ -185,14 +185,10 @@ namespace Kernel
|
|||
void AC97AudioController::handle_new_data()
|
||||
{
|
||||
ASSERT(m_spinlock.current_processor_has_lock());
|
||||
|
||||
if (m_bdl_head != m_bdl_tail)
|
||||
return;
|
||||
|
||||
queue_samples_to_bld();
|
||||
}
|
||||
|
||||
void AC97AudioController::queue_samples_to_bld()
|
||||
bool AC97AudioController::queue_samples_to_bld()
|
||||
{
|
||||
ASSERT(m_spinlock.current_processor_has_lock());
|
||||
|
||||
|
@ -228,7 +224,7 @@ namespace Kernel
|
|||
|
||||
// if head was not updated, no data was queued
|
||||
if (lvi == m_bdl_head)
|
||||
return;
|
||||
return false;
|
||||
|
||||
m_sample_data_blocker.unblock();
|
||||
|
||||
|
@ -238,6 +234,8 @@ namespace Kernel
|
|||
const uint8_t control = m_bus_master->read8(BusMasterRegister::PO_CR);
|
||||
if (!(control & RDBM))
|
||||
m_bus_master->write8(BusMasterRegister::PO_CR, control | RDBM);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AC97AudioController::handle_irq()
|
||||
|
@ -249,17 +247,18 @@ namespace Kernel
|
|||
|
||||
SpinLockGuard _(m_spinlock);
|
||||
|
||||
if (status & LVBCI)
|
||||
bool did_enqueue = false;
|
||||
if (status & BCIS)
|
||||
{
|
||||
m_bdl_tail = (m_bdl_tail + 1) % m_bdl_entries;
|
||||
did_enqueue = queue_samples_to_bld();
|
||||
}
|
||||
|
||||
if ((status & LVBCI) && !did_enqueue)
|
||||
{
|
||||
const uint8_t control = m_bus_master->read8(BusMasterRegister::PO_CR);
|
||||
m_bus_master->write8(BusMasterRegister::PO_CR, control & ~RDBM);
|
||||
}
|
||||
|
||||
if (status & BCIS)
|
||||
{
|
||||
m_bdl_tail = (m_bdl_tail + 1) % m_bdl_entries;
|
||||
queue_samples_to_bld();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue