Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package switcheroo-control for 
openSUSE:Factory checked in at 2022-07-06 15:41:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/switcheroo-control (Old)
 and      /work/SRC/openSUSE:Factory/.switcheroo-control.new.1548 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "switcheroo-control"

Wed Jul  6 15:41:55 2022 rev:12 rq:986890 version:2.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/switcheroo-control/switcheroo-control.changes    
2022-05-14 22:54:56.891199825 +0200
+++ 
/work/SRC/openSUSE:Factory/.switcheroo-control.new.1548/switcheroo-control.changes
  2022-07-06 15:42:07.134527779 +0200
@@ -1,0 +2,8 @@
+Mon Jul  4 00:01:24 UTC 2022 - Atri Bhattacharya <badshah...@gmail.com>
+
+- Update to version 2.6:
+  * Remove the recently added support for setting the GPU for
+    Vulkan apps as this broke sandboxed Vulkan apps. 
+  * Fix for non-x86 platforms not having a default GPU.
+
+-------------------------------------------------------------------

Old:
----
  switcheroo-control-2.5.tar.gz

New:
----
  switcheroo-control-2.6.tar.gz

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

Other differences:
------------------
++++++ switcheroo-control.spec ++++++
--- /var/tmp/diff_new_pack.n7a29j/_old  2022-07-06 15:42:07.886528887 +0200
+++ /var/tmp/diff_new_pack.n7a29j/_new  2022-07-06 15:42:07.890528893 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           switcheroo-control
-Version:        2.5
+Version:        2.6
 Release:        0
 Summary:        D-Bus service to check the availability of dual-GPU
 License:        GPL-3.0-only

++++++ switcheroo-control-2.5.tar.gz -> switcheroo-control-2.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/switcheroo-control-2.5/.gitlab-ci.yml 
new/switcheroo-control-2.6/.gitlab-ci.yml
--- old/switcheroo-control-2.5/.gitlab-ci.yml   2022-04-29 15:47:52.000000000 
+0200
+++ new/switcheroo-control-2.6/.gitlab-ci.yml   2022-07-01 11:29:43.000000000 
+0200
@@ -13,15 +13,13 @@
                 python3-gobject
                 python3-dbusmock
                 umockdev
-                mesa-vulkan-drivers.x86_64
-                mesa-vulkan-drivers.i686
   DIST_DEPENDENCIES: xz
 
 build:
   before_script:
     - dnf update -y --nogpgcheck && dnf install -y --nogpgcheck $DEPENDENCIES
   script:
-    - meson -Dgtk_doc=true _build
+    - meson -Dgtk_doc=true -Dtests=true _build
     - ninja -v -C _build
     - ninja -v -C _build switcheroo-control-doc
     - ninja -v -C _build install
@@ -36,7 +34,7 @@
   before_script:
     - dnf update -y --nogpgcheck && dnf install -y --nogpgcheck $DEPENDENCIES 
$DIST_DEPENDENCIES
   script:
-    - meson --buildtype release -Dgtk_doc=true _build
+    - meson --buildtype release -Dgtk_doc=true -Dtests=true _build
     - cd _build
     - ninja dist
     - ninja switcheroo-control-doc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/switcheroo-control-2.5/NEWS 
