Changeset 1432

Show
Ignore:
Timestamp:
11/16/08 06:02:47 (12 years ago)
Author:
ppalmers
Message:

fix RT priority issues with recent jack changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libffado-2.0/config.h.in

    r1429 r1432  
    112112 
    113113#define IEEE1394SERVICE_CYCLETIMER_HELPER_RUN_REALTIME       1 
    114 #define IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO_INCREASE    -10 
     114#define IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO               1 
    115115 
    116116// config rom read wait interval 
     
    168168// prio 
    169169#define ISOHANDLERMANAGER_ISO_PRIO_INCREASE                  0 
    170 #define ISOHANDLERMANAGER_ISO_PRIO_INCREASE_RECV            -6 
     170#define ISOHANDLERMANAGER_ISO_PRIO_INCREASE_RECV            -1 
    171171#define ISOHANDLERMANAGER_ISO_PRIO_INCREASE_XMIT             1 
    172172 
  • branches/libffado-2.0/src/ffado.cpp

    r1371 r1432  
    113113 
    114114    dev->m_deviceManager->setVerboseLevel(dev->options.verbose); 
     115 
     116    if(dev->options.realtime) { 
     117        debugOutput(DEBUG_LEVEL_VERBOSE, 
     118                    "Starting with realtime scheduling, base priority %d\n",  
     119                    dev->options.packetizer_priority); 
     120    } else { 
     121        debugWarning("Realtime scheduling is not enabled. This will cause significant reliability issues.\n"); 
     122    } 
    115123    dev->m_deviceManager->setThreadParameters(dev->options.realtime, dev->options.packetizer_priority); 
    116124 
  • branches/libffado-2.0/src/libieee1394/ieee1394service.cpp

    r1429 r1432  
    9090    , m_pCTRHelper ( new CycleTimerHelper( *this, IEEE1394SERVICE_CYCLETIMER_DLL_UPDATE_INTERVAL_USEC, 
    9191                                           rt && IEEE1394SERVICE_CYCLETIMER_HELPER_RUN_REALTIME, 
    92                                            prio + IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO_INCREASE ) ) 
     92                                           IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO ) ) 
    9393    , m_have_new_ctr_read ( false ) 
    9494    , m_pWatchdog ( new Util::Watchdog() ) 
     
    368368    bool result = true; 
    369369    if (priority > THREAD_MAX_RTPRIO) priority = THREAD_MAX_RTPRIO; 
     370    if (priority < THREAD_MIN_RTPRIO) priority = THREAD_MIN_RTPRIO; 
    370371    m_base_priority = priority; 
    371372    m_realtime = rt; 
     
    378379        debugOutput(DEBUG_LEVEL_VERBOSE, "Switching CycleTimerHelper to (rt=%d, prio=%d)\n",  
    379380                                         rt && IEEE1394SERVICE_CYCLETIMER_HELPER_RUN_REALTIME, 
    380                                          priority + IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO_INCREASE); 
     381                                         IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO); 
    381382        result &= m_pCTRHelper->setThreadParameters(rt && IEEE1394SERVICE_CYCLETIMER_HELPER_RUN_REALTIME, 
    382                                                     priority + IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO_INCREASE); 
     383                                                    IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO); 
    383384    } 
    384385    return result; 
  • branches/libffado-2.0/src/libieee1394/IsoHandlerManager.cpp

    r1375 r1432  
    533533    debugOutput( DEBUG_LEVEL_VERBOSE, "(%p) switch to: (rt=%d, prio=%d)...\n", this, rt, priority); 
    534534    if (priority > THREAD_MAX_RTPRIO) priority = THREAD_MAX_RTPRIO; // cap the priority 
     535    if (priority < THREAD_MIN_RTPRIO) priority = THREAD_MIN_RTPRIO; // cap the priority 
    535536    m_realtime = rt; 
    536537    m_priority = priority; 
  • branches/libffado-2.0/src/libutil/PosixThread.cpp

    r1292 r1432  
    125125 
    126126        memset(&rt_param, 0, sizeof(rt_param)); 
    127         rt_param.sched_priority = fPriority; 
     127        if(fPriority <= 0) { 
     128            debugWarning("Clipping to minimum priority (%d -> 1)\n", fPriority); 
     129            rt_param.sched_priority = 1; 
     130        } else if(fPriority >= 99) { 
     131            debugWarning("Clipping to maximum priority (%d -> 98)\n", fPriority); 
     132            rt_param.sched_priority = 98; 
     133        } else { 
     134            rt_param.sched_priority = fPriority; 
     135        } 
    128136 
    129137        if ((res = pthread_attr_setschedparam(&attributes, &rt_param))) { 
     
    133141 
    134142        if ((res = pthread_create(&fThread, &attributes, ThreadHandler, this))) { 
    135             debugError("Cannot set create thread %d %s\n", res, strerror(res)); 
     143            debugError("Cannot create realtime thread (%d: %s)\n", res, strerror(res)); 
     144            debugError(" priority: %d %s\n", fPriority); 
    136145            return -1; 
    137146        } 
     
    142151 
    143152        if ((res = pthread_create(&fThread, 0, ThreadHandler, this))) { 
    144             debugError("Cannot set create thread %d %s\n", res, strerror(res)); 
     153            debugError("Cannot create thread %d %s\n", res, strerror(res)); 
    145154            return -1; 
    146155        } 
     
    188197 
    189198    memset(&rtparam, 0, sizeof(rtparam)); 
    190     rtparam.sched_priority = fPriority; 
     199    if(fPriority <= 0) { 
     200        debugWarning("Clipping to minimum priority (%d -> 1)\n", fPriority); 
     201        rtparam.sched_priority = 1; 
     202    } else if(fPriority >= 99) { 
     203        debugWarning("Clipping to maximum priority (%d -> 98)\n", fPriority); 
     204        rtparam.sched_priority = 98; 
     205    } else { 
     206        rtparam.sched_priority = fPriority; 
     207    } 
    191208 
    192209    //if ((res = pthread_setschedparam(fThread, SCHED_FIFO, &rtparam)) != 0) {