Mailinglist Archive: opensuse-commit (1903 mails)

< Previous Next >
commit suse-prime for openSUSE:Factory
Hello community,

here is the log from the commit of package suse-prime for openSUSE:Factory
checked in at 2019-04-08 20:54:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/suse-prime (Old)
and /work/SRC/openSUSE:Factory/.suse-prime.new.3908 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "suse-prime"

Mon Apr 8 20:54:07 2019 rev:8 rq:692307 version:0.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/suse-prime/suse-prime.changes 2019-04-03
09:27:54.743812337 +0200
+++ /work/SRC/openSUSE:Factory/.suse-prime.new.3908/suse-prime.changes
2019-04-08 20:54:15.082599858 +0200
@@ -2,100 +1,0 @@
-Mon Apr 1 18:11:12 UTC 2019 - Mykola Krachkovsky <w01dnick@xxxxxxxxx>
-
-- Repair broken suse-prime-bbswitch package
-
--------------------------------------------------------------------
-Mon Apr 1 14:03:36 UTC 2019 - Stefan Dirsch <sndirsch@xxxxxxxx>
-
-- Update to version 0.6.8
- * Big Update (changes in systemd services)
- + prime-boot-selector service deprecated, all features are
- now handled with one only service.
- + used journalctl to check if system is booting or if
- "logout-switch" is needed
- + no more multiple service enable/disable needed during
- switch, prime-select service is enabled everytime
- + removed all "prime-boot-selector" references in logging
- and help command
- + boot_status file has now only two states (S > wait for
- switching, N > not waiting)
- + changed systemd call from "prime-select apply_current"
- to "prime-select systemd_call"
- + updated README
-
--------------------------------------------------------------------
-Fri Mar 29 14:13:29 UTC 2019 - Stefan Dirsch <sndirsch@xxxxxxxx>
-
-- Update to version 0.6.7
- * Corrected DPI value in xorg-nvidia.conf (boo#1130723)
-
--------------------------------------------------------------------
-Mon Mar 25 13:30:18 UTC 2019 - Stefan Dirsch <sndirsch@xxxxxxxx>
-
-- Update to version 0.6.6
- * Add logging to journal as well
-
--------------------------------------------------------------------
-Sun Mar 24 21:40:17 UTC 2019 - Mykola Krachkovsky <w01dnick@xxxxxxxxx>
-
-- Split power support into separate package suse-prime-bbswitch
- which don't need manual work
-
--------------------------------------------------------------------
-Tue Mar 19 14:42:56 UTC 2019 - Stefan Dirsch <sndirsch@xxxxxxxx>
-
-- Update to version 0.6.5
- * augmented README
- * do not mention "intel" driver issue with kwin since it is obsolete
- * improved "intel" xorg config to work properly with compositors
-
--------------------------------------------------------------------
-Mon Feb 25 11:05:54 UTC 2019 - sndirsch@xxxxxxxx
-
-- Update to version 0.6.4
- * added support for xdm and kdm
- * removed useless "sudo" in journalctl calls
-
--------------------------------------------------------------------
-Fri Feb 22 09:48:49 UTC 2019 - sndirsch@xxxxxxxx
-
-- Update to version 0.6.3
- * Best DM support (lightdm added)
-
--------------------------------------------------------------------
-Thu Feb 21 09:54:47 UTC 2019 - sndirsch@xxxxxxxx
-
-- Update to version 0.6.2
- - fixes all known issues with GDM, runlevel 3 and manually-started
- x sessions
- * Xorg logfile comparision no longer necessary, let's use
- journalctl to check user logout
- * other DM(s) than sddm/gdm will be implemented in the future
-
--------------------------------------------------------------------
-Fri Feb 8 14:40:50 UTC 2019 - sndirsch@xxxxxxxx
-
-- Update to version 0.6.1
- * mainly bugfixes
-- supersedes 0001-Resolved-multiple-unexistent-file-error.patch
-
--------------------------------------------------------------------
-Wed Jan 30 11:56:58 UTC 2019 - sndirsch@xxxxxxxx
-
-- Update to version 0.6
- * new systemd service file prime-boot-selector in addition to prime-select
- + Service prime-select chooses with whatever driver was previously set by
user.
- + Service prime-boot-selector sets all things during boot [MUST BE ENABLED]
- * new prime-select command options
- + prime-select boot intel|intel2|nvidia|last
- + prime-select next-boot intel|intel2|nvidia|abort
- + prime-select service check|disable|restore
-- 0001-Resolved-multiple-unexistent-file-error.patch (post 0.6)
- * Resolved multiple unexistent file errors
- * Resolved a big issue in switch command if prime_logfile doesn't exist,
- file check added
- * Added non existent file handling in various parts of script (next-boot,
- log-view, unset, current_check) Those issues manifested themselves
- after a fresh installation, because some config files still were not
- present
-
--------------------------------------------------------------------

Old:
----
SUSEPrime-0.6.8.tar.gz

New:
----
SUSEPrime-0.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ suse-prime.spec ++++++
--- /var/tmp/diff_new_pack.h4gM3v/_old 2019-04-08 20:54:16.346600785 +0200
+++ /var/tmp/diff_new_pack.h4gM3v/_new 2019-04-08 20:54:16.350600788 +0200
@@ -12,12 +12,12 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

-# Please submit bugfixes or comments via https://bugs.opensuse.org/
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name: suse-prime
-Version: 0.6.8
+Version: 0.5
Release: 0
Summary: GPU (nvidia/intel) selection for NVIDIA optimus laptops
License: SUSE-Public-Domain
@@ -27,7 +27,6 @@
Recommends: nvidia_driver
Supplements: modalias(nvidia_driver:pci:v00008086d*sv*sd*bc03sc*i*)
Conflicts: suse-prime-alt
-Conflicts: suse-prime-bbswitch
BuildArch: noarch

%description
@@ -35,22 +34,6 @@
NVIDIA GPU on a Optimus Laptop. The switching is similar to
the feature provided by the nvidia-prime package in Ubuntu.

-%package bbswitch
-Summary: GPU (nvidia/intel) selection for NVIDIA optimus laptops with
bbswitch support
-Group: System/X11/Utilities
-BuildRequires: systemd
-Requires: bbswitch
-Conflicts: suse-prime-alt
-Conflicts: suse-prime
-BuildArch: noarch
-%{?systemd_requires}
-
-%description bbswitch
-A collection of shell scripts that makes it possible to use the
-NVIDIA GPU on a Optimus Laptop. The switching is similar to
-the feature provided by the nvidia-prime package in Ubuntu.
-Uses bbswitch to switch on/of power of NVIDIA GPU.
-
%prep
%setup -n SUSEPrime-%{version}

@@ -62,43 +45,17 @@
install -m 0644 xorg-intel.conf %{buildroot}%{_sysconfdir}/prime/
install -m 0644 xorg-intel-intel.conf %{buildroot}%{_sysconfdir}/prime/
install -m 0644 xorg-nvidia.conf %{buildroot}%{_sysconfdir}/prime/
-mkdir -p %{buildroot}%{_sysconfdir}/modprobe.d
-install -m 0644 09-nvidia-blacklist.conf %{buildroot}%{_sysconfdir}/modprobe.d/
-mkdir -p %{buildroot}%{_unitdir}
-install -m 0644 prime-select.service %{buildroot}%{_unitdir}/
+install -m 0644 09-nvidia-blacklist.conf %{buildroot}%{_sysconfdir}/prime/
+install -m 0644 prime-select.service %{buildroot}%{_sysconfdir}/prime/
echo "undefined" > %{buildroot}%{_sysconfdir}/prime/current_type
install -D -m 0755 prime-select.sh %{buildroot}%{_sbindir}/prime-select

%preun
if [ "$1" -eq 0 ]; then
# cleanup before uninstalling the package completely
- export PATH=$PATH:/usr/sbin
%{_sbindir}/prime-select unset
fi

-%pre bbswitch
-%service_add_pre prime-select.service
-
-%post bbswitch
-%{?regenerate_initrd_post}
-%service_add_post prime-select.service
-systemctl enable prime-select.service
-
-%preun bbswitch
-%service_del_preun prime-select.service
-if [ "$1" -eq 0 ]; then
- # cleanup before uninstalling the package completely
- export PATH=$PATH:/usr/sbin
- %{_sbindir}/prime-select unset
-fi
-
-%postun bbswitch
-%{?regenerate_initrd_post}
-%service_del_postun prime-select.service
-
-%posttrans bbswitch
-%{?regenerate_initrd_posttrans}
-
%files
%defattr(-,root,root)
%doc README.md
@@ -106,18 +63,9 @@
%config %{_sysconfdir}/prime/xorg-intel.conf
%config %{_sysconfdir}/prime/xorg-intel-intel.conf
%config %{_sysconfdir}/prime/xorg-nvidia.conf
+%config %{_sysconfdir}/prime/09-nvidia-blacklist.conf
+%config %{_sysconfdir}/prime/prime-select.service
%config(noreplace) %{_sysconfdir}/prime/current_type
%{_sbindir}/prime-select

-%files bbswitch
-%doc README.md
-%{_sysconfdir}/prime
-%config %{_sysconfdir}/prime/xorg-intel.conf
-%config %{_sysconfdir}/prime/xorg-intel-intel.conf
-%config %{_sysconfdir}/prime/xorg-nvidia.conf
-%config(noreplace) %{_sysconfdir}/prime/current_type
-%{_sbindir}/prime-select
-%config %{_sysconfdir}/modprobe.d/09-nvidia-blacklist.conf
-%{_unitdir}/prime-select.service
-
%changelog

++++++ SUSEPrime-0.6.8.tar.gz -> SUSEPrime-0.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SUSEPrime-0.6.8/README.md new/SUSEPrime-0.5/README.md
--- old/SUSEPrime-0.6.8/README.md 2019-04-01 15:50:46.000000000 +0200
+++ new/SUSEPrime-0.5/README.md 2019-01-24 21:08:13.000000000 +0100
@@ -1,10 +1,10 @@
-openSUSE nvidia-prime like package
+OpenSUSE nvidia-prime like package
==================================

Assumptions
-----------

-* You are running openSUSE Tumbleweed
+* You are running OpenSUSE Tumbleweed
* You don't have bumblebee installed
* You installed nvidia drivers using http://opensuse-community.org/nvidia.ymp

@@ -24,10 +24,6 @@
* Bo Simonsen <bo@xxxxxxxxxxxx>
* Michal Srb <msrb@xxxxxxxx>

-Related projects
-----------------
-
-* SUSEPrimeQT <https://github.com/simopil/SUSEPrimeQt/> Provides a simple GUI
for SUSEPrime

NVIDIA power off support
-------------------------
@@ -57,47 +53,61 @@

This will also blacklist the `nouveau` module which can really get in the way
with Optimus and causing black screens.

-### Install the systemd services for doing switch and set correct card during
boot
+### Install the systemd service for loading NVIDIA module when needed

```
-cp /etc/prime/prime-select.service /usr/lib/systemd/system
-cp /etc/prime/prime-boot-selector.service /usr/lib/systemd/system
-systemctl enable prime-boot-selector
+cp /etc/prime/prime-select.service /usr/lib/systemd/system
+systemctl enable prime-select
```

-Service prime-select chooses with whatever driver was previously set by user.
-Service prime-boot-selector sets all things during boot [MUST BE ENABLED]
-If nvidia is set, it will load the NVIDIA modules before starting the
Graphical Target.
+This service calls prime-select with whatever driver was previously set by
user.
+If nvidia is set, it will load the NVIDIA modules before starting the Display
Manager (login screen).
Moreover, if an intel config is set but the Intel card was disabled in BIOS
(leaving only the dGPU), this service will automatically switch to the nvidia
config.


## FAQ

-### How do I select a driver ?
+### What are the script parameters to select a driver ?

prime-select `<driver>`

-Where `<driver>` is one of:
+Where `driver` is one of:

-- `intel`: use the `modesetting` driver
-- `intel2`: use the `intel` driver (xf86-video-intel)
+- `intel`: uses the modesetting driver
+- `intel2`: uses the intel driver (xf86-video-intel). If you use Plasma you
might get corrupted flickering display. To fix this make sure to disable vsync
in the Plasma compositor settings first. Vsync will be handled by the intel
driver
- `nvidia`: use the NVIDIA binary driver


-### How do I check the current driver configured and the power state of the
NVIDIA card ?
+### How do I switch from nvidia to intel with NVIDIA power off support ?
+
+
+It requires switching runlevels for the script to be able to remove the NVIDIA
modules and power off the card:
+
+Exit Xorg, going into runlevel 3 (multi-user):
+
+```
+<save all your work in Xorg, close programs as needed>
+sudo init 3
+<login as root on console>
+```
+
+Use the script to change driver:
+
+```
+prime-select intel
+```
+
+Restart in run level 5 (graphical mode) with the new driver:

```
-/usr/sbin/prime-select get-current
-Driver configured: intel
-[bbswitch] NVIDIA card is OFF
+init 5
```

-To get more details on the Xorg driver, install package `inxi` if necessary
and use `inxi -G`:
+### How to I check that the NVIDIA card is powered off ?

```
-inxi -G
-Graphics: Device-1: Intel UHD Graphics 630 driver: i915 v: kernel
- Device-2: NVIDIA GP107GLM [Quadro P600 Mobile] driver: N/A
- Display: x11 server: X.Org 1.20.4 driver: intel resolution:
3840x2160~60Hz
- OpenGL: renderer: Mesa DRI Intel UHD Graphics 630 (Coffeelake 3x8
GT2) v: 4.5 Mesa 18.3.4
+cat /proc/acpi/bbswitch
+0000:01:00.0 OFF
```
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SUSEPrime-0.6.8/prime-select.service
new/SUSEPrime-0.5/prime-select.service
--- old/SUSEPrime-0.6.8/prime-select.service 2019-04-01 15:50:46.000000000
+0200
+++ new/SUSEPrime-0.5/prime-select.service 2019-01-24 21:08:13.000000000
+0100
@@ -1,11 +1,10 @@
[Unit]
-Description=SUSEPrime systemd service
-After=multi-user.target
-Before=display-manager.service
+Description=Prime Select Service
+Before=display-manager.service

[Service]
Type=oneshot
-ExecStart=prime-select systemd_call
+ExecStart=prime-select apply-current

[Install]
-WantedBy=multi-user.target
+WantedBy=graphical.target
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SUSEPrime-0.6.8/prime-select.sh
new/SUSEPrime-0.5/prime-select.sh
--- old/SUSEPrime-0.6.8/prime-select.sh 2019-04-01 15:50:46.000000000 +0200
+++ new/SUSEPrime-0.5/prime-select.sh 2019-01-24 21:08:13.000000000 +0100
@@ -7,51 +7,28 @@
# Adapted for OpenSUSE Tumbleweed by Michal Srb <msrb@xxxxxxxx>
# Extended for TUXEDO Computers by Vinzenz Vietzke <vv@xxxxxxxxxxxxxxxxxxx>
# Augmented by bubbleguuum <bubbleguuum@xxxxxxx>
-# Improved by simopil <pilia.simone96@xxxxxxxxx>

type=$1
xorg_nvidia_conf="/etc/prime/xorg-nvidia.conf"
xorg_intel_conf_intel="/etc/prime/xorg-intel.conf"
xorg_intel_conf_intel2="/etc/prime/xorg-intel-intel.conf"
-prime_logfile="/var/log/prime-select.log"
nvidia_modules="nvidia_drm nvidia_modeset nvidia_uvm nvidia"
driver_choices="nvidia|intel|intel2"
lspci_intel_line="VGA compatible controller: Intel"

function usage {
echo
- echo "usage: `basename $0`
$driver_choices|unset|get-current|get-boot|log-view|log-clean"
- echo "usage: `basename $0` boot $driver_choices|last"
- echo "usage: `basename $0` next-boot $driver_choices|abort"
- echo "usage: `basename $0` service check|disable|restore"
+ echo "usage: `basename $0` $driver_choices|unset|get-current|apply-current"
echo
- echo "intel: use the Intel card with the \"modesetting\" driver"
- echo "intel2: use the Intel card with the \"intel\" Open Source
driver (xf86-video-intel)"
- echo "nvidia: use the NVIDIA proprietary driver"
- echo "boot: select default card at boot or set last used"
- echo "next-boot: select card ONLY for next boot, it not touches your
boot preference. abort: restores next boot to default"
- echo "get-boot: display default card at boot"
- echo "service: disable, check or restore prime-select service. Could
be useful disabling service"
- echo " before isolating multi-user.target to prevent service
execution."
- echo "log-view: view switching logfile to see errors or debug"
- echo "log-clean: clean logfile"
- echo "unset: disable effects of this script and let Xorg decide what
driver to use"
+ echo "intel: use the Intel card with the modesetting driver"
+ echo "intel2: use the Intel card with the Intel open-source driver
(xf86-video-intel). If you use this driver in a Plasma session, make sure to
first disable vsync in the Plasma compositor settings to prevent video
corruption"
+ echo "nvidia: use the NVIDIA binary driver"
+ echo "unset: disable effects of this script and let Xorg decide what
driver to use"
echo "get-current: display driver currently in use by this tool"
- echo
- echo "##FOLLOWING COMMANDS ARE USED BY prime-select SERVICEs, DON'T USE
THEM MANUALLY##"
- echo "systemd_call: called during boot or after user logout for
switch"
- echo "user_logout_waiter: waits user logout (used by prime-select systemd
service)"
+ echo "apply-current: re-apply this script using previously set driver
(used by prime-select systemd service)"
echo
}

