libva icon indicating copy to clipboard operation
libva copied to clipboard

Compiling with --enable-i915-driver

Open kousu opened this issue 5 years ago • 1 comments

I have an aging Dell Latitude 2100 I am trying to keep alive. Long story short, I need /usr/lib/dri/i915_drv_video.so but I only have /usr/lib/dri/i965_drv_video.so in my distro (libva-intel-driver from archlinux32).

This thread seems to match my issues, and that person managed to solve their problem by compiling libva from scratch with --enable-i915-driver. But that was 8 years ago and the build system is using meson now and I don't see any options like that in it; I only see --driverdir, --with_x11, --with_wayland, --enable_hybrid_codec, --enable_tests in meson_options.txt.

Is there a way to compile the older driver still? I see that there code for i915 is still around, if I git grep i915. How do I use it?

I'm not really holding my breath here, but if I could keep this device alive and out of a landfill a little longer that would be stellar :star2: . Thanks for any advice or pointers you can toss my way.

The Long Story

This laptop can play .avis fine but .mp4s with H.264 video stutter badly. Watching top(1) I can tell that the .avis are using low CPU while the H.264s are pegging the CPUs to 100%.

I suspected the hardware acceleration isn't working.

Here is what I know about the GPU in this laptop:

$ lspci
00:00.0 Host bridge: Intel Corporation Mobile 945GSE Express Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GSE Express Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
00:1b.0 Audio device: Intel Corporation NM10/ICH7 Family High Definition Audio Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 1 (rev 01)
00:1c.1 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 2 (rev 01)
00:1c.3 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 4 (rev 01)
00:1d.0 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #1 (rev 01)
00:1d.1 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #2 (rev 01)
00:1d.2 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #3 (rev 01)
00:1d.3 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #4 (rev 01)
00:1d.7 USB controller: Intel Corporation NM10/ICH7 Family USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 01)
00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7-M Family) SATA Controller [IDE mode] (rev 01)
00:1f.3 SMBus: Intel Corporation NM10/ICH7 Family SMBus Controller (rev 01)
09:00.0 Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5764M Gigabit Ethernet PCIe (rev 10)
0c:00.0 Network controller: Broadcom Inc. and subsidiaries BCM4312 802.11b/g LP-PHY (rev 01)

$ sudo pacman -S intel-gpu-tools
$ lsgpu
sys:/sys/devices/pci0000:00/0000:00:02.0/drm/card0
    subsystem       : drm
    drm card        : /dev/dri/card0
    parent          : sys:/sys/devices/pci0000:00/0000:00:02.0

sys:/sys/devices/pci0000:00/0000:00:02.0/drm/renderD128
    subsystem       : drm
    drm render      : /dev/dri/renderD128
    parent          : sys:/sys/devices/pci0000:00/0000:00:02.0

sys:/sys/devices/pci0000:00/0000:00:02.0
    subsystem       : pci
    drm card        : /dev/dri/card0
    drm render      : /dev/dri/renderD128
    vendor          : 8086
    device          : 27AE

https://pci-ids.ucw.cz/read/PC/8086/27ae confirms that this is a 945GSE .. System-on-Chip? .., which, cross-referencing https://en.wikipedia.org/wiki/Intel_GMA#GMA_950_on_Windows and https://en.wikipedia.org/wiki/List_of_Intel_graphics_processing_units#Third_generation, seems to contain the GMA 950 graphics card, specifically the "Calistoga" model from 2006.

I followed https://wiki.archlinux.org/index.php/VLC_media_player#Hardware_video_acceleration to https://wiki.archlinux.org/index.php/Hardware_video_acceleration#Verifying_VA-API. I installed every libva I could see:

$ pacman -Q | grep libva
libva 2.8.0-1.0
libva-intel-driver 2.4.1-1.0
libva-utils 2.8.0-1.0
libva-vdpau-driver 0.7.4-4.0
libva1 1.8.3-2.4
libva1-intel-driver 1.8.3-1.5

