Good day! I decided to share with you a story about how far from trivial, as it turned out, to solve the problem of playing a high-quality video stream on Fedora 17 x86-64. Until recently, spending free hours on my netbook (Asus 1215B, E-450, 8Gb RAM, 500Gb SATA), I thought that I was happy with everything. Walking on the Internet, music, movies (mostly dvdrip'y), games (now fashionable in the good old Half-Life hack), everything worked without complaints, until I wanted to watch a movie with 1080p marked. When buying Windows 7 Home x64, in conjunction with K-Lite + MPC, I coped with such tasks without any problems, so I, without a second thought, poked the cursor twice in the file and got ready to watch. To say that the video stream is slowed down - to say nothing! The well-known parameter “Frames Per Second” has turned into “Seconds Per Frame”, and the mood has fallen below the baseboard. And began smoking manuals!
The first search query, on hardware decoding of the video stream, sent me
here . Everything is simple and the points:
Of course, what could be the problem if all the packages are in the repository? But this is for Ubuntu. In the repositories for Fedora, I found only a proprietary driver from AMD, aka fglrx. There was no hint of XvBA.
')
Regular search queries led me to a
page where the user under the nickname canyon tells where to get the packages for Fedora17, and how to install them correctly. He insisted on installing the fglrx driver from
the AMD site , since, in his experience, the one that is “broken” in the repositories, in consequence of which, hardware decoding does not work. From the site, so from the site. Moreover, the driver version differed favorably (13.1 vs 12.10). Download successful:
$ wget -c http://www2.ati.com/drivers/linux/amd-driver-installer-catalyst-13.1-linux-x86.x86_64.zip $ unzip amd-driver-installer-catalyst-13.1-linux-x86.x86_64.zip $ chmod +x amd-driver-installer-catalyst-13.1-linux-x86.x86_64.run
And I proceeded to the implementation points of the manual. All the irony of his phrase “Quick How-To” was fully realized by me. Fast how-to, in practice turned out to be a brief how-to (apparently the difficulty of translation). I will say right away. Before the start of all actions, in my OS, along with the “mesa-libGL” package, there was another package - “mesa-libGL-devel”, which pulled many dependencies (including * .h files) required for building the XvBA driver with GLX support. And so, everything is in order. Launching AMD Proprietary Driver Installer:
$ sudo ./amd-driver-installer-catalyst-13.1-linux-x86.x86_64.run
I got crash after crash. Our dependencies are everything! As a result, personally, my system did not have enough kernel-headers and kernel-devel packages, but even after installing them, /usr/share/ati/fglrx-install.log was full as never before. The installer cursed the absence of the file "/lib/modules/3.7.6-102.fc17.x86_64/build/include/linux/version.h". A recursive folder search found “version.h” at “/usr/include/linux/version.h”. Making sure that this file belongs to the current version of the kernel — I copied it to the required address.
$ uname -r $ rpm -qf /usr/include/linux/version.h $ sudo cp /usr/include/linux/version.h /lib/modules/3.7.6-102.fc17.x86_64/build/include/linux/version.h
After that, the driver was still installed, but I did not dare to restart the system, since everything in the same “fglrx-install.log” was a record (extract):
/usr/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c : "VM_RESERVED" undeclared (first use in this function) [Error] Kernel Module : Failed to compile kernel module - please consult readme.
Variable is not defined - the kernel module is not compiled. Trouble Search and search again. Here it is. The user under the nickname lx6544 reposted the
manual , in which this problem was solved as follows:
In the file “/usr/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c”, after the 100th row, the definition of the variable “VM_RESERVED” was added:
#ifndef VM_RESERVED #define VM_RESERVED (VM_DONTEXPAND | VM_DONTDUMP) #endif
Next, the kernel module was rebuilt and installed:
$ cd /lib/modules/fglrx/build_mod/ $ sudo ./make.sh
$ cd /lib/modules/fglrx/ $ sudo ./make_install.sh
Both pairs of commands returned “done” to me and I rebooted the OS.
$ sudo aticonfig --initial -f $ reboot
The proprietary driver has been installed. Worked properly. Further, according to the
manual from the user canyon, there was a rebuild and installation of the RPM package under the current OS:
$ sudo yum install rpm-build $ rpmbuild --rebuild ~/libva-xvba-driver-0.8.0-2.fc17.src.rpm
And then the collapse. In the terminal window there was a “very” informative message:
checking for XvBA... no configure: error: you need XvBA to build this package
Not telling me anything special. In "~ / rpmbuild / BUILD / xvba-driver-0.8.0 / config.log" it was already written more specifically:
configure:13374: gcc -o conftest -O2 -g -I/usr/include -L/usr/lib64 conftest.c -lrt -lpthread -lm -lXvBAW -lX11 -lXext -lGL -ldl >&5 conftest.c:44:21: fatal error: amdxvba.h: No such file or directory compilation terminated.
File "amdxvba.h"? I already read
about it !
$ wget -c http://developer.amd.com/wordpress/media/2012/10/xvba-sdk-0.74-404001.tar.gz $ tar -xf xvba-sdk-0.74-404001.tar.gz include/amdxvba.h $ sudo cp include/amdxvba.h /usr/include/
Next, just in case, I checked all the libraries specified for “gcc” in the previous line of the log. Lacked only two symlink'ov on "-lXvBAW"
$ sudo ln -s /usr/lib/libXvBAW.so.1 /usr/lib/libXvBAW.so $ sudo ln -s /usr/lib64/libXvBAW.so.1 /usr/lib64/libXvBAW.so
After creating the symlink, the configuration was successful:
VA-API version ................... : 0.32.1 GLX support ...................... : yes Cg compiler ...................... : no Enable debugging information ..... : yes Enable XvBA tracer ............... : yes
But the assembly is not. The compiler cursed the unknown variable type (PFNGLMULTITEXCOORD2FPROC) specified in the file "utils_glx.h".
The very first link in the search results clarified the situation. Yes indeed:
In the file “/usr/include/GL/gl.h”, the variable “GL_VERSION_1_3” was uniquely defined:
#define GL_VERSION_1_3 1
As a result, in the file “/usr/include/GL/glext.h” (version 85), the definition of the type “PFNGLMULTITEXCOORD2FPROC” was omitted:
#define GL_GLEXT_VERSION = 85 ... #ifndef GL_VERSION_1_3 ... typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); ... #endif
Well, the /usr/include/GL/glext.h file has been fixed:
$ sudo gedit /usr/include/GL/glext.h
#if GL_GLEXT_VERSION >= 85 typedef void (*PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); #endif
And RPM package successfully assembled and installed.
$ rpmbuild --rebuild ~/libva-xvba-driver-0.8.0-2.fc17.src.rpm $ sudo yum install libva-utils ~/rpmbuild/RPMS/x86_64/libva-xvba-driver-0.8.0-2.fc17.x86_64.rpm
The call of the “vainfo” command no longer gave an error, and the launch of the VLC player with the “--ffmpeg-hw” parameter convinced me that the hardware decoding worked:
$ vainfo
libva: va_getDriverName() returns 0 libva: Trying to open /usr/lib64/dri/fglrx_drv_video.so libva: va_openDriver() returns 0 vainfo: VA-API version: 0.32 (libva 1.0.16) vainfo: Driver version: Splitted-Desktop Systems XvBA backend for VA-API - 0.8.0 vainfo: Supported profile and entrypoints VAProfileH264High : VAEntrypointVLD VAProfileVC1Advanced : VAEntrypointVLD
$ vlc --ffmpeg-hw ~/1080p.mkv
VLC media player 2.0.5 Twoflower (revision 2.0.5-0-g1661b7d) ... libva: VA-API version 0.32.1 Xlib: extension "XFree86-DRI" missing on display ":0". libva: va_getDriverName() returns 0 libva: Trying to open /usr/lib64/dri/fglrx_drv_video.so No accelerated IMDCT transform found libva: va_openDriver() returns 0 xvba_video: XVBA_GetSurface(): status 2 [0x7f5628c1ada8] avcodec decoder: Using VA API version 0.32 for hardware decoding.
Reproduction was clear and smooth. Now for sure - PROFIT!
UPDATE1 :
As,
norguhtar remarked
correctly , copying the “version.h” file is not good, it’s better to edit the source. Therefore, I sketched the second way to install a proprietary driver from AMD:
$ wget -c http://www2.ati.com/drivers/linux/amd-driver-installer-catalyst-13.1-linux-x86.x86_64.zip $ unzip amd-driver-installer-catalyst-13.1-linux-x86.x86_64.zip $ chmod +x amd-driver-installer-catalyst-13.1-linux-x86.x86_64.run $ sudo -s # ./amd-driver-installer-catalyst-13.1-linux-x86.x86_64.run --force # cp -a /usr/lib/modules/fglrx /usr/lib/modules/fglrx_backup # for i in `find /usr/lib/modules/fglrx/ -type f`; do cat $i | sed -e "s/linux\/version\.h/generated\/uapi\/linux\/version\.h/g" > ${i}_tmpext; done # for i in `find /usr/lib/modules/fglrx -name '*_tmpext'`; do mv -vf $i `echo $i | sed s/\_tmpext//`; done
# gedit /usr/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c
#ifndef VM_RESERVED #define VM_RESERVED (VM_DONTEXPAND | VM_DONTDUMP) #endif
# cd /usr/lib/modules/fglrx # chmod +x make_install.sh build_mod/make.sh # cd build_mod # ./make.sh # cd .. # ./make_install # aticonfig --initial -f # exit $ reboot
This method leaves the file "version.h" alone. Instead, the source code of the kernel module is corrected. All files in the source folder are searched and each occurrence of “linux / version.h” is replaced with “generated / uapi / linux / version.h”. After that, the module is assembled and installed.
Files to download:
libva-xvba-driver-0.8.0-2.fc17.x86_64.rpm
libva-xvba-driver-0.8.0-2.fc17.src.rpm
Bibliography:
Unified video decoder
Video Acceleration API
X-Video Bitstream Acceleration
Hardware video decoding on AMD Radeon in Ubuntu (mplayer)
HD video playback