Bug 79688 - [dri3] Latest git breaks PRIME Offloading to Nouveau GPU
Summary: [dri3] Latest git breaks PRIME Offloading to Nouveau GPU
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: GLX (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-05 15:49 UTC by Tobias Klausmann
Modified: 2015-12-05 15:38 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Tobias Klausmann 2014-06-05 15:49:34 UTC
After upgrading to latest git offloading to the Nouveau card wont work as expected anymore.

It is quite easy to check:

xrandr --setprovideroffloadsink nouveau Intel

DRI_PRIME=1 glxinfo | grep "OpenGL vendor string"

which was giving the right Vendor for Nouveau, after upgrading it is the Intel provider, despite the case that 

xrandr --listproviders

still lists the Nouveau card.

Reverting to a older driver (pre DRI3) resovles the problem again. So it may be a incompatibility betweeen DRI2/3
Comment 1 Axel Davy 2014-06-06 04:05:15 UTC
This is due to Mesa DRI3 code not taking care of the DRI_PRIME env var.

As a temporary fix, the user can set LIBGL_DRI3_DISABLE in addition to DRI_PRIME when wanting to use the secondary card.

A temporary patch could be mergedto not try the DRI3 path when DRI_PRIME is set.

The complete fix should be DRI3 DRI_PRIME support. http://lists.freedesktop.org/archives/mesa-dev/2014-May/060131.html
I hadn't time yet to rewrite the gallium dri3 code and to rebase the patches, but they should be ready soon.
Comment 2 Axel Davy 2014-06-09 01:03:57 UTC
I've rebased the patches.

Could you test this branch and confirm the problem is solved for you ?
https://github.com/axeldavy/mesa/tree/submit
Comment 3 Tobias Klausmann 2014-06-09 03:50:45 UTC
I have tested that branch, but it is still not working as before (the same behavior is observed), sorry.
Comment 4 Axel Davy 2014-06-09 11:20:39 UTC
I forgot to precise render-nodes are needed. Did you activate them ?
For recent kernels, you need to precise drm.rnodes=1
Comment 5 Tobias Klausmann 2014-06-09 13:28:54 UTC
Hmm you were right, drm.rnodes=1 was missing but it still fails with a 3.15 kernel. Is there a kernel config i'm missing? :/
Comment 6 Axel Davy 2014-06-09 13:46:07 UTC
If you have render-nodes, you should have /dev/dri/render12X (X a number) existing.

Could you try 'udevadm info' on them ? They should advertise the tag 'ID_PATH_TAG'.

If this tag is advertised, could you show what is printed when you add 'LIBGL_DEBUG=verbose' when you execute your application ?
Comment 7 Tobias Klausmann 2014-06-09 13:51:22 UTC
udevadm info /dev/dri/renderD128
P: /devices/pci0000:00/0000:00:02.0/drm/renderD128
N: dri/renderD128
E: DEVNAME=/dev/dri/renderD128
E: DEVPATH=/devices/pci0000:00/0000:00:02.0/drm/renderD128
E: DEVTYPE=drm_minor
E: MAJOR=226
E: MINOR=128
E: SUBSYSTEM=drm

udevadm info /dev/dri/renderD129
P: /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/renderD129
N: dri/renderD129
E: DEVNAME=/dev/dri/renderD129
E: DEVPATH=/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/renderD129
E: DEVTYPE=drm_minor
E: MAJOR=226
E: MINOR=129
E: SUBSYSTEM=drm

so no, something wrong with my kernel-config i guess?
Comment 8 Axel Davy 2014-06-09 14:04:17 UTC
I know ID_PATH_TAG is a rather recent flag.

At first it was only computed for /dev/dri/cardX,
but with a relatively recent patch (which I believe was merged at the end of last year) it should be computed for /dev/dri/renderD12X.

Is the tag present for your /dev/dri/cardX ?

If asking for the tag for /dev/dri/renderD12X cards is too much, I could add code to use /dev/dri/cardX tags, and get the corresponding /dev/dri/renderD12X.
Comment 9 Tobias Klausmann 2014-06-09 16:05:04 UTC
The tag is present for /dev/dri/card0,1 so this may be the best option to use
Comment 10 Axel Davy 2014-06-10 00:18:55 UTC
Ok, we have discussed on irc and managed to get it working.

When ID_PATH_TAG is advertised for /dev/dri/cardX, but not /dev/dri/renderD12X,
ones need to add a file containing:

SUBSYSTEM=="drm", IMPORT{builtin}="path_id"

in /etc/udev/rules.d/

The name of the file must end by '.rules'

Then we had another problem, since the user didn't have the permission to open the render-nodes.
With that solved, everything went ok.
Comment 11 Tobias Jakobi 2014-07-06 12:01:11 UTC
Just wanted to add that this bugreport really helped me to setup DRI3+PRIME with my Intel/Radeon combo.

In fact I was missing rendernodes, which per pointed out in the original patch description (http://lists.freedesktop.org/archives/mesa-dev/2014-May/060131.html), but apparantly I missed them.

Also, it appears that while drm.rnodes is rw, it only makes a difference if you set it during boot. If you set it after the system is booted, so by writing into /sys/module/xyz, then it does nothing.
Comment 12 poma 2015-12-04 05:14:15 UTC
Some of the results with recent Mesa 3D on Optimus/Prime


# xrandr --listproviders 
Providers: number : 1
Provider 0: id: 0x48 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 5 associated providers: 0 name:Intel

# cat /sys/kernel/debug/vgaswitcheroo/switch 
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynOff:0000:01:00.0

# lspci | egrep -i vga\|3d
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 3D controller: NVIDIA Corporation GK208M [GeForce GT 740M] (rev a1)

# LIBGL_DEBUG=verbose vblank_mode=0 DRI_PRIME=1 glxgears
...

DIS powering up:

# cat /sys/kernel/debug/vgaswitcheroo/switch
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynPwr:0000:01:00.0


# DRI_PRIME=0 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile 

# DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Gallium 0.4 on NV108

# DRI_PRIME=0 glxinfo | grep "OpenGL vendor string"
OpenGL vendor string: Intel Open Source Technology Center

# DRI_PRIME=1 glxinfo | grep "OpenGL vendor string"
OpenGL vendor string: nouveau
Comment 13 poma 2015-12-04 05:16:06 UTC
 = XPresent VSync DRI2 INTEL =

# LIBGL_DEBUG=verbose vblank_mode=0 glxgears
libGL: OpenDriver: trying /usr/lib64/dri/tls/i965_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/i965_dri.so
ATTENTION: default value of option vblank_mode overridden by environment.
ATTENTION: default value of option vblank_mode overridden by environment.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Using DRI2 for screen 0
libGL: Can't open configuration file /root/.drirc: No such file or directory.
14187 frames in 5.0 seconds = 2837.223 FPS
13509 frames in 5.0 seconds = 2701.708 FPS
13376 frames in 5.0 seconds = 2675.033 FPS
13652 frames in 5.0 seconds = 2730.306 FPS
13381 frames in 5.0 seconds = 2676.152 FPS
13656 frames in 5.0 seconds = 2731.119 FPS
13489 frames in 5.0 seconds = 2697.706 FPS
13471 frames in 5.0 seconds = 2694.155 FPS
13338 frames in 5.0 seconds = 2667.453 FPS
13565 frames in 5.0 seconds = 2712.999 FPS
^C
Comment 14 poma 2015-12-04 05:16:38 UTC
 = XPresent VSync DRI2 NOUVEAU =

# DRI_PRIME=1 LIBGL_DEBUG=verbose vblank_mode=0 glxgearslibGL: OpenDriver: trying /usr/lib64/dri/tls/nouveau_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/nouveau_dri.so
libGL: Can't open configuration file /root/.drirc: No such file or directory.
ATTENTION: default value of option vblank_mode overridden by environment.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Using DRI2 for screen 0
11059 frames in 5.0 seconds = 2211.646 FPS
11099 frames in 5.0 seconds = 2219.753 FPS
11122 frames in 5.0 seconds = 2224.265 FPS
11120 frames in 5.0 seconds = 2223.937 FPS
11089 frames in 5.0 seconds = 2217.751 FPS
11070 frames in 5.0 seconds = 2213.801 FPS
11070 frames in 5.0 seconds = 2213.818 FPS
11071 frames in 5.0 seconds = 2214.184 FPS
11071 frames in 5.0 seconds = 2214.194 FPS
11069 frames in 5.0 seconds = 2213.607 FPS
^C
Comment 15 poma 2015-12-04 05:17:39 UTC
 = XPresent VSync DRI3 INTEL =

/etc/X11/xorg.conf.d/intel-dri3.conf
Section "Device"
	Identifier  "intel0"
	Driver      "intel"
	Option      "DRI" "3"
EndSection

Xorg.0.log:
intel(0): direct rendering: DRI2 DRI3 enabled

# LIBGL_DEBUG=verbose vblank_mode=0 glxgears
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: pci id for fd 4: 8086:0156, driver i965
libGL: OpenDriver: trying /usr/lib64/dri/tls/i965_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/i965_dri.so
ATTENTION: default value of option vblank_mode overridden by environment.
ATTENTION: default value of option vblank_mode overridden by environment.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Using DRI3 for screen 0
libGL: Can't open configuration file /root/.drirc: No such file or directory.
24691 frames in 5.0 seconds = 4938.108 FPS
25310 frames in 5.0 seconds = 5061.974 FPS
23346 frames in 5.0 seconds = 4669.024 FPS
22835 frames in 5.0 seconds = 4566.970 FPS
26354 frames in 5.0 seconds = 5270.756 FPS
25152 frames in 5.0 seconds = 5030.316 FPS
25098 frames in 5.0 seconds = 5019.583 FPS
23447 frames in 5.0 seconds = 4689.399 FPS
23899 frames in 5.0 seconds = 4779.689 FPS
21966 frames in 5.0 seconds = 4393.033 FPS
^C
Comment 16 poma 2015-12-04 05:18:22 UTC
 = XPresent VSync DRI3 NOUVEAU =

/etc/X11/xorg.conf.d/nouveau-dri3.conf
Section "Device"
	Identifier  "nvidia0"
	Driver      "nouveau"
	Option      "DRI" "3"
EndSection

Xorg.0.log:
NOUVEAU(0): DRI3 on EXA enabled

# DRI_PRIME=1 LIBGL_DEBUG=verbose vblank_mode=0 glxgears
libGL: pci id for fd 5: 10de:1292, driver nouveau
libGL: OpenDriver: trying /usr/lib64/dri/tls/nouveau_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/nouveau_dri.so
libGL: Can't open configuration file /root/.drirc: No such file or directory.
ATTENTION: default value of option vblank_mode overridden by environment.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Using DRI3 for screen 0
13974 frames in 5.0 seconds = 2794.645 FPS
14077 frames in 5.0 seconds = 2815.394 FPS
14079 frames in 5.0 seconds = 2815.704 FPS
14078 frames in 5.0 seconds = 2815.532 FPS
14078 frames in 5.0 seconds = 2815.559 FPS
14079 frames in 5.0 seconds = 2815.626 FPS
14079 frames in 5.0 seconds = 2815.732 FPS
14079 frames in 5.0 seconds = 2815.622 FPS
14079 frames in 5.0 seconds = 2815.615 FPS
14069 frames in 5.0 seconds = 2813.748 FPS
^C
Comment 17 poma 2015-12-04 05:19:22 UTC
 = GLX VSync DRI2 INTEL =

# LIBGL_DEBUG=verbose vblank_mode=0 glxgears
libGL: OpenDriver: trying /usr/lib64/dri/tls/i965_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/i965_dri.so
ATTENTION: default value of option vblank_mode overridden by environment.
ATTENTION: default value of option vblank_mode overridden by environment.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Using DRI2 for screen 0
libGL: Can't open configuration file /root/.drirc: No such file or directory.
20624 frames in 5.0 seconds = 4124.721 FPS
20847 frames in 5.0 seconds = 4169.352 FPS
20036 frames in 5.0 seconds = 4007.072 FPS
20823 frames in 5.0 seconds = 4164.519 FPS
20792 frames in 5.0 seconds = 4158.378 FPS
20800 frames in 5.0 seconds = 4159.968 FPS
20752 frames in 5.0 seconds = 4150.326 FPS
20831 frames in 5.0 seconds = 4166.060 FPS
20823 frames in 5.0 seconds = 4164.594 FPS
20811 frames in 5.0 seconds = 4162.066 FPS
^C
Comment 18 poma 2015-12-04 05:20:19 UTC
 = GLX VSync DRI3 INTEL =

/etc/X11/xorg.conf.d/intel-dri3.conf
Section "Device"
	Identifier  "intel0"
	Driver      "intel"
	Option      "DRI" "3"
EndSection

Xorg.0.log:
intel(0): direct rendering: DRI2 DRI3 enabled

# LIBGL_DEBUG=verbose vblank_mode=0 glxgears
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: pci id for fd 4: 8086:0156, driver i965
libGL: OpenDriver: trying /usr/lib64/dri/tls/i965_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/i965_dri.so
ATTENTION: default value of option vblank_mode overridden by environment.
ATTENTION: default value of option vblank_mode overridden by environment.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Using DRI3 for screen 0
libGL: Can't open configuration file /root/.drirc: No such file or directory.
20142 frames in 5.0 seconds = 4028.390 FPS
20267 frames in 5.0 seconds = 4053.330 FPS
20428 frames in 5.0 seconds = 4085.486 FPS
20363 frames in 5.0 seconds = 4072.486 FPS
20281 frames in 5.0 seconds = 4056.115 FPS
20248 frames in 5.0 seconds = 4048.564 FPS
20466 frames in 5.0 seconds = 4093.135 FPS
20355 frames in 5.0 seconds = 4070.827 FPS
20476 frames in 5.0 seconds = 4095.126 FPS
20529 frames in 5.0 seconds = 4105.680 FPS
^C
Comment 19 poma 2015-12-04 05:21:10 UTC
 = GLX VSync DRI3 NOUVEAU =

/etc/X11/xorg.conf.d/nouveau-dri3.conf
Section "Device"
	Identifier  "nvidia0"
	Driver      "nouveau"
	Option      "DRI" "3"
EndSection

Xorg.0.log:
NOUVEAU(0): DRI3 on EXA enabled

# DRI_PRIME=1 LIBGL_DEBUG=verbose vblank_mode=0 glxgears
libGL: pci id for fd 5: 10de:1292, driver nouveau
libGL: OpenDriver: trying /usr/lib64/dri/tls/nouveau_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/nouveau_dri.so
libGL: Can't open configuration file /root/.drirc: No such file or directory.
ATTENTION: default value of option vblank_mode overridden by environment.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Using DRI3 for screen 0
14127 frames in 5.0 seconds = 2825.278 FPS
14174 frames in 5.0 seconds = 2834.725 FPS
14196 frames in 5.0 seconds = 2839.174 FPS
14194 frames in 5.0 seconds = 2838.693 FPS
14189 frames in 5.0 seconds = 2837.756 FPS
14187 frames in 5.0 seconds = 2837.263 FPS
14182 frames in 5.0 seconds = 2836.374 FPS
14180 frames in 5.0 seconds = 2835.815 FPS
14188 frames in 5.0 seconds = 2837.346 FPS
14181 frames in 5.0 seconds = 2836.074 FPS
^C
Comment 20 Axel Davy 2015-12-04 06:37:19 UTC
Should this bug report be closed ?
DRI3 has complete DRI_PRIME support now.

Also I'm not sure why you do post these benchmarks here.
Is there some hidden message about something not working right ?
Comment 21 Tobias Klausmann 2015-12-04 14:30:30 UTC
(In reply to Axel Davy from comment #20)
> Should this bug report be closed ?
> DRI3 has complete DRI_PRIME support now.
> 

As far as it concerns me, DRI3 Support is fine and this bug can be marked as "resolved fixed". 


> Also I'm not sure why you do post these benchmarks here.
> Is there some hidden message about something not working right ?
Comment 22 poma 2015-12-04 19:23:53 UTC
(In reply to Tobias Klausmann from comment #21)
> (In reply to Axel Davy from comment #20)
> > Should this bug report be closed ?
> > DRI3 has complete DRI_PRIME support now.
> > 
> 
> As far as it concerns me, DRI3 Support is fine and this bug can be marked as
> "resolved fixed". 
> 

Do you refer to DRI3 in general, or is it DRI_PRIME?

Tobias, while DRI3 enabled, can you run:
$ ssh -Y [user@]hostname firefox

What is the result?
Comment 23 poma 2015-12-04 19:32:16 UTC
(In reply to Axel Davy from comment #20)
> Should this bug report be closed ?
> DRI3 has complete DRI_PRIME support now.
> 

Actually, I have some questions, but if you closing, bye bye.

> Also I'm not sure why you do post these benchmarks here.
> Is there some hidden message about something not working right ?

For me these are ordinary tests, no benchmarks, to see is it working, working properly, or not.

phoronix.com has some benchmarks.
Comment 24 Tobias Klausmann 2015-12-04 20:09:44 UTC
(In reply to poma from comment #22)
> (In reply to Tobias Klausmann from comment #21)
> > (In reply to Axel Davy from comment #20)
> > > Should this bug report be closed ?
> > > DRI3 has complete DRI_PRIME support now.
> > > 
> > 
> > As far as it concerns me, DRI3 Support is fine and this bug can be marked as
> > "resolved fixed". 
> > 
> 
> Do you refer to DRI3 in general, or is it DRI_PRIME?

I was referring to RI_PRIME, as this bug was about DRI_PRIME

> 
> Tobias, while DRI3 enabled, can you run:
> $ ssh -Y [user@]hostname firefox
> 
> What is the result?

If you mean a running firefox process without a window showing up, i would guess this is not DRI3's fault, as other applications are showing up just fine, others don't. As far as i could elaborate in under 5 minutes, newer frameworks (gtk3, kde5 (qt5)) do not work, older ones do work just fine...if you have more information about this beeing DRI3, please open a bugreport about this specific problem!
Comment 25 poma 2015-12-05 13:29:27 UTC
(In reply to Tobias Klausmann from comment #24)
...
> If you mean a running firefox process without a window showing up, i would
> guess this is not DRI3's fault, as other applications are showing up just
> fine, others don't. As far as i could elaborate in under 5 minutes, newer
> frameworks (gtk3, kde5 (qt5)) do not work, older ones do work just fine...if
> you have more information about this beeing DRI3, please open a bugreport
> about this specific problem!


Thanks for testing, man.

GL/DRI3 over ssh broken
https://bugs.freedesktop.org/show_bug.cgi?id=93261
Comment 26 Tobias Klausmann 2015-12-05 15:38:53 UTC
As the bugs are now sorted, i gonna close this one as fixed!

Thanks Axel for the great works!


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.