Bug 90451

Summary: Dedicated gpu on HP 355 G2 not working correctly (slower than integrated+corrupt display in es2gears)
Product: Drivers Reporter: l55
Component: Video(DRI - non Intel)Assignee: drivers_video-dri
Status: NEW ---    
Severity: high CC: alexdeucher, l55
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.16 Subsystem:
Regression: No Bisected commit-id:
Attachments: Xorg log
dmesg output

Description l55 2014-12-29 12:11:15 UTC
The HP 355 G2 has an integrated R5 Mullins and a dedicated Hainan GPU(R5 M240). Only the integrated one seems to work correctly.

When running "DRI_PRIME=1 es2gears"(dedicated) i get corrupt image and lower fps than with "es2gears"(integrated), while i think the dedicated should be way better. These are the results on Ubuntu 14.10(kernel 3.16).

I also tried the Gears on Gallium livedvd (2014.12.25) with kernel 3.19-rc1 and devel mesa/xorg/radeon drivers ( http://www.gearsongallium.com/?p=1668 ).
With Gears on Gallium the switchable graphics don't seem to work at all, it seems to use the integrated gpu always, even with DRI_PRIME=1.
Comment 1 Alex Deucher 2015-01-02 22:47:36 UTC
Please attach your dmesg output and xorg log.  Note that due to limitations in the current Linux core graphics stack support for hybrid laptops is very sub-optimal.
Comment 2 l55 2015-01-08 09:14:21 UTC
Created attachment 162811 [details]
Xorg log

Xorg log
Comment 3 l55 2015-01-08 09:21:47 UTC
Created attachment 162821 [details]
dmesg output

I noticed that unigine tropics benchmark reports the same video memory for running without DRI_PRIME=1 and with DRI_PRIME=1, so it seems it doesn't switch gpus at all, although with DRI_PRIME=1 it takes longer to launch and display of the benchmark window is corrupt. 

I also tried fglrx: Differences are:
- unigine reports 512MB gpu memory, with opensource driver it reports 256MB
- it reports that it's running on the dedicated gpu (aticonfig --pxl), but unigine still reports 512MB(should be 2048)
Comment 4 Alex Deucher 2015-01-08 14:25:31 UTC
GL does not provide a standard mechanism to query the amount of memory on the GPU so in most cases apps just guess.  Most default to 256MB, but they sometimes make guesses based on the GL vendor string.
Comment 5 Michel Dänzer 2015-01-09 09:36:58 UTC
You can check which GPU is used with/out DRI_PRIME=1 with

 glxinfo | grep ' renderer'

Is there any chance you can try a current upstream version or even Git snapshot of Mesa?
Comment 6 l55 2015-01-11 13:04:08 UTC
looks like basically it's switching:
$ glxinfo | grep ' renderer'
OpenGL renderer string: Gallium 0.4 on AMD MULLINS
$ DRI_PRIME=1 glxinfo | grep ' renderer'
OpenGL renderer string: Gallium 0.4 on AMD HAINAN

I tried enabling this repo but i can't install mesa, it says it can't find the package, although it's listed on the ppa page:
https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers

The xserver-xorg-video-ati git snapshot from this repo made my system freeze even more often.(Another issue i have which is probably related to ati driver i reported here: Total system freeze: https://bugzilla.kernel.org/show_bug.cgi?id=90981 . Maybe you could also take a look at this?)
Comment 7 l55 2015-01-11 15:12:44 UTC
i installed kernel 3.18.2 and upgraded mesa and the other packages except for libdrm-radeon1,xserver-xorg-video-ati,xserver-xorg-video-radeon from the mentioned oibaf ppa.
Now DRI_PRIME=1 esgears displays fine, but fps are not higher than with integrated(the same fps) and unigine tropics benchmark is still corrupted.

I tried to run a game with wine on the gears on gallium livedvd and the fps, if i recall correctly, were lower on the dedicated gpu than with the integrated but no corrupt display there(didn't test es2gears/tropics with it because es2gears is not included(tropics benchmark may be included in phoronics test suite, i'll check that) and the livedvd doesn't seem to have a package manager)

gears on gallium 2014.12.25 packages:
Mesa-git – 10.5_git2014.12.25
Kernel – 3.19-rc1
libdrm – 2.4.99_git2014.09.30
Mesa-demos – 9.1.0_git2014.07.06
xorg-server – 1.16.99.9
xf86-video-ati – 7.99.99_2014.12.20
Comment 8 l55 2015-01-11 15:46:42 UTC
I tested with gears on gallium, there i can't even switch gpus:

$ xrandr --listproviders
Providers: number : 1
Provider 0: id: 0x54 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 3 associated providers: 0 name:radeon

$ glxinfo | grep ' renderer'
ATTENTION: default value of option vblank_mode overridden by environment.
OpenGL renderer string: Gallium 0.4 on AMD MULLINS

$ DRI_PRIME=1 glxinfo | grep ' renderer'
ATTENTION: default value of option vblank_mode overridden by environment.
OpenGL renderer string: Gallium 0.4 on AMD MULLINS


However in vgaswitcheroo/switch there are still 2 gpus:

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

Has there been some change in how to switch between gpus and it's not done with DRI_PRIME=1 anymore?