Building mesa-git with video decode enabled on squeeze

Share your own howto's etc. Not for support questions!

Building mesa-git with video decode enabled on squeeze

Postby Ibidem » 2011-08-23 00:34

Recently, Mesa head has merged support for using Gallium to accelerate video decode using VDPAU, XvMC, and va-api.
This code is mostly tested on the r600g driver, so if you have a Radeon HD 3xxx or better, you're in luck.
Be aware, however, that the driver does not have good thermal/power management; hot laptops like my x100e will be worse off than with fglrx.
I did this, tested OpenGL, and reverted to fglrx because my laptop was too hot to complete any major compile, or view a flash video in Gnash.

Notes on building Mesa from git HEAD (7.12 git)
OS: Debian 6.0.x/squeeze
Backports and updates enabled, but don't help much with this; one or two of the packages are available, though.

You will need at least 2-3 GB (I think) of diskspace.

1. Installing stock packages
# apt-get build-depends libgl1-mesa-glx (use -s to preview)
If you prefer OpenMotif, (re)install libmotif-dev afterwards; if no motif, uninstall lesstif2-dev.
Install llvm-dev and git (the versions in the repositories are fine); llvm-dev is needed for Gallium.

2. Upgrading packages to usable versions
Get sources for the packages below from Wheezy or Sid (Wheezy is up-to-date
enough). Rebuild in the indicated order; xorg-sgml-doctools & libdrm will
provide build-depends for later packages, IIRC, and should thus be installed
before proceeding.

===NEEDED FOR 7.11+===
xorg-sgml-doctools 1.5+ (install before proceeding)
libdrm 2.4+ (install before proceeding)
libxi 1.4.2+
libxmu 1.1.0+
===NEEDED FOR 7.12+===
x11proto-dri2 2.6+
x11proto-gl 1.4.14+

#Get sources
#prepare
Code: Select all
mkdir debs
#Unpack
dpkg-source -x *.dsc #you may need to do one at a time
cd xorg-sgml*/ && dpkg-buildpackage -b; cd -
sudo dpkg -i xorg-sgml*.deb; mv *.deb debs/
cd libdrm*/ && dpkg-buildpackage -b; cd -
sudo dpkg -i *.deb # there are half a dozen packages, all of which are needed
mv *.deb debs

Then build the rest of the packages, and install.

3. Adding in pipe-video build-depends
# apt-get install libvdpau-dev libxvmc-dev libva-dev
You need headers for vdpau to enable vdpau, etc.
Only install headers for the APIs you will enable, though.

4. Get the source.
Do you want the main version, which is regularly updated, but only supports
MPEG2 video decode now, or Emeric's VP8-enabled branch, which lags behind?
I don't know the URL for Emeric's branch; trunk is here:
Code: Select all
git clone  git://anongit.freedesktop.org/mesa/mesa mesa.git


5. Determine your driver.
#TODO: mention how.

Assuming you have an r600-compatible Radeon, you're in luck.
This includes all HD 3xxx cards, like my X100e's HD 3200 Mobility.
These cards are where pipe-video support is developed.
An Intel card, though, is very bad news: Intel doesn't support Gallium,
but only the "classic" driver, without pipe-video.


