Multimedia Support in the Linux Kernel
Kernel Preemption
Timers aren't the only items of interest in this section; you can also decide on the degree of preemption you intend for your kernel, but first, consider the topic of preemption in the Linux kernel.
As users' needs have become more sophisticated, their demands on computer hardware have become greater. Multitasking is an ordinary aspect of modern computing, and although multitasking is indeed a lovely thing, it also creates a world of concerns for multimedia production and playback. Without some sort of process control, applications will clash over access to system resources and services, causing audio dropouts, stuttering video, and even complete system lock-ups. Under normal circumstances, most users will be happy with a non-preemptive kernel, but if your applications need priority access to resources and services, the normal kernel scheduler might not suffice. Preemption is a way to guarantee an application's priority status, keeping other processes from interfering with its operations. For example, when I record with Ardour, I need to be absolutely certain that no other process is going to knock Ardour aside. The preemptive kernel saves the day.
Preemption is available in four modes. The first sets no preemption at all and is the default for servers. Voluntary preemption, the second mode, is the default for normal desktop use without timing-critical applications. The third option provides a low-latency system for users who want an optimal system for multimedia performance from applications such as games and audio/video players. The fourth choice, complete preemption, is for users who want a media production platform, either in a studio setting or as a real-time performance system. Your choice of preemption mode depends on your needs, so choose wisely. As you shall see, a preemptive kernel can have its own problems.
Device Drivers
Without the correct drivers, your shiny new cards and USB add-ons won't yield so much as a squawk, so again be sure you've selected the right drivers for your hardware. Although you can build all the available drivers as modules for the kernel to load as needed, if you must be conscientious about space, you can build only the modules you need for your current hardware. For a multimedia system, look closely at kernel support for your graphics hardware, video devices, and sound cards.
Kernel drivers for graphics adapters have code for hardware from various manufacturers. Just find your device and select the proper driver. However, bear in mind that these drivers work closely with the X Window System, and the overall performance of your graphics display(s) will be determined by the optimal combination of X and the kernel driver. Other potentially relevant options include /dev/agpgart support for older machines, a direct rendering management system for certain video chipsets, and support for framebuffer devices.
The default kernel sound system is from the Advanced Linux Sound Architecture project (ALSA). To activate sound support in the kernel, select the CONFIG_SOUND and CONFIG_SND options. Next, choose the driver corresponding to your sound hardware. This step is potentially confusing: Your sound card might not be listed, but its chipset could be supported by the ALSA drivers. For a complete list of supported devices tabulated by sound card, manufacturer, and chipset names, see the ALSA website's SoundCard Matrix.
If your sound hardware is connected to a USB port, you'll need to enable the CONFIG_SND_USB and CONFIG_SND_USB_AUDIO options. PCMCIA cards will require the CONFIG_SND_PCMCIA option, and similar options exist for sound support with PowerPC, Sparc, ARM, and other non-x86 Linux-capable platforms.
The kernel configuration utility lists Open Sound System (OSS) modules as deprecated, but they are still usable. The older OSS system can be employed if ALSA can't be used, but I would advise the use of the OSS/Free package [1] instead of the kernel's OSS modules. OSS/Free is now open source software, and the current package is an exceptionally stable and powerful alternative to ALSA. Also, it is easy to install and can be used within an otherwise ALSA-based system.
Multimedia Devices
The Multimedia Devices section includes essential support for video and radio capture devices. If you work with a webcam, a television card, or a radio tuner, you'll need to activate the video4linux (V4L) driver by selecting the CONFIG_VIDEO_DEV option. Recent kernels include extensive support for a variety of video capture devices, so be sure to scan the list of supported hardware. First select the relevant option(s), and be sure to enable the CONFIG_V4L_USB_DRIVERS option if you plan to use a USB-connected capture or encoding device.
As previously mentioned, the drivers section includes the option to build the driver for the enhanced real-time clock (CONFIG_SND_RTCTIMER). When this option is selected, you will be given the opportunity to declare RTC as the default timer for the ALSA sequencer (a MIDI dataflow manager). Consider this option a necessity. This section also includes an option for building the driver for an IEEE 1394 port, more familiarly known as the Firewire port. Firewire is an excellent data transfer protocol, designed to handle high-capacity streams, but Linux support is relatively new. This option includes a stable and an experimental driver; choose the option that best applies to your hardware.
Disk drive performance should be optimal. The drive type (IDE, SCSI) is not so important as it once was, but if your system includes IDE drives, you should check a few options in the subsection for ATA/ATAPI/MFM/RLL support. In the IDE/ATA/ATAPI Block Devices section, you need to find and accept the options for Generic PCI Bus-master DMA Support and Use PCI DMA By Default When Available. These options enable DMA (direct memory access) for your disks, which is helpful with low-latency disk-intensive work. However, even with these options, you might still need to optimize your disk performance with the hdparm utility. The following command enables 32-bit I/O and turns on DMA support for the IDE hard drive in my JAD 1.0 machine:
hdparm -c 1 -d 1 /dev/hda
For a status report on the indicated device, run the utility without parameters. Incidentally, if you know nothing about hdparm, its manual page is required reading before you use the tool. Some of hdparm's parameters are dangerous, but fortunately, you need only the two flags shown above to improve the performance of your IDE drives.
« Previous 1 2 3 4 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.