Based on your query in http://ubuntuforums.org/showthread.php?t=2291771 and the answers there, what you are asking for is not possible.
From the forum:
From my understanding of Nvidia Optimus technology I do not think it
is possible. The purpose of Optimus is automatic switching between a
more powerful GPU for high intensity graphic tasks with likewise high
battery drain and a less powerful GPU for low intensity graphic tasks
with the benefit of less battery drain.
In Linux we have yet to get an Nvidia driver that will do automatic
switching.
I am guessing that the problems you are having with video play back
are nothing to do with which GPU is being used but in connection with
the CPU being under intensive use and needing to task switch. The
Nvidia GPU should handle video playback easily. If it is not then it
could be a case of too much going on at the same time.
On the other hand, you can try bumblebee/optirun
as described in Correct nvidia+intel graphics setup in 14.04
Then you can start ue4
with optirun
prefix, thus using the Nvidia card for it and use Intel for other processes like the browser. Open a terminal by pressing Ctrl+Alt+T and enter:
(optirun <name of the program> &)
The (parenthesis) and &
will detach the process from the terminal. This will allow you to work on the terminal after launching the program. There are other ways of completely detaching the program from the terminal.
Also see How does bumblebee optirun actually work?.
I don't have an Nvidia card, so I have not tried it.
Hope this helps
On my 9750 running Ubuntu 18.04, whenever I turn off the dgpu using bbswitch before logging in or on boot, my system freezes.
After trying many different methods and many reboots I settled on a workaround: scheduling a cron job to activate bbswitch after some delay (60s) on reboot, so that I can login before bbswitch kicks in.
open crontab as root in terminal:
sudo crontab -e
add to cron:
@reboot sleep 60 && /sbin/modprobe bbswitch
replace /sbin/modprobe to where your modprobe executable is, this assumes bbswitch is installed.
Also add to /etc/modprobe.d/bbswitch.conf:
options bbswitch load_state=0 unload_state=1
This turns off the dgpu on loading bbswitch and turns in on on unloading bbswitch. Refer to here for more details.
For the lid problem, I had to edit logind.conf:
sudo nano /etc/systemd/logind.conf
change the following line:
HandleLidSwitchDocked=ignore
to
HandleLidSwitchDocked=suspend
Strangely if you leave the default settings (=ignore), attach an external display and shut the lid the computer does not freeze on reopening. With =ignore and with an external display the computer suspends when you close the lid but you can wake the external monitor with your mouse/keyboard.
Best Answer
If you want only
mpv
to be affected, just alias it:You can add this to
~/.bashrc
or~/.bash_aliases
.