but their verification advice still fails for me:

When run under Xorg:

$ vainfo 
libva info: VA-API version 1.8.0
libva info: Trying to open /usr/lib/dri/i915_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

when not:

$ vainfo 
error: can't connect to X server!
libva info: VA-API version 1.8.0
libva info: Trying to open /usr/lib/dri/iHD_drv_video.so
libva info: va_openDriver() returns -1
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva error: /usr/lib/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

I'm guessing that the issue really is that GMA 9450 needs goes with the i915 driver which, of course, doesn't exist; under X it knows it needs the i915 driver, and fails immediately; when not under X it tries everything, and actually briefly starts the i965 driver before crashing. It wants the i915.

$  grep -iE 'vdpau | dri driver' /var/log/Xorg.0.log
[    32.349] (II) intel(0): [DRI2]   DRI driver: i915
[    32.349] (II) intel(0): [DRI2]   VDPAU driver: va_gl

I don't think exploring VDPAU is a useful option here because it's just calling into the VA-API driver. If I try it with mpv --hwdev=vdpau it warns me "VDPAU is most likely emulated via VA-API.", and then lags so it doesn't seem to have managed to activate the GPU:

$ mpv --hwdec=vdpau scene.mp4 
 (+) Video --vid=1 (*) (h264 1920x808 24.000fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
[vo/gpu/opengl] At least OpenGL 2.1 or OpenGL ES 2.0 required.
[vo/gpu/opengl] At least OpenGL 2.1 or OpenGL ES 2.0 required.
Driver does not support the 0x27ae PCI ID.
[vo/gpu/vulkan/libplacebo] vkEnumeratePhysicalDevices(params->instance, &num, NULL): VK_ERROR_INITIALIZATION_FAILED
[vo/gpu/vulkan/libplacebo] Found no suitable device, giving up.
[vo/gpu/vulkan/libplacebo] Failed initializing vulkan device
libva info: VA-API version 1.8.0
libva info: Trying to open /usr/lib/dri/i915_drv_video.so
libva info: va_openDriver() returns -1
[vo/vdpau] VDPAU is most likely emulated via VA-API.
[vo/vdpau] This is inefficient. Use --vo=gpu instead.
[vo/vdpau] Warning: this compatibility VO is low quality and may have issues with OSD, scaling, screenshots and more.
[vo/vdpau] vo=gpu is the preferred choice in any case and includes VDPAU support via hwdec=vdpau or vdpau-copy.
Using emulated hardware decoding API.
[ffmpeg/video] h264: Failed setup for format vdpau: hwaccel initialisation returned error.
AO: [alsa] 48000Hz stereo 2ch float
VO: [vdpau] 1920x808 yuv420p
[vo/vdpau] Compositing window manager detected. Assuming timing info is inaccurate.
AV: 00:00:00 / 02:29:52 (0%) A-V:  0.475

Audio/Video desynchronisation detected! Possible reasons include too slow
hardware, temporary CPU spikes, broken drivers, and broken files. Audio
position will not match to the video (see A-V status field).

The only clue I found is https://bbs.archlinux.org/viewtopic.php?id=136605, which is 8 years old now and was dealing with a version I guess about 6 years old at the time it was posted. I can tell that this is a pretty niche rabbit-hole but I'm hoping someone might know something.

kousu avatar Sep 19 '20 03:09 kousu

8086:27ae (Gen3) only has MPEG-2 decoder, so use mplayer -vo xvmc instead of mpv --hwdec=vaapi. https://github.com/intel/intel-vaapi-driver/blob/master/src/i965_pciids.h#L27-L33 https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel/-/blob/master/xvmc/i915_xvmc.h#L40 https://github.com/mpv-player/mpv/commit/cbdb7e630526

jbeich avatar Oct 15 '20 21:10 jbeich