You are not logged in.

#1 2018-03-16 13:07:08

MrFry
Member
Registered: 2018-03-16
Posts: 26

[SOLVED] Using nVidia GPU

Hello!

I have Lenovo Z50 70 laptop, with integrated i7 gpu, and deicated nVidia geforce 840M gpu. I have installed nvidia package, and bumblebee.

optirun glxspheres64 works, nvidia-smi gpu stat shows a process, with 84% gpu usage during glxspheres64. If I start some game with wine (optirun wine path), it starts, and works. nvidia-smi shows a new process (name: /usr/lib/xorg-server/Xorg), and systemctl status bumblebeed shows a new group, optirun --status shows that "1 applications using bumblebeed". But the game (Terraria in this case) is really laggy. Its not preformance heavy, so it really shouldn't lag. Gpu usage during game : 0%. Memory used by the game : 4MiB. Same with Unreal Tournament 2004.

Other game tried was Starcraft II. Once started, after a while (3-4 sec) the nvidia-smi and optirun --status won't show anything running on nVidia gpu. Maybe becouse a launcher starts the game, and exits, and the child process is not started on the nVidia gpu. Also, game tells me, its is being ran on the intel gpu. This may not be a good indicator, but still.

Some stuff I did untill now:

I installed Arch with intel drivers. Then I had trouble installing nvidia drivers, becouse I always got black screen. Tried nearly all Arch wiki solutions, but none of them helped. Then I uninstalled xf86-video-intel, installed nvidia, and everything seemed fine. During Arch installion, I installed xf86-video-vesa too, becouse I read somewhere, that it is something, that Arch can fall back to, if there are some serious problems.

I haven't ran nvidia-xconfig yet. Well, I did, but I get blackscreen after booting. In the /etc/X11 folder, xorg.conf is an empty file, as xorg.conf.d is an empty directory too. There is nothing like nvida-xconfig. I tried to put some stuff like nvidia device bus ID in xorg.conf, but I always got a black screen. Also sometimes the boot log displayed during boot starts flashing, can't even switch to tty. If somehow can, it flashes, and I can rarely input any keys.

Tried running programs/games with the following commands:

primusrun wine ...
optirun wine ...
optirun -b primus wine ...
optirun -b primus -c yuv wine ...
vblank_mode=0 primusrun wine ...

Kernel parameters tried:

  • nomodeset: Choppy, slow loading graphics, like browsing a site with extremely slow internet.

  • i915.modeset=0: same. Xorg.log

