we now print a warning message in the log when the interrupt comes in the second half of a buffer: this should mean the interrupt comes earlier than expected.

Please report such warnings, they can help to investigate timing issues with some hda codecs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32589 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2009-08-21 21:55:40 +00:00
parent 4271a1354c
commit 1f5d96afb8
2 changed files with 10 additions and 2 deletions
@@ -130,6 +130,7 @@ struct hda_stream {
bool running;
spinlock lock; /* Write lock */
uint32 type;
int32 warn_count;
hda_controller* controller;
@@ -104,7 +104,8 @@ stream_handle_interrupt(hda_controller* controller, hda_stream* stream)
}
position = stream->Read32(HDAC_STREAM_POSITION);
bufferSize = ALIGN(stream->sample_size * stream->num_channels * stream->buffer_length, 128);
bufferSize = ALIGN(stream->sample_size * stream->num_channels
* stream->buffer_length, 128);
// Buffer Completed Interrupt
acquire_spinlock(&stream->lock);
@@ -117,7 +118,12 @@ stream_handle_interrupt(hda_controller* controller, hda_stream* stream)
release_sem_etc(controller->buffer_ready_sem, 1, B_DO_NOT_RESCHEDULE);
//dprintf("stream_handle_interrupt %d %d %ld\n", stream->id, stream->buffer_cycle, position);
if (stream->warn_count < 20
&& (position - stream->buffer_cycle * bufferSize) > (bufferSize >> 1)) {
dprintf("hda: stream incorrect position %ld %ld %ld\n",
stream->id, stream->buffer_cycle, position);
stream->warn_count++;
}
}
@@ -414,6 +420,7 @@ hda_stream_new(hda_audio_group* audioGroup, int type)
stream->buffer_descriptors_area = B_ERROR;
stream->type = type;
stream->controller = controller;
stream->warn_count = 0;
switch (type) {
case STREAM_PLAYBACK: