1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>8.3. DGA</title><link rel="stylesheet" href="default.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="MPlayer - The Movie Player"><link rel="up" href="video.html" title="Chapter 8. Video output devices"><link rel="prev" href="xv.html" title="8.2. Xv"><link rel="next" href="sdl.html" title="8.4. SDL"><link rel="preface" href="howtoread.html" title="How to read this documentation"><link rel="chapter" href="intro.html" title="Chapter 1. Introduction"><link rel="chapter" href="install.html" title="Chapter 2. Installation"><link rel="chapter" href="usage.html" title="Chapter 3. Usage"><link rel="chapter" href="advaudio.html" title="Chapter 4. Advanced audio usage"><link rel="chapter" href="cd-dvd.html" title="Chapter 5. CD/DVD usage"><link rel="chapter" href="tv.html" title="Chapter 6. TV"><link rel="chapter" href="radio.html" title="Chapter 7. Radio"><link rel="chapter" href="video.html" title="Chapter 8. Video output devices"><link rel="chapter" href="ports.html" title="Chapter 9. Ports"><link rel="chapter" href="mencoder.html" title="Chapter 10. Basic usage of MEncoder"><link rel="chapter" href="encoding-guide.html" title="Chapter 11. Encoding with MEncoder"><link rel="chapter" href="faq.html" title="Chapter 12. Frequently Asked Questions"><link rel="appendix" href="bugreports.html" title="Appendix A. How to report bugs"><link rel="appendix" href="skin.html" title="Appendix B. MPlayer skin format"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">8.3. DGA</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="xv.html">Prev</a> </td><th width="60%" align="center">Chapter 8. Video output devices</th><td width="20%" align="right"> <a accesskey="n" href="sdl.html">Next</a></td></tr></table><hr></div><div class="sect1" title="8.3. DGA"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dga"></a>8.3. DGA</h2></div></div></div><p title="PREAMBLE"><b>PREAMBLE. </b>
2
This document tries to explain in some words what DGA is in general and
3
what the DGA video output driver for <span class="application">MPlayer</span>
4
can do (and what it can't).
5
</p><p title="WHAT IS DGA"><b>WHAT IS DGA. </b>
6
<acronym class="acronym">DGA</acronym> is short for <span class="emphasis"><em>Direct Graphics
7
Access</em></span> and is a means for a program to bypass the X server and
8
directly modifying the framebuffer memory. Technically spoken this happens
9
by mapping the framebuffer memory into the memory range of your process.
10
This is allowed by the kernel only if you have superuser privileges. You
11
can get these either by logging in as <code class="systemitem">root</code> or by setting the SUID bit on the
12
<span class="application">MPlayer</span> executable (<span class="bold"><strong>not
13
recommended</strong></span>).
15
There are two versions of DGA: DGA1 is used by XFree 3.x.x and DGA2 was
16
introduced with XFree 4.0.1.
18
DGA1 provides only direct framebuffer access as described above. For
19
switching the resolution of the video signal you have to rely on the
22
DGA2 incorporates the features of XVidMode extension and also allows
23
switching the depth of the display. So you may, although basically
24
running a 32 bit depth X server, switch to a depth of 15 bits and vice
27
However DGA has some drawbacks. It seems it is somewhat dependent on the
28
graphics chip you use and on the implementation of the X server's video
29
driver that controls this chip. So it does not work on every system...
30
</p><p title="INSTALLING DGA SUPPORT FOR MPLAYER"><b>INSTALLING DGA SUPPORT FOR MPLAYER. </b>
31
First make sure X loads the DGA extension, see in
32
<tt class="filename">/var/log/XFree86.0.log</tt>:
34
</p><pre class="programlisting">(II) Loading extension XFree86-DGA</pre><p title="INSTALLING DGA SUPPORT FOR MPLAYER">
36
See, XFree86 4.0.x or greater is
37
<span class="bold"><strong>highly recommended</strong></span>!
38
<span class="application">MPlayer</span>'s DGA driver is autodetected by
39
<tt class="filename">./configure</tt>, or you can force it
40
with <tt class="option">--enable-dga</tt>.
42
If the driver couldn't switch to a smaller resolution, experiment with
43
options <tt class="option">-vm</tt> (only with X 3.3.x), <tt class="option">-fs</tt>,
44
<tt class="option">-bpp</tt>, <tt class="option">-zoom</tt> to find a video mode that
45
the movie fits in. There is no converter right now :(
47
Become <code class="systemitem">root</code>. DGA needs root
48
access to be able to write directly video memory. If you want to run it as
49
user, then install <span class="application">MPlayer</span> SUID root:
51
</p><pre class="screen">
52
chown root <em class="replaceable"><code>/usr/local/bin/mplayer</code></em>
53
chmod 750 <em class="replaceable"><code>/usr/local/bin/mplayer</code></em>
54
chmod +s <em class="replaceable"><code>/usr/local/bin/mplayer</code></em>
57
Now it works as a simple user, too.
58
</p><div class="caution" title="Security risk" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Security risk</h3><p>
59
This is a <span class="bold"><strong>big</strong></span> security risk!
60
<span class="bold"><strong>Never</strong></span> do this on a server or on a computer
61
that can be accessed by other people because they can gain root privileges
62
through SUID root <span class="application">MPlayer</span>.
64
Now use <tt class="option">-vo dga</tt> option, and there you go! (hope so:) You
65
should also try if the <tt class="option">-vo sdl:driver=dga</tt> option works for you!
67
</p><p title="RESOLUTION SWITCHING"><a name="dga-modelines"></a><b>RESOLUTION SWITCHING. </b>
68
The DGA driver allows for switching the resolution of the output signal.
69
This avoids the need for doing (slow) software scaling and at the same time
70
provides a fullscreen image. Ideally it would switch to the exact
71
resolution (except for honoring aspect ratio) of the video data, but the X
72
server only allows switching to resolutions predefined in
73
<tt class="filename">/etc/X11/XF86Config</tt>
74
(<tt class="filename">/etc/X11/XF86Config-4</tt> for XFree 4.X.X respectively).
75
Those are defined by so-called modelines and depend on
76
the capabilities of your video hardware. The X server scans this config
77
file on startup and disables the modelines not suitable for your hardware.
78
You can find out which modes survive with the X11 log file. It can be found
79
at: <tt class="filename">/var/log/XFree86.0.log</tt>.
81
These entries are known to work fine with a Riva128 chip, using the nv.o X
83
</p><pre class="programlisting">
86
Modeline "800x600" 40 800 840 968 1056 600 601 605 628
87
Modeline "712x600" 35.0 712 740 850 900 400 410 412 425
88
Modeline "640x480" 25.175 640 664 760 800 480 491 493 525
89
Modeline "400x300" 20 400 416 480 528 300 301 303 314 Doublescan
90
Modeline "352x288" 25.10 352 368 416 432 288 296 290 310
91
Modeline "352x240" 15.750 352 368 416 432 240 244 246 262 Doublescan
92
Modeline "320x240" 12.588 320 336 384 400 240 245 246 262 Doublescan
94
</pre><p title="DGA & MPLAYER"><b>DGA & MPLAYER. </b>
95
DGA is used in two places with <span class="application">MPlayer</span>: The SDL
96
driver can be made to make use of it (<tt class="option">-vo sdl:driver=dga</tt>) and
97
within the DGA driver (<tt class="option">-vo dga</tt>). The above said is true
98
for both; in the following sections I'll explain how the DGA driver for
99
<span class="application">MPlayer</span> works.
100
</p><p title="FEATURES"><b>FEATURES. </b>
101
The DGA driver is invoked by specifying <tt class="option">-vo dga</tt> at the
102
command line. The default behavior is to switch to a resolution matching
103
the original resolution of the video as close as possible. It deliberately
104
ignores the <tt class="option">-vm</tt> and <tt class="option">-fs</tt> options
105
(enabling of video mode switching and fullscreen) - it always tries to
106
cover as much area of your screen as possible by switching the video mode,
107
thus refraining from using additional cycles of your CPU to scale the
108
image. If you don't like the mode it chooses you may force it to choose
109
the mode matching closest the resolution you specify by <tt class="option">-x</tt>
110
and <tt class="option">-y</tt>. By providing the <tt class="option">-v</tt> option, the
111
DGA driver will print, among a lot of other things, a list of all
112
resolutions supported by your current <tt class="filename">XF86Config</tt> file.
113
Having DGA2 you may also force it to use a certain depth by using the
114
<tt class="option">-bpp</tt> option. Valid depths are 15, 16, 24 and 32. It
115
depends on your hardware whether these depths are natively supported or if
116
a (possibly slow) conversion has to be done.
118
If you should be lucky enough to have enough offscreen memory left to
119
put a whole image there, the DGA driver will use double buffering, which
120
results in much smoother movie playback. It will tell you whether
121
double buffering is enabled or not.
123
Double buffering means that the next frame of your video is being drawn in
124
some offscreen memory while the current frame is being displayed. When the
125
next frame is ready, the graphics chip is just told the location in memory
126
of the new frame and simply fetches the data to be displayed from there.
127
In the meantime the other buffer in memory will be filled again with new
130
Double buffering may be switched on by using the option
131
<tt class="option">-double</tt> and may be disabled with
132
<tt class="option">-nodouble</tt>. Current default option is to disable
133
double buffering. When using the DGA driver, onscreen display (OSD) only
134
works with double buffering enabled. However, enabling double buffering may
135
result in a big speed penalty (on my K6-II+ 525 it used an additional 20%
136
of CPU time!) depending on the implementation of DGA for your hardware.
137
</p><p title="SPEED ISSUES"><b>SPEED ISSUES. </b>
138
Generally spoken, DGA framebuffer access should be at least as fast as
139
using the X11 driver with the additional benefit of getting a fullscreen
140
image. The percentage speed values printed by
141
<span class="application">MPlayer</span> have to be interpreted with some care,
142
as for example, with the X11 driver they do not include the time used by
143
the X server needed for the actual drawing. Hook a terminal to a serial
144
line of your box and start <span class="command"><strong>top</strong></span> to see what is really
145
going on in your box.
147
Generally spoken, the speedup done by using DGA against 'normal' use of X11
148
highly depends on your graphics card and how well the X server module for it
151
If you have a slow system, better use 15 or 16 bit depth since they require
152
only half the memory bandwidth of a 32 bit display.
154
Using a depth of 24 bit is a good idea even if your card natively just supports
155
32 bit depth since it transfers 25% less data compared to the 32/32 mode.
157
I've seen some AVI files be played back on a Pentium MMX 266. AMD K6-2
158
CPUs might work at 400 MHZ and above.
159
</p><p title="KNOWN BUGS"><b>KNOWN BUGS. </b>
160
Well, according to some developers of XFree, DGA is quite a beast. They
161
tell you better not to use it. Its implementation is not always flawless
162
with every chipset driver for XFree out there.
163
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
164
With XFree 4.0.3 and <tt class="filename">nv.o</tt> there is a bug resulting
166
</p></li><li class="listitem"><p>
167
ATI driver requires to switch mode back more than once after finishing
169
</p></li><li class="listitem"><p>
170
Some drivers simply fail to switch back to normal resolution (use
171
<span class="keycap"><b>Ctrl</b></span>+<span class="keycap"><b>Alt</b></span>+<span class="keycap"><b>Keypad +</b></span>
173
<span class="keycap"><b>Ctrl</b></span>+<span class="keycap"><b>Alt</b></span>+<span class="keycap"><b>Keypad -</b></span>
174
to switch back manually).
175
</p></li><li class="listitem"><p>
176
Some drivers simply display strange colors.
177
</p></li><li class="listitem"><p>
178
Some drivers lie about the amount of memory they map into the process's
179
address space, thus vo_dga won't use double buffering (SIS?).
180
</p></li><li class="listitem"><p>
181
Some drivers seem to fail to report even a single valid mode. In this
182
case the DGA driver will crash telling you about a nonsense mode of
183
100000x100000 or something like that.
184
</p></li><li class="listitem"><p>
185
OSD only works with double buffering enabled (else it flickers).
186
</p></li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="xv.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="video.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sdl.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">8.2. Xv </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 8.4. SDL</td></tr></table></div></body></html>