-function logging {
- if ! [ -f $prime_logfile ]; then
- echo "##SUSEPrime logfile##" > $prime_logfile
- fi
- echo "[ $(date +"%H:%M:%S") ] ${1}" >> $prime_logfile
- echo "${1}" | systemd-cat -t suse-prime -p info
-}
-
function check_root {
if (( $EUID != 0 )); then
echo "You must run this script as root"
@@ -59,86 +36,96 @@
fi
}

-function bbcheck {
- if [ "$(rpm -q bbswitch | grep bbswitch-)" > /dev/null ]; then
- if [ "$(grep OFF /proc/acpi/bbswitch)" > /dev/null ]; then
- echo "[bbswitch] NVIDIA card is OFF"
- elif [ "$(grep ON /proc/acpi/bbswitch)" > /dev/null ]; then
- echo "[bbswitch] NVIDIA card is ON"
- else
- echo "bbswitch is installed but seems broken. Cannot change nvidia
power status"
- fi
- else
- echo "bbswitch is not installed. NVIDIA card will not be powered off"
- fi
-}
-
function clean_files {
rm -f /etc/X11/xorg.conf.d/90-nvidia.conf
rm -f /etc/X11/xorg.conf.d/90-intel.conf
}

-function set_nvidia {
- if [ -f /proc/acpi/bbswitch ]; then
- tee /proc/acpi/bbswitch > /dev/null <<EOF
-ON
-EOF
- fi
+case $type in

- logging "trying switch ON nvidia: $(bbcheck)"
- # will load all other dependency modules
- modprobe nvidia_drm
+ apply-current)
+
+ if [ -f /etc/prime/current_type ]; then
+
+ current_type=`cat /etc/prime/current_type`
+
+ if [ "$current_type" != "nvidia" ] && ! lspci | grep
"$lspci_intel_line" > /dev/null; then
+
+ # this can happen if user set intel but changed to "Discrete
only" in BIOS
+ # in that case the Intel card is not visible to the system and
we must switch to nvidia
+
+ echo "Forcing nvidia due to Intel card not found"
+ current_type="nvidia"
+ fi
+
+ $0 $current_type
+ fi
+ ;;