new/switcheroo-control-2.6/NEWS
--- old/switcheroo-control-2.5/NEWS     2022-04-29 15:47:52.000000000 +0200
+++ new/switcheroo-control-2.6/NEWS     2022-07-01 11:29:43.000000000 +0200
@@ -1,3 +1,12 @@
+2.6
+---
+
+This release removes the recently added support for setting the GPU for
+Vulkan apps as this broke sandboxed Vulkan apps. The support should come
+back soon when functionality gets added to VulkanLoader.
+
+This release also fixes non-x86 platforms not having a default GPU.
+
 2.5
 ---
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/switcheroo-control-2.5/meson.build 
new/switcheroo-control-2.6/meson.build
--- old/switcheroo-control-2.5/meson.build      2022-04-29 15:47:52.000000000 
+0200
+++ new/switcheroo-control-2.6/meson.build      2022-07-01 11:29:43.000000000 
+0200
@@ -1,5 +1,5 @@
 project('switcheroo-control', 'c',
-  version : '2.5',
+  version : '2.6',
   license: 'GPLv3+',
   default_options : [
     'buildtype=debugoptimized',
@@ -46,4 +46,19 @@
   subdir('docs')
 endif
 
-subdir('tests')
+if get_option('tests')
+  # Python 3 required modules
+  python3_required_modules = ['dbus', 'dbusmock', 'gi']
+
+  python = import('python')
+  python3 = python.find_installation('python3')
+  foreach p : python3_required_modules
+    # Source: 
https://docs.python.org/3/library/importlib.html#checking-if-a-module-can-be-imported
+    script = 'import importlib.util; import sys; exit(1) if 
importlib.util.find_spec(\''+ p +'\') is None else exit(0)'
+    if run_command(python3, '-c', script, check: false).returncode() != 0
+      error('Python3 module \'' + p + '\' required for running tests but not 
found')
+    endif
+  endforeach
+
+  subdir('tests')
+endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/switcheroo-control-2.5/meson_options.txt 
new/switcheroo-control-2.6/meson_options.txt
--- old/switcheroo-control-2.5/meson_options.txt        2022-04-29 
15:47:52.000000000 +0200
+++ new/switcheroo-control-2.6/meson_options.txt        2022-07-01 
11:29:43.000000000 +0200
@@ -15,3 +15,9 @@
   value: false,
   description: 'Build docs',
 )
+
+option('tests',
+  description: 'Whether to run tests',
+  type: 'boolean',
+  value: false
+)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/switcheroo-control-2.5/src/switcheroo-control.c 
new/switcheroo-control-2.6/src/switcheroo-control.c
--- old/switcheroo-control-2.5/src/switcheroo-control.c 2022-04-29 
15:47:52.000000000 +0200
+++ new/switcheroo-control-2.6/src/switcheroo-control.c 2022-07-01 
11:29:43.000000000 +0200
@@ -231,63 +231,12 @@
        return TRUE;
 }
 
-static void
-add_vulkan_icd_from_dir (GString *string,
-                        const char *path,
-                        const char *driver)
-{
-       GDir *dir;
-       const char *basename;
-
-       dir = g_dir_open (path, 0, NULL);
-       if (!dir)
-               return;
-       while ((basename = g_dir_read_name (dir)) != NULL) {
-               g_autofree char *icd_file = NULL;
-
-               if (strstr (basename, driver) == NULL)
-                       continue;
-               icd_file = g_build_filename (path, basename, NULL);
-               if (string->len != 0)
-                       g_string_append_c (string, ':');
-               g_string_append (string, icd_file);
-       }
-       g_dir_close (dir);
-}
-
-static char *
-get_vulkan_icd (const char *driver)
-{
-       const gchar * const *dirs;
-       const char *vk_driver;
-       GString *s;
-       guint i;
-
-       if (!driver)
-               return NULL;
-
-       vk_driver = driver;
-       if (g_str_equal (driver, "i915"))
-               vk_driver = "intel";
-
-       dirs = g_get_system_data_dirs ();
-       s = g_string_new (NULL);
-       for (i = 0; dirs[i] != NULL; i++) {
-               g_autofree char *vk_dir = NULL;
-
-               vk_dir = g_build_filename (dirs[i], "vulkan/icd.d", NULL);
-               add_vulkan_icd_from_dir (s, vk_dir, vk_driver);
-       }
-       return g_string_free (s, s->len == 0);
-}
-
 static GPtrArray *
 get_card_env (GUdevClient *client,
              GUdevDevice *dev)
 {
        GPtrArray *array;
-       g_autoptr(GUdevDevice) parent;
-       char *icd_filenames;
+       g_autoptr(GUdevDevice) parent = NULL;
 
        array = g_ptr_array_new_full (0, g_free);
 
@@ -317,13 +266,6 @@
                }
        }
 
-       /* XXX: this doesn't work with multi-radeon or multi-nvidia setups */
-       icd_filenames = get_vulkan_icd (g_udev_device_get_driver (parent));
-       if (icd_filenames != NULL) {
-               g_ptr_array_add (array, g_strdup ("VK_ICD_FILENAMES"));
-               g_ptr_array_add (array, icd_filenames);
-       }
-
        if (array->len == 0) {
                g_ptr_array_free (array, TRUE);
                return NULL;
@@ -336,7 +278,7 @@
 get_card_name (GUdevDevice *d)
 {
        const char *vendor, *product;
-       g_autoptr(GUdevDevice) parent;
+       g_autoptr(GUdevDevice) parent = NULL;
        g_autofree char *renderer = NULL;
 
        parent = g_udev_device_get_parent (d);
@@ -364,7 +306,7 @@
 static gboolean
 get_card_is_default (GUdevDevice *d)
 {
-       g_autoptr(GUdevDevice) parent;
+       g_autoptr(GUdevDevice) parent = NULL;
 
        parent = g_udev_device_get_parent (d);
        return g_udev_device_get_sysfs_attr_as_boolean (parent, "boot_vga");
@@ -460,6 +402,12 @@
        if (data->add_fake_cards)
                add_fake_trident_card (cards);
 
+       /* Make sure the only card is the default */
+       if (cards->len == 1) {
+               CardData *card = cards->pdata[0];
+               card->is_default = TRUE;
+       }
+
        return cards;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/switcheroo-control-2.5/src/switcherooctl.in 
new/switcheroo-control-2.6/src/switcherooctl.in
--- old/switcheroo-control-2.5/src/switcherooctl.in     2022-04-29 
15:47:52.000000000 +0200
+++ new/switcheroo-control-2.6/src/switcherooctl.in     2022-07-01 
11:29:43.000000000 +0200
@@ -108,7 +108,12 @@
         raise ReferenceError
     else:
         # Move the first GPU to the front, it's the default
-        default_gpu = next(gpu for gpu in gpus if gpu['Default'])
+        try:
+            default_gpu = next(gpu for gpu in gpus if gpu['Default'])
+        except:
+            # The first GPU is the default if there's no default
+            default_gpu = gpus[0]
+            pass
         gpus.remove(default_gpu)
         gpus.insert(0, default_gpu)
         return gpus
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/switcheroo-control-2.5/tests/integration-test.py 
new/switcheroo-control-2.6/tests/integration-test.py
--- old/switcheroo-control-2.5/tests/integration-test.py        2022-04-29 
15:47:52.000000000 +0200
+++ new/switcheroo-control-2.6/tests/integration-test.py        2022-07-01 
11:29:43.000000000 +0200
@@ -22,7 +22,6 @@
 import sys
 import dbus
 import tempfile
-import re
 import subprocess
 import unittest
 import time
@@ -60,12 +59,10 @@
         if os.access(os.path.join(builddir, 'src', 'switcheroo-control'), 
os.X_OK):
             cls.daemon_path = os.path.join(builddir, 'src', 
'switcheroo-control')
             print('Testing binaries from local build tree (%s)' % 
cls.daemon_path)
-            cls.local_daemon = True
         elif os.environ.get('UNDER_JHBUILD', False):
             jhbuild_prefix = os.environ['JHBUILD_PREFIX']
             cls.daemon_path = os.path.join(jhbuild_prefix, 'libexec', 
'switcheroo-control')
             print('Testing binaries from JHBuild (%s)' % cls.daemon_path)
-            cls.local_daemon = False
         else:
             cls.daemon_path = None
             with open('/usr/lib/systemd/system/switcheroo-control.service') as 
f:
@@ -74,7 +71,6 @@
                         cls.daemon_path = line.split('=', 1)[1].strip()
                         break
             assert cls.daemon_path, 'could not determine daemon path from 
systemd .service file'
-            cls.local_daemon = False
             print('Testing installed system binary (%s)' % cls.daemon_path)
 
         # fail on CRITICALs on client side
@@ -105,25 +101,23 @@
         The testbed is initially empty.
         '''
         self.testbed = UMockdev.Testbed.new()
-        self.xdg_dir = self.testbed.get_root_dir() + '/share'
-        os.makedirs(self.xdg_dir)
 
         self.proxy = None
         self.log = None
         self.daemon = None
 
-    def tearDown(self):
-        del self.testbed
-        self.stop_daemon()
-
-        # on failures, print daemon log
-        errors = [x[1] for x in self._outcome.errors if x[1]]
-        if errors and self.log:
+    def run(self, result=None):
+        super(Tests, self).run(result)
+        if result and len(result.errors) + len(result.failures) > 0 and 
self.log:
             with open(self.log.name) as f:
                 sys.stderr.write('\n-------------- daemon log: 
----------------\n')
                 sys.stderr.write(f.read())
                 sys.stderr.write('------------------------------\n')
 
+    def tearDown(self):
+        del self.testbed
+        self.stop_daemon()
+
     #
     # Daemon control and D-BUS I/O
     #
@@ -139,13 +133,9 @@
         # note: Python doesn't propagate the setenv from Testbed.new(), so we
         # have to do that ourselves
         env['UMOCKDEV_DIR'] = self.testbed.get_root_dir()
-        env['XDG_DATA_DIRS'] = self.xdg_dir + ':/usr/local/share/:/usr/share/'
         self.log = tempfile.NamedTemporaryFile()
         if os.getenv('VALGRIND') != None:
-            if self.local_daemon:
-                daemon_path = ['libtool', '--mode=execute', 'valgrind', 
self.daemon_path, '-v']
-            else:
-                daemon_path = ['valgrind', self.daemon_path, '-v']
+            daemon_path = ['valgrind', self.daemon_path, '-v']
         else:
             daemon_path = [self.daemon_path, '-v']
 
@@ -235,8 +225,6 @@
                   'FWUPD_GUID', '0x8086:0x5917' ]
                 )
 
-        self.testbed.set_attribute_link(parent, 'driver', '../../i915')
-
         self.testbed.add_device('drm', 'dri/card0', parent,
                 [],
                 [ 'DEVNAME', '/dev/dri/card0',
@@ -267,8 +255,6 @@
                   'FWUPD_GUID', '0x10de:0x134e' ]
                 )
 
-        self.testbed.set_attribute_link(parent, 'driver', '../../nouveau')
-
         self.testbed.add_device('drm', 'dri/card1', parent,
                 [],
                 [ 'DEVNAME', '/dev/dri/card1',
@@ -316,6 +302,35 @@
                   'ID_PATH_TAG', 'pci-0000_01_00_0' ]
                 )
 
+    def add_vc4_gpu(self):
+        parent = self.testbed.add_device('platform', 'VC4 platform device', 
None,
+                [],
+                [ 'DRIVER', 'vc4-drm',
+                  'OF_NAME', 'gpu',
+                  'OF_FULLNAME', '/soc/gpu',
+                  'OF_COMPATIBLE_0', 'brcm,bcm2835-vc4',
+                  'OF_COMPATIBLE_N', '1',
+                  'MODALIAS', 'of:NgpuT(null)Cbrcm,bcm2835-vc4',
+                  'ID_PATH', 'platform-soc:gpu',
+                  'ID_PATH_TAG', 'platform-soc_gpu' ]
+                )
+
+        self.testbed.set_attribute_link(parent, 'driver', '../../vc4-drm')
+
+        self.testbed.add_device('drm', 'dri/card1', parent,
+                [],
+                [ 'DEVNAME', '/dev/dri/card1',
+                  'ID_PATH', 'platform-soc:gpu',
+                  'ID_PATH_TAG', 'platform-soc_gpu' ]
+                )
+
+        self.testbed.add_device('drm', 'dri/renderD129', parent,
+                [],
+                [ 'DEVNAME', '/dev/dri/renderD129',
+                  'ID_PATH', 'platform-soc:gpu',
+                  'ID_PATH_TAG', 'platform-soc_gpu' ]
+                )
+
     #
     # Actual test cases
     #
@@ -333,13 +348,31 @@
         self.assertEqual(len(gpus), 1)
         self.assertEqual(gpus[0]['Name'], 'Intel?? UHD Graphics 620 (Kabylake 
GT2)')
         sc_env = gpus[0]['Environment']
-
-        self.assertEqual(len(sc_env), 4)
+        self.assertEqual(len(sc_env), 2)
         self.assertEqual(sc_env[0], 'DRI_PRIME')
         self.assertEqual(sc_env[1], 'pci-0000_00_02_0')
-        self.assertEqual(sc_env[2], 'VK_ICD_FILENAMES')
-        regex = 
re.compile('/usr/share/vulkan/icd\.d/intel_icd\..*json:/usr/share/vulkan/icd.d/intel_icd\..*json')
-        self.assertRegex(sc_env[3], regex)
+        self.assertEqual(gpus[0]['Default'], True)
+
+        # process = subprocess.Popen(['gdbus', 'introspect', '--system', 
'--dest', 'net.hadess.SwitcherooControl', '--object-path', 
'/net/hadess/SwitcherooControl'])
+        # print (self.get_dbus_property('GPUs'))
+
+        self.stop_daemon()
+
+    def test_rpi(self):
+        self.add_vc4_gpu()
+
+        self.start_daemon()
+        self.assertEqual(self.get_dbus_property('HasDualGpu'), False)
+        self.assertEqual(self.get_dbus_property('NumGPUs'), 1)
+
+        gpus = self.get_dbus_property('GPUs')
+        self.assertEqual(len(gpus), 1)
+        self.assertEqual(gpus[0]['Name'], 'Unknown Graphics Controller')
+        sc_env = gpus[0]['Environment']
+
+        self.assertEqual(len(sc_env), 2)
+        self.assertEqual(sc_env[0], 'DRI_PRIME')
+        self.assertEqual(sc_env[1], 'platform-soc_gpu')
         self.assertEqual(gpus[0]['Default'], True)
 
         # process = subprocess.Popen(['gdbus', 'introspect', '--system', 
'--dest', 'net.hadess.SwitcherooControl', '--object-path', 
'/net/hadess/SwitcherooControl'])
@@ -371,13 +404,9 @@
         gpu = gpus[1]
         self.assertEqual(gpu['Name'], 'Intel?? UHD Graphics 620 (Kabylake 
GT2)')
         sc_env = gpu['Environment']
-        self.assertEqual(len(sc_env), 4)
+        self.assertEqual(len(sc_env), 2)
         self.assertEqual(sc_env[0], 'DRI_PRIME')
         self.assertEqual(sc_env[1], 'pci-0000_00_02_0')
-        self.assertEqual(sc_env[2], 'VK_ICD_FILENAMES')
-        icds = sc_env[3].split(':')
-        self.assertTrue('/usr/share/vulkan/icd.d/intel_icd.x86_64.json' in 
icds)
-        self.assertTrue('/usr/share/vulkan/icd.d/intel_icd.i686.json' in icds)
         self.assertEqual(gpu['Default'], True)
 
         # process = subprocess.Popen(['gdbus', 'introspect', '--system', 
'--dest', 'net.hadess.SwitcherooControl', '--object-path', 
'/net/hadess/SwitcherooControl'])
@@ -421,11 +450,6 @@
         self.add_intel_gpu()
         self.add_nvidia_gpu()
 
-        vk_dir = os.path.join(self.xdg_dir, 'vulkan/icd.d')
-        os.makedirs(vk_dir)
-        with open(os.path.join(vk_dir, 'nvidia_icd.json'), 'w') as json:
-            json.write('')
-
         self.start_daemon()
         self.assertEqual(self.get_dbus_property('HasDualGpu'), True)
         self.assertEqual(self.get_dbus_property('NumGPUs'), 2)
@@ -446,7 +470,6 @@
         self.assertIn('__GLX_VENDOR_LIBRARY_NAME', sc_env)
         self.assertIn('__NV_PRIME_RENDER_OFFLOAD', sc_env)
         self.assertIn('__VK_LAYER_NV_optimus', sc_env)
-        self.assertIn('VK_ICD_FILENAMES', sc_env)
 
         def get_sc_env(name):
             i = sc_env.index(name)
@@ -455,7 +478,6 @@
         self.assertEqual(get_sc_env('__GLX_VENDOR_LIBRARY_NAME'), 'nvidia')
         self.assertEqual(get_sc_env('__NV_PRIME_RENDER_OFFLOAD'), '1')
         self.assertEqual(get_sc_env('__VK_LAYER_NV_optimus'), 'NVIDIA_only')
-        self.assertEqual(get_sc_env('VK_ICD_FILENAMES'), vk_dir + 
'/nvidia_icd.json')
 
         self.stop_daemon()
 
@@ -490,8 +512,7 @@
 
         out = subprocess.run([tool_path], capture_output=True)
         self.assertEqual(out.returncode, 0, "'switcherooctl' call failed")
-        regex = re.compile('Device: 0.*\n.*Intel.*UHD Graphics 620 \(Kabylake 
GT2\)\n  Default:     yes\n  Environment: DRI_PRIME=pci-0000_00_02_0 
VK_ICD_FILENAMES=/usr/share/vulkan/icd\.d/intel_icd\..*json:/usr/share/vulkan/icd.d/intel_icd\..*json\n\nDevice:
 1\n  Name:        GM108M \[GeForce 930MX\]\n  Default:     no\n', re.M)
-        self.assertRegex(out.stdout.decode('UTF-8'), regex)
+        self.assertEqual(out.stdout, b'Device: 0\n  Name:        Intel\xc2\xae 
UHD Graphics 620 (Kabylake GT2)\n  Default:     yes\n  Environment: 
DRI_PRIME=pci-0000_00_02_0\n\nDevice: 1\n  Name:        GM108M [GeForce 
930MX]\n  Default:     no\n  Environment: DRI_PRIME=pci-0000_01_00_0\n')
 
         out = subprocess.run([tool_path, 'launch', '--gpu', '0', 'env'], 
capture_output=True)
         self.assertEqual(out.returncode, 0, "'switcherooctl launch --gpu 0' 
failed")

Reply via email to