Changeset 906 for trunk/libffado

Show
Ignore:
Timestamp:
03/06/08 04:22:38 (13 years ago)
Author:
ppalmers
Message:

implement support for kernel space skipped cycles notification (non-public experimental code)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/config.h.in

    r905 r906  
    5252// These are the result of a lot of trial and error 
    5353// due to weirdness in the kernel layer 
    54 #define MAX_XMIT_PACKET_SIZE                2048 
    55 #define MAX_XMIT_NB_BUFFERS                 2
     54#define MAX_XMIT_PACKET_SIZE                (2048-16) 
     55#define MAX_XMIT_NB_BUFFERS                 4
    5656 
    5757#define ISOHANDLER_FLUSH_BEFORE_ITERATE     0 
  • trunk/libffado/src/libieee1394/IsoHandler.cpp

    r904 r906  
    4747        unsigned char *data, unsigned int *length, 
    4848        unsigned char *tag, unsigned char *sy, 
    49         int cycle, unsigned int dropped) { 
     49        int cycle, unsigned int dropped1) { 
    5050 
    5151    IsoHandler *xmitHandler = static_cast<IsoHandler *>(raw1394_get_userdata(handle)); 
    5252    assert(xmitHandler); 
    53  
    54     return xmitHandler->getPacket(data, length, tag, sy, cycle, dropped); 
     53    unsigned int skipped = (dropped1 & 0xFFFF0000) >> 16; 
     54    unsigned int dropped = dropped1 & 0xFFFF; 
     55 
     56    return xmitHandler->getPacket(data, length, tag, sy, cycle, dropped, skipped); 
    5557} 
    5658 
     
    5961                        unsigned int length, unsigned char channel, 
    6062                        unsigned char tag, unsigned char sy, unsigned int cycle, 
    61                         unsigned int dropped) { 
     63                        unsigned int dropped1) { 
    6264 
    6365    IsoHandler *recvHandler = static_cast<IsoHandler *>(raw1394_get_userdata(handle)); 
    6466    assert(recvHandler); 
    6567 
    66     return recvHandler->putPacket(data, length, channel, tag, sy, cycle, dropped); 
     68    unsigned int skipped = (dropped1 & 0xFFFF0000) >> 16; 
     69    unsigned int dropped = dropped1 & 0xFFFF; 
     70 
     71    return recvHandler->putPacket(data, length, channel, tag, sy, cycle, dropped, skipped); 
    6772} 
    6873 
     
    403408                    unsigned char *data, unsigned int length, 
    404409                    unsigned char channel, unsigned char tag, unsigned char sy, 
    405                     unsigned int cycle, unsigned int dropped) { 
     410                    unsigned int cycle, unsigned int dropped, unsigned int skipped) { 
    406411 
    407412    debugOutputExtreme(DEBUG_LEVEL_ULTRA_VERBOSE, 
     
    415420    #endif 
    416421    if(m_Client) { 
    417         return m_Client->putPacket(data, length, channel, tag, sy, cycle, dropped); 
     422        return m_Client->putPacket(data, length, channel, tag, sy, cycle, dropped, skipped); 
    418423    } 
    419424 
     
    425430IsoHandler::getPacket(unsigned char *data, unsigned int *length, 
    426431                      unsigned char *tag, unsigned char *sy, 
    427                       int cycle, unsigned int dropped) { 
     432                      int cycle, unsigned int dropped, unsigned int skipped) { 
    428433 
    429434    debugOutputExtreme(DEBUG_LEVEL_ULTRA_VERBOSE, 
     
    432437    if(m_Client) { 
    433438        enum raw1394_iso_disposition retval; 
    434         retval = m_Client->getPacket(data, length, tag, sy, cycle, dropped, m_max_packet_size); 
     439        retval = m_Client->getPacket(data, length, tag, sy, cycle, dropped, skipped, m_max_packet_size); 
    435440        #ifdef DEBUG 
    436441        if (*length > m_max_packet_size) { 
  • trunk/libffado/src/libieee1394/IsoHandler.h

    r904 r906  
    6969            putPacket(unsigned char *data, unsigned int length, 
    7070                        unsigned char channel, unsigned char tag, unsigned char sy, 
    71                         unsigned int cycle, unsigned int dropped); 
     71                        unsigned int cycle, unsigned int dropped, unsigned int skipped); 
    7272 
    7373    static enum raw1394_iso_disposition iso_transmit_handler(raw1394handle_t handle, 
     
    7878            getPacket(unsigned char *data, unsigned int *length, 
    7979                    unsigned char *tag, unsigned char *sy, 
    80                     int cycle, unsigned int dropped); 
     80                    int cycle, unsigned int dropped, unsigned int skipped); 
    8181 
    8282public: 
  • trunk/libffado/src/libstreaming/generic/StreamProcessor.cpp

    r904 r906  
    266266StreamProcessor::putPacket(unsigned char *data, unsigned int length, 
    267267                           unsigned char channel, unsigned char tag, unsigned char sy, 
    268                            unsigned int cycle, unsigned int dropped) { 
     268                           unsigned int cycle, unsigned int dropped, 
     269                           unsigned int skipped) { 
    269270#ifdef DEBUG 
    270271    if(m_last_cycle == -1) { 
     
    277278        dropped_cycles = diffCycles(cycle, m_last_cycle) - 1; 
    278279        if (dropped_cycles < 0) { 
    279             debugWarning("(%p) dropped < 1 (%d), cycle: %d, last_cycle: %d, dropped: %d\n",  
    280                          this, dropped_cycles, cycle, m_last_cycle, dropped); 
     280            debugWarning("(%p) dropped < 1 (%d), cycle: %d, last_cycle: %d, dropped: %d, 'skipped'=%u\n",  
     281                         this, dropped_cycles, cycle, m_last_cycle, dropped, skipped); 
    281282        } 
    282283        if (dropped_cycles > 0) { 
    283             debugWarning("(%p) dropped %d packets on cycle %u, 'dropped'=%u, cycle=%d, m_last_cycle=%d\n", 
    284                 this, dropped_cycles, cycle, dropped, cycle, m_last_cycle); 
     284            debugWarning("(%p) dropped %d packets on cycle %u, 'dropped'=%u, 'skipped'=%u, cycle=%d, m_last_cycle=%d\n", 
     285                this, dropped_cycles, cycle, dropped, skipped, cycle, m_last_cycle); 
    285286            m_dropped += dropped_cycles; 
    286287            m_last_cycle = cycle; 
     
    451452StreamProcessor::getPacket(unsigned char *data, unsigned int *length, 
    452453                           unsigned char *tag, unsigned char *sy, 
    453                            int cycle, unsigned int dropped, unsigned int max_length) { 
     454                           int cycle, unsigned int dropped, 
     455                           unsigned int skipped, unsigned int max_length) { 
    454456    if (cycle<0) { 
    455457        *tag = 0; 
     
    472474    if (m_last_cycle != cycle && m_last_cycle != -1) { 
    473475        dropped_cycles = diffCycles(cycle, m_last_cycle) - 1; 
     476        // correct for skipped packets 
     477        // since those are not dropped, but only delayed 
     478        dropped_cycles =- skipped; 
     479        if(skipped) { 
     480            debugWarning("(%p) skipped %d cycles, cycle: %d, last_cycle: %d, dropped: %d\n",  
     481                         this, skipped, cycle, m_last_cycle, dropped); 
     482        } 
    474483        if (dropped_cycles < 0) {  
    475             debugWarning("(%p) dropped < 1 (%d), cycle: %d, last_cycle: %d, dropped: %d\n",  
    476                          this, dropped_cycles, cycle, m_last_cycle, dropped); 
     484            debugWarning("(%p) dropped < 1 (%d), cycle: %d, last_cycle: %d, dropped: %d, skipped: %d\n",  
     485                         this, dropped_cycles, cycle, m_last_cycle, dropped, skipped); 
    477486        } 
    478487        if (dropped_cycles > 0) { 
    479             debugWarning("(%p) dropped %d packets on cycle %u (last_cycle=%u, dropped=%d)\n", 
    480                          this, dropped_cycles, cycle, m_last_cycle, dropped); 
     488            debugWarning("(%p) dropped %d packets on cycle %u (last_cycle=%u, dropped=%d, skipped: %d)\n", 
     489                         this, dropped_cycles, cycle, m_last_cycle, dropped, skipped); 
    481490            m_dropped += dropped_cycles; 
    482491            // HACK: this should not be necessary, since the header generation functions should trigger the xrun. 
  • trunk/libffado/src/libstreaming/generic/StreamProcessor.h

    r864 r906  
    152152        putPacket(unsigned char *data, unsigned int length, 
    153153                  unsigned char channel, unsigned char tag, unsigned char sy, 
    154                   unsigned int cycle, unsigned int dropped); 
     154                  unsigned int cycle, unsigned int dropped, unsigned int skipped); 
    155155 
    156156    enum raw1394_iso_disposition 
    157157    getPacket(unsigned char *data, unsigned int *length, 
    158158                unsigned char *tag, unsigned char *sy, 
    159                 int cycle, unsigned int dropped, unsigned int max_length); 
     159                int cycle, unsigned int dropped, unsigned int skipped, unsigned int max_length); 
    160160 
    161161    bool getFrames(unsigned int nbframes, int64_t ts); ///< transfer the buffer contents to the client