- gpu_info=`nvidia-xconfig --query-gpu-info`
- # This may easily fail, if no NVIDIA kernel module is available or
alike
- if [ $? -ne 0 ]; then
- logging "PCI BusID of NVIDIA card could not be detected!"
- exit 1
- fi
+ nvidia)
+
+ check_root

- # There could be more than on NVIDIA card/GPU; use the first one in that
case
+ if [ -f /proc/acpi/bbswitch ]; then
+ tee /proc/acpi/bbswitch > /dev/null <<EOF
+ON
+EOF
+ fi

- nvidia_busid=`echo "$gpu_info" |grep -i "PCI BusID"|head -n 1|sed 's/PCI
BusID ://'|sed 's/ //g'`
+ # will load all other dependency modules
+ modprobe nvidia_drm
+
+ gpu_info=`nvidia-xconfig --query-gpu-info`
+ # This may easily fail, if no NVIDIA kernel module is available or alike
+ if [ $? -ne 0 ]; then
+ echo "PCI BusID of NVIDIA card could not be detected!"
+ exit 1
+ fi
+
+ # There could be more than on NVIDIA card/GPU; use the first one in
that case

- libglx_nvidia=`update-alternatives --list libglx.so|grep nvidia-libglx.so`
+ nvidia_busid=`echo "$gpu_info" |grep -i "PCI BusID"|head -n 1|sed
's/PCI BusID ://'|sed 's/ //g'`

