diff --git a/debian/changelog b/debian/changelog index 9be09d95..40715fec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,23 @@ -nvidia-graphics-drivers-450 (450.66-0ubuntu2) UNRELEASED; urgency=medium +nvidia-graphics-drivers-450 (450.66-0ubuntu3) focal; urgency=medium - * + * XB-Support: LTSB + * Refresh files from templates - -- Alberto Milone Thu, 03 Sep 2020 11:31:10 +0200 + -- Alberto Milone Wed, 16 Sep 2020 16:39:08 +0200 + +nvidia-graphics-drivers-450 (450.66-0ubuntu2) groovy; urgency=medium + + * debian/templates/control.in: + - Add the XB-PmAliases field, so that ubuntu-drivers can + check RTD3 support from the apt cache, and enable it + on installation. + - Add build-dependency on python3 (for pm-aliases-gen). + * debian/pm-aliases-gen, + debian/rules: + - Include and use the pm-aliases-gen tool to extract the IDs + from the json database. + + -- Alberto Milone Thu, 03 Sep 2020 15:56:57 +0200 nvidia-graphics-drivers-450 (450.66-0ubuntu1) groovy; urgency=medium diff --git a/debian/control b/debian/control index 9235fb1c..4461d2ec 100644 --- a/debian/control +++ b/debian/control @@ -23,6 +23,7 @@ Build-Depends: pkg-config, libc6, libx11-6, + python3, Standards-Version: 4.1.1 Homepage: http://www.nvidia.com XS-Autobuild: yes @@ -56,6 +57,8 @@ Recommends: libnvidia-fbc1-450:i386 (= ${binary:Version}) [amd64], libnvidia-gl-450:i386 (= ${binary:Version}) [amd64] XB-Modaliases: ${modaliases} +XB-PmAliases: ${nvidia:pm-modaliases} +XB-Support: LTSB Description: NVIDIA driver metapackage This metapackage depends on the NVIDIA binary driver and on all of its libraries, to provide hardware acceleration for OpenGL/GLX/EGL/GLES/Vulkan diff --git a/debian/pm-aliases-gen b/debian/pm-aliases-gen new file mode 100755 index 00000000..efabef44 --- /dev/null +++ b/debian/pm-aliases-gen @@ -0,0 +1,105 @@ +#!/usr/bin/python3 +# +# Copyright 2020 Canonical Ltd. +# Author: Alberto Milone +# + +import json +import re +import logging +import sys +import argparse + + +class DeviceInfo(object): + + def __init__(self, device): + self._vendor = '10DE' + self._device = device + self._devid = (device.get('devid').replace('0x', '') + if device.get('devid') else '*') + self._subvendorid = (device.get('subvendorid').replace('0x', '') + if device.get('subvendorid') else '*') + self._subdevid = (device.get('subdevid').replace('0x', '') + if device.get('subdevid') else '*') + + def get_vendor(self): + return self._vendor + + def get_devid(self): + return self._devid + + def get_subvendorid(self): + return self._subvendorid + + def get_subdevid(self): + return self._subdevid + + def get_features(self): + return self._device.get('features') + + def get_legacy_series(self): + return self._device.get('legacybranch') + + def get_device_name(self): + return self._device.get('name') + + def supports_runtimepm(self): + return ('runtimepm' in self.get_features()) + + def is_tesla(self): + return ('tesla' in self.get_features()) + + +def _get_devices_from_data(data): + devices = {} + match = None + for chip in data["chips"]: + devices[chip.get('devid')] = chip + + return devices + +def _supports_runtimepm(device): + features = device.get('features') + if features: + return ('runtimepm' in features) + return None + +def _get_runtimepm_devices(data): + supported_devices = [] + devices = _get_devices_from_data(data) + for device in devices: + if _supports_runtimepm(devices.get(device)): + supported_devices.append(DeviceInfo(devices.get(device))) + return supported_devices + +def print_runtimepm_aliases(data): + devices = _get_runtimepm_devices(data) + template = '%spci:v0000%sd0000%ssv%ssd%sbc03sc*i*%s' + line = '' + + it = 0 + for device in devices: + line += template % ('nvidia(' if it == 0 else '', + device.get_vendor(), device.get_devid(), + device.get_subvendorid(), + device.get_subdevid(), + ', ' if it < (len(devices) - 1) else ')') + it +=1 + print(line) + +def main(file_stream): + logger = logging.basicConfig(level=logging.DEBUG, stream=sys.stdout) + data = json.load(file_stream) + + print_runtimepm_aliases(data) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('source', help='The .json source file to parse') + args = parser.parse_args() + + with open(args.source) as f: + main(f) + f.close() diff --git a/debian/rules b/debian/rules index e32792d5..7f97e7ee 100755 --- a/debian/rules +++ b/debian/rules @@ -115,6 +115,7 @@ override_dh_auto_clean: rm -fr $(foreach a,$(ARCH_LIST),$a/NVIDIA-Linux-$a $a/$(NVIDIA_DIRNAME_$a)) rm -fr kernel-source-tree rm -f nvidia.ids nv-kernel.ids nv-readme.ids pci.ids.nvidia* + rm -f debian/runtimepm_ids rm -f LICENSE.txt LICENSE.tmp copyright.tmp test ! -d debian/po || debconf-updatepo rm -f debian/$(pkg_driver).substvars @@ -229,10 +230,15 @@ get_download_url = $(or $(HTTPURL_PREFIX_$(strip $1)),$(HTTPURL_PREFIX))/$(HTTP get_origdir = $(or $(ORIGDIR.$(strip $1)),$(ORIGDIR)-$(strip $1)) get_tarball = $(or $(TARBALL.$(strip $1)),$(TARBALL_BASE)-$(strip $1)$(TARBALL_SUFFIX)) -override_dh_gencontrol: +generate-runtimepm-aliases: + python3 $(CURDIR)/debian/pm-aliases-gen \ + NVIDIA-Linux/supported-gpus.json > $(CURDIR)/debian/runtimepm_ids + +override_dh_gencontrol: generate-runtimepm-aliases dh_gencontrol -- -V'nvidia:Version=$(version)' \ -V'nvidia:xorgDepends=$(xorg_depends)' \ - -V'nvidia:xorgProvides=$(xorg_provides)' + -V'nvidia:xorgProvides=$(xorg_provides)' \ + -V'nvidia:pm-modaliases=$(shell cat $(CURDIR)/debian/runtimepm_ids)' generate-modaliases: # Generate modaliases for the restricted drivers manager diff --git a/debian/templates/control.in b/debian/templates/control.in index 3bda177a..d6446e3b 100644 --- a/debian/templates/control.in +++ b/debian/templates/control.in @@ -23,6 +23,7 @@ Build-Depends: pkg-config, libc6, libx11-6, + python3, Standards-Version: 4.1.1 Homepage: http://www.nvidia.com XS-Autobuild: yes @@ -56,6 +57,8 @@ Recommends: libnvidia-fbc1-#FLAVOUR#:i386 (= ${binary:Version}) [amd64], libnvidia-gl-#FLAVOUR#:i386 (= ${binary:Version}) [amd64] XB-Modaliases: ${modaliases} +XB-PmAliases: ${nvidia:pm-modaliases} +XB-Support: LTSB Description: NVIDIA driver metapackage This metapackage depends on the NVIDIA binary driver and on all of its libraries, to provide hardware acceleration for OpenGL/GLX/EGL/GLES/Vulkan