* buffer_ready_sem was released with B_DO_NOT_RESCHEDULE, but without
returning B_INVOKE_SCHEDULER from the interrupt handler, causing latencies up to a full quantum for the multi audio output thread. This change improves audio clicks quite a bit on my machine. Though they still happen from time to time and particulary on FS activity. * Automatic whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34633 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -82,19 +82,21 @@ next_corb(hda_controller *controller)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Called with interrupts off
|
/*! Called with interrupts off.
|
||||||
static void
|
Returns \c true, if the scheduler shall be invoked.
|
||||||
|
*/
|
||||||
|
static bool
|
||||||
stream_handle_interrupt(hda_controller* controller, hda_stream* stream)
|
stream_handle_interrupt(hda_controller* controller, hda_stream* stream)
|
||||||
{
|
{
|
||||||
uint8 status;
|
uint8 status;
|
||||||
uint32 position, bufferSize;
|
uint32 position, bufferSize;
|
||||||
|
|
||||||
if (!stream->running)
|
if (!stream->running)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
status = stream->Read8(HDAC_STREAM_STATUS);
|
status = stream->Read8(HDAC_STREAM_STATUS);
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
stream->Write8(HDAC_STREAM_STATUS, status);
|
stream->Write8(HDAC_STREAM_STATUS, status);
|
||||||
|
|
||||||
@@ -105,7 +107,7 @@ stream_handle_interrupt(hda_controller* controller, hda_stream* stream)
|
|||||||
|
|
||||||
if ((status & STATUS_BUFFER_COMPLETED) == 0) {
|
if ((status & STATUS_BUFFER_COMPLETED) == 0) {
|
||||||
dprintf("hda: stream buffer not completed (id:%ld)\n", stream->id);
|
dprintf("hda: stream buffer not completed (id:%ld)\n", stream->id);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
position = stream->Read32(HDAC_STREAM_POSITION);
|
position = stream->Read32(HDAC_STREAM_POSITION);
|
||||||
@@ -129,6 +131,8 @@ stream_handle_interrupt(hda_controller* controller, hda_stream* stream)
|
|||||||
stream->id, stream->buffer_cycle, position);
|
stream->id, stream->buffer_cycle, position);
|
||||||
stream->warn_count++;
|
stream->warn_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -211,8 +215,10 @@ hda_interrupt_handler(hda_controller* controller)
|
|||||||
for (uint32 index = 0; index < HDA_MAX_STREAMS; index++) {
|
for (uint32 index = 0; index < HDA_MAX_STREAMS; index++) {
|
||||||
if ((intrStatus & (1 << index)) != 0) {
|
if ((intrStatus & (1 << index)) != 0) {
|
||||||
if (controller->streams[index]) {
|
if (controller->streams[index]) {
|
||||||
stream_handle_interrupt(controller,
|
if (stream_handle_interrupt(controller,
|
||||||
controller->streams[index]);
|
controller->streams[index])) {
|
||||||
|
handled = B_INVOKE_SCHEDULER;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dprintf("hda: Stream interrupt for unconfigured stream "
|
dprintf("hda: Stream interrupt for unconfigured stream "
|
||||||
"%ld!\n", index);
|
"%ld!\n", index);
|
||||||
|
|||||||
Reference in New Issue
Block a user