- update-alternatives --set libglx.so $libglx_nvidia > /dev/null
+ libglx_nvidia=`update-alternatives --list libglx.so|grep
nvidia-libglx.so`

- clean_files
+ update-alternatives --set libglx.so $libglx_nvidia > /dev/null

- cat $xorg_nvidia_conf | sed 's/PCI:X:X:X/'${nvidia_busid}'/' >
/etc/X11/xorg.conf.d/90-nvidia.conf
+ clean_files

- echo "nvidia" > /etc/prime/current_type
- logging "Nvidia card correctly set"
-}
+ cat $xorg_nvidia_conf | sed 's/PCI:X:X:X/'${nvidia_busid}'/' >
/etc/X11/xorg.conf.d/90-nvidia.conf

-function set_intel {
- # modesetting driver is part of xorg-x11-server and always available
- conf=$xorg_intel_conf_intel
- echo "intel" > /etc/prime/current_type
- #jump to common function intel1/intel2
- common_set_intel
-}
+ echo "$type" > /etc/prime/current_type
+
+ $0 get-current
+ ;;

-function set_intel2 {
- conf=$xorg_intel_conf_intel2
- echo "intel2" > /etc/prime/current_type
- #jump to common function intel1/intel2
- common_set_intel
-}
+ intel|intel2)
+
+ check_root
+
+ if [ "$type" = "intel2" ]; then
+ if ! rpm -q xf86-video-intel > /dev/null; then
+ echo "package xf86-video-intel is not installed";
+ exit 1
+ fi
+
+ conf=$xorg_intel_conf_intel2
+ else
+ # modesetting driver is part of xorg-x11-server and always
available
+ conf=$xorg_intel_conf_intel
+ fi

