The time now is Sat 13 Feb 2016, 19:54
All times are UTC - 4
Joined: 07 Apr 2008
|Posted: Fri 11 Apr 2008, 17:26 Post subject:
Understanding Linux Graphics Drivers
Subject description: Understanding the four levels of Linux Graphics and how to get hardware acceleration working
Recently I have been wrapping my head around the complexity of linux graphics drivers, and decided to summarise my research for any reliative linux newbies that want to understand this better.
I am also getting a wiki account to put an editable version under http://puppylinux.org/wikka/TextSearch?phrase=CategoryHardware
Suggestions would be appreciated - I am sure I haven't covered everything. For starters, it has a slant towards VIA graphics.
(oh, and apologies for posting as code - the only way to retain nested bullets. But it does make urls unclickable).
|In order for graphics card hardware acceleration to work, four levels of support have to come together (http://en.wikipedia.org/wiki/X_video_extension):
1) The graphics card hardware has to support the required features.
2) The device driver software for the graphics card.
3) The X server programs have to support the required features (e.g. XVideo interface).
4) The application software (e.g. video playback) has to make use of this interface.
The following 4 sections roughly address each of these four levels.
There are a number of different features that can be hardware accelerated (http://wiki.openchrome.org/tikiwiki/tiki-index.php?page=HardwareCaveats):
- 2D accel. - benefits general desktop use.
Sometimes refers to XV - see below (but I think is more than just XV?).
- 3D accel. - benefits OpenGL (anything else?).
- XV - The X video extension. http://en.wikipedia.org/wiki/X_video_extension
Is a video output mechanism for the X Window System.
Rescales video playback, performs color space conversions,
can be used to change contrast, brightness and hue.
- XvMC - X-Video Motion Compensation (XvMC). http://en.wikipedia.org/wiki/XvMC
Is an extension of the X video extension (Xv) for the X Window System.
Provides MPEG2 playback acceleration, and on some chips, MPEG4 playback acceleration.
- ?? Does anyone know if XvMC acceleration works for Adobe Flash Video (FLVs) ??
?? Does it work for all FLV codecs (Spark, OnVP6, MP4), or just some ??
Software that uses XvMC includes: MPlayer, MythTV, VLC, FFmpeg and xine.
XvMC accelerates: motion compensation (mo comp), inverse discrete cosine transform (iDCT),
and "Variable-Length Decoding", more commonly known as "slice level acceleration" (VLD).
NOTE: some hadware does not support XvMC, but does support mo comp and iDCT (Intel and ATI).
These are not as good - VLD decoding offloads much more CPU load.
- Other features: Dual head, Panel, HDTV.
Each feature has to have all four levels of support workng (see above): hardware, device driver, X server and software.
VIA linux graphics drivers are a complicated area. http://wiki.openchrome.org/tikiwiki/tiki-index.php?page=The+Different+Unichrome+family+display+drivers lists that there are 6 different projects with 6 different drivers, all with their strengths and weaknesses: VIA proprietary, Xorg, OpenChrome (related to xorg), Kdrive, the Unichrome project, the XFree86 driver.
The strengths and weaknesses often include partial implementations of hardware acceleration features. For example, a driver may have 3D but not MPEG4 implemented.
For most people, this can be reduced to 3 choices:
- Xorg - basic functionality for many chipsets, maybe more functionality, but not cutting edge.
- OpenChrome - http://wiki.openchrome.org/tikiwiki/tiki-index.php
- A free and Open Source video driver for the VIA/S3G UniChrome, UniChrome Pro and Chrome9 graphics chipsets.
- is basically the Xorg driver with some experimental enhancements for
the community to try out before they are commited to Xorg.
- CX700M(2) is supported, but like all chipsets - not fully implemented:
- 2D accel - OK. 3D accel - OK. XV - OK. MPEG2 - not implemented (up to 2048x2048).
- MPEG4 - not implemented. Dual head - not implemented. Panel - needs VBE.
- ?? So OpenChrome have not implemented XvMC for any VIA hardware. Is this true ??
?? I thought I got the impression elsewhere that it would work. ??
- Manufacturer Proprietary drivers - e.g. http://www.viaarena.com/
- VIA proprietary drivers. Contain support for most chipsets, mpeg2 and mpeg4 acceleration,
- but are of low quality and often unstable. Insecure - the 3D driver leaves
your system open for attack by malicious clients, and furthermore,
- applications that accelerate mpeg2 and mpeg4 must be run as root, which is a very
bad idea if they contain vulnerabilities (and they do).
- Avoid using these drivers unless you know what you are really doing! (or is a kiosk??)
- Also, these drivers are distribution specific and a driver for different distribution
other than yours might not work.
- Supports: UMA Chipset series: S3 Graphics UniChrome™ Pro IGP Series,
Chipset Name: CX700(M)(M2), Graphics Device ID: 3157
- Has CX700M driver for Ubuntu 7.1. With Binary/Kernel binary. Version - 0.8, 04 December 2007
- Work on Xubuntu too? Does it support all the hadware stuff?
- Has CX700M driver for Debian 3.1r4/4.0, Fedora Core 4/5/6, Mandriva 2007/2007.1,
openSUSE 10.2 and Ubuntu 6.10/7.04 Desktop.
Source with documentation. Version - 0.83 07 June 2007.
Supports 2D, MP2, MP4, “Hardware Video Overlay”, and “TV Out” including HDTV.
- Has CX700M driver for other linux variants too.
- ?? Has anyone got these working with Puppy Linux ?? How ??
And as a slight aside, on 8th April, VIA Technologies "announced a new initiative to improve support for the Open Source development community". Fingers crossed it improves matters somewhat. http://www.via.com.tw/en/resources/pressroom/pressrelease.jsp?press_release_no=2088
If you want to try propriatary NVidia or Ati drivers for Puppy 3, use: http://dotpups.de/puppy3/dotpups/XServer/
As mentioned, the X server programs have to support the XVideo interface. I am not too sure about this level, but I do know that these advanced features seem to be reliant on other linux files/drivers/modules(?) being present. For example, DRI, DRM, OpenGL. I am not 100% clear on which features require which modules.
- X server - http://en.wikipedia.org/wiki/X_server
- The X Window System (commonly X11 or X) is a system which implements the
X display protocol and provides windowing on bitmap displays.
It provides the standard toolkit and protocol with which to build
graphical user interfaces (GUIs)
- X is an optional application layer on top of the operating system kernel.
- X was specifically designed to be used over network connections.
Thus, the machine where an application program (the client application) runs
can differ from the user's local machine (the display server).
- So the X server is the display server on the user's local machine using the X protocol.
- The X.Org Server - http://en.wikipedia.org/wiki/X.Org_Server
(officially the X.Org Foundation Open Source Public Implementation of X11)
Is the X server in the official reference implementation of the X Window System.
- DRI - Direct Rendering Infrastructure - http://en.wikipedia.org/wiki/Direct_Rendering_Infrastructure
Is is an interface used in the X Window System to securely allow user applications to access
the video hardware without requiring data to be passed (slowly) through the X server.
Is now part of the X.Org Server.
Its primary application is to provide hardware acceleration of the Mesa implementation of OpenGL.
The DRI OpenGL support consists of several pieces:
- The Direct Rendering Manager (DRM) - see below
- a userland driver module, which contains an OpenGL driver that typically prepares
buffers of commands to be sent to the hardware by the DRM, and interacts with the
windowing system for synchronization of access to the hardware.
- some sort of server. In X this is the libdri.so support module and a DRI-enabled DDX (2D driver).
- DRM - Direct Rendering Manager (DRM) - http://en.wikipedia.org/wiki/Direct_Rendering_Manager
Is a component of the Direct Rendering Infrastructure,
a system to provide efficient video acceleration (especially 3D rendering).
It consists of two in-kernel drivers (realized as kernel modules on Linux),
a generic drm driver,
and another which has specific support for the video hardware.
This pair of drivers allows a userspace client direct access to the video hardware.
- SDL - Simple DirectMedia Layer - http://en.wikipedia.org/wiki/Simple_DirectMedia_Layer
- Not a base requirement, but is required for some graphical software to work.
- Is a cross-platform, multimedia, free and open source software library written in C.
Lastly, the application software (e.g. video playback) has to make use of this interface.
This also relates to testing - I have not found a simple and reliable way to test what drivers are in use, what modules are in use, and what graphics features are currently enabled.
So the alternative is the complicated, unreliable way ;-) . Ok, generally reliable, but certainly not simple!
This being to run various diagnostics and software that utilise the target features. I am sure there are better options for some, but this is what I am aware of:
- From the terminal, type 'lsmod' to list modules installed.
- 'lsmod |grep via' will find any modules containing the term 'via'.
Should contain 'via' and 'via_agp'.
Should also notice 'dri' (or was it 'drm'?) using 'via'.
If not, 'modprobe via' will load the via module, but it didn't help me.
- May need to be called earlier during bootup.
- putting it in /etc/rc.d/rc.local has been suggested, but didn't work for me.
- 'echo via >> /etc/modules' might work??, but didn't work for me.
- Search '/var/log/Xorg.0.log'
- Search for 'VIA'.
Can see e.g. 'VESA(0): VESA VBE OEM: VIA CX700'.
Suggesting graphics are loaded using VESA drivers (which are old and non-accelerated).
X Server Support:
- Type 'xdriinfo' from terminal.
- untested - ??????????
- Search for:
If don't exist, you probably don't have OpenGL installed yet.
- Search '/var/log/Xorg.0.log'
- Search for 'dri'.
Can reveal errors like 'AIGLX: Screen 0 is not DRI capable'.
- Search for 'drm'.
A forum says:
'You may see reference to libdrm, which I seem to remember is very important.'
- Search for 'glx'.
Can reveal errors like 'GLX: Initialized MESA-PROXY GL provider for screen 0'.
Which suggests OpenGL will be processed in software - non-accelerated.
- Search for 'glx'.
Can reveal errors like 'VIA(0): [XvMC] Cannot use XvMC without DRI!'.
- Geany text editor (install the pet type 'geany' from terminal).
With acceleration, text should scroll very fast.
I assume this proves DRI and DRM are working properly.
- 3D Control Center (3DCC)
The latest I could find is 3DCC-Puppy-2.12-and-2.13.pup - developed for Puppy 2.13.
May also need to install 'getdir.pup' and 'Gtklist04MU.pup'.
DON'T use the driver installation for later versions of Puppy.
Puppy3 now has a DRI modules package in PetGet.
Please install that, and OpenGL and libSDL.
But the 3D Demo is helpful -
warns if you don't have DRI acceleration, and gives a benchmark framerate.
4fps for non-accelerated VIA CX700M.
- GlxTools - glxinfo and glxgears.
- Unpack 'glxtools.tgz' (tested) or install 'glxgears-pup1x.pup' (untested).
- Run "glxinfo". Hope that you see "direct rendering: Yes".
Can filter down with "glxinfo |grep direct".
- Run "glxgears" from the terminal will report fps.
With no OpenGL, will get error like 'Xlib: extension "GLX" missing on display ":0.0".'
With non-accelerated OpenGL, expect a low fps (60-70fps) for a VIA CX700M.
With 3D acceleration, should give from 400 - 500 fps.
With 3D acceleration, a 64mb nvidia MX440 in a 713mhz (OCed) intel celeron
With 3D acceleration, a fast system (in 2008) reported 8500 fps.
Xv and XvMC
- Software that uses XvMC includes: MPlayer, MythTV, VLC, FFmpeg and xine.
- Without the Direct Rendering (DRI) graphics driver,
DVD playback with Xine on an Epia/Unichrome system is terrible.
100% CPU usage and stuttering playback. But depends a little on CPU speed.
- Install MPlayer-1.0rc2-unichrome.pet (15.03.08) from http://dotpups.de/puppy3/dotpups/Multimedia/
- Launch it from the commandline with the correct xvmc parameters.
'mplayer -vo xvmc -vc ffmpeg12mc [file]'
'mplayer -vo xvmc,xv -vc ffmpeg12mc, [file]'
I think this just lets the video fallback to xv if xvmc fails.
- If the video plays, all is well. If it fails, you will see
various error messages on the commandline.
- MPlayer will not launch unless libXvMCW is present.
- see http://www.murga-linux.com/puppy/viewtopic.php?t=13216
- libXvMCW-xorg6.8.1.pup available
- too old for me - Puppy 3 has Xorg 7.2.
- By now is probably integrated into other packages (xorg?).
- Xine with XvMC hardware acceleration,
Jan 2006 - http://www.murga-linux.com/puppy/viewtopic.php?t=5701
You could also try gxine. The accelerated output option for xine is "xxmc".
MU has a old but gold unichrome-xine DOT pup which I would recommend to vastly improve playback.
- NOTE: There are other video output methods besides 'xv' and 'xvmc'.
- See http://www.murga-linux.com/puppy/viewtopic.php?t=13216
- "x11" video output under Xvesa (not as good as xv+Xorg).
- "gl" video output under Xorg+OpenGL (older).
- "dga2" video output (older).
- I am not sure what, if any impact this has on our testing.
- If you are testing by simply 'does playback look smoother' it might be inconclusive.
- If you test by forcing xvmc use (e.g. use the '-vo xvmc' flag) you should be fine.
Joined: 07 Apr 2008
|Posted: Fri 11 Apr 2008, 17:36 Post subject:
The main unanswered questions that have arisen from this for me are:
- Has anyone tried the VIA proprietary drivers in Puppy Linux. Do they work and how do you get them working?
- The OpenChrome website suggests they have not implemented XvMC for any VIA hardware. Is this true? I thought I got the impression elsewhere that it would work.
- Does anyone know if XvMC acceleration works for Adobe Flash Video (FLVs)? Does it work for all FLV codecs (Spark, OnVP6, MP4), or just some?
Joined: 10 Jun 2005
|Posted: Fri 11 Apr 2008, 21:23 Post subject:
I compiled the OpenChrome Xorg driver in early 2006 when Puppy was at version 1.08. 3D and XvMC were working perfectly with a VIA CLE266 chipset on a VIA Epia board.
Puppy's version of Xorg has changed significantly since then, and the OpenChrome features have been integrated into the standard Xorg via driver ... but various forum members have had trouble getting Unichrome 3D to work. I seem to recall that dvw86 has had success, but his chipset is older. I think it's the newer Unichrome chipsets which are troublesome. Unichrome is currently being discussed on the forum here -
|nosignal wrote: |
|Has anyone tried the VIA proprietary drivers in Puppy Linux. |
The proprietary VIA Xorg driver has a bad reputation. The opensource Xorg driver, based on development by the OpenChrome project, is regarded as much better.
|nosignal wrote: |
|The OpenChrome website suggests they have not implemented XvMC for any VIA hardware. |
Absolutely wrong. One of the major features of Openchrome development is XvMC support. You may be getting OpenChrome confused with their parent project: unichrome.sf.net. This earlier development project did, indeed, rip out XvMC support.
|nosignal wrote: |
|Does anyone know if XvMC acceleration works for Adobe Flash Video (FLVs)? Does it work for all FLV codecs (Spark, OnVP6, MP4) |
XvMC acceleration currently only supports MPEG1 and MPEG2. MPEG4 support is planned, but not ready.
The original Flash Video format, Sorensen Spark, as well as the VP6, H.263 and H.264 codecs are all part of the MPEG-4 family, so all are currently unsupported by XvMC. However, this shouldn't matter for most Flash content available on the web, which is typically of modest resolution.
XvMC is particularly useful for full standard definition DVD content (720x576) and, indeed, for the latest high definition DVD content (1920x1080).
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
Powered by phpBB © 2001, 2005 phpBB Group