
:FM<IJKFIP Multimedia and the Kernel Dlck`d\[`XJlggfik`ek_\C`eloB\ie\c B<IE<C JFLE;J We’ll show you how to tune up your Linux system for multimedia that apply to the topic (i.e., support for multimedia), and the following descrip- applications. BY DAVE PHILLIPS tions and explanations assume some experience in compiling programs from n the late 1960s, “multimedia” was a and software required by machines in- source code. However, even if you’re a new term connected typically to the tended for the production and presenta- complete novice, Google can direct you @work of artists such as Andy Warhol. tion of rich media formats. Because of to text and video guides for the process. Although Warhol was not the only artist space limitations, I can only touch on It’s not terribly difficult, and if you’re working in this domain, his Exploding some of the factors required to optimize patient and thorough, it might be fun. Plastic Inevitable performances defined that support, but I hope my efforts in- the multimedia event. An EPI show si- spire you to compile your own media- :GLKpg\ multaneously included film, projected optimized kernel. The source code is The first settings will be made in the Pro- images, dancers, music, recitations, and free, the build process isn’t terribly com- cessor type and features section. The pro- so on, for an effect calculated to over- plicated, and the results can yield a con- cessor type is an easy choice, but if whelm the senses. By comparison, the siderable improvement in audio and you’re not sure what CPU is in your ma- multimedia experience on your com- video performance. chine, just issue the uname -a command puter is relatively restrained, but it can at a terminal prompt. be colorful and exciting. :fe]`^li`e^k_\B\ie\c]fi This tool will respond by listing vari- A computer-based multimedia produc- Dlck`d\[`XDXZ_`e\j ous facts about your hardware and its tion comprises text, graphics, sound, The Linux kernel provides support for operating system. For example, on my and video, but these elements can be multimedia with drivers for a variety notebook, I’m running Ubuntu 8.10 with combined into a media-rich presenta- of devices (sound cards, video boards, a kernel patched for real-time operation. tion, an interactive audio/ video installa- graphics tablets, etc.) and code for fea- The uname utility reports the following tion, or a stroke-inducing first-person ac- tures of various motherboard chipsets. information about my system: tion game. Each combination is a true The kernel's openness and modularity multimedia production. Like the original invite extension by developers who want dlphilp@maximus:~$ uname -a multimedia events, they require abun- to add new capabilities to the existing Linux maximus 2.6.27-3-rt #1 5 dant resources. Modern machines have kernel services. PREEMPT RT Mon Oct 27 5 plenty of drive space and RAM, fast Before you compile the kernel, you 03:05:19 UTC 2008 i686 GNU/Linux CPUs, and powerful video capabilities, must configure its options, usually with but modern multimedia software can the help of a menu-based utility that From this report, I learn that my kernel test the performance envelope of even presents the configuration options and is numbered 2.6.27-3-rt, that it’s running the most powerful desktop computer. preferences in an organized GUI (Figure on the first (#1) of a dual-core machine, In this article, I look at the Linux ker- 1). The scope of this article is restricted and that it has been compiled for full nel’s integral support for the hardware to those parts of the kernel configuration preemption. Also, I know that my CPU 38 ISSUE 100 MARCH 2009 038-041_realtime.indd 38 14.01.2009 17:09:08 Uhr Multimedia and the Kernel :FM<IJKFIP type is an i686, a post-Pentium processor trol software. The kernel type. Actually, it’s an AMD Turion-X2, module loader handles configured as a single-core 32-bit i686 everything. You did enable (with the CONFIG_X86 kernel option) so the support for loadable that I can use certain software that will modules, didn’t you? not run on a dual-core 64-bit machine. At this point, I’ll include a word about Ye Olde Way B\ie\cK`d\ij of configuring high-resolu- Successful multimedia performance of tion timing at the kernel any kind is critically dependent on tim- level. Users of pre-2.6 ker- ing. Audio and video need tight synchro- nels might not have access nization, and sound needs to be free of to the new timers, but they dropouts and spurious noise. Fortu- can still set up their ker- nately, the modern Linux kernel pro- nels for enhanced resolu- vides the necessary components, but tion. The CONFIG_HZ op- your distribution might not have the op- tion allows frequency set- tions enabled for those timers. To ac- tings for 100, 250, and quire the benefits of better timing, you 1,000Hz, the last of which might need to recompile your kernel. is the preferred resolution The high-resolution timers option for any system running (CONFIG_HIGH_RES_TIMERS) enables a audio and MIDI applica- “tickless” system with a timing accuracy tions. Conventional wis- =`^li\(1-+Jkl[`fËjb\ie\cZfe]`^liXk`fe>L@% of about 1msec on most contemporary dom advises compiling the machines – a considerable improvement RTC driver, again a necessity for high- be absolutely certain that no other pro- over the standard hertz-based timer res- resolution audio and MIDI event timing. cess is going to knock Ardour aside. The olution. Introduced in kernel 2.6.21, the Note that the timer frequency option is preemptive kernel saves the day. tickless system reduces the load on the available in the Processor type and fea- Preemption is available in four modes. system clock by shutting off the timer in- tures section of your kernel configura- The first sets no preemption at all and is terrupt (the tick) whenever the system tion, but the RTC driver is selected in the the default for servers. Voluntary pre- idles. This process saves power on lap- Device Drivers section. emption, the second mode, is the default tops and notebooks and improves multi- for normal desktop use without timing- tasking performance. The option for B\ie\cGi\\dgk`fe critical applications. The third option high-resolution timers can be enabled Timers aren’t the only items of interest provides a low-latency system for users without the tickless system, but in an in this section; you can also decide on who want an optimal system for multi- optimal multimedia system, make sure the degree of preemption you intend for media performance from applications that CONFIG_NO_HZ is set to true. your kernel, but first, consider the topic such as games and audio/ video players. The high-performance event timer of preemption in the Linux kernel. The fourth choice, complete preemption, (HPET) was once known as the multi- As users’ needs have become more so- is for users who want a media produc- media timer. According to its entry in phisticated, their demands on computer tion platform, either in a studio setting Wikipedia, this timer “… can produce hardware have become greater. Multi- or as a real-time performance system. periodic interrupts at a much higher res- tasking is an ordinary aspect of modern Your choice of preemption mode de- olution than the RTC [real-time clock] computing, and although multitasking is pends on your needs, so choose wisely. and is often used to synchronize multi- indeed a lovely thing, it also creates a As you shall see, a preemptive kernel media streams, providing smooth play- world of concerns for multimedia pro- can have its own problems. back and reducing the need to use other duction and playback. Without some timestamp calculations.” The option sort of process control, applications will ;\m`Z\;i`m\ij (CONFIG_HPET_TIMER) is machine clash over access to system resources Without the correct drivers, your shiny dependent and will not work on older and services, causing audio dropouts, new cards and USB add-ons won’t yield hardware or operating systems, includ- stuttering video, and even complete sys- so much as a squawk, so again be sure ing the Linux 2.4 series. It also requires tem lock-ups. Under normal circum- you’ve selected the right drivers for your the rtc-cmos driver instead of the tradi- stances, most users will be happy with a hardware. Although you can build all the tional RTC driver discussed next. non-preemptive kernel, but if your appli- available drivers as modules for the ker- Which of these timers should you use? cations need priority access to resources nel to load as needed, if you must be On my JAD 1.0 box (openSUSE 10.2), and services, the normal kernel sched- conscientious about space, you can build the HPET and the high-resolution timer uler might not suffice. Preemption is a only the modules you need for your cur- options are both compiled into the ker- way to guarantee an application’s prior- rent hardware. For a multimedia system, nel. Clocks and timers operate transpar- ity status, keeping other processes from look closely at kernel support for your ently on Linux, so don’t worry about interfering with its operations. For exam- graphics hardware, video devices, and loading modules or installing other con- ple, when I record with Ardour, I need to sound cards. MARCH 2009 ISSUE 100 39 038-041_realtime.indd 39 14.01.2009 17:09:10 Uhr :FM<IJKFIP Multimedia and the Kernel Kernel drivers for graphics adapters capture devices.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages4 Page
-
File Size-