[haiku-commits] haiku: hrev53254 - in src/add-ons/kernel: drivers/audio/usb busses/usb

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 14 Jul 2019 00:11:41 -0400 (EDT)

hrev53254 adds 4 changesets to branch 'master'
old head: d5a29ba97c31a8a98ce044b3dff95fd04b71a6b4
new head: b281541f9a8786e5eeb59612eabf798f0c037de5
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=b281541f9a87+%5Ed5a29ba97c31

----------------------------------------------------------------------------

b3c896af1b1e: multi_audio_test: Continue if getting buffers failed.
  
  Don't try and read the buffers anyway, that'll lead to a page fault.

f1e99f166704: XHCI: Use PRI to appease GCC2.

4a6a2fbfda7a: XHCI: Increase priorities of the event and finish threads.
  
  The "event" thread is what is woken up after interrupts, and
  the "finish" thread handles the results of the "event" thread,
  so prioritize them accordingly. Probably increases responsiveness
  of USB input and disk devices visibly on heavily loaded systems.

b281541f9a87: usb_audio: Map the buffer area as B_READ_AREA/B_WRITE_AREA.
  
  The calling userland process needs to be able to access it.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

3 files changed, 32 insertions(+), 25 deletions(-)
src/add-ons/kernel/busses/usb/xhci.cpp           |  6 +--
src/add-ons/kernel/drivers/audio/usb/Stream.cpp  | 50 +++++++++++---------
.../kernel/drivers/audio/multi_audio_test.cpp    |  1 +

############################################################################

Commit:      b3c896af1b1eeac5fd99138261a6fb61b7e4eadf
URL:         https://git.haiku-os.org/haiku/commit/?id=b3c896af1b1e
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Jul 14 02:34:54 2019 UTC

multi_audio_test: Continue if getting buffers failed.

Don't try and read the buffers anyway, that'll lead to a page fault.

----------------------------------------------------------------------------

diff --git a/src/tests/add-ons/kernel/drivers/audio/multi_audio_test.cpp 
b/src/tests/add-ons/kernel/drivers/audio/multi_audio_test.cpp
index c5fe911410..3a735442a6 100644
--- a/src/tests/add-ons/kernel/drivers/audio/multi_audio_test.cpp
+++ b/src/tests/add-ons/kernel/drivers/audio/multi_audio_test.cpp
@@ -377,6 +377,7 @@ do_play(int argc, char** argv)
                if (ioctl(sDevice, B_MULTI_BUFFER_EXCHANGE, &bufferInfo,
                                sizeof(multi_buffer_list)) < B_OK) {
                        printf("Getting buffers failed: %s\n", strerror(errno));
+                       continue;
                }
 
                // fill buffer with data

############################################################################

Commit:      f1e99f1667047271a5a3834395676454de5b852d
URL:         https://git.haiku-os.org/haiku/commit/?id=f1e99f166704
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Jul 14 02:59:14 2019 UTC

XHCI: Use PRI to appease GCC2.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/busses/usb/xhci.cpp 
b/src/add-ons/kernel/busses/usb/xhci.cpp
index 530bc23bc5..ad29613c40 100644
--- a/src/add-ons/kernel/busses/usb/xhci.cpp
+++ b/src/add-ons/kernel/busses/usb/xhci.cpp
@@ -2021,7 +2021,7 @@ XHCI::GetPortSpeed(uint8 index, usb_speed* speed)
                *speed = USB_SPEED_SUPERSPEED;
                break;
        default:
-               TRACE_ALWAYS("nonstandard port speed %d, assuming SuperSpeed\n",
+               TRACE_ALWAYS("nonstandard port speed %" B_PRId32 ", assuming 
SuperSpeed\n",
                        PS_SPEED_GET(portStatus));
                *speed = USB_SPEED_SUPERSPEED;
                break;

############################################################################

Commit:      4a6a2fbfda7ad824dd6de6da96ca5d6c5c8bcd7e
URL:         https://git.haiku-os.org/haiku/commit/?id=4a6a2fbfda7a
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Jul 14 03:18:23 2019 UTC

XHCI: Increase priorities of the event and finish threads.

The "event" thread is what is woken up after interrupts, and
the "finish" thread handles the results of the "event" thread,
so prioritize them accordingly. Probably increases responsiveness
of USB input and disk devices visibly on heavily loaded systems.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/busses/usb/xhci.cpp 
b/src/add-ons/kernel/busses/usb/xhci.cpp
index ad29613c40..079823dcdc 100644
--- a/src/add-ons/kernel/busses/usb/xhci.cpp
+++ b/src/add-ons/kernel/busses/usb/xhci.cpp
@@ -361,12 +361,12 @@ XHCI::XHCI(pci_info *info, Stack *stack)
 
        // create finisher service thread
        fFinishThread = spawn_kernel_thread(FinishThread, "xhci finish thread",
-               B_NORMAL_PRIORITY, (void *)this);
+               B_URGENT_PRIORITY, (void *)this);
        resume_thread(fFinishThread);
 
        // create finisher service thread
        fEventThread = spawn_kernel_thread(EventThread, "xhci event thread",
-               B_NORMAL_PRIORITY, (void *)this);
+               B_URGENT_DISPLAY_PRIORITY, (void *)this);
        resume_thread(fEventThread);
 
        // Find the right interrupt vector, using MSIs if available.