-function common_set_intel {
- # find Intel card bus id. Without this Xorg may fail to start
+ # find Intel card bus id. Without this Xorg may fail to start
line=`lspci | grep "$lspci_intel_line" | head -1`
if [ $? -ne 0 ]; then
- logging "Failed to find Intel card with lspci"
- exit 1
+ echo "Failed to find Intel card with lspci"
+ exit 1
fi

intel_busid=`echo $line | cut -f 1 -d ' ' | sed -e 's/\./:/g;s/:/ /g' |
awk -Wposix '{printf("PCI:%d:%d:%d\n","0x" $1, "0x" $2, "0x" $3 )}'`
if [ $? -ne 0 ]; then
- logging "Failed to build Intel card bus id"
- exit 1
+ echo "Failed to build Intel card bus id"
+ exit 1
fi

libglx_xorg=`update-alternatives --list libglx.so|grep xorg-libglx.so`
@@ -152,395 +139,40 @@
modprobe -r $nvidia_modules

if [ -f /proc/acpi/bbswitch ]; then
- tee /proc/acpi/bbswitch > /dev/null <<EOF
+ tee /proc/acpi/bbswitch > /dev/null <<EOF
OFF
EOF
- fi
-
- logging "trying switch OFF nvidia: $(bbcheck)"
- logging "Intel card correctly set"
-}
-
-function apply_current {
- if [ -f /etc/prime/current_type ]; then
-
- current_type=`cat /etc/prime/current_type`
-
- if [ "$current_type" != "nvidia" ] && ! lspci | grep
"$lspci_intel_line" > /dev/null; then
-
- # this can happen if user set intel but changed to "Discrete only"
in BIOS
- # in that case the Intel card is not visible to the system and we
must switch to nvidia
-
- logging "Forcing nvidia due to Intel card not found"
- current_type="nvidia"
- fi
-
- set_$current_type
- fi
-}
-
-function current_check {
- if [ "$(pgrep -fl "prime-select user_logout_waiter")" > /dev/null ]; then
- echo "Error: a switch operation already in execution"
- echo "You can undo it using sudo killall prime-select"
- exit 1
- fi
- if ! [ -f /etc/prime/current_type ]; then
- echo "Preparing first configuration"
- elif [ "$type" = "$(cat /etc/prime/current_type)" ]; then
- echo "$type driver already in use!"
- exit 1
- fi
-}
-
-function booting {
- if ! [ -f /etc/prime/boot_state ]; then
- echo "N" > /etc/prime/boot_state
- fi
- if ! [ -f /etc/prime/boot ]; then
- echo "last" > /etc/prime/boot
- fi
-
- if [ -f /etc/prime/forced_boot ]; then
- echo "$(cat /etc/prime/forced_boot)" > /etc/prime/current_type
- rm /etc/prime/forced_boot
- logging "Boot: forcing booting with $(cat
/etc/prime/current_type), boot preference ignored"
- logging "Boot: setting-up $(cat /etc/prime/current_type) card"
- apply_current
- else
- boot_type=`cat /etc/prime/boot`
- if [ "$boot_type" != "last" ]; then
- echo "$boot_type" > /etc/prime/current_type
- fi
- logging "Boot: setting-up $(cat /etc/prime/current_type) card"
- apply_current
- fi
-}
+ grep OFF /proc/acpi/bbswitch > /dev/null || echo "Failed to power
off NVIDIA card"

