So just checking a few things regarding ClearLinux and my main laptop with is a shiny new Asus Q53F with the dreaded Optimus Nvidia as the discrete processor and an Intel as the main graphics device. I thought I’d see how Clear handled this.
My distro of choice is the distro that can make all other distros, Gentoo. Since Gentoo has not yet adopted Xorg 1.20 and it’s use of the GL vendor library changes in Mesa (libglvnd) to automatically offload to the more powerful Nvidia GPU I’ve had to do a lot of patching and custom ebuilds to get everything going (you can find this work now in the bobwya overlay). What a pain! How does ClearLinux do?
First, I don’t see libglvnd anywhere on the system or the manifests so I think I’m stuck with PRIME offloading for now.
First of all, I have NOT installed ClearLinux to the ASUS because I don’t want it to wipe out my bootloader and I’m just a bit touchy about that. So this is using the Liveboot only (build 29590).
So here goes:
- Which cards does X see?
root@clr-live ~ # xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x64 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 0 name:modesetting
Provider 1: id: 0x3f cap: 0x5, Source Output, Source Offload crtcs: 0 outputs: 0 associated providers: 0 name:nouveau
We have the intel in modesetting mode (good) and nouveau (hate that spelling) for the Nvidia. Looks like DRI3 is a go.
-
root@clr-live ~ # glxinfo|grep vendor
glxinfo: command not found
To install glxinfo use: swupd bundle-add os-testsuite-phoronix-desktop
What? Seriously I have to install the WHOLE Phoronix test suite just to get the GL tools? How in the world do you test anything about GL without glxinfo and glxgears?
-
I guess we’ll use glmark2.
swupd bundle-add glmark2
Good news, we have it.
$ glmark2
=======================================================
glmark2 2017.07
=======================================================
OpenGL Information
GL_VENDOR: Intel Open Source Technology Center
GL_RENDERER: Mesa DRI Intel® HD Graphics (Whiskey Lake 3x8 GT2)
GL_VERSION: 3.0 Mesa 19.2.0-devel
=======================================================
[build] use-vbo=false: FPS: 3518 FrameTime: 0.284 ms
=======================================================
glmark2 Score: 3518
=======================================================
As expected the Intel is driving the display. -
Verify it at PRIME 0
clrlinux@clr-live ~ $ DRI_PRIME=0 glmark2
=======================================================
glmark2 2017.07
=======================================================
OpenGL Information
GL_VENDOR: Intel Open Source Technology Center
GL_RENDERER: Mesa DRI Intel® HD Graphics (Whiskey Lake 3x8 GT2)
GL_VERSION: 3.0 Mesa 19.2.0-devel
=======================================================
[build] use-vbo=false: FPS: 3463 FrameTime: 0.289 ms
=======================================================
glmark2 Score: 3463
======================================================= -
Check in the nvidia at PRIME 1
clrlinux@clr-live ~ $ DRI_PRIME=1 glmark2
nvc0_screen_create:1092 - Error allocating PGRAPH context for M2MF: -16
libGL error: failed to create dri screen
libGL error: failed to load driver: nouveau
=======================================================
glmark2 2017.07
=======================================================
OpenGL Information
GL_VENDOR: Intel Open Source Technology Center
GL_RENDERER: Mesa DRI Intel® HD Graphics (Whiskey Lake 3x8 GT2)
GL_VERSION: 3.0 Mesa 19.2.0-devel
=======================================================
No go. The nVidia can’t open a DRI display. No good for DRI3.
-
Sometimes though the mapping can be force. We’ll try that.
$ xrandr --setprovideroffloadsink 1 0
DRI_PRIME=1 glmark2
nvc0_screen_create:1092 - Error allocating PGRAPH context for M2MF: -16
libGL error: failed to create dri screen
libGL error: failed to load driver: nouveau
=======================================================
glmark2 2017.07
=======================================================
OpenGL Information
GL_VENDOR: Intel Open Source Technology Center
GL_RENDERER: Mesa DRI Intel® HD Graphics (Whiskey Lake 3x8 GT2)
GL_VERSION: 3.0 Mesa 19.2.0-devel
=======================================================
Same thing. -
One last shot. Let’s disable DRI3 and try DRI3. This forces use to do the mapping, which we have already done. So we’ll just disable DRI3.
$ LIBGL_DRI3_DISABLE=1 DRI_PRIME=1 glmark2
=======================================================
glmark2 2017.07
=======================================================
OpenGL Information
GL_VENDOR: Intel Open Source Technology Center
GL_RENDERER: Mesa DRI Intel® HD Graphics (Whiskey Lake 3x8 GT2)
GL_VERSION: 3.0 Mesa 19.2.0-devel
=======================================================
It went right to the Intel. DRI2 seems a bust unless … we need to reverse map it.
- Since this might cause a black screen that won’t let me work any more and in LiveBoot I’ll lose EVERYTHING, I’ll post and then edit.
$ xrandr --setprovideroutputsource 0 1
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 139 (RANDR)
Minor opcode of failed request: 35 (RRSetProviderOutputSource)
Value in failed request: 0x3f
Serial number of failed request: 16
Current serial number in output stream: 17
No taco on taco night. It seems at least with the LiveBoot ClearLinux Optimus is a dead animal. I would think though the GL vendor mapping would be the answer since ClearLinux has all the right gear (Xorg 1.20.4 and Mesa 1.8) Any I think Mesa 1.8. I don’t see a good way to verify that using swupd though libGL is marked 1.2.0. Edit: AH I see glmark2 gives us ehte Mesa version which is 19 and capable of doing the GLVND mappings. Hopefully in the future ClearLinux will fully support Mesa 19 and GLVND so we can use the nVidia GPU for real work.
It might be possible to use DRI2 and bbswitch (Bumblebee) with a proprietary driver. This just seems a hard test in the limit disk space of the LiveBoot. Perhaps in the future.
Optimus anyone?