############################################################################

Revision:    hrev53254
Commit:      b281541f9a8786e5eeb59612eabf798f0c037de5
URL:         https://git.haiku-os.org/haiku/commit/?id=b281541f9a87
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Jul 14 03:43:14 2019 UTC

usb_audio: Map the buffer area as B_READ_AREA/B_WRITE_AREA.

The calling userland process needs to be able to access it.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/drivers/audio/usb/Stream.cpp 
b/src/add-ons/kernel/drivers/audio/usb/Stream.cpp
index f0a790934f..49a284c1f6 100644
--- a/src/add-ons/kernel/drivers/audio/usb/Stream.cpp
+++ b/src/add-ons/kernel/drivers/audio/usb/Stream.cpp
@@ -165,31 +165,37 @@ Stream::_SetupBuffers()
                / (fDevice->fUSBVersion < 0x0200 ? 1000 : 8000);
        TRACE(INF, "packetSize:%ld\n", fPacketSize);
 
-       if (fArea == -1) {
-               fAreaSize = (sizeof(usb_iso_packet_descriptor) + fPacketSize)
-                       * sampleSize * 1024 / fPacketSize;
-               TRACE(INF, "estimate fAreaSize:%d\n", fAreaSize);
-
-               // round up to B_PAGE_SIZE and create area
-               fAreaSize = (fAreaSize + (B_PAGE_SIZE - 1)) &~ (B_PAGE_SIZE - 
1);
-               TRACE(INF, "rounded up fAreaSize:%d\n", fAreaSize);
-
-               fArea = create_area( (fIsInput) ? DRIVER_NAME "_record_area"
-                       : DRIVER_NAME "_playback_area", (void**)&fDescriptors,
-                       B_ANY_KERNEL_ADDRESS, fAreaSize, B_CONTIGUOUS,
-                       B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
-
-               if (fArea < 0) {
-                       TRACE(ERR, "Error of creating %#x - "
-                               "bytes size buffer area:%#010x\n", fAreaSize, 
fArea);
-                       fStatus = fArea;
-                       return fStatus;
-               }
+       if (fPacketSize == 0) {
+               TRACE(ERR, "computed packet size is 0!");
+               return B_BAD_VALUE;
+       }
+
+       if (fArea != -1)
+               delete_area(fArea);
+
+       fAreaSize = (sizeof(usb_iso_packet_descriptor) + fPacketSize)
+               * sampleSize * 1024 / fPacketSize;
+       TRACE(INF, "estimate fAreaSize:%d\n", fAreaSize);
 
-               TRACE(INF, "Created area id:%d at addr:%#010x size:%#010lx\n",
-                       fArea, fDescriptors, fAreaSize);
+       // round up to B_PAGE_SIZE and create area
+       fAreaSize = (fAreaSize + (B_PAGE_SIZE - 1)) &~ (B_PAGE_SIZE - 1);
+       TRACE(INF, "rounded up fAreaSize:%d\n", fAreaSize);
+
+       fArea = create_area( (fIsInput) ? DRIVER_NAME "_record_area"
+               : DRIVER_NAME "_playback_area", (void**)&fDescriptors,
+               B_ANY_KERNEL_ADDRESS, fAreaSize, B_CONTIGUOUS,
+               B_READ_AREA | B_WRITE_AREA);
+
+       if (fArea < 0) {
+               TRACE(ERR, "Error of creating %#x - "
+                       "bytes size buffer area:%#010x\n", fAreaSize, fArea);
+               fStatus = fArea;
+               return fStatus;
        }
 
+       TRACE(INF, "Created area id:%d at addr:%#010x size:%#010lx\n",
+               fArea, fDescriptors, fAreaSize);
+
        // descriptors count
        fDescriptorsCount = fAreaSize
                / (sizeof(usb_iso_packet_descriptor) + fPacketSize);


Other related posts:

  • » [haiku-commits] haiku: hrev53254 - in src/add-ons/kernel: drivers/audio/usb busses/usb - waddlesplash