-function logout_switch {
- apply_current
- echo "N" > /etc/prime/boot_state
- logging "HotSwitch: Reaching graphical.target [ boot_state > N ]"
- systemctl isolate graphical.target &
- systemctl stop prime-select
-}
+ else
+ rpm -q bbswitch > /dev/null || echo "bbswitch is not installed.
NVIDIA card will not be powered off"
+ fi
+
+ echo "$type" > /etc/prime/current_type

-case $type in
-
- apply-current)
-
- check_root
- apply_current
- ;;
-
- nvidia|intel|intel2)
-
- current_check
- check_root
- if ! [ -f /var/log/prime-select.log ]; then
- echo "##SUSEPrime logfile##" > $prime_logfile
- fi
- if [ $(wc -l < $prime_logfile) -gt 1000 ]; then
- #cleaning logfile if has more than 1k events
- rm $prime_logfile &> /dev/null
- echo "##SUSEPrime logfile##" > $prime_logfile
- fi
- if [ "$type" = "intel2" ];then
- if ! rpm -q xf86-video-intel > /dev/null; then
- echo "package xf86-video-intel is not installed";
- exit 1
- fi
- fi
- if ! [ -f
/etc/systemd/system/multi-user.target.wants/prime-select.service ]; then
- echo "ERROR: prime-select service seems broken or disabled by user.
Try prime-select service restore"
- exit 1
- fi
- if ! { [ "$(bbcheck)" = "[bbswitch] NVIDIA card is ON" ] || [
"$(bbcheck)" = "[bbswitch] NVIDIA card is OFF" ]; }; then
- bbcheck
- fi
- #DM_check
- runlev=$(runlevel | awk '{print $2}')
- if [ $runlev = 5 ]; then
- #GDM_mode
- if [ "$(systemctl status display-manager | grep gdm)" > /dev/null
]; then
- $0 user_logout_waiter $type gdm &
- logging "user_logout_waiter: started"
- #SDDM_mode
- elif [ "$(systemctl status display-manager | grep sddm)" >
/dev/null ]; then
- $0 user_logout_waiter $type sddm &
- logging "user_logout_waiter: started"
- #lightdm_mode
- elif [ "$(systemctl status display-manager | grep lightdm)" >
/dev/null ]; then
- $0 user_logout_waiter $type lightdm &
- logging "user_logout_waiter: started"
- #XDM_mode
- elif [ "$(systemctl status display-manager | grep xdm)" >
/dev/null ]; then
- $0 user_logout_waiter $type xdm &
- logging "user_logout_waiter: started"
- #KDM_mode(uses xdm->calls xdm_mode)
- elif [ "$(systemctl status display-manager | grep kdm)" >
/dev/null ]; then
- $0 user_logout_waiter $type xdm &
- logging "user_logout_waiter: started"
- #unsupported_dm_force_close_option
- else
- echo "Unsupported display-manager, please report this to
project page to add support."
- echo "Script works ever in init 3"
- echo "You can force-close session and switch graphics [could
be dangerous],"
- read -p "ALL UNSAVED DATA IN SESSION WILL BE LOST, CONTINUE?
[Y/N]: " choice
- case "$choice" in
- y|Y )
- killall xinit
- $0 user_logout_waiter $type now
- ;;
- * ) echo "Aborted. Exit."; exit ;;
- esac
- fi
- #manually_started_X_case
- elif [ $runlev = 3 ] && [ "$(pgrep -fl "xinit")" > /dev/null ]; then
- $0 user_logout_waiter $type x_only &
- logging "user_logout_waiter: started"
- else
- echo "Seems you are on runlevel 3."
- read -p "Do you want to switch graphics now and reach
graphical.target? [y/n]: " choice
- case "$choice" in
- y|Y ) $0 user_logout_waiter $type now ;;
- * ) echo "Aborted. Exit."; exit ;;
- esac
- fi
-
- echo -e "Logout to switch graphics"
+ $0 get-current
;;