6. Configure.
You will need to know the prefix/libdir/driverdir/*dir you intend to use,
the features to support, and how to enable them. ./configure --help is key.

I used
./configure --enable-gallium-llvm --with-gallium-drivers=swrast,r600 \
--with-dri-drivers=r128 --enable-motif --enable-glw --enable-texture-float \
--enable-shared-glapi --enable-shared-dricore --disable-gles-overlay \
--disable-gles1 --disable-gles2 --enable-motif --enable-glw \
--enable-texture-float --enable-shared-glapi --enable-shared-dricore \
--disable-gles-overlay --disable-gles1 --disable-gles2 --disable-egl \
--enable-va --disable-xvmc --enable-vdpau --prefix=/mnt/mesa/opt/mesa712 \
--with-dri-driverdir=/mnt/mesa/opt/mesa712
I enabled the r128 driver, since default is to build all DRI drivers (SLOW)

--enable-texture-float enables a patented OpenGL extension, not suited for
distribution in the US or some other countries. You need to license it (from
SGI) in the US. This does not include code to enable s3tc, though using s2tc appears to be OK

Gallium r600 will not build unless you enable the gallium swrast driver; IIRC,
all Gallium drivers rely on "swrast" (the softpipe/llvmpipe driver) as fallback.
--enable-shared-glapi and --enable-shared-dricore will speed up the build
and reduce disk use by building internal components as shared libs, but are
experimental (BEWARE!).
I have attempted to disable everything but OpenGL and pipe-video (I disabled
xvmc too).

I recommend installing in /opt/mesa or some such path, as this avoids fouling
up the main system paths. In my case, I had a separate partition for all the experiments.

You will need to set some variables in your .bashrc (or whatever you use) to use the alternate install:
Code: Select all
export LIBGL_DRIVERS_PATH=/mnt/mesa/opt/mesa712
export LD_LIBRARY_PATH=/mnt/mesa/opt/mesa712/lib:/mnt/mesa/lib:/mnt/mesa/opt/mesa712/lib/va:/mnt/mesa/opt/mesa712/lib/vdpau
export EGL_DRIVERS_PATH=/mnt/mesa/opt/mesa712/lib/egl
export PATH=~/bin:/mnt/mesa/bin:$PATH

See:
http://pkg-xorg.alioth.debian.org/howto/build-mesa.html
(by Cyril Brulebois) for the original guide.
Some configure options for 7.12git are completely different; additionally, the old list of packages is inadequate.
Thinkpad X100e/Debian Squeeze (All reposiories enabled)/Linux 3.4.11:
1GB RAM/1.6GHz Neo X2/ATI HD 3200/RTL8191SEVA2 wlan0, RTL8169 eth0
Ibidem
 
Posts: 157
Joined: 2010-12-24 18:28

Re: Building mesa-git with video decode enabled on squeeze

Postby Ibidem » 2012-02-26 23:48

Now, you'll need to manually backport/update libdrm to 2.4.31
I'm using the tarball http://dri.freedesktop.org/libdrm/libdrm-2.4.31.tar.bz2
Copy over debian/ from a packaged older version.
Check the patches in debian/patches: as it stands, patch 01 needs a slight change in offset from 70 to 74.
Run
Code: Select all
dch -d
(increase version to match the directory)

If you run dpkg-buildpackage -b, it will die because *.symbols doesn't match the version. Copy the new symbols files over the old ones (it will take 3 builds before this works).
Then install the debs, and you can configure.

There is a bug in the configure script: CXXFLAGS must be set to include -I../../src/mapi -I../../src/mesa
If you don't do this you will get an FTBFS!
Thinkpad X100e/Debian Squeeze (All reposiories enabled)/Linux 3.4.11:
1GB RAM/1.6GHz Neo X2/ATI HD 3200/RTL8191SEVA2 wlan0, RTL8169 eth0
Ibidem
 
Posts: 157
Joined: 2010-12-24 18:28

Re: Building mesa-git with video decode enabled on squeeze

Postby Ibidem » 2012-03-05 00:28

Now, you'll need to backport libxcb 1.8 & xcb-proto 1.7 before building.

xcb-proto is pretty simple; make sure to install BOTH debs before building libxcb (see bug #662113)

Then run
Code: Select all
sed -e 's|/*/|/|g' -i debian/*.install

and you're ready to build libxcb.
Install libxcb-dri2 and the -dev package.
Code: Select all
su
ls libxcb*.deb|grep -v dbg |grep -E dri2\|glx\|xv\|libxcb1|xargs dpkg -i

(Note-if you think there may be someone else who may have written to the directory, omit the "dpkg -i" and review the packages before installation.)

And you can now build the latest Mesa on Squeeze.

Also, use
Code: Select all
 ./configure --without-dri-drivers
to disable building mesa classic drivers.
Right now I'm using
Code: Select all
export CXXFLAGS="-Os -I../../src/mapi -I../../src/mesa" #Workaround for the occasional omission of $(INCLUDES) from CXXFLAGS
export CFLAGS="-Os"
./configure --enable-gallium-llvm --with-gallium-drivers=r600 --enable-glx --enable-motif --enable-glw --enable-texture-float --disable-gles1 --enable-shared-glapi --disable-gles2 --enable-egl --enable-xvmc --prefix=/opt/mesa8 --without-dri-drivers --with-dri-driverdir=/opt/mesa8/lib --enable-vdpau

(--with-dri-driverdir sets the directory where all drivers land, not just the "classic" DRI drivers).
Thinkpad X100e/Debian Squeeze (All reposiories enabled)/Linux 3.4.11:
1GB RAM/1.6GHz Neo X2/ATI HD 3200/RTL8191SEVA2 wlan0, RTL8169 eth0
Ibidem
 
Posts: 157
Joined: 2010-12-24 18:28


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 13 guests

fashionable