Some commands:

  • nvidia-xconfig : Package xorg-server was not found in the pkg-config search path. Perhaps you should add the directory containing `xorg-server.pc' No package 'xorg-server' found.

  • pacman -Q | grep xf86 : lib32-libxxf86vm, libxxf86dga, libxxf86vm, xf86-input-libinput, xf86-video-vesa

  • pacman -Q | grep xorg-server : xorg-server, xorg-server-common

  • lspci -k|grep -iA2 vga : VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller. Kernel driver in use: i915

  • lspci -k|grep -iA2 3d : 3D controller: NVIDIA Corporation GM108M [GeForce 840M]. Kernel driver in use: nvidia

I have tried this : Optimus using nvidia Arch wiki Resulting in a blackscreen.  Xorg.log

Rolled back Wine to 2.2, but had the same result, except Starcraft did not even start.

Staring Starcraft with optirun console output After a bit, I don't know how to explain this, the terminal "frees up", so I can type anything. Im afraid, that the game launcher starts on nvidia gpu, but the game itself does not.

Also, I have tried anything logical from the Arch wiki, but nothing helped, thats why I here. I hope, someone already solved this problem, and knows the solution. I got everything else working on Arch, and I don't play that much, but It would be very frustrating if I couldn't make this work. I also posted this on r/archlinux, but had no succesfull solution.

Again the problem in short: games/programs run on bumblebee, but 0 cpu usage. Seems like nothing runs on nvidia card.

I hope I posted every necessary information, if not, please ask for it.

Thank you for reading, and for helping.

Last edited by MrFry (2018-03-18 13:16:18)

Offline

#2 2018-03-16 14:10:33

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] Using nVidia GPU

Ah finally at a place with proper formatting capabilities tongue

In general from the console output it reads like you forgot to install the lib32-versions of primusrun/virtualgl .

Start off with defining what you want, maximum performance at the cost of battery runtime, or do you want to look at fixing a bumblebee setup because you prefer the usefulness of running the dedicated card on an as needed basis? it's important that you decide this, as the two common solutions to either problem conflict with each other. What is the current state of the system? Post

pacman -Qs bumblebee
pacman -Qs nvidia
pacman -Qs mesa
pacman -Qs primus
cat /etc/X11/xorg.conf

in [ code ] tags

Last edited by V1del (2018-03-16 14:17:01)

Offline

#3 2018-03-16 14:45:23

MrFry
Member
Registered: 2018-03-16
Posts: 26

Re: [SOLVED] Using nVidia GPU

Well, I want maximum performance of course. Or I mean I forgot to mention, that battery life is not a question here, AC is always plugged in, especially when I sometimes start some games. I have read, that bumblebee is not utilizing the full power of the dedicated GPU, but it sounds really nice, that intel gpu is for basic rendering (desktop, video, simple graphics), and the dedicated gpu only runs games and stuff. This is just my idea, and I am starting to think, that this is not always the best, and hard to achieve in this case neutral

So in short: maximum performance at cost of battery.

It is also possible, that I forgot to install/setup something, in fact,  its very likely that this is the case. I learnt everything from Arch wiki, and some other internet sources, and had no experience before.

pacman -Qs bumblebee:

local/bumblebee 3.2.1-16
    NVIDIA Optimus support for Linux through VirtualGL
local/primus 20151110-7
    Faster OpenGL offloading for Bumblebee

pacman -Qs nvidia:

local/bumblebee 3.2.1-16
    NVIDIA Optimus support for Linux through VirtualGL
local/lib32-nvidia-utils 390.25-1
    NVIDIA drivers utilities (32-bit)
local/libvdpau 1.1.1+3+ga21bf7a-1
    Nvidia VDPAU library
local/nvidia 390.25-16
    NVIDIA drivers for linux
local/nvidia-utils 390.25-2
    NVIDIA drivers utilities

pacman -Qs mesa:

local/glu 9.0.0-4
    Mesa OpenGL Utility library
local/lib32-glu 9.0.0-3
    Mesa OpenGL utility library (32 bits)
local/lib32-mesa 17.3.6-1
    an open-source implementation of the OpenGL specification (32-bit)
local/mesa 17.3.6-1
    an open-source implementation of the OpenGL specification
local/mesa-demos 8.4.0-1
    Mesa demos and tools incl. glxinfo + glxgears

pacman -Qs primus:

local/primus 20151110-7
    Faster OpenGL offloading for Bumblebee

cat /etc/X11/xorg.conf:
its an empty file neutral

Offline

#4 2018-03-16 15:04:13

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] Using nVidia GPU

Yeah, for primsrun and friends to work with wine you definitely lack the lib32 libs. However, as we have now established you would rather want offloading to work.

In that case remove bumblebee and bbswitch and primus and the /etc/X11/xorg.conf just to be sure.  Then follow https://wiki.archlinux.org/index.php/NV … ing_nvidia (you don't necessarily need the xorg.conf mentioned there, but it doesn't hurt either) paying close attention to the .xinitrc and/or display manager instructions.

If after following that this setup still doesn't work, post the contents and names and filepaths you've adjusted  as well as an updated xorg log.

Offline

#5 2018-03-16 15:17:19

MrFry
Member
Registered: 2018-03-16
Posts: 26

Re: [SOLVED] Using nVidia GPU

Here is Xorg.log from my previous attempt trying this. If I remember correctly, it reseulted in a blacksreen.

I will try again, becouse I wansn't exactly sure, what ~/.xinitrc is. Is it the same as /home/$USER/.xinitrc? If it is, do I need to add this to every user? Well, there is only one user, im just a bit curious smile Also, its not there now, so I must create one.

Also (just to be sure) I don't need to edit xorg.conf in this case, right?

Last edited by MrFry (2018-03-16 15:18:40)

Offline

#6 2018-03-16 15:34:55

MrFry
Member
Registered: 2018-03-16
Posts: 26

Re: [SOLVED] Using nVidia GPU

Without modifying anything, but uninstalling bumblebee, I get black screen after reboot. After reinstalling bumblebee, its fine.

Xorg.log

Offline

#7 2018-03-16 15:36:37

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] Using nVidia GPU

Yes ~ refers to your user's $HOME directory. You have to add it to the user you are logging in, and starting X as.

However be aware that the optimus article only outlines the additional lines you have to add. If you don't yet have an ~/.xinitrc you should follow https://wiki.archlinux.org/index.php/Xinit#xinitrc for the basic setup and append the xrandr lines before you start the environment.

No, given that the bumblebee files have been removed with the package removal, your xorg.conf should remain empty.

Edit: I know, that's what the xrandr lines are supposed to fix. And if you already get a black screen that implies something is already trying to start X. Are you booting into SDDM directly? Follow the corresponding info, and for testing purposes, disable SDDM and try to get this working using startx and xinitrc first.

Last edited by V1del (2018-03-16 15:40:05)

Offline

#8 2018-03-16 16:16:37

MrFry
Member
Registered: 2018-03-16
Posts: 26

Re: [SOLVED] Using nVidia GPU

Well, I tried to setup that xinit stuff. After I copied xinitrc from /etc/X11/xinit to my user folder, and modifying it, I also copied it to the specified SDDM folder. (/usr/share/sddm/scripts/Xsetup). After I rebooted, I did not get a blackscreen, but I got 3 white boxes, each with a terminal running in, at the left part of the screen. I have never seen anything like this before. Here is the Xorg.log from that. After this, I reverted everything from TTY. Something like this, but black background, and no window borders

I am a bit lost now. I did lots of changes, and combinations of them, hoping that one will work, and then reverted them when failed. What exactly should I do first? Remove bumblebee, or try to  only use nvidia device ? Its a bit odd, that removing bumblebee gives me a black screen.

Don't know what you mean, by booting into SDDM directly, but the display manager starts automatically, if you mean this. I have tried to disable SDDM, and rebooting with edited xinitrc sugessted in the wiki, logging in, and startx-ing, but got the same 3 white terminal screen.

Edit: So now basicly I reverted everything I tried since I made this thread

Last edited by MrFry (2018-03-16 16:18:35)

Offline

#9 2018-03-16 16:25:42

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Using nVidia GPU

MrFry wrote:

After I rebooted, I did not get a blackscreen, but I got 3 white boxes, each with a terminal running in, at the left part of the screen. I have never seen anything like this before.

That's the default twm desktop that startx launches if you haven't told it any different, it means that everything is set up correctly. Can you post your ~/.xinitrc.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#10 2018-03-16 16:32:13

MrFry
Member
Registered: 2018-03-16
Posts: 26

Re: [SOLVED] Using nVidia GPU

Here you go. I deleted it after it won't boot normally, but I made it by cp-ing /etc/X11/xinit/xinitrc, and adding

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

as the wiki suggested.

Offline

#11 2018-03-16 16:38:09

Cknight70
Member
Registered: 2018-01-24
Posts: 76

Re: [SOLVED] Using nVidia GPU

You started the default xinitrc environment, but don't have the twm package installed (the green window boarders)?

For the sake of not confusing ourselves, you will not need bumblebee, bbswitch, or primusrun at all if you only plan on using the nvidia card. The purpose of those is for switchable graphics (Typically Intel running by default, and the nvidia card called for a particular application with optirun or primusrun commands)


I would also blacklist your intel related modules https://wiki.archlinux.org/index.php/NV … grated_GPU

Edit: See below

Last edited by Cknight70 (2018-03-16 17:15:44)

Offline

#12 2018-03-16 16:48:57

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] Using nVidia GPU

@Cknight no, blacklisting intel modules will be absolutely fatal here. In general the Nvidia article is to be disregarded on an Optimus system. The intel modules are required, as that is were the output is connected to, we only relay the nvidia output over the intel card.

@MrFry now you've got far enough that it technically should work. Remove/comment the block that starts twm and the clock and friends, and add

exec startkde

at the end instead. You should land in KDE upon startx'ing run a

glxinfo | grep OpenGL

to verify the renderer used, or post a Xorg log if this fails. However the xorg log from your TWM boot lacks nvidia module loads, your really have to trust us on this. Unless you remove bumblebee this will not work,

Last edited by V1del (2018-03-16 17:08:20)

Offline

#13 2018-03-16 18:02:59

MrFry
Member
Registered: 2018-03-16
Posts: 26

Re: [SOLVED] Using nVidia GPU

Added exec startkde to the end of .xinitrc, removed bumblebee, and it worked. Fonts are a bit different, glxinfo outputs nvidia stuff, and firefox has screen tearing, so its definetly running on nVidia card. Even Starcraft in wine tells me that.

Disabling intel modules from loading gives error : HSW/BDW HD-audio HDMI/DP requires binding with gfx driver at boot. But I won't disable those now.

Now, what should I do, to make this automatic? I mean I got blackscreen on boot, then typed startx in TTY, and KDE Plasma started. (and how to fix screantearing. jk, thats another adventure smile )

Offline

#14 2018-03-16 18:30:54

Cknight70
Member
Registered: 2018-01-24
Posts: 76

Re: [SOLVED] Using nVidia GPU

Glad you got it working smile

For SDDM, obviously verify SDDM is installed.
Then
https://wiki.archlinux.org/index.php/Di … ay_manager
https://wiki.archlinux.org/index.php/NV … timus#SDDM
https://wiki.archlinux.org/index.php/SDDM

Or you can make startx run on tty login if you want to be more minimalist
https://wiki.archlinux.org/index.php/Xi … X_at_login

Post back if you have anymore questions, or edit your first post to mark the thread as solved.

Last edited by Cknight70 (2018-03-16 18:44:29)

Offline

#15 2018-03-16 18:42:58

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] Using nVidia GPU

For fixing screen tearing add

nvidia-drm.modeset=1

to your kernel parameters.

As already linked setting up the Xsetup file for SDDM should fix that (contrary to the ~/.xinitrc, in the SDDM case these two lines are the only thing you have to add there)

If you think this is solved, please edit your initial post and prepend [SOLVED] or similar to the title.

Offline

#16 2018-03-16 18:49:33

MrFry
Member
Registered: 2018-03-16
Posts: 26

Re: [SOLVED] Using nVidia GPU

Deleted: whops, somehow made firefox post it twice big_smile Gonna try it soon smile

Last edited by MrFry (2018-03-16 18:52:21)

Offline

#17 2018-03-16 19:17:19

MrFry
Member
Registered: 2018-03-16
Posts: 26

Re: [SOLVED] Using nVidia GPU

So, this works, but I get a black screen at boot. I switch to TTY2 (ctrl alt f2), and login, then startx. But if I switch back to TTY1, Its still black. In /etc/systemd/system/ there is a link to /usr/lib/systemd/system/sddm.service. I think copying the xinitrc to  the SDDM-s Xsetup is not correct, but now I don't want to mess anything up, and don't have an exact idea, what to paste.

Also thanks for the quick screen tearing issue help, it worked

Offline

#18 2018-03-18 03:06:42

Cknight70
Member
Registered: 2018-01-24
Posts: 76

Re: [SOLVED] Using nVidia GPU

Just add the two lines linked in the optimus article and enable sddm.service and you should be good to go, like V1del said.

V1del wrote:

contrary to the ~/.xinitrc, in the SDDM case these two lines are the only thing you have to add there


As for your black screen I'm really not sure, but you'll probably have more success starting a new thread with more details about your problem. Like can you see the cli login screen on TTY1? if you turn off silent in your kernal parameters do you see the system startup?

Hope that helps.

Last edited by Cknight70 (2018-03-18 03:10:21)

Offline

#19 2018-03-18 08:47:53

MrFry
Member
Registered: 2018-03-16
Posts: 26

Re: [SOLVED] Using nVidia GPU

/usr/share/sddm/scripts/Xsetup :

#!/bin/sh
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

It still blackscreens. I don't know, if new thread is a good idea, since this is not completely solved, and if someone has the same problem could find  the solution here.
There is output till /dev/sda*: clean, */* Files, */* Blocks (or something like this), then screen goes black, no backlight, like its switched off instead of the graphical login screen. Its on TTY1, to acces my laptop, I switch to TTY2. There I have output, asks for my logins. I log in, type startx, and KDE Plasma starts. But if anytime I switch back to TTY1, I get the same black ("off") screen. Switching back to TTY2, I get the desktop I logged in previously.

systemctl | grep sddm :

session-c1.scope                                                                         loaded active running   Session c1 of user sddm                                                      
sddm.service                                                                             loaded active running   Simple Desktop Display Manager                                               
user-974.slice                                                                           loaded active active    User Slice of sddm

systemctl | grep sddm output is the same before (in TTY2) and after running xstart

Edit: after xstart, in KDE desktop I have 2 xterm windows. Just before KDE apears, I see 3 white terminals, like I posted before. Don't know, if its unusuall,  but I tought I mention it.

Last edited by MrFry (2018-03-18 08:53:12)

Offline

#20 2018-03-18 11:40:16

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] Using nVidia GPU

You just have to comment out the xterm entries in your .xinitrc for them to not appear. As for SDDM is the script executable and readable by non root users?  What's the output of

journalctl -b --unit=sddm

? Is your Xsetup path configured away from the default? paste your /etc/sddm.conf

Offline

#21 2018-03-18 13:15:41

MrFry
Member
Registered: 2018-03-16
Posts: 26

Re: [SOLVED] Using nVidia GPU

Granted premission to execute /usr/share/sddm/scripts/Xsetup for everyone, and after reboot I was greeted with the SDDM login screen on TTY1. Don't know, if everybody needs that execute permission, but it works now smile

Thank you everybody for your help, it is now completely fixed. Marked as solved.

Offline

Board footer

Powered by FluxBB