All of lore.kernel.org
 help / color / mirror / Atom feed
* Implementing isochronous transfers in hw/hcd-ohci.c
@ 2021-09-09 21:06 Programmingkid
  2021-09-10  5:07 ` Gerd Hoffmann
  0 siblings, 1 reply; 8+ messages in thread
From: Programmingkid @ 2021-09-09 21:06 UTC (permalink / raw)
  To: Gerd Hoffmann, QEMU Developers; +Cc: Howard Spoelstra

Hi Gerd,

Howard and I were talking about USB audio problems with Mac OS guests. We think the issue might be with frames being sent to the USB audio card too soon. My guess is only one frame is suppose to be transmitted every 1 millisecond. I was also reading the todo notes in the file hw/hcd-ohci.c. This is what it says:

 * TODO:
 *  o Isochronous transfers
 *  o Allocate bandwidth in frames properly
 *  o Disable timers when nothing needs to be done, or remove timer usage
 *    all together.
 *  o BIOS work to boot from USB storage
*/

Do you think implementing isochronous transfers would fix the audio problems Mac OS guest are experiencing?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Implementing isochronous transfers in hw/hcd-ohci.c
  2021-09-09 21:06 Implementing isochronous transfers in hw/hcd-ohci.c Programmingkid
@ 2021-09-10  5:07 ` Gerd Hoffmann
  2021-09-10  6:12   ` Howard Spoelstra
  0 siblings, 1 reply; 8+ messages in thread
From: Gerd Hoffmann @ 2021-09-10  5:07 UTC (permalink / raw)
  To: Programmingkid; +Cc: QEMU Developers, Howard Spoelstra

On Thu, Sep 09, 2021 at 05:06:17PM -0400, Programmingkid wrote:
> Hi Gerd,
> 
> Howard and I were talking about USB audio problems with Mac OS guests. We think the issue might be with frames being sent to the USB audio card too soon. My guess is only one frame is suppose to be transmitted every 1 millisecond. I was also reading the todo notes in the file hw/hcd-ohci.c. This is what it says:
> 
>  * TODO:
>  *  o Isochronous transfers
>  *  o Allocate bandwidth in frames properly
>  *  o Disable timers when nothing needs to be done, or remove timer usage
>  *    all together.
>  *  o BIOS work to boot from USB storage
> */
> 
> Do you think implementing isochronous transfers would fix the audio problems Mac OS guest are experiencing?

Most likely yes, audio devices typically use iso endpints.

take care,
  Gerd



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Implementing isochronous transfers in hw/hcd-ohci.c
  2021-09-10  5:07 ` Gerd Hoffmann
@ 2021-09-10  6:12   ` Howard Spoelstra
  2021-09-10  7:51     ` Gerd Hoffmann
  2021-09-10 11:51     ` BALATON Zoltan
  0 siblings, 2 replies; 8+ messages in thread
From: Howard Spoelstra @ 2021-09-10  6:12 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Programmingkid, QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 1791 bytes --]

On Fri, Sep 10, 2021 at 7:07 AM Gerd Hoffmann <kraxel@redhat.com> wrote:

> On Thu, Sep 09, 2021 at 05:06:17PM -0400, Programmingkid wrote:
> > Hi Gerd,
> >
> > Howard and I were talking about USB audio problems with Mac OS guests.
> We think the issue might be with frames being sent to the USB audio card
> too soon. My guess is only one frame is suppose to be transmitted every 1
> millisecond. I was also reading the todo notes in the file hw/hcd-ohci.c.
> This is what it says:
> >
> >  * TODO:
> >  *  o Isochronous transfers
> >  *  o Allocate bandwidth in frames properly
> >  *  o Disable timers when nothing needs to be done, or remove timer usage
> >  *    all together.
> >  *  o BIOS work to boot from USB storage
> > */
> >
> > Do you think implementing isochronous transfers would fix the audio
> problems Mac OS guest are experiencing?
>
> Most likely yes, audio devices typically use iso endpints.
>
> take care,
>   Gerd
>

Hi,

Below I pasted the first lines mentioning isochronous traffic from a pcap
file when running fedora12 with the usb-audio device and the first lines
from a pcap file running Mac OS 9.2 with the usb-audio device

Fedora:
91 56.715001 host 0.5.1 USB 256 URB_ISOCHRONOUS out
92 56.715018 0.5.1 host USB 64 URB_ISOCHRONOUS out

MacOS:
143 56.031989 host 0.16.1 USB 256 URB_ISOCHRONOUS out
144 56.032026 0.16.1 host USB 64 URB_ISOCHRONOUS out

The usb-audio device works for the fedora guest, so would this not indicate
that the iso endpoints are already working?

The usb-audio device also work (for a limited amount of time) when running
MacOS. Looking at USB logging in the Mac OS guest, to me it seems the MacOS
side runs into timing issues when packages drift too far apart. It then
finally gives up trying to keep the stream open.

Best,
Howard

[-- Attachment #2: Type: text/html, Size: 2442 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Implementing isochronous transfers in hw/hcd-ohci.c
  2021-09-10  6:12   ` Howard Spoelstra
