SUMMARY:
Current approaches to (a) enabling / managing TV-out on ATI's video cards and (b) ways of enabling / managing Xvideo (video overlay) assignment on a running X server. I introduce ATI's aticonfig utility as the main part of the solution.
(see end of article)(2nd Edition. Seems many people found this article useful. I edited for simplicity of consumption)
(addition: I made a simple SuperKaramba applet for XVideo switching.)
PREFACE:Unlike what many ppl think, TV-out (linux, windows, etc) has 2 different meanings.
To normal folk, TV-out from a computer means, you can see your computer screen picture on TV, similar to hooking up a laptop to a projector for business presentation. To folk like me, who play with video streams on their computers and would like to push it to the TV, TV-out immediately collects one more layer of complexity. We are talking about management of video overlay.
Video (I am talking about, good-looking, non-flickering, perfect picture) is a special citizen in computer world. That perfect kind of video picture you expect from a DVD movie is treated as special stream by computer and gets a special - direct - way from the decoder into a "back door" on the video card and onto the screen. So, while the rest of the picture of your regular computer screen goes through compositing, waits in line and finally gets to the screen, the video feed can swoosh through the time-space continuum and be simply glued on top of the picture right before it comes out of the video card. That is what's called video overlay, or Xv in X window world.
(Xv is not the only kind of overlay on X, but it's the most commonly supported by drivers and media frameworks. See the end of the article for OpenGL overlay discussion)Why is this important? Normally, this "hardware accelerated" video overlay can only be pushed out of only one output of video card. This problem is often described as "The video shows on one screen, but there is only black/blue/pink square on the other screen." ATI's windows drivers learned to multiply Video Overlay. On Windows XP, my Radeon's drivers allowed me to clone Video Overlay to all the screens at the same time. On Linux though... you know. Now you should understand what my problem is...
THE PROBLEM WE ARE SOLVING:I have a TV card in my Slackware box that I use to record fun TV programs like "South Park," "Family Guy," "Lost." Luckly, my wife is not into "South Park," or "Family Guy" so I just watch these on my computer screen.
(I use KDE's Kaffeine player frontend for Xine, with Xv as output standard.) Unfortunately, "Lost" is her thing and she wants to watch it on a 34+ inch TV. I don't blame her, the TV comes with a sofa parked somewhat in front of it. So...
I want a TV-out that is easy to enable and (most importantly) can output Xv on demand! I don't want the TV resolution to dictate what refresh rate and screen size I have on main monitor. I don't want to run a separate X server (extra resources used) to be able to output Xv onto it instantaneously (i.e. without restarting X).
I want to work / use Xv on main monitor, turn TV on, switch the video stream to it, watch a movie on TV using same Xv extension, return back to my computer screen to work / watch movies through Xv on computer monitor, all without restarting X.
You may say, "Whattsa matter wit you? You can do it already..." Not quite. With Xv in the mix, on Linux this is an uphill battle.
SOLUTIONS:There are 3 ways I can potentially go with my ATI Radeon 8500 (SVGA, DVI and S-Video out.):
A. Xorg drivers, or B. Xorg drivers sprinkled by Gatos project, or C. ATI proprietary drivers (fglrx).A. Xorg drivers (6.8.2 and 6.9, 7.0):The Xorg's "radeon" driver has NO obvious, listed options for enabling or controlling the TV-out. There are numerous messages on the xorg mailing list saying that radeon driver does not know how to activate the TV encoder chip. As a result, simply defining the S-Video out as one more monitor only produces garbage on TV screen. The latter is confirmed by other messages on the same list.
For some, the problem with "stock" Xorg drivers (its inability to activate the TV-out encoder chip) could be mitigated by a utility called atitvout. It is designed to make direct calls to the video card BIOS. In my case, the calls were unanswered. TV-out not yet.
B. Xorg + Gatos:I red the TV out documentation on Gatos web site and am a bit scared. The instructions talk of patching the X sources, compiling them, compiling additional software, etc. At the same time, there is very little mentioned about what and where I can do on Xv front. Does it come out on both screens? If not, how easy is it to switch screens? (see xvattr link for that)
Without those answers and influenced even more by the statement of immaturity of the solution, the unhappy prospect of recompiling X and other funkiness, I decided to postpone the discovery of Gatos until some better days. Besides, some Gatos parts are moving into Xorg 7.0. Once they are well documented, I'll look into this again.
In the meantime, those who dare to go this route should find these resources useful:
"TV output module" page of Gatos project.
A non-ATI
utility for switching the screen for video overlay. Example usage: xvattr --attribute XV_SWITCHCRT -v [0/1]
C. ATI's proprietary fglrx drivers:
There were huge problems with using ATI's drivers
- No Composite support; (per 8.24.8 release notes)
- No (reliable) support for software-suspend / hibernation; (per 8.24.8 release notes)
- No support for ACPI. (The drivers expect APM.) (per personal experience)
- - No TV out support on ATI's X1xxx cards yet. (per 8.24.8 release notes)
There are huge pluses as well:
Well, the OpenGL for starters. Also, hands down, ATI's fglrx drivers offer best documented and easiest ways to enable and control TV-Out. I don't need to set up any new monitor section. I don't have to change ANY of the settings in the xorg.conf. If the card detects a TV connected to the S-Video or composite/Yellow RCA connector, TV out is activated automatically when X starts. You can even leave "Option 'DesktopSetup' '(none)'" in place. All you really have to change is the TV signal standard, if the default "NTSC-M" is not for you.
The excellent part of the ATI's tv-out is that TV is on, even when my main monitor's resolution and refresh rate are well above those of a TV. In this mode, TV simply "pans" (Imagine looking at a picture with a magnifying glass.) Even cooler part of this set up is that (my) ATI's TV encoder chip accepts 800x600 resolution as acceptable. It then scales it down to TV's 320x280 interlaced (or, whatever that is), producing unquestionably exceptional (for TV) picture.
Managing Xv on a running X server:The docs also make it clear that I can output Xv to only one out at a time. In my search for a simple way to switch which screen gets the Video Overlay I found - aticonfig.
ATI ships an "aticonfig" command line utility with it's drivers. It is designed for changing the xorg.conf through command line arguments. One of them is "--overlay-on=" option, which targets "Option 'OverlayOnCRTC2' 'n'" but affects the running X server as well. Bingo!
This command ("aticonfig --overlay-on="[0/1]) can switch a running Xv video stream from one screen to another in mid-air.
I can watch a movie on computer screen, pause it, run "aticonfig --ovon=1", turn TV on, say to my wife "You have to see this" and hit play to continue watching the movie on TV. (A tear is crawling out of my eye.) It's a miracle!
IS THERE ANOTHER WAY? aka. How to get video stream on BOTH, the computer and TV screens?:All that XVideo talk I had above is nice. But, what if you need you video stream to be cloned to many monitors? Then, we need to look into a completely different type of video overlay - OpenGL overlay.
To make it work, you don't even have to touch the Xorg.conf. As long as OpenGL works on your system, you have a chance to use OpenGL "video" overlay. To enable it, you go to your favorite video player and change the video output driver setting.
In my case, it's KDE's excellent
Kaffeine media player v.0.8, that uses
Xine media engine. If the setting (see screenshot) is accepted by Xine (Kaffeine will let you know if not), you will instantly be able to output video to all cloned screens.

So, why all the hoopla about XVideo above? Why NOT just use OpenGL overlay? Two reasons:
- Not everybody on Linux has a working OpenGL. Direct rendering / OpenGL brakes hibernation on many platforms too. So, on my laptop accelerated OpenGL is completely disabled.
- XVideo uses much, much, much fewer CPU resources. On my 933Mhz Pentium III, Radeon 8500 computer, OpenGL overlay consumes 100% of CPU, makes the rest of the system jerky and drops video frames fairly often. Playing a DVD through XVideo, scaled up to 1280x1024, with some extra effects, only consumes about 30% of CPU.