Changeset 870

Show
Ignore:
Timestamp:
01/20/08 13:59:43 (13 years ago)
Author:
ppalmers
Message:

try and work around buffer size issues in raw1394

Files:

Legend:

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

    r868 r870  
    5959#define MAX_ISO_XMIT_BUFFER_FILL_PCT        50 
    6060 
     61// These are the result of a lot of trial and error 
     62// due to weirdness in the kernel layer 
     63#define MAX_XMIT_PACKET_SIZE                512 
     64#define MAX_XMIT_NB_BUFFERS                 64 
     65 
    6166#define ISOHANDLER_PER_HANDLER_THREAD       0 
    6267#define ISOHANDLER_USE_POLL                 0 
  • trunk/libffado/src/libieee1394/IsoHandler.cpp

    r868 r870  
    495495    #ifdef DEBUG 
    496496    m_last_wakeup = m_manager.get1394Service().getCurrentTimeAsUsecs(); 
     497    if (length > m_max_packet_size) { 
     498        debugWarning("(%p, %s) packet too large: len=%u max=%u\n", 
     499                     this, getTypeString(), length, m_max_packet_size); 
     500    } 
    497501    #endif 
    498502    if(m_Client) { 
     
    504508 
    505509 
    506 enum raw1394_iso_disposition IsoHandler::getPacket( 
    507                     unsigned char *data, unsigned int *length, 
    508                     unsigned char *tag, unsigned char *sy, 
    509                     int cycle, unsigned int dropped) { 
     510enum raw1394_iso_disposition 
     511IsoHandler::getPacket(unsigned char *data, unsigned int *length, 
     512                      unsigned char *tag, unsigned char *sy, 
     513                      int cycle, unsigned int dropped) { 
    510514 
    511515    debugOutputExtreme(DEBUG_LEVEL_ULTRA_VERBOSE, 
     
    515519    m_last_wakeup = m_manager.get1394Service().getCurrentTimeAsUsecs(); 
    516520    #endif 
     521 
    517522    if(m_Client) { 
    518         return m_Client->getPacket(data, length, tag, sy, cycle, dropped, m_max_packet_size); 
     523        enum raw1394_iso_disposition retval; 
     524        retval = m_Client->getPacket(data, length, tag, sy, cycle, dropped, m_max_packet_size); 
     525        #ifdef DEBUG 
     526        if (*length > m_max_packet_size) { 
     527            debugWarning("(%p, %s) packet too large: len=%u max=%u\n", 
     528                         this, getTypeString(), *length, m_max_packet_size); 
     529        } 
     530        #endif 
     531        return retval; 
    519532    } 
    520533    *tag = 0; 
  • trunk/libffado/src/libieee1394/IsoHandlerManager.cpp

    r868 r870  
    171171    for (i = 0; i < m_poll_nfds_shadow; i++) { 
    172172        if(m_poll_fds_shadow[i].revents) { 
    173             debugOutput(DEBUG_LEVEL_VERBOSE, 
     173            debugOutput(DEBUG_LEVEL_VERY_VERBOSE, 
    174174                        "received events: %08X for (%d/%d, %p, %s)\n", 
    175175                        m_poll_fds_shadow[i].revents,  
     
    202202        // check if the handler is still alive 
    203203        if(m_IsoHandler_map_shadow[i]->isDead()) { 
    204             debugError("Iso handler %p (%s) is dead!\n", 
     204            debugError("Iso handler (%p, %s) is dead!\n", 
    205205                       m_IsoHandler_map_shadow[i], 
    206206                       m_IsoHandler_map_shadow[i]->getTypeString()); 
     
    389389        unsigned int packets_per_period = stream->getPacketsPerPeriod(); 
    390390        unsigned int max_packet_size = stream->getMaxPacketSize(); 
    391         unsigned int page_size = getpagesize(); 
     391//         unsigned int page_size = getpagesize(); 
    392392 
    393393        // Ensure we don't request a packet size bigger than the 
    394394        // kernel-enforced maximum which is currently 1 page. 
    395         if (max_packet_size > page_size) { 
    396             debugError("max packet size (%u) > page size (%u)\n", max_packet_size, page_size); 
     395//         if (max_packet_size > page_size) { 
     396//             debugError("max packet size (%u) > page size (%u)\n", max_packet_size, page_size); 
     397//             return false; 
     398//         } 
     399        if (max_packet_size > MAX_XMIT_PACKET_SIZE) { 
     400            debugError("max packet size (%u) > MAX_XMIT_PACKET_SIZE (%u)\n", 
     401                       max_packet_size, MAX_XMIT_PACKET_SIZE); 
    397402            return false; 
    398403        } 
    399  
    400         //max_packet_size = page_size; // HACK 
    401         unsigned int irq_interval = packets_per_period / MINIMUM_INTERRUPTS_PER_PERIOD; 
    402         if(irq_interval <= 0) irq_interval=1; 
    403404 
    404405        // the SP specifies how many packets to ISO-buffer 
    405406        int buffers = stream->getNbPacketsIsoXmitBuffer(); 
     407        if (buffers > MAX_XMIT_NB_BUFFERS) { 
     408            debugOutput(DEBUG_LEVEL_VERBOSE, 
     409                        "nb buffers (%u) > MAX_XMIT_NB_BUFFERS (%u)\n", 
     410                        buffers, MAX_XMIT_NB_BUFFERS); 
     411            buffers = MAX_XMIT_NB_BUFFERS; 
     412        } 
     413        unsigned int irq_interval = buffers / MINIMUM_INTERRUPTS_PER_PERIOD; 
     414        if(irq_interval <= 0) irq_interval=1; 
    406415 
    407416        debugOutput( DEBUG_LEVEL_VERBOSE, " creating IsoXmitHandler\n");