@ 2021-09-10  7:51     ` Gerd Hoffmann
  2021-09-10 11:51     ` BALATON Zoltan
  1 sibling, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2021-09-10  7:51 UTC (permalink / raw)
  To: Howard Spoelstra; +Cc: Programmingkid, QEMU Developers

  Hi,

> > >  * TODO:
> > >  *  o Isochronous transfers

> > Most likely yes, audio devices typically use iso endpints.

> The usb-audio device works for the fedora guest, so would this not indicate
> that the iso endpoints are already working?

Indeed, so probably the comment is just outdated.

take care,
  Gerd



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Implementing isochronous transfers in hw/hcd-ohci.c
  2021-09-10  6:12   ` Howard Spoelstra
  2021-09-10  7:51     ` Gerd Hoffmann
@ 2021-09-10 11:51     ` BALATON Zoltan
  2021-09-10 19:23       ` Programmingkid
  1 sibling, 1 reply; 8+ messages in thread
From: BALATON Zoltan @ 2021-09-10 11:51 UTC (permalink / raw)
  To: Howard Spoelstra; +Cc: Programmingkid, Gerd Hoffmann, QEMU Developers

On Fri, 10 Sep 2021, Howard Spoelstra wrote:
> On Fri, Sep 10, 2021 at 7:07 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
>
>> On Thu, Sep 09, 2021 at 05:06:17PM -0400, Programmingkid wrote:
>>> Hi Gerd,
>>>
>>> Howard and I were talking about USB audio problems with Mac OS guests.
>> We think the issue might be with frames being sent to the USB audio card
>> too soon. My guess is only one frame is suppose to be transmitted every 1
>> millisecond. I was also reading the todo notes in the file hw/hcd-ohci.c.
>> This is what it says:
>>>
>>>  * TODO:
>>>  *  o Isochronous transfers
>>>  *  o Allocate bandwidth in frames properly
>>>  *  o Disable timers when nothing needs to be done, or remove timer usage
>>>  *    all together.
>>>  *  o BIOS work to boot from USB storage
>>> */
>>>
>>> Do you think implementing isochronous transfers would fix the audio
>> problems Mac OS guest are experiencing?
>>
>> Most likely yes, audio devices typically use iso endpints.
>>
>> take care,
>>   Gerd
>>
>
> Hi,
>
> Below I pasted the first lines mentioning isochronous traffic from a pcap
> file when running fedora12 with the usb-audio device and the first lines
> from a pcap file running Mac OS 9.2 with the usb-audio device
>
> Fedora:
> 91 56.715001 host 0.5.1 USB 256 URB_ISOCHRONOUS out
> 92 56.715018 0.5.1 host USB 64 URB_ISOCHRONOUS out
>
> MacOS:
> 143 56.031989 host 0.16.1 USB 256 URB_ISOCHRONOUS out
> 144 56.032026 0.16.1 host USB 64 URB_ISOCHRONOUS out
>
> The usb-audio device works for the fedora guest, so would this not indicate
> that the iso endpoints are already working?
>
> The usb-audio device also work (for a limited amount of time) when running
> MacOS. Looking at USB logging in the Mac OS guest, to me it seems the MacOS
> side runs into timing issues when packages drift too far apart. It then
> finally gives up trying to keep the stream open.

