2001-05-17 22:01:50 +00:00
|
|
|
|
|
|
|
Contents
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
1. Summary
|
|
|
|
2. What is DGA
|
2001-05-17 23:35:51 +00:00
|
|
|
3. Resolution switching
|
|
|
|
4. DGA & MPlayer
|
|
|
|
5. Features of the DGA driver
|
|
|
|
6. Speed issues
|
|
|
|
7. Known bugs
|
|
|
|
8. Future work
|
2001-05-17 22:01:50 +00:00
|
|
|
|
|
|
|
A. Some modelines
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1. Summary
|
|
|
|
~~~~~~~~~~
|
|
|
|
This document tries to explain in some words what DGA is in general and
|
|
|
|
what the DGA video output driver for mplayer can do (and what it can't).
|
|
|
|
|
|
|
|
2. What is DGA?
|
|
|
|
~~~~~~~~~~~~~~~
|
|
|
|
|
2001-06-10 22:04:10 +00:00
|
|
|
DGA is short for Direct Graphics Access and is a means for a program to
|
2001-06-10 21:34:39 +00:00
|
|
|
bypass the X-Server and directly modifying the framebuffer memory.
|
2001-05-17 22:01:50 +00:00
|
|
|
Technically spoken this happens by mapping the framebuffer memory into
|
2001-06-10 22:04:10 +00:00
|
|
|
the memory range of your process. This is allowed by the kernel only
|
2001-05-17 23:35:51 +00:00
|
|
|
if you have superuser privileges. You can get these either by logging in
|
2001-06-10 22:04:10 +00:00
|
|
|
as root or by setting the suid bit on the mplayer excecutable (NOT
|
|
|
|
recommended!).
|
2001-05-17 22:01:50 +00:00
|
|
|
|
2001-06-10 22:04:10 +00:00
|
|
|
There are two versions of DGA: DGA1 is used by XFree 3.x.x and DGA2 was
|
2001-05-17 23:35:51 +00:00
|
|
|
introduced with XFree 4.0.1.
|
2001-05-17 22:01:50 +00:00
|
|
|
|
2001-06-10 22:04:10 +00:00
|
|
|
DGA1 provides only direct framebuffer access as described above. For
|
2001-05-17 23:35:51 +00:00
|
|
|
switching the resolution of the video signal you have to rely on the
|
|
|
|
XVidMode extension.
|
|
|
|
|
2001-06-10 21:34:39 +00:00
|
|
|
DGA2 incorporates the features of XVidMode extension and also allows
|
2001-05-17 23:35:51 +00:00
|
|
|
switching the depth of the display. So you may, although basically
|
|
|
|
running a 32 bit depth XServer, switch to a depth of 15 bits and vice
|
|
|
|
versa.
|
|
|
|
|
|
|
|
However DGA has some drawbacks. It seems it is somewhat dependent on the
|
|
|
|
graphics chip you use and on the implementation of the XServer's video
|
|
|
|
driver that controls this chip. So it does not work on every system ...
|
|
|
|
|
|
|
|
|
|
|
|
3. Resolution switching
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
The DGA driver allows for switching the resolution of the output signal.
|
|
|
|
This avoids the need for doing (slow) software scaling and at the same
|
|
|
|
time provides a fullscreen image. Ideally it would switch to the exact
|
|
|
|
resolution (except for honouring aspect ratio) of the video data, but the
|
|
|
|
XServer only allows switching to resolutions predefined in
|
|
|
|
/etc/X11/XF86Config (/etc/X11/XF86Config-4 for XFree 4.0.X respectively).
|
|
|
|
Those are defined by so-called modelines and depend on the capabilites
|
|
|
|
of your video hardware. The XServer scans this config file on startup and
|
2001-06-10 22:04:10 +00:00
|
|
|
disables the modelines not suitable for your hardware. You can find
|
2001-05-17 23:35:51 +00:00
|
|
|
out which modes survive with the X11 log file. It can be found at:
|
2001-06-10 22:04:10 +00:00
|
|
|
/var/log/XFree86.0.log
|
2001-05-17 23:35:51 +00:00
|
|
|
See appendix A for some sample modeline definitions.
|
|
|
|
|
2001-06-10 22:04:10 +00:00
|
|
|
4. DGA & MPlayer
|
2001-05-17 23:35:51 +00:00
|
|
|
~~~~~~~~~~~~~~~~
|
2001-05-17 22:01:50 +00:00
|
|
|
|
2001-05-17 23:35:51 +00:00
|
|
|
DGA is used in two places with MPlayer: The SDL driver can be made to make
|
2001-05-18 20:48:21 +00:00
|
|
|
use of it (-vo sdl -sdl dga) and within the DGA driver (-vo dga).
|
2001-05-17 23:35:51 +00:00
|
|
|
The above said is true for both; in the following sections I'll explain
|
|
|
|
how the DGA driver for MPlayer works.
|
|
|
|
|
|
|
|
|
|
|
|
5. Features of the DGA driver
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
The DGA driver is invoked by specifying -vo dga at the command line.
|
2001-06-10 21:34:39 +00:00
|
|
|
The default behaviour is to switch to a resolution matching the original
|
|
|
|
resolution of the video as close as possible. It deliberately ignores the
|
|
|
|
-vm and -fs switches (enabling of video mode switching and fullscreen) -
|
|
|
|
it always tries to cover as much area of your screen as possible by switching
|
|
|
|
the video mode, thus refraining to use a single additional cycle of your CPU
|
|
|
|
to scale the image.
|
|
|
|
If you don't like the mode it chooses you may force it to choose the mode
|
|
|
|
matching closest the resolution you specify by -x and -y.
|
|
|
|
By providing the -v option, the DGA driver will print, among a lot of other
|
|
|
|
things, a list of all resolutions supported by your current XF86-Config
|
|
|
|
file.
|
|
|
|
Having DGA2 you may also force it to use a certain depth by using the -bpp
|
|
|
|
option. Valid depths are 15, 16, 24 and 32. It depends on your hardware
|
|
|
|
whether these depths are natively supported or if a (possibly slow)
|
|
|
|
conversion has to be done.
|
2001-05-17 23:35:51 +00:00
|
|
|
|
2001-06-10 21:34:39 +00:00
|
|
|
If you should be lucky enough to have enough offscreen memory left to
|
|
|
|
put a whole image there, the DGA driver will use doublebuffering, which
|
|
|
|
results in much smoother movie replaying. It will tell you whether double-
|
|
|
|
buffering is enabled or not.
|
2001-05-17 23:35:51 +00:00
|
|
|
|
2001-06-10 21:34:39 +00:00
|
|
|
|
|
|
|
6. Speed issues
|
|
|
|
~~~~~~~~~~~~~~~
|
|
|
|
Generally spoken, DGA framebuffer access should be at least as fast as using
|
|
|
|
the X11 driver with the additional benefit of getting a fullscreen image.
|
|
|
|
The percentage speed values printed by mplayer have to be interpreted with
|
|
|
|
some care, as for example, with the X11 driver they do not include the time
|
|
|
|
used by the X-Server needed for the actual drawing. Hook a terminal to a
|
|
|
|
serial line of your box and start top to see what is really going on in your
|
|
|
|
box ...
|
|
|
|
|
|
|
|
Generally spoken, the speedup done by using DGA against 'normal' use of X11
|
|
|
|
highly depends on your graphics card and how well the X-Server module for it
|
|
|
|
is optimized.
|
|
|
|
|
|
|
|
If you have a slow system, better use 15 or 16bit depth since they require
|
|
|
|
only half the memory bandwidth of a 32 bit display.
|
2001-05-17 23:35:51 +00:00
|
|
|
|
2001-06-10 21:34:39 +00:00
|
|
|
Using a depth of 24bit is even a good idea if your card natively just supports
|
|
|
|
32 bit depth since it transfers 25% less data compared to the 32/32 mode.
|
2001-05-17 23:35:51 +00:00
|
|
|
|
2001-06-10 21:34:39 +00:00
|
|
|
I've seen some avi files already be replayed on a Pentium MMX 266. AMD K6-2
|
|
|
|
CPUs might work at 400 MHZ and above.
|
|
|
|
|
|
|
|
7. Known Bugs
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Well, according to some developpers of XFree, DGA is quite a beast. They
|
|
|
|
tell you better not to use it. Its implementation is not always flawless
|
|
|
|
with every chipset driver for XFree out there.
|
|
|
|
|
|
|
|
o with XFree 4.0.3 and nv.o there is a bug resulting in strange colors
|
|
|
|
o ATI driver requires to switch mode back more than once after finishing
|
|
|
|
using of DGA
|
|
|
|
o some drivers simply fail to switch back to normal resolution (use
|
|
|
|
Ctrl-Alt-Keypad +, - to switch back manually)
|
|
|
|
o some drivers simply display strange colors
|
|
|
|
o some drivers lie about the amount of memory they map into the process's
|
2001-06-12 09:07:36 +00:00
|
|
|
address space, thus vo_dga won't use doublebuffering (SIS?)
|
2001-06-10 21:34:39 +00:00
|
|
|
o some drivers seem to fail to report even a single valid mode. In this
|
|
|
|
case the DGA driver will crash telling you about a nonsense mode of
|
|
|
|
100000x100000 or the like ...
|
|
|
|
o OSD only works with doublebuffering enabled
|
|
|
|
|
|
|
|
8. Future work
|
|
|
|
~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
o use of the new X11 render interface for OSD
|
|
|
|
o where is my TODO list ???? :-(((
|
2001-05-17 23:35:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
A. Sample modelines
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
Section "Modes"
|
|
|
|
Identifier "Modes[0]"
|
2001-06-10 21:34:39 +00:00
|
|
|
# 800x600 @ 60 Hz, 37.8 kHz hsync
|
|
|
|
Modeline "800x600" 40 800 840 968 1056 600 601 605 628
|
2001-06-12 09:07:36 +00:00
|
|
|
Modeline "712x600" 35.0 712 740 850 900 400 410 412 425
|
|
|
|
Modeline "640x480" 25.175 640 664 760 800 480 491 493 525
|
|
|
|
Modeline "400x300" 20 400 416 480 528 300 301 303 314 Doublescan
|
2001-06-10 21:34:39 +00:00
|
|
|
Modeline "352x288" 25.10 352 368 416 432 288 296 290 310
|
2001-06-12 09:07:36 +00:00
|
|
|
Modeline "352x240" 15.750 352 368 416 432 240 244 246 262 Doublescan
|
|
|
|
Modeline "320x240" 12.588 320 336 384 400 240 245 246 262 Doublescan
|
2001-05-17 23:35:51 +00:00
|
|
|
EndSection
|
|
|
|
|
|
|
|
|
|
|
|
These entries work fine with my Riva128 chip, using nv.o XServer driver
|
|
|
|
module.
|
|
|
|
|
|
|
|
Acki (acki@acki-netz.de, www.acki-netz.de) 17.5.2001
|
2001-05-17 22:01:50 +00:00
|
|
|
|
|
|
|
|