nodir | a6074d4c | 2015-09-01 04:26:45 | [diff] [blame] | 1 | # Enabling hardware <video> decode codepaths on linux |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 2 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 3 | Hardware acceleration of video decode on Linux is |
| 4 | [unsupported](https://crbug.com/137247) in Chrome for user-facing builds. During |
| 5 | development (targeting other platforms) it can be useful to be able to trigger |
| 6 | the code-paths used on HW-accelerated platforms (such as CrOS and win7) in a |
| 7 | linux-based development environment. Here's one way to do so, with details based |
| 8 | on a gprecise setup. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 9 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 10 | * Install pre-requisites: On Ubuntu Precise, at least, this includes: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 11 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 12 | ```shell |
| 13 | sudo apt-get install libtool libvdpau1 libvdpau-dev |
| 14 | ``` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 15 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 16 | * Install and configure [libva](http://cgit.freedesktop.org/libva/) |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 17 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 18 | ```shell |
| 19 | DEST=${HOME}/apps/libva |
| 20 | cd /tmp |
| 21 | git clone git://anongit.freedesktop.org/libva |
| 22 | cd libva |
| 23 | git reset --hard libva-1.2.1 |
| 24 | ./autogen.sh && ./configure --prefix=${DEST} |
| 25 | make -j32 && make install |
| 26 | ``` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 27 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 28 | * Install and configure the |
| 29 | [VDPAU](http://cgit.freedesktop.org/vaapi/vdpau-driver) VAAPI driver |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 30 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 31 | ```shell |
| 32 | DEST=${HOME}/apps/libva |
| 33 | cd /tmp |
| 34 | git clone git://anongit.freedesktop.org/vaapi/vdpau-driver |
| 35 | cd vdpau-driver |
| 36 | export PKG_CONFIG_PATH=${DEST}/lib/pkgconfig/:$PKG_CONFIG_PATH |
| 37 | export LIBVA_DRIVERS_PATH=${DEST}/lib/dri |
| 38 | export LIBVA_X11_DEPS_CFLAGS=-I${DEST}/include |
| 39 | export LIBVA_X11_DEPS_LIBS=-L${DEST}/lib |
| 40 | export LIBVA_DEPS_CFLAGS=-I${DEST}/include |
| 41 | export LIBVA_DEPS_LIBS=-L${DEST}/lib |
| 42 | make distclean |
| 43 | unset CC CXX |
| 44 | ./autogen.sh && ./configure --prefix=${DEST} --enable-debug |
| 45 | find . -name Makefile |xargs sed -i 'sI/usr/lib/xorg/modules/driversI${DEST}/lib/driIg' |
| 46 | sed -i -e 's/_(\(VAEncH264VUIBufferType\|VAEncH264SEIBufferType\));//' src/vdpau_dump.c |
| 47 | make -j32 && rm -f ${DEST}/lib/dri/{nvidia_drv_video.so,s3g_drv_video.so} && make install |
| 48 | ``` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 49 | |
Daniel Bratell | f73f0df | 2018-09-24 13:52:49 | [diff] [blame] | 50 | * Add to args.gn: |
| 51 | * `target_os = "chromeos"` to link in `VaapiVideoDecodeAccelerator` |
| 52 | * `proprietary_codecs = true` and `ffmpeg_branding = "Chrome"` to |
| 53 | allow Chrome to play h.264 content, which is the only codec |
| 54 | VAVDA knows about today. |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 55 | * Rebuild chrome |
| 56 | * Run chrome with `LD_LIBRARY_PATH=${HOME}/apps/libva/lib` in the environment, |
| 57 | and with the `--no-sandbox` command line flag. |
| 58 | * If things don't work, a Debug build (to include D\*LOG's) with |
| 59 | `--vmodule=*content/common/gpu/media/*=10,gpu_video*=1` might be |
| 60 | enlightening. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 61 | |
nodir | a6074d4c | 2015-09-01 04:26:45 | [diff] [blame] | 62 | ** note |
| 63 | NOTE THIS IS AN UNSUPPORTED CONFIGURATION AND LIKELY TO BE BROKEN AT ANY |
| 64 | POINT IN TIME |
| 65 | ** |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 66 | |
| 67 | This page is purely here to help developers targeting supported HW `<video>` |
| 68 | decode platforms be more effective. Do not expect help if this setup fails to |
| 69 | work. |