chrs2021 Posted June 22, 2006 Share Posted June 22, 2006 Latency issues, I assume, are due to something about the DMA engine, which all goes back to the hardware pointer. If we can figure out this one function, I think we'll have working sound. should i still mess around with my code or do you think it is futile for some like me who has no C++ coding experience Link to comment Share on other sites More sharing options...
thedopefishlives Posted June 22, 2006 Share Posted June 22, 2006 Mess all you want, if you find something, great Although I wouldn't recommend kernel code for someone still exploring C++ syntax and coding practices, perhaps you might magically stumble upon something that the rest of us have overlooked. Link to comment Share on other sites More sharing options...
EdFlyer Posted June 22, 2006 Share Posted June 22, 2006 alright, its time for to dive in to this tonight and update my codebase to the (almost) working code. looks like its gonna be an exciting night. Link to comment Share on other sites More sharing options...
thedopefishlives Posted June 22, 2006 Share Posted June 22, 2006 Between my discovery earlier today and the work everyone here is putting in tonight, we could ostensibly have a halfway decent driver by the weekend Link to comment Share on other sites More sharing options...
EdFlyer Posted June 22, 2006 Share Posted June 22, 2006 I copied in this code from the intel driver IOByteCount CLASS::getDMAEngineHardwarePointer( IOAC97DMAEngineID engine ) { UInt32 remain; // number of samples left in current buffer UInt8 civ; // current descriptor index value UInt8 civ_last; // cached version of prior IOByteCount position; DMAEngineState * dma; AppleAC97AudioIntelHWReg * dmaReg; CHECK_DMA_ENGINE_ID(engine, 0); dma = &fDMAState[engine]; dmaReg = dma->hwReg; // Determine which descriptor within the list of 32 descriptors is // currently being processed. civ = dmaReg->read8( kBMCurrentIndex ); do { // Get the number of samples left to be processed in the // current descriptor. civ_last = civ; remain = dmaReg->read16( kBMPositionInBuffer ); } while ((civ = dmaReg->read8( kBMCurrentIndex )) != civ_last); position = (((civ + 1) * dma->bdBufferSize) - (remain * kBytesPerSample)); DebugLog("%s::%s[%lx] = %lx\n", getName(), __FUNCTION__, engine, position); return position; } And it works, but I have still yet to hear sound (maybe i missed something in the code that i downloaded. It's the last zip that dopefish uploaded.) I'm gonna do some tracing to see what's going on. I see all sorts of information being outputted indicating the hardware pointer is being found. But something doesn't look quite right because it seems to get to something like 3ffff and loops back to 0. and keeps doing that. So i'm not sure. Alright. back to the code. Link to comment Share on other sites More sharing options...
thedopefishlives Posted June 22, 2006 Share Posted June 22, 2006 It *should* do some looping, since it is a ring buffer. Link to comment Share on other sites More sharing options...
EdFlyer Posted June 22, 2006 Share Posted June 22, 2006 I still have yet to hear sound. I'm still getting the popping. It says that the output is going to line out, but I don't have line out, that's probably why I don't hear sound. i'm gonna see if I can figure out why it only has line out and not headphones. Link to comment Share on other sites More sharing options...
thedopefishlives Posted June 22, 2006 Share Posted June 22, 2006 Heh, mine went to speakers and didn't have any problem. *shrugs* I may try to figure your fix into my code, see what that does to the DMA. Link to comment Share on other sites More sharing options...
zelda Posted June 22, 2006 Share Posted June 22, 2006 Dope, I was just looking at your code, it is awesome ... I haven't seen such good code in years (well gotta give it a try once I reach home) Tariq Link to comment Share on other sites More sharing options...
Roxas Posted June 22, 2006 Share Posted June 22, 2006 it would be fricking awesome, if we could get sound work... BYE BYE WINDOWS Have to thank the guys in charge fantastic job..... (Any help on designing the new web site, be my guest(multimedia design student)). Link to comment Share on other sites More sharing options...
thedopefishlives Posted June 22, 2006 Share Posted June 22, 2006 Dope, I was just looking at your code, it is awesome ... I haven't seen such good code in years (well gotta give it a try once I reach home) Tariq Wow, dude, that made my day. All those years of careful coding practices must've really paid off. Link to comment Share on other sites More sharing options...
zelda Posted June 22, 2006 Share Posted June 22, 2006 really dope, very nice code. On another note... I am getting this error while loading ATI...kext (Jas DVD 10.4.6 ..) sudo kextload -t /System/Library/Extensions/AppleAC97Audio.kext Password: kextload: extension /System/Library/Extensions/AppleAC97Audio.kext appears to be valid 20AppleAC97AudioEngine is not compatible with its superclass, 13IOAudioEngine superclass changed? kextload: a link/load error occured for kernel extension /System/Library/Extensions/AppleAC97Audio.kext load failed for extension /System/Library/Extensions/AppleAC97Audio.kext (run kextload with -t for diagnostic output) Could someone help Tariq Link to comment Share on other sites More sharing options...
thedopefishlives Posted June 22, 2006 Share Posted June 22, 2006 Hey all, I found this page for documentation on the ATI IXP chipset and how it works: http://www.jp.netbsd.org/Documentation/Har...I/ixp-audio.txt I'm going to try to use some of the information from it to modify the interrupt handler and see if it helps anything. Link to comment Share on other sites More sharing options...
zelda Posted June 22, 2006 Share Posted June 22, 2006 < xcodebuild > should build the packages ? is it not ? do we need some environment setting or do we need to put package in /Users/noah ? Tariq Link to comment Share on other sites More sharing options...
zelda Posted June 22, 2006 Share Posted June 22, 2006 awesome, sweet music ... (basically combined ed's package and Dope's .cpp .h files) ;-) Let me see how long it continues ... Tariq Link to comment Share on other sites More sharing options...
zelda Posted June 22, 2006 Share Posted June 22, 2006 Nope, only about 5 mins Tariq Link to comment Share on other sites More sharing options...
stugihair Posted June 22, 2006 Share Posted June 22, 2006 Could you post your compiled kext??? Link to comment Share on other sites More sharing options...
thedopefishlives Posted June 22, 2006 Share Posted June 22, 2006 Hang on, guys, I'm having breakthroughs right and left, we might get this licked yet. Ed, I found out the purpose of the whole IOC mechanism, such as is found in the Intel driver. The OS registers a callback to our driver (dma->interruptAction) which is to be called when the driver has finished playing/recording the buffer. I believe that it is this callback which eventually calls stopDMAEngine(). Normally, we would call this on an XRUN interrupt, which (according to the documentation I dug up earlier) signifies the end of the DMA descriptor chain. Our chain doesn't have an end, since it's set up as a ring buffer. I'm going to try hacking up a method to keep track of the "first" DMA descriptor pointer, and calling the IOC callback when the DMA engine advances to that point. I don't know if it's entirely accurate, but perhaps it will be progress. Link to comment Share on other sites More sharing options...
zelda Posted June 22, 2006 Share Posted June 22, 2006 This kext was compiled on JAS DVD with 10.4.6 update. Backup your /System/Library/Extensions/AppleAC97Audio.kext use tar -xjvf atisound.tar.bz2 -C /System/Library/Extensions change permissions Add you device ID to ATI kext inside AppleAC97Audio.kext plugin directory (mine was 4341) Good luck. Tariq sorry couldn't upload bz2 file, renames it to zip, but it is essentially the same. Tariq atisound.tar.bz2.zip Link to comment Share on other sites More sharing options...
thedopefishlives Posted June 22, 2006 Share Posted June 22, 2006 The version I'm uploading right now proves what I just said is right. I have seen calls to performAudioEngineStop() in the debug logs. All that remains now is to determine how long the audio sample is, and stop playback when the sample is complete. Strictly, this release doesn't "work" in the sense that it doesn't always play sound, but it is a proof-of-concept of the IOC mechanism. ATIAppleAC97Audio.zip Link to comment Share on other sites More sharing options...
zelda Posted June 22, 2006 Share Posted June 22, 2006 With this release sound stop's working after 5 min's but then it starts again... good work dope, i guess we are almost there. forgot to mention there is latency problem, could be because of debug logs .. will try to turn them off.. Link to comment Share on other sites More sharing options...
thedopefishlives Posted June 22, 2006 Share Posted June 22, 2006 Perhaps. Latency should improve once the final release version with no debugging output is released. That release was meant, as I said, as proof-of-concept... Sound is spotty and I can't find any patterns in it. Link to comment Share on other sites More sharing options...
Elv13 Posted June 22, 2006 Share Posted June 22, 2006 ok, great step, the driver try to load, but i get this: AppleAC97Audio : Version : 1.0.0 Dernière modification : 06-06-22 11:39 Chaîne des informations : 1.0.0, Copyright Apple Computer, Inc. 2004 Emplacement : /System/Library/Extensions/AppleAC97Audio.kext Version de kext : 1.0.0 Adresse de chargement : 0x2215b000 Valide : Oui Authentique : Oui Dépendances : Incomplètes Erreurs de dépendance : com.apple.iokit.IOAudioFamily : Aucune version valide de cette dépendance n'a été trouvée Intégrité : Cette kext n’a pas de reçu EDIT: NVM, i got it to work, but the voice is ugly, but it work!!!!!!! thanks! now i have 3 fully working os on my laptop EDIT2: Ok, it took 9:52 min to become too much ugly to understand, it is better than 5 minute, the sound dont stop for me, but it lagg a lot ofter this amount of time Link to comment Share on other sites More sharing options...
EdFlyer Posted June 22, 2006 Share Posted June 22, 2006 good work dope....hopefully you can get it 100%, and then I can figure out how to get it to map to the right audio port on my laptop. Link to comment Share on other sites More sharing options...
thedopefishlives Posted June 22, 2006 Share Posted June 22, 2006 good work dope....hopefully you can get it 100%, and then I can figure out how to get it to map to the right audio port on my laptop. I think the latency is caused because the DMA engine runs through all 256 DMA descriptors, and the sound doesn't play until the DMA engine is finished. If I can figure out how to cut off the DMA engine at the right point, I think the latency will improve drastically. Link to comment Share on other sites More sharing options...
Recommended Posts