Changeset 1099
- Timestamp:
- 05/02/08 15:58:56 (16 years ago)
- Files:
-
- trunk/libffado/config.h.in (modified) (9 diffs)
- trunk/libffado/src/debugmodule/debugmodule.cpp (modified) (3 diffs)
- trunk/libffado/src/libstreaming/StreamProcessorManager.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/config.h.in
r1083 r1099 47 47 #define DEBUG_MB_BUFFERS 1024 48 48 49 // use an RT thread for reading out the messagebuffer. 50 // can reduce the number of buffer xruns, but not 51 // recommended 52 #define DEBUG_MESSAGE_BUFFER_REALTIME 0 53 #define DEBUG_MESSAGE_BUFFER_REALTIME_PRIO 1 54 55 // When a write can't get the buffer lock, how many times 56 // should it retry, and wait how long between retries? 57 #define DEBUG_MESSAGE_BUFFER_COLLISION_WAIT_NTRIES 2 58 #define DEBUG_MESSAGE_BUFFER_COLLISION_WAIT_NSEC 50000 59 60 49 61 // support a debug backlog 50 62 // note that this does not influence non-debug builds … … 55 67 // support backtrace debugging 56 68 // note that this does not influence non-debug builds 57 #define DEBUG_BACKTRACE_SUPPORT 169 #define DEBUG_BACKTRACE_SUPPORT 0 58 70 // max length of backtrace 59 71 #define DEBUG_MAX_BACKTRACE_LENGTH 8 … … 62 74 63 75 // lock debugging 64 #define DEBUG_LOCK_COLLISION_TRACING 176 #define DEBUG_LOCK_COLLISION_TRACING 0 65 77 66 78 // make this zero to disable the most extreme 67 79 // debug logging in the critical sections 68 #define DEBUG_EXTREME_ENABLE 080 #define DEBUG_EXTREME_ENABLE 0 69 81 70 82 // watchdog … … 81 93 // we should be using absolute clock_nanosleep 82 94 // but on my system it causes a problem on shutdown. 83 #define USE_ABSOLUTE_NANOSLEEP 195 #define USE_ABSOLUTE_NANOSLEEP 1 84 96 85 97 // 1394 service constants 86 #define IEEE1394SERVICE_USE_CYCLETIMER_DLL 187 #define IEEE1394SERVICE_CYCLETIMER_DLL_UPDATE_INTERVAL_USEC 20000088 #define IEEE1394SERVICE_MAX_FIREWIRE_PORTS 489 90 #define IEEE1394SERVICE_CYCLETIMER_HELPER_RUN_REALTIME 191 #define IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO_INCREASE -1098 #define IEEE1394SERVICE_USE_CYCLETIMER_DLL 1 99 #define IEEE1394SERVICE_CYCLETIMER_DLL_UPDATE_INTERVAL_USEC 200000 100 #define IEEE1394SERVICE_MAX_FIREWIRE_PORTS 4 101 102 #define IEEE1394SERVICE_CYCLETIMER_HELPER_RUN_REALTIME 1 103 #define IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO_INCREASE -10 92 104 93 105 // The current version of libiec61883 doesn't seem to calculate 94 106 // the bandwidth correctly. Defining this to non-zero skips 95 107 // bandwidth allocation when doing CMP connections. 96 #define IEEE1394SERVICE_SKIP_IEC61883_BANDWIDTH_ALLOCATION 197 98 #define MINIMUM_INTERRUPTS_PER_PERIOD 2U108 #define IEEE1394SERVICE_SKIP_IEC61883_BANDWIDTH_ALLOCATION 1 109 110 #define MINIMUM_INTERRUPTS_PER_PERIOD 2U 99 111 100 112 // These are the result of a lot of trial and error 101 113 // due to weirdness in the kernel layer 102 #define MAX_XMIT_PACKET_SIZE (2048-16)103 #define MAX_XMIT_NB_BUFFERS 200104 105 #define ISOHANDLER_FLUSH_BEFORE_ITERATE 0106 107 #define ISOHANDLER_DEATH_DETECT_TIMEOUT_USECS 1000000LL108 109 #define ISOHANDLER_CHECK_CTR_RECONSTRUCTION 0114 #define MAX_XMIT_PACKET_SIZE (2048-16) 115 #define MAX_XMIT_NB_BUFFERS 200 116 117 #define ISOHANDLER_FLUSH_BEFORE_ITERATE 0 118 119 #define ISOHANDLER_DEATH_DETECT_TIMEOUT_USECS 1000000LL 120 121 #define ISOHANDLER_CHECK_CTR_RECONSTRUCTION 0 110 122 111 123 #define ISOHANDLERMANAGER_MAX_ISO_HANDLERS_PER_PORT 16 … … 171 183 // given by AMDTP_TRANSMIT_TRANSFER_DELAY (in ticks), but we can send 172 184 // packets early if we want to. (not completely according to spec) 173 // (for spec compliance you need to specify a value of 1 or 2)174 #define AMDTP_MAX_CYCLES_TO_TRANSMIT_EARLY 2185 // (for spec compliance you need to specify a value of 0) 186 #define AMDTP_MAX_CYCLES_TO_TRANSMIT_EARLY 0 175 187 176 188 // ensure that the AMDTP SP clips all float values to [-1.0..1.0] … … 184 196 // AMDTP_ALLOW_PAYLOAD_IN_NODATA_XMIT is enabled. Devices can 185 197 // explicity override this 186 #define AMDTP_SEND_PAYLOAD_IN_NODATA_XMIT_BY_DEFAULT true198 #define AMDTP_SEND_PAYLOAD_IN_NODATA_XMIT_BY_DEFAULT true 187 199 188 200 // -- MOTU options -- // … … 192 204 // then used to stamp the packet and determine the transmission 193 205 // time instant. 194 //#define MOTU_TRANSMIT_TRANSFER_DELAY (11776U)195 //#define MOTU_TRANSMIT_TRANSFER_DELAY (3072U)196 206 #define MOTU_TRANSMIT_TRANSFER_DELAY (0U) 197 207 … … 209 219 // given by MOTU_TRANSMIT_TRANSFER_DELAY (in ticks), but we can send 210 220 // packets early if we want to. 211 //#define MOTU_MAX_CYCLES_TO_TRANSMIT_EARLY 6212 221 #define MOTU_MAX_CYCLES_TO_TRANSMIT_EARLY 2 213 222 … … 220 229 // cluster info block for the stream configuration. Should not 221 230 // be necessary 222 #define AVC_STREAMCONFIG_USE_MUSICPLUG 0231 #define AVC_STREAMCONFIG_USE_MUSICPLUG 0 223 232 224 233 #endif // CONFIG_H trunk/libffado/src/debugmodule/debugmodule.cpp
r1074 r1099 332 332 333 333 mb_overruns = 0; 334 mb_initialized = 1; 335 336 if (pthread_create(&mb_writer_thread, NULL, &mb_thread_func, (void *)this) != 0) 334 335 #if DEBUG_MESSAGE_BUFFER_REALTIME 336 /* Get the client thread to run as an RT-FIFO 337 scheduled thread of appropriate priority. 338 */ 339 pthread_attr_t attributes; 340 struct sched_param rt_param; 341 pthread_attr_init(&attributes); 342 int res; 343 if ((res = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED))) { 344 fprintf(stderr, "Cannot request explicit scheduling for RT thread %d %s\n", res, strerror(res)); 345 return -1; 346 } 347 if ((res = pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_JOINABLE))) { 348 fprintf(stderr, "Cannot request joinable thread creation for RT thread %d %s\n", res, strerror(res)); 349 return -1; 350 } 351 if ((res = pthread_attr_setscope(&attributes, PTHREAD_SCOPE_SYSTEM))) { 352 fprintf(stderr, "Cannot set scheduling scope for RT thread %d %s\n", res, strerror(res)); 353 return -1; 354 } 355 356 if ((res = pthread_attr_setschedpolicy(&attributes, SCHED_FIFO))) { 357 358 //if ((res = pthread_attr_setschedpolicy(&attributes, SCHED_RR))) { 359 fprintf(stderr, "Cannot set FIFO scheduling class for RT thread %d %s\n", res, strerror(res)); 360 return -1; 361 } 362 363 memset(&rt_param, 0, sizeof(rt_param)); 364 rt_param.sched_priority = DEBUG_MESSAGE_BUFFER_REALTIME_PRIO; 365 366 if ((res = pthread_attr_setschedparam(&attributes, &rt_param))) { 367 fprintf(stderr, "Cannot set scheduling priority for RT thread %d %s\n", res, strerror(res)); 368 return -1; 369 } 370 371 if ((res = pthread_create(&mb_writer_thread, &attributes, mb_thread_func, (void *)this))) { 372 fprintf(stderr, "Cannot set create thread %d %s\n", res, strerror(res)); 373 mb_initialized = 0; 374 } else { 375 mb_initialized = 1; 376 } 377 #else 378 if (pthread_create(&mb_writer_thread, NULL, &mb_thread_func, (void *)this) != 0) { 337 379 mb_initialized = 0; 380 } else { 381 mb_initialized = 1; 382 } 383 #endif 338 384 #endif 339 385 … … 538 584 { 539 585 unsigned int ntries; 540 struct timespec wait = {0, 50000};586 struct timespec wait = {0, DEBUG_MESSAGE_BUFFER_COLLISION_WAIT_NSEC}; 541 587 // the backlog 542 ntries= 1;588 ntries=DEBUG_MESSAGE_BUFFER_COLLISION_WAIT_NTRIES; 543 589 while (ntries) { // try a few times 544 590 if (pthread_mutex_trylock(&bl_mb_write_lock) == 0) { … … 571 617 } 572 618 573 ntries= 1;619 ntries=6; 574 620 while (ntries) { // try a few times 575 621 if (pthread_mutex_trylock(&mb_write_lock) == 0) { trunk/libffado/src/libstreaming/StreamProcessorManager.cpp
r1046 r1099 970 970 971 971 debugOutputExtreme( DEBUG_LEVEL_VERBOSE, 972 "transfer at %llu ticks...\n",973 m_ time_of_transfer);972 "transfer period %d at %llu ticks...\n", 973 m_nbperiods, m_time_of_transfer); 974 974 975 975 // this is to notify the client of the delay that we introduced by waiting