- boot)
-
- check_root
-
- case $2 in
-
- nvidia|intel|intel2|last)
-
- if [ "$2" = "intel2" ]; then
- if ! rpm -q xf86-video-intel > /dev/null; then
- echo "package xf86-video-intel is not installed";
- exit 1
- fi
- fi
- echo "$2" > /etc/prime/boot
- $0 get-boot
- ;;
-
- *)
-
- echo "Invalid choice"
- usage
- ;;
- esac
- ;;
-
- next-boot)
-
- check_root
-
- case $2 in
-
- nvidia|intel|intel2)
-
- if [ "$2" = "intel2" ]; then
- if ! rpm -q xf86-video-intel > /dev/null; then
- echo "package xf86-video-intel is not installed";
- exit 1
- fi
- fi
- echo "$2" > /etc/prime/forced_boot
- $0 get-boot
- ;;
-
- abort)
-
- if [ -f /etc/prime/forced_boot ]; then
- rm /etc/prime/forced_boot
- echo "Next boot forcing aborted"
- else
- echo "Next boot is NOT forced"
- exit 1
- fi
- ;;
-
- *)
-
- echo "Invalid choice"
- usage
- ;;
- esac
- ;;
-
-
get-current)

- if [ -f /etc/prime/current_type ]; then
+ if [ -f /etc/prime/current_type ]; then
echo -n "Driver configured: "
cat /etc/prime/current_type
else
echo "No driver configured."
usage
- fi
- bbcheck
- ;;
+ fi
+ ;;

unset)

- check_root
- $0 service disable
- clean_files
- rm /etc/prime/current_type &> /dev/null
- rm /etc/prime/boot_state &> /dev/null
- rm /etc/prime/boot &> /dev/null
- rm /etc/prime/forced_boot &> /dev/null
- rm $prime_logfile &> /dev/null
- ;;
+ check_root

- service)
-
- case $2 in
-
- check)
-
- if [ -f
/etc/systemd/system/multi-user.target.wants/prime-select.service ]; then
- echo "prime-select: service is set correctly"
- exit
- fi
- echo "prime-select: service has a wrong setting or is disabled
by user, please do prime-select service restore"
- echo "If you are running this command in multi-user.target
please ignore this message"
- ;;
-
- restore)
-
- check_root
- systemctl enable prime-select
- echo "prime-select: service restored"
- logging "service restored by user"
- ;;
-
- disable)
-
- check_root
- systemctl disable prime-select
- echo -e "prime-select: service disabled. Remember prime-select
needs this service to work correctly.\nUse prime-select service restore to
enable service again "
- logging "service disabled by user"
- ;;
-
- *)
-
- echo "Invalid choice"
- usage
- ;;
- esac
-
+ clean_files
+ rm /etc/prime/current_type
;;

