From ea9f99f3fb20c068154164ce98740ba55e26ea79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 10 Sep 2009 22:55:02 +0000 Subject: [PATCH] try to align the offset to be more compliant git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33047 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/audio/hda/hda_controller.cpp | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp b/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp index 47176bf37e..fcade1a565 100644 --- a/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp +++ b/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp @@ -119,13 +119,6 @@ stream_handle_interrupt(hda_controller* controller, hda_stream* stream) stream->frames_count += stream->buffer_length; stream->buffer_cycle = position / bufferSize; - // playback interrupts come early, offsets don't work on non intel - // TODO find out why - if (stream->type == STREAM_PLAYBACK - && stream->controller->pci_info.vendor_id != INTEL_VENDORID) { - stream->buffer_cycle++; - } - release_spinlock(&stream->lock); release_sem_etc(controller->buffer_ready_sem, 1, B_DO_NOT_RESCHEDULE); @@ -563,13 +556,18 @@ hda_stream_setup_buffers(hda_audio_group* audioGroup, hda_stream* stream, // TODO check on other vendors, see in stream_handle_interrupt() // Tested only on Intel ICH8 uint32 offset = 0; - if (stream->type == STREAM_PLAYBACK && stream->controller->pci_info.vendor_id == INTEL_VENDORID) { - if (stream->sample_size == 2) - offset = 6; - else if (stream->sample_size > 2) - offset = 8; + if (stream->type == STREAM_PLAYBACK) { + if (stream->controller->pci_info.vendor_id == INTEL_VENDORID) { + if (stream->sample_size == 2) + offset = 3; + else if (stream->sample_size > 2) + offset = 4; + } else { + offset = 11; + } + offset *= 64; + offset = ALIGN(offset, 128); } - offset *= 32; /* Calculate size of buffer (aligned to 128 bytes) */ bufferSize = stream->sample_size * stream->num_channels