I was also trying to find why the usb-audio device does not work with 
MorphOS but I could not figure it out. Now I have two machines (mac99 and 
pegasos2) that can boot MorphOS but usb-audio does not work with either so 
maybe it's not because of the USB controller. I've found there is a debug 
property that enables some logging: -device usb-audio,debug=1 but that did 
not reveal much more. It looks like MorphOS tries to query the device but 
replies come very slow (not sure if that's normal or a problem) then just 
gives up after a while. Maybe you can try comparing what Fedora and other 
OSes query as it may be we're missing some info in USB descriptors that 
other drivers than Linux's rely on but that's just a guess I haven't 
tested with Linux guest on pegasos2 or mac99 yet.

Regards,
BALATON Zoltan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Implementing isochronous transfers in hw/hcd-ohci.c
  2021-09-10 11:51     ` BALATON Zoltan
@ 2021-09-10 19:23       ` Programmingkid
  2021-09-11  9:46         ` Howard Spoelstra
  0 siblings, 1 reply; 8+ messages in thread
From: Programmingkid @ 2021-09-10 19:23 UTC (permalink / raw)
  To: BALATON Zoltan; +Cc: QEMU Developers, Gerd Hoffmann, Howard Spoelstra



> On Sep 10, 2021, at 7:51 AM, BALATON Zoltan <balaton@eik.bme.hu> wrote:
> 
> On Fri, 10 Sep 2021, Howard Spoelstra wrote:
>> On Fri, Sep 10, 2021 at 7:07 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
>> 
>>> On Thu, Sep 09, 2021 at 05:06:17PM -0400, Programmingkid wrote:
>>>> Hi Gerd,
>>>> 
>>>> Howard and I were talking about USB audio problems with Mac OS guests.
>>> We think the issue might be with frames being sent to the USB audio card
>>> too soon. My guess is only one frame is suppose to be transmitted every 1
>>> millisecond. I was also reading the todo notes in the file hw/hcd-ohci.c.
>>> This is what it says:
>>>> 
>>>> * TODO:
>>>> *  o Isochronous transfers
>>>> *  o Allocate bandwidth in frames properly
>>>> *  o Disable timers when nothing needs to be done, or remove timer usage
>>>> *    all together.
>>>> *  o BIOS work to boot from USB storage
>>>> */
>>>> 
>>>> Do you think implementing isochronous transfers would fix the audio
>>> problems Mac OS guest are experiencing?
>>> 
>>> Most likely yes, audio devices typically use iso endpints.
>>> 
>>> take care,
>>>  Gerd
>>> 
>> 
>> Hi,
>> 
>> Below I pasted the first lines mentioning isochronous traffic from a pcap
>> file when running fedora12 with the usb-audio device and the first lines
>> from a pcap file running Mac OS 9.2 with the usb-audio device
>> 
>> Fedora:
>> 91 56.715001 host 0.5.1 USB 256 URB_ISOCHRONOUS out
>> 92 56.715018 0.5.1 host USB 64 URB_ISOCHRONOUS out
>> 
>> MacOS:
>> 143 56.031989 host 0.16.1 USB 256 URB_ISOCHRONOUS out
>> 144 56.032026 0.16.1 host USB 64 URB_ISOCHRONOUS out
>> 
>> The usb-audio device works for the fedora guest, so would this not indicate
>> that the iso endpoints are already working?
>> 
>> The usb-audio device also work (for a limited amount of time) when running
>> MacOS. Looking at USB logging in the Mac OS guest, to me it seems the MacOS
>> side runs into timing issues when packages drift too far apart. It then
>> finally gives up trying to keep the stream open.
> 
> I was also trying to find why the usb-audio device does not work with MorphOS but I could not figure it out. Now I have two machines (mac99 and pegasos2) that can boot MorphOS but usb-audio does not work with either so maybe it's not because of the USB controller. I've found there is a debug property that enables some logging: -device usb-audio,debug=1 but that did not reveal much more. It looks like MorphOS tries to query the device but replies come very slow (not sure if that's normal or a problem) then just gives up after a while. Maybe you can try comparing what Fedora and other OSes query as it may be we're missing some info in USB descriptors that other drivers than Linux's rely on but that's just a guess I haven't tested with Linux guest on pegasos2 or mac99 yet.
> 
> Regards,
> BALATON Zoltan

Thank for the info everyone. When I try to use the USB-Audio device in Mac OS 10.4.11, the operating system doesn't use it. It does show up in the System Profiler application. In Mac OS 9.2 the sound from it is perfect sounding, but the operating system crashes after less than a minute. In Mac OS 10.2.3 the operating system does set it as its output device but it does not work.

To find out what is wrong we would probably have to build the USB audio drivers in Mac OS X and enable debug output to see what is wrong. They are open source and I have done this in the past. As for Mac OS 9, I'm not sure how to debug its driver. 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Implementing isochronous transfers in hw/hcd-ohci.c
  2021-09-10 19:23       ` Programmingkid
@ 2021-09-11  9:46         ` Howard Spoelstra
  2021-09-11 15:10           ` Programmingkid
  0 siblings, 1 reply; 8+ messages in thread
From: Howard Spoelstra @ 2021-09-11  9:46 UTC (permalink / raw)
  To: Programmingkid; +Cc: QEMU Developers, Gerd Hoffmann


[-- Attachment #1.1: Type: text/plain, Size: 3903 bytes --]

On Fri, Sep 10, 2021 at 9:23 PM Programmingkid <programmingkidx@gmail.com>
wrote:

>
>
> > On Sep 10, 2021, at 7:51 AM, BALATON Zoltan <balaton@eik.bme.hu> wrote:
> >
> > On Fri, 10 Sep 2021, Howard Spoelstra wrote:
> >> On Fri, Sep 10, 2021 at 7:07 AM Gerd Hoffmann <kraxel@redhat.com>
> wrote:
> >>
> >>> On Thu, Sep 09, 2021 at 05:06:17PM -0400, Programmingkid wrote:
> >>>> Hi Gerd,
> >>>>
> >>>> Howard and I were talking about USB audio problems with Mac OS guests.
> >>> We think the issue might be with frames being sent to the USB audio
> card
> >>> too soon. My guess is only one frame is suppose to be transmitted
> every 1
> >>> millisecond. I was also reading the todo notes in the file
> hw/hcd-ohci.c.
> >>> This is what it says:
> >>>>
> >>>> * TODO:
> >>>> *  o Isochronous transfers
> >>>> *  o Allocate bandwidth in frames properly
> >>>> *  o Disable timers when nothing needs to be done, or remove timer
> usage
> >>>> *    all together.
> >>>> *  o BIOS work to boot from USB storage
> >>>> */
> >>>>
> >>>> Do you think implementing isochronous transfers would fix the audio
> >>> problems Mac OS guest are experiencing?
> >>>
> >>> Most likely yes, audio devices typically use iso endpints.
> >>>
> >>> take care,
> >>>  Gerd
> >>>
> >>
> >> Hi,
> >>
> >> Below I pasted the first lines mentioning isochronous traffic from a
> pcap
> >> file when running fedora12 with the usb-audio device and the first lines
> >> from a pcap file running Mac OS 9.2 with the usb-audio device
> >>
> >> Fedora:
> >> 91 56.715001 host 0.5.1 USB 256 URB_ISOCHRONOUS out
> >> 92 56.715018 0.5.1 host USB 64 URB_ISOCHRONOUS out
> >>
> >> MacOS:
> >> 143 56.031989 host 0.16.1 USB 256 URB_ISOCHRONOUS out
> >> 144 56.032026 0.16.1 host USB 64 URB_ISOCHRONOUS out
> >>
> >> The usb-audio device works for the fedora guest, so would this not
> indicate
> >> that the iso endpoints are already working?
> >>
> >> The usb-audio device also work (for a limited amount of time) when
> running
> >> MacOS. Looking at USB logging in the Mac OS guest, to me it seems the
> MacOS
> >> side runs into timing issues when packages drift too far apart. It then
> >> finally gives up trying to keep the stream open.
> >
> > I was also trying to find why the usb-audio device does not work with
> MorphOS but I could not figure it out. Now I have two machines (mac99 and
> pegasos2) that can boot MorphOS but usb-audio does not work with either so
> maybe it's not because of the USB controller. I've found there is a debug
> property that enables some logging: -device usb-audio,debug=1 but that did
> not reveal much more. It looks like MorphOS tries to query the device but
> replies come very slow (not sure if that's normal or a problem) then just
> gives up after a while. Maybe you can try comparing what Fedora and other
> OSes query as it may be we're missing some info in USB descriptors that
> other drivers than Linux's rely on but that's just a guess I haven't tested
> with Linux guest on pegasos2 or mac99 yet.
> >
> > Regards,
> > BALATON Zoltan
>
> Thank for the info everyone. When I try to use the USB-Audio device in Mac
> OS 10.4.11, the operating system doesn't use it. It does show up in the
> System Profiler application. In Mac OS 9.2 the sound from it is perfect
> sounding, but the operating system crashes after less than a minute. In Mac
> OS 10.2.3 the operating system does set it as its output device but it does
> not work.
>
> To find out what is wrong we would probably have to build the USB audio
> drivers in Mac OS X and enable debug output to see what is wrong. They are
> open source and I have done this in the past. As for Mac OS 9, I'm not sure
> how to debug its driver.


See the screen shot attached for the warnings about timing in MacOS 9.2
before the stream collapses.This was after some system sounds were played
successfully.
[image: usb-audiolog.png]
Best,
Howard

[-- Attachment #1.2: Type: text/html, Size: 5068 bytes --]

[-- Attachment #2: usb-audiolog.png --]
[-- Type: image/png, Size: 84123 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Implementing isochronous transfers in hw/hcd-ohci.c
  2021-09-11  9:46         ` Howard Spoelstra
@ 2021-09-11 15:10           ` Programmingkid
  0 siblings, 0 replies; 8+ messages in thread
From: Programmingkid @ 2021-09-11 15:10 UTC (permalink / raw)
  To: Howard Spoelstra; +Cc: QEMU Developers, Gerd Hoffmann



> On Sep 11, 2021, at 5:46 AM, Howard Spoelstra <hsp.cat7@gmail.com> wrote:
> 
> 
> 
> On Fri, Sep 10, 2021 at 9:23 PM Programmingkid <programmingkidx@gmail.com> wrote:
> 
> 
> > On Sep 10, 2021, at 7:51 AM, BALATON Zoltan <balaton@eik.bme.hu> wrote:
> > 
> > On Fri, 10 Sep 2021, Howard Spoelstra wrote:
> >> On Fri, Sep 10, 2021 at 7:07 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
> >> 
> >>> On Thu, Sep 09, 2021 at 05:06:17PM -0400, Programmingkid wrote:
> >>>> Hi Gerd,
> >>>> 
> >>>> Howard and I were talking about USB audio problems with Mac OS guests.
> >>> We think the issue might be with frames being sent to the USB audio card
> >>> too soon. My guess is only one frame is suppose to be transmitted every 1
> >>> millisecond. I was also reading the todo notes in the file hw/hcd-ohci.c.
> >>> This is what it says:
> >>>> 
> >>>> * TODO:
> >>>> *  o Isochronous transfers
> >>>> *  o Allocate bandwidth in frames properly
> >>>> *  o Disable timers when nothing needs to be done, or remove timer usage
> >>>> *    all together.
> >>>> *  o BIOS work to boot from USB storage
> >>>> */
> >>>> 
> >>>> Do you think implementing isochronous transfers would fix the audio
> >>> problems Mac OS guest are experiencing?
> >>> 
> >>> Most likely yes, audio devices typically use iso endpints.
> >>> 
> >>> take care,
> >>>  Gerd
> >>> 
> >> 
> >> Hi,
> >> 
> >> Below I pasted the first lines mentioning isochronous traffic from a pcap
> >> file when running fedora12 with the usb-audio device and the first lines
> >> from a pcap file running Mac OS 9.2 with the usb-audio device
> >> 
> >> Fedora:
> >> 91 56.715001 host 0.5.1 USB 256 URB_ISOCHRONOUS out
> >> 92 56.715018 0.5.1 host USB 64 URB_ISOCHRONOUS out
> >> 
> >> MacOS:
> >> 143 56.031989 host 0.16.1 USB 256 URB_ISOCHRONOUS out
> >> 144 56.032026 0.16.1 host USB 64 URB_ISOCHRONOUS out
> >> 
> >> The usb-audio device works for the fedora guest, so would this not indicate
> >> that the iso endpoints are already working?
> >> 
> >> The usb-audio device also work (for a limited amount of time) when running
> >> MacOS. Looking at USB logging in the Mac OS guest, to me it seems the MacOS
> >> side runs into timing issues when packages drift too far apart. It then
> >> finally gives up trying to keep the stream open.
> > 
> > I was also trying to find why the usb-audio device does not work with MorphOS but I could not figure it out. Now I have two machines (mac99 and pegasos2) that can boot MorphOS but usb-audio does not work with either so maybe it's not because of the USB controller. I've found there is a debug property that enables some logging: -device usb-audio,debug=1 but that did not reveal much more. It looks like MorphOS tries to query the device but replies come very slow (not sure if that's normal or a problem) then just gives up after a while. Maybe you can try comparing what Fedora and other OSes query as it may be we're missing some info in USB descriptors that other drivers than Linux's rely on but that's just a guess I haven't tested with Linux guest on pegasos2 or mac99 yet.
> > 
> > Regards,
> > BALATON Zoltan
> 
> Thank for the info everyone. When I try to use the USB-Audio device in Mac OS 10.4.11, the operating system doesn't use it. It does show up in the System Profiler application. In Mac OS 9.2 the sound from it is perfect sounding, but the operating system crashes after less than a minute. In Mac OS 10.2.3 the operating system does set it as its output device but it does not work.
> 
> To find out what is wrong we would probably have to build the USB audio drivers in Mac OS X and enable debug output to see what is wrong. They are open source and I have done this in the past. As for Mac OS 9, I'm not sure how to debug its driver.
> 
> See the screen shot attached for the warnings about timing in MacOS 9.2 before the stream collapses.This was after some system sounds were played successfully.
> <usb-audiolog.png>
> Best,
> Howard

So the question to answer is what is the wr gap?

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-09-11 15:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09 21:06 Implementing isochronous transfers in hw/hcd-ohci.c Programmingkid
2021-09-10  5:07 ` Gerd Hoffmann
2021-09-10  6:12   ` Howard Spoelstra
2021-09-10  7:51     ` Gerd Hoffmann
2021-09-10 11:51     ` BALATON Zoltan
2021-09-10 19:23       ` Programmingkid
2021-09-11  9:46         ` Howard Spoelstra
2021-09-11 15:10           ` Programmingkid

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.