- user_logout_waiter)
-
- currtime=$(date +"%T");
- #manage journalctl to check when X restarted, then jump init 3
- case "$3" in
-
- gdm )
- #GDM_mode
- until [ "$(journalctl --since "$currtime" | grep
"pam_unix(gdm-password:session): session closed")" > /dev/null ]; do
- sleep 0.5s
- done
- logging "user_logout_waiter: X restart detected, preparing switch
to $2 [ boot_state > S ]"
- ;;
-
- #SDDM_mode
- sddm )
- until [ "$(journalctl --since "$currtime" -e _COMM=sddm | grep
"Removing display")" > /dev/null ]; do
- sleep 0.5s
- done
- logging "user_logout_waiter: X restart detected, preparing switch
to $2 [ boot_state > S ]"
- ;;
-
- #lightdm_mode
- lightdm )
- until [ "$(journalctl --since "$currtime" -e | grep
"pam_unix(lightdm:session): session closed")" > /dev/null ]; do
- sleep 0.5s
- done
- logging "user_logout_waiter: X restart detected, preparing switch
to $2 [ boot_state > S ]"
- ;;
-
- #xdm/kdm_mode
- xdm )
- until [ "$(journalctl --since "$currtime" -e | grep
"pam_unix(xdm:session): session closed for user")" > /dev/null ]; do
- sleep 0.5s
- done
- logging "user_logout_waiter: X restart detected, preparing switch
to $2 [ boot_state > S ]"
- #stopping display-manager before runlev.3 seems work faster
- systemctl stop display-manager
- ;;
-
- #manually_started_X_case
- x_only )
- while [ "$(pgrep -fl "xinit")" > /dev/null ]; do
- sleep 0.5s
- done
- logging "user_logout_waiter: X stop detected, preparing switch to
$2 [ boot_state > S ]"
- ;;
- now )
- logging "user_logout_waiter: runlevel 3 mode, preparing switch to
$2 [ boot_state > S ]"
- ;;
- esac
-
- echo $2 > /etc/prime/current_type
- echo "S" > /etc/prime/boot_state
- logging "HotSwitch: Reaching multi-user.target"
- systemctl isolate multi-user.target
- ;;
-
- systemd_call)
- #checks if system is booting or switching only
- if [ "$(journalctl -b 0 | grep suse-prime)" > /dev/null ]; then
- if [ "$(cat /etc/prime/boot_state)" = "S" ]; then
- logout_switch
- fi
- else
- booting
- fi
- ;;
-
- get-boot)
-
- if [ -f /etc/prime/boot ]; then
- echo "Default at system boot: $(cat /etc/prime/boot)"
- else
- echo "Default at system boot: auto (last)"
- echo "You can configure it with prime-select boot
intel|intel2|nvidia|last"
- fi
- if [ -f /etc/prime/forced_boot ]; then
- echo "Next boot forced to $(cat /etc/prime/forced_boot) by user"
- fi
- ;;
-
- log-view)
-
- if [ -f $prime_logfile ]; then
- less +G -e $prime_logfile
- else
- echo "No logfile in /var/log/prime-select.log"
- fi
- ;;
-
- log-clean)
-
- if [ -f $prime_logfile ]; then
- check_root
- rm $prime_logfile
- echo "$prime_logfile removed!"
- else
- echo "$prime_logfile is already clean!"
- fi
- ;;
-
*)
- usage
+ usage
;;
esac
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SUSEPrime-0.6.8/xorg-intel-intel.conf
new/SUSEPrime-0.5/xorg-intel-intel.conf
--- old/SUSEPrime-0.6.8/xorg-intel-intel.conf 2019-04-01 15:50:46.000000000
+0200
+++ new/SUSEPrime-0.5/xorg-intel-intel.conf 2019-01-24 21:08:13.000000000
+0100
@@ -6,20 +6,6 @@
Section "Device"
Identifier "intel"
Driver "intel"
-
- # DRI3 is necessary, otherwise DRI2 is used by default
- # and this causes issues with compositors (scrolling stutter in
- # particular)
-
- Option "DRI" "3"
-
- # Unlike what man "intel" says, TearFree is enabled by default
- # It is unecessary to have it enabled (consumes memory, see man) when a
competent compositor with
- # vsync enabled is used.
- # Comment this line (or set to "true") if not using a compositor (not
recommended)
-
- Option "TearFree" "false"
-
BusID "PCI:X:X:X"
EndSection

diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SUSEPrime-0.6.8/xorg-nvidia.conf
new/SUSEPrime-0.5/xorg-nvidia.conf
--- old/SUSEPrime-0.6.8/xorg-nvidia.conf 2019-04-01 15:50:46.000000000
+0200
+++ new/SUSEPrime-0.5/xorg-nvidia.conf 2019-01-24 21:08:13.000000000 +0100
@@ -34,6 +34,5 @@
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:X:X:X"
- Option "DPI" "96 x 96"
Option "AllowEmptyInitialConfiguration"
EndSection


< Previous Next >
This Thread