Bug 67283 - VDPAU doesn't work on hybrid laptop through DRI_PRIME
Summary: VDPAU doesn't work on hybrid laptop through DRI_PRIME
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Radeon (show other bugs)
Version: XOrg git
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Default DRI bug account
QA Contact:
Depends on:
Reported: 2013-07-25 01:00 UTC by Hohahiu
Modified: 2013-08-05 14:34 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:

dmesg (67.76 KB, text/plain)
2013-07-25 01:00 UTC, Hohahiu
no flags Details
Xorg.0.log (49.37 KB, text/plain)
2013-07-25 01:00 UTC, Hohahiu
no flags Details
mesa patch to make vl pick the right device (2.05 KB, patch)
2013-07-25 01:45 UTC, Dave Airlie
no flags Details | Splinter Review
libvdpau patch to pick the correct driver. (1.06 KB, patch)
2013-07-25 01:46 UTC, Dave Airlie
no flags Details | Splinter Review

Description Hohahiu 2013-07-25 01:00:01 UTC
Created attachment 82968 [details]

I have a hybrid muxless laptop with intel+radeon:
#lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Cape Verde [Radeon HD 7700M Series]

I use openSUSE 12.3 x86_64 with
kernel              3.11-rc2
Xorg-x11-server     1.14.2
Mesa                git20130723
libdrm2             git20130722
libdrm-radeon       git20130722
xf86-video-ati      git20130709

The kernel is booted with i915.i915_enable_rc6=7 i915.i915_enable_fbc=1 i915.lvds_downclock=1 drm.vblankoffdelay=1 radeon.dpm=1 modeset=1.

$xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x6e cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 3 outputs: 6 associated providers: 1 name:Intel
Provider 1: id: 0x45 cap: 0xd, Source Output, Source Offload, Sink Offload crtcs: 6 outputs: 0 associated providers: 1 name:radeon

$xrandr --setprovideroffloadsink 0x45 0x6e

$DRI_PRIME=1 glxinfo | grep OpenGL
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD CAPE VERDE
OpenGL version string: 2.1 Mesa 9.2.0-devel
OpenGL shading language version string: 1.30
OpenGL extensions:

But if I try VDPAU I get:

$DRI_PRIME=1 vdpauinfo
display: :0   screen: 0
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1


$DRI_PRIME=1 VDPAU_DRIVER=radeonsi vdpauinfo
display: :0   screen: 0
do_winsys_init: DRM version is 1.6.0 but this driver is only compatible with 2.3.x (kernel 2.6.34) or later.
Error creating VDPAU device: 23
Comment 1 Hohahiu 2013-07-25 01:00:54 UTC
Created attachment 82969 [details]
Comment 2 Martin Peres 2013-07-25 01:06:52 UTC
For the records, we have the exact same problem with nouveau.
Comment 3 Dave Airlie 2013-07-25 01:44:27 UTC
I can make vdpauinfo work with two patches, but I haven't looked at making anything play yet!

one patch is for libvdpau and one patch for mesa.
Comment 4 Dave Airlie 2013-07-25 01:45:54 UTC
Created attachment 82970 [details] [review]
mesa patch to make vl pick the right device
Comment 5 Dave Airlie 2013-07-25 01:46:26 UTC
Created attachment 82971 [details] [review]
libvdpau patch to pick the correct driver.
Comment 6 Martin Peres 2013-07-25 03:03:35 UTC
Thanks airlied, it works for me.

However, on KWin, I have to minimize and then maximize again the video in order to have the video rolling. Otherwise, I only see an empty/black window.
Comment 7 Hohahiu 2013-07-25 05:05:32 UTC
I've tried both patches. It seems like everything works pretty well. So vdpainfo now shows the supported formats. The 1080p video plays without any problem (I also use kwin, xrender in particular) in mplayer. Top showed decrease in CPU usage while using VDPAU.
Dave, thank you for the fast fix.
Comment 8 Christian König 2013-07-25 07:45:30 UTC
Sounds like we can close the bug as soon as the proposed patches are upstream.
Comment 9 Martin Peres 2013-07-26 05:06:51 UTC
@Hohahiu: Do you also have to minimize and maximize the video in order to see an image?
Comment 10 Aaron Plattner 2013-07-26 05:20:59 UTC
I applied Dave's patch to libvdpau: http://cgit.freedesktop.org/~aplattner/libvdpau/commit/?id=22a2f15f3e5f36641f72211da9f786b6778d0481

I'll make an 0.7 release to pick up this and a file descriptor leak fix soon, unless something else crops up before then.
Comment 11 Hohahiu 2013-07-26 23:33:09 UTC
@Martin Peres, I've done a little bit of investigation. 
 So if I don't use any desktop effects in kwin, the video on mplayer+VDPAU is choppy and not visible sometimes (except fullscreen). Also in this case I cannot exit fullscreen. Basically double click doesn't have any effect as well as alt+tab. Or to be more precise it seems like a window is minimized but the video is on top of desktop. 
 If I use desktop effects+Xrender everything works like a charm. 
 The desktop effects+OpenGL render behave exactly like you described in your message. 
 By the way I use KDE 4.10.5 (OpenSUSE 12.3). Is it possible that this issue a bug in kwin? Which options do you use in KDE?
Comment 12 Martin Peres 2013-07-26 23:37:19 UTC
@Hohahiu: I always use GL, so I guess we are seeing consistency here. This is good. We should try with other compositors and see if it helps.
Comment 13 sfievet 2013-08-05 14:34:17 UTC
would these patches work for a "muxed" hybrid laptop as well ? 
Otherwise, what would be needed to have libvdpau automatically pick up the right driver on muxed systems ?

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.