Пример #1
0
    def __init__(self, backend, version):
        self._free = False
        if 'update' in version:
            name=_('NVIDIA accelerated graphics driver (post-release updates)')
        else:
            name=_('NVIDIA accelerated graphics driver')
        XorgDriverHandler.__init__(self, backend, 'nvidia_' + version.replace('-', '_'),
            'nvidia-' + version,
            None, None, {'NoLogo': 'True'},
            remove_modules=['dri', 'GLcore'],
            name=name,
            description=_('3D-accelerated proprietary graphics driver for '
                'NVIDIA cards. Required if you want to run Unity.'),
            rationale=_('This driver is required to fully utilise '
                'the 3D potential of NVIDIA graphics cards, as well as provide '
                '2D acceleration of newer cards.\n\n'
                'You need to install this driver if you wish to use the Unity '
                'desktop, enable desktop effects, or run software that '
                'requires 3D acceleration, such as some games.'))

        self._module_alias = 'nvidia'
        self._recommended = None
        self._do_rebind = False
        (self._alternatives, self._other_alternatives) = self._get_alternatives()
        self.version = version
        self.needs_kernel_headers = True
Пример #2
0
    def __init__(self, backend, package=None):
        self._free = False

        name = _('Intel Cedarview graphics driver')

        XorgDriverHandler.__init__(
            self,
            backend,
            'cedarview_gfx',
            'cedarview-graphics-drivers',
            None,
            None,
            add_modules=['glx'],
            disable_modules=[],
            name=name,
            description=_('3D-accelerated proprietary graphics driver for '
                          'Intel Cedarview cards.'),
            rationale=_(
                'This driver is required to fully utilise the 3D '
                'potential of some Intel Cedarview cards, as well as provide '
                '2D acceleration of newer cards.'))

        self._alternatives = self._get_alternatives()
        self.needs_kernel_headers = True
        self.alternative_name = 'intel-cdv'
Пример #3
0
    def test_xorg_driver_nobackup_nodriver(self):
        '''XorgDriverHandler with no xorg.conf backup and no explicit "Driver"'''
        
        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', None,
            None, extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'], remove_modules=['dri'],
            name='Vanilla accelerated graphics driver')

        self.failIf(h.enable())
        conf = open(OSLib.inst.xorg_conf_path).read()
        # should keep the "Driver" as it was before
        self.assert_(re.search('^\s*driver\s*"vanilla"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I|re.M))

        # unlink backup file
        os.unlink(os.path.join(OSLib.inst.backup_dir, 'mesa-vanilla.oldconf'))

        self.failIf(h.disable())
        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"vanilla"\s*$', conf, re.I|re.M))
        self.failIf('SuperSpeed' in conf)
        self.failIf(re.search('^\s*load\s*"glx"\s*$', conf, re.I|re.M))
        # modules which were explicitly disabled should be removed
        self.failIf(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"dri"\s*$', conf, re.I|re.M))
Пример #4
0
    def test_xorg_driver_nobackup(self):
        """XorgDriverHandler with no xorg.conf backup"""

        h = XorgDriverHandler(
            self.backend,
            "vanilla3d",
            "mesa-vanilla",
            "v3d",
            "vanilla",
            extra_conf_options={"SuperSpeed": "true"},
            add_modules=["glx"],
            disable_modules=["dri2"],
            remove_modules=["dri"],
            name="Vanilla accelerated graphics driver",
        )

        self.failIf(h.enable())
        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I | re.M))

        # unlink backup file
        os.unlink(os.path.join(OSLib.inst.backup_dir, "v3d.oldconf"))

        self.failIf(h.disable())
        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"vanilla"\s*$', conf, re.I | re.M))
        self.failIf("SuperSpeed" in conf)
        self.failIf(re.search('^\s*load\s*"glx"\s*$', conf, re.I | re.M))
        # modules which were explicitly disabled should be removed
        self.failIf(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"dri"\s*$', conf, re.I | re.M))
Пример #5
0
    def __init__(self, backend):
        self._free = False
        # use "None" as driver_package, since we have several;
        # LocalKernelModulesDriverDB overwrites it later with the correct
        # package from the modalias lists
        XorgDriverHandler.__init__(
            self,
            backend,
            'nvidia',
            None,
            'nvidia',
            'nv', {'NoLogo': 'True'},
            add_modules=['nvidia'],
            disable_modules=['nouveau'],
            remove_modules=[],
            name=_('NVIDIA accelerated graphics driver'),
            description=_('3D-accelerated proprietary graphics driver for '
                          'NVIDIA cards.'),
            rationale=_(
                'This driver is required to fully utilise '
                'the 3D potential of NVIDIA graphics cards, as well as provide '
                '2D acceleration of newer cards.\n\n'
                'If you wish to enable desktop effects, this driver is '
                'required.\n\n'
                'If this driver is not enabled, you will not be able to '
                'enable desktop effects and will not be able to run software '
                'that requires 3D acceleration, such as some games.'))

        self.package = 'nvidia'
        self._do_rebind = False
Пример #6
0
    def __init__(self, backend, package=None):
        self._free = False

        name = _('ATI/AMD proprietary FGLRX graphics driver')
        description = _(
            'This driver may increase performance and improve '
            'battery life, however it may also compromise stability.')
        rationale = _('Only enable this driver if you have issues '
                      'with the current one.')
        if package and 'update' in package:
            name = _(
                'ATI/AMD proprietary FGLRX graphics driver (post-release updates)'
            )
        elif package and 'experimental' in package:
            name = _(
                'ATI/AMD proprietary FGLRX graphics driver (**experimental** beta)'
            )
            description = None
            rationale = None

        XorgDriverHandler.__init__(
            self,
            backend, (package and package.replace('-', '_') or 'fglrx'),
            (package and package or 'fglrx'),
            None,
            None,
            add_modules=['glx'],
            disable_modules=[],
            name=name,
            description=description,
            rationale=rationale)

        (self._alternatives,
         self._other_alternatives) = self._get_alternatives()
        self.needs_kernel_headers = True
Пример #7
0
    def test_xorg_driver_enable_all_one_serverlayout(self):
        '''XorgDriverHandler enable the proprietary driver with one ServerLayout in xorg.conf'''
        
        os.unlink(OSLib.inst.xorg_conf_path)
        
        f = open(OSLib.inst.xorg_conf_path, 'a')
        print >> f, '''
Section "Device"
        Identifier "Graphics card 1"
        Driver "via"
EndSection

Section "Device"
        Identifier "Graphics card 2"
        Driver "via"
EndSection

Section "Screen"
        Identifier "Screen 1"
        Device "Graphics card 1"
EndSection

Section "Screen"
        Identifier "Screen 2"
        Device "Graphics card 2"
EndSection

Section "ServerLayout"
        Identifier "Another Layout"
        Screen "Screen 2"
EndSection
'''
        f.close()
        
        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla', extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'], remove_modules=['dri'],
            name='Vanilla accelerated graphics driver')
        
        # only the 2nd device section should have the driver changed
        self.failIf(h.enable())
        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*driver\s*"vanilla"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*driver\s*"via"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I|re.M))

        # backup file should have been created
        self.assert_(os.path.isfile(os.path.join(OSLib.inst.backup_dir, 'v3d.oldconf')))
    
        # disabling should restore xorg.conf
        self.failIf(h.disable())
        conf = open(OSLib.inst.xorg_conf_path).read()
        self.failIf(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*driver\s*"vanilla"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*driver\s*"via"\s*$', conf, re.I|re.M))
Пример #8
0
 def __init__(self, backend):
     self._free = False
     XorgDriverHandler.__init__(self, backend, 'fglrx', 'xorg-driver-fglrx',
         'fglrx', 'ati', add_modules=['glx'], disable_modules=[],
         name=_('AMD proprietary FGLRX graphics driver'),
         description=_('3D-accelerated proprietary graphics driver for '
             'AMD (ATI) cards.'),
         rationale=_('This driver is required to fully utilise the 3D '
             'potential of some AMD (ATI) graphics cards, as well as provide '
             '2D acceleration of newer cards.'))
Пример #9
0
    def disable(self):
        XorgDriverHandler.disable(self)

        # Set the alternative back to open drivers
        open_drivers = self._alternatives.get_open_egl_drivers_alternative()
        logging.debug('pvr-omap4.disable(%s): open_drivers: %s',
                self.module, open_drivers)
        if open_drivers:
            self._alternatives.set_alternative(open_drivers)

        return False
Пример #10
0
    def enable(self):
        XorgDriverHandler.enable(self)

        # Set the alternative to PowerVR SGX (EGL)
        pvr_omap4_alternative = self._alternatives.get_alternative_by_name(
                self.pkg_alternative, ignore_pattern='-updates')
        if not pvr_omap4_alternative:
            logging.error('%s: get_alternative_by_name(%s) returned nothing' % (
                self.id(), self.pkg_alternative))
            return
        self._alternatives.set_alternative(pvr_omap4_alternative)
Пример #11
0
    def enable(self):
        XorgDriverHandler.enable(self)

        # Set the alternative to PowerVR SGX (EGL)
        pvr_omap4_alternative = self._alternatives.get_alternative_by_name(
            self.pkg_alternative, ignore_pattern='-updates')
        if not pvr_omap4_alternative:
            logging.error('%s: get_alternative_by_name(%s) returned nothing' %
                          (self.id(), self.pkg_alternative))
            return
        self._alternatives.set_alternative(pvr_omap4_alternative)
Пример #12
0
    def disable(self):
        XorgDriverHandler.disable(self)

        # Set the alternative back to open drivers
        open_drivers = self._alternatives.get_open_egl_drivers_alternative()
        logging.debug('pvr-omap4.disable(%s): open_drivers: %s', self.module,
                      open_drivers)
        if open_drivers:
            self._alternatives.set_alternative(open_drivers)

        return False
Пример #13
0
    def test_xorg_driver_enable_all_no_serverlayout(self):
        """XorgDriverHandler enable the proprietary driver without ServerLayout in xorg.conf"""

        os.unlink(OSLib.inst.xorg_conf_path)

        f = open(OSLib.inst.xorg_conf_path, "a")
        print >> f, """
Section "Device"
        Identifier "Graphics card 1"
        Driver "via"
EndSection

Section "Device"
        Identifier "Graphics card 2"
        Driver "via"
EndSection
"""
        f.close()

        h = XorgDriverHandler(
            self.backend,
            "vanilla3d",
            "mesa-vanilla",
            "v3d",
            "vanilla",
            extra_conf_options={"SuperSpeed": "true"},
            add_modules=["glx"],
            disable_modules=["dri2"],
            remove_modules=["dri"],
            name="Vanilla accelerated graphics driver",
        )

        # all drivers will be changed
        self.failIf(h.enable())
        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*driver\s*"vanilla"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*driver\s*"via"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I | re.M))

        # backup file should have been created
        self.assert_(os.path.isfile(os.path.join(OSLib.inst.backup_dir, "v3d.oldconf")))

        # disabling should restore xorg.conf
        self.failIf(h.disable())
        conf = open(OSLib.inst.xorg_conf_path).read()
        self.failIf(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*driver\s*"vanilla"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*driver\s*"via"\s*$', conf, re.I | re.M))
Пример #14
0
    def enable(self):
        XorgDriverHandler.enable(self)

        # Set the alternative to cdv
        cdv_alternative = self._alternatives.get_alternative_by_name(
            self.alternative_name, ignore_pattern='-updates')
        if not cdv_alternative:
            logging.error('%s: get_alternative_by_name(%s) returned nothing' %
                          (self.id(), self.package))
            return
        self._alternatives.set_alternative(cdv_alternative)
        subprocess.call(['update-initramfs', '-u'])
        subprocess.call(['update-initramfs', '-u', '-k', os.uname()[2]])
Пример #15
0
 def enable(self):
     XorgDriverHandler.enable(self)
     
     # Set the alternative to FGLRX
     fglrx_alternative = self._alternatives.get_alternative_by_name(self.package)
     if not fglrx_alternative:
         logging.error('%s: get_alternative_by_name(%s) returned nothing' % (
             self.id(), self.package))
         return
     self._alternatives.set_alternative(fglrx_alternative)
     other_fglrx_alternative = self._other_alternatives.get_alternative_by_name(self.package)
     self._other_alternatives.set_alternative(other_fglrx_alternative)
     subprocess.call(['update-initramfs', '-u'])
     subprocess.call(['update-initramfs', '-u', '-k', os.uname()[2]])
Пример #16
0
    def test_check_composite_noavail(self):
        '''calling with --check-composite and no available driver'''

        sys.argv = ['ui-test', '--check-composite']
        ui = sandbox.TestUI()

        h = XorgDriverHandler(ui, 'vanilla3d', 'mesa-vanilla', 'v3d',
                              'vanilla')
        self.failIf(h.enabled())
        ui.backend().handlers[h.id()] = h

        self.assertEqual(ui.run(), 1)
        self.stop_capture()

        self.assert_('no available' in self.stderr)
Пример #17
0
    def test_check_composite_noavail(self):
        '''calling with --check-composite and no available driver'''

        sys.argv = ['ui-test', '--check-composite']
        ui = sandbox.TestUI()

        h = XorgDriverHandler(ui, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla')
        self.failIf(h.enabled())
        ui.backend().handlers[h.id()] = h

        self.assertEqual(ui.run(), 1)
        self.stop_capture()

        self.assert_('no available' in self.stderr)
Пример #18
0
    def disable(self):
        XorgDriverHandler.disable(self)
        # make sure that 'cedarview-drm' is removed too
        self.backend.remove_package('cedarview-drm')

        # Set the alternative back to open drivers
        open_drivers = self._alternatives.get_open_drivers_alternative()
        logging.debug('cdv.disable(%s): open_drivers: %s', self.module,
                      open_drivers)
        if open_drivers:
            self._alternatives.set_alternative(open_drivers)

        subprocess.call(['update-initramfs', '-u'])
        subprocess.call(['update-initramfs', '-u', '-k', os.uname()[2]])

        return False
Пример #19
0
    def enabled(self):
        # See if fglrx is the current alternative
        target_alternative = self._alternatives.get_alternative_by_name(
            'fglrx')
        current_alternative = self._alternatives.get_current_alternative()
        other_target_alternative = self._other_alternatives.get_alternative_by_name(
            'fglrx')
        other_current_alternative = self._other_alternatives.get_current_alternative(
        )

        logging.debug(
            'fglrx.enabled(%s): target_alt %s current_alt %s other target alt %s other current alt %s',
            self.module, target_alternative, current_alternative,
            other_target_alternative, other_current_alternative)

        if current_alternative is None:
            logging.debug('current alternative of %s is None, not enabled',
                          self.module)
            return False
        if current_alternative != target_alternative or \
           other_current_alternative != other_target_alternative:
            logging.debug('%s is not the alternative in use', self.module)
            return False

        return XorgDriverHandler.enabled(self)
Пример #20
0
    def __init__(self, backend, package=None):
        self._free = False

        name=_('PowerVR SGX proprietary graphics driver for OMAP 4')

        XorgDriverHandler.__init__(self, backend, 'omapdrm_pvr', 'pvr-omap4',
            None, None, name=name,
            description=_('3D-accelerated proprietary graphics driver for '
                'OMAP 4 SoCs.'),
            rationale=_('This driver is required to fully utilise the 3D '
                'potential of OMAP 4 powered boards.'))

        self.pkg_alternative = 'pvr-omap4-egl'
        self._module_alias = 'omapdrm_pvr'
        self._alternatives = self._get_alternatives()
        self.omap4_re = re.compile('^Hardware.*OMAP4.*')
        self.needs_kernel_headers = True
Пример #21
0
    def enable(self):
        XorgDriverHandler.enable(self)

        # Set the alternative to NVIDIA
        nvidia_alternative = self._alternatives.get_alternative_by_name(
            self.package)
        if not nvidia_alternative:
            logging.error('%s: get_alternative_by_name(%s) returned nothing' %
                          (self.id(), self.package))
            return
        self._alternatives.set_alternative(nvidia_alternative)
        other_nvidia_alternative = self._other_alternatives.get_alternative_by_name(
            self.package)
        self._other_alternatives.set_alternative(other_nvidia_alternative)

        subprocess.call(['update-initramfs', '-u'])
        subprocess.call(['update-initramfs', '-u', '-k', os.uname()[2]])
Пример #22
0
    def available(self):
        # we don't offer cdv in a life CD environment, as we will run out of
        # RAM trying to download and install all the packages in the RAM disk.
        if os.path.isdir('/rofs'):
            logging.debug('Disabling cdv driver on live system')
            return False

        logging.debug('cdv.available: falling back to default')
        return XorgDriverHandler.available(self)
Пример #23
0
    def available(self):
        # we don't offer fglrx in a life CD environment, as we will run out of
        # RAM trying to download and install all the packages in the RAM disk.
        if os.path.isdir('/rofs'):
            logging.debug('Disabling fglrx driver on live system')
            return False

        logging.debug('fglrx.available: falling back to default')
        return XorgDriverHandler.available(self)
Пример #24
0
    def disable(self):
        # make sure that fglrx-kernel-source is removed too
        XorgDriverHandler.disable(self)
        #kernel_source = 'fglrx-kernel-source'
        #self.backend.remove_package(kernel_source)

        # Set the alternative back to open drivers
        open_drivers = self._alternatives.get_open_drivers_alternative()
        logging.debug('fglrx.disable(%s): open_drivers: %s', self.module, open_drivers)
        if open_drivers:
            self._alternatives.set_alternative(open_drivers)
        other_open_drivers = self._other_alternatives.get_open_drivers_alternative()
        logging.debug('fglrx.disable(%s): other_open_drivers: %s', self.module, other_open_drivers)
        if other_open_drivers:
            self._other_alternatives.set_alternative(other_open_drivers)
        subprocess.call(['update-initramfs', '-u'])
        subprocess.call(['update-initramfs', '-u', '-k', os.uname()[2]])

        return False
Пример #25
0
    def disable(self):
        # make sure that fglrx-kernel-source is removed too
        XorgDriverHandler.disable(self)
        #kernel_source = 'fglrx-kernel-source'
        #self.backend.remove_package(kernel_source)

        # Set the alternative back to open drivers
        open_drivers = self._alternatives.get_open_drivers_alternative()
        logging.debug('fglrx.disable(%s): open_drivers: %s', self.module, open_drivers)
        if open_drivers:
            self._alternatives.set_alternative(open_drivers)
        other_open_drivers = self._other_alternatives.get_open_drivers_alternative()
        logging.debug('fglrx.disable(%s): other_open_drivers: %s', self.module, other_open_drivers)
        if other_open_drivers:
            self._other_alternatives.set_alternative(other_open_drivers)
        subprocess.call(['update-initramfs', '-u'])
        subprocess.call(['update-initramfs', '-u', '-k', os.uname()[2]])

        return False
Пример #26
0
    def __init__(self, backend, package=None):
        self._free = False

        if package and 'update' in package:
            name=_('ATI/AMD proprietary FGLRX graphics driver (post-release updates)')
        else:
            name=_('ATI/AMD proprietary FGLRX graphics driver')

        XorgDriverHandler.__init__(self, backend, (package and
            package.replace('-', '_') or 'fglrx'), (package and
            package or 'fglrx'), None, None, add_modules=['glx'],
            disable_modules=[], name=name,
            description=_('3D-accelerated proprietary graphics driver for '
                'ATI cards.'),
            rationale=_('This driver is required to fully utilise the 3D '
                'potential of some ATI graphics cards, as well as provide '
                '2D acceleration of newer cards.'))

        (self._alternatives, self._other_alternatives) = self._get_alternatives()
        self.needs_kernel_headers = True
Пример #27
0
    def __init__(self, backend, package=None):
        self._free = False

        if package and 'update' in package:
            name=_('ATI/AMD proprietary FGLRX graphics driver (post-release updates)')
        else:
            name=_('ATI/AMD proprietary FGLRX graphics driver')

        XorgDriverHandler.__init__(self, backend, (package and
            package.replace('-', '_') or 'fglrx'), (package and
            package or 'fglrx'), None, None, add_modules=['glx'],
            disable_modules=[], name=name,
            description=_('3D-accelerated proprietary graphics driver for '
                'ATI cards.'),
            rationale=_('This driver is required to fully utilise the 3D '
                'potential of some ATI graphics cards, as well as provide '
                '2D acceleration of newer cards.'))

        (self._alternatives, self._other_alternatives) = self._get_alternatives()
        self.needs_kernel_headers = True
Пример #28
0
    def test_xorg_driver_existing_proprietary(self):
        '''XorgDriverHandler backup with the proprietary driver already in xorg.conf'''
        
        f = open(OSLib.inst.xorg_conf_path, 'a')
        print >> f, '''
Section "Device"
        Identifier "Graphics card 1"
        Driver "via"
EndSection

Section "Device"
        Identifier "Graphics card 2"
        Driver "v3d"
EndSection
'''
        f.close()
        
        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla', extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'], remove_modules=['dri'],
            name='Vanilla accelerated graphics driver')

        self.failIf(h.enable())
        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*driver\s*"vanilla"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*driver\s*"via"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I|re.M))

        # no backup file should have been created
        self.failIf(os.path.isfile(os.path.join(OSLib.inst.backup_dir, 'v3d.oldconf')))
    
        # disabling should restore xorg.conf
        self.failIf(h.disable())
        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*driver\s*"vanilla"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*driver\s*"via"\s*$', conf, re.I|re.M))
Пример #29
0
    def test_xorg_driver_abi_checking(self):
        '''XorgDriverHandler ABI checking'''

        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla', name='Vanilla accelerated graphics driver')

        # our TestOSLib doesn't define video_driver_abi(), so should be
        # available by default
        self.assertNotEqual(h.available(), False)

        orig_video_driver_abi = OSLib.inst.video_driver_abi
        try:
            # should be available for matching ABI
            OSLib.inst.video_driver_abi = lambda pkg: OSLib.inst.current_xorg_video_abi()
            self.assertNotEqual(h.available(), False)

            # should not be available for nonmatching ABI
            OSLib.inst.video_driver_abi = lambda pkg: 'otherabi'
            self.assertEqual(h.available(), False)
        finally:
            OSLib.inst.video_driver_abi = orig_video_driver_abi
Пример #30
0
    def test_xorg_driver_loaded_drivers(self):
        """XorgDriverHandler.loaded_drivers()"""

        # system one
        drivers = XorgDriverHandler.loaded_drivers()
        self.assertEqual(type(drivers), type(set()))
        if "DISPLAY" in os.environ:
            self.assertGreaterEqual(len(drivers), 1)

        # synthetic
        with open(os.path.join(OSLib.inst.workdir, "Xorg.1.log"), "w") as f:
            f.write(
                """X.Org X Server 1.10.4
[    14.451] (II) LoadModule: "intel"
[    14.452] (II) Loading /usr/lib/xorg/modules/drivers/intel_drv.so
[    14.459] (II) LoadModule: "vesa"
[    14.459] (II) Loading /usr/lib/xorg/modules/drivers/vesa_drv.so
[    14.452] (II) Loading /usr/lib/xorg/modules/drivers/intel_drv.so
"""
            )
        self.assertEqual(XorgDriverHandler.loaded_drivers(OSLib.inst.workdir), set(["intel", "vesa"]))
Пример #31
0
    def disable(self):
        XorgDriverHandler.disable(self)
        if self.package:
            try:
                self.backend.remove_package('nvidia-settings')
            except SystemError:
                pass
        
        # Set the alternative back to open drivers
        open_drivers = self._alternatives.get_open_drivers_alternative()
        logging.debug('NVidia.disable(%s): open_drivers: %s', self.module, open_drivers)
        if open_drivers:
            self._alternatives.set_alternative(open_drivers)
        other_open_drivers = self._other_alternatives.get_open_drivers_alternative()
        logging.debug('NVidia.disable(%s): other_open_drivers: %s', self.module, other_open_drivers)
        if other_open_drivers:
            self._other_alternatives.set_alternative(other_open_drivers)
        subprocess.call(['update-initramfs', '-u'])       
        subprocess.call(['update-initramfs', '-u', '-k', os.uname()[2]])

        return False
Пример #32
0
    def __init__(self, backend, version):
        self._free = False
        name = _('NVIDIA accelerated graphics driver')
        description = _('3D-accelerated proprietary graphics driver for '
                        'NVIDIA cards. Required if you want to run Unity.')
        rationale = _(
            'This driver is required to fully utilise '
            'the 3D potential of NVIDIA graphics cards, as well as provide '
            '2D acceleration of newer cards.\n\n'
            'You need to install this driver if you wish to use the Unity '
            'desktop, enable desktop effects, or run software that '
            'requires 3D acceleration, such as some games.')
        if 'update' in version:
            name = _(
                'NVIDIA accelerated graphics driver (post-release updates)')
        elif 'experimental' in version:
            name = _(
                'NVIDIA accelerated graphics driver (**experimental** beta)')
            description = None
            rationale = None

        XorgDriverHandler.__init__(self,
                                   backend,
                                   'nvidia_' + version.replace('-', '_'),
                                   'nvidia-' + version,
                                   None,
                                   None, {'NoLogo': 'True'},
                                   remove_modules=['dri', 'GLcore'],
                                   name=name,
                                   description=description,
                                   rationale=rationale)

        self._module_alias = 'nvidia'
        self._recommended = None
        self._do_rebind = False
        (self._alternatives,
         self._other_alternatives) = self._get_alternatives()
        self.version = version
        self.needs_kernel_headers = True
Пример #33
0
    def available(self):
        '''Check /proc/cpuinfo for an OMAP 4 board.'''
        if XorgDriverHandler.available(self) == False:
            return False

        try:
            for l in open('/proc/cpuinfo'):
                if self.omap4_re.match(l):
                    return True
        except IOError as e:
            logging.error('could not open /proc/cpuinfo: %s' % str(e))

        return False
Пример #34
0
    def available(self):
        '''Check /proc/cpuinfo for an OMAP 4 board.'''
        if XorgDriverHandler.available(self) == False:
            return False

        try:
            for l in open('/proc/cpuinfo'):
                if self.omap4_re.match(l):
                    return True
        except IOError as e:
            logging.error('could not open /proc/cpuinfo: %s' % str(e))

        return False
Пример #35
0
    def __init__(self, backend):
        self._free = False
        # use "None" as driver_package, since we have several;
        # LocalKernelModulesDriverDB overwrites it later with the correct
        # package from the modalias lists
        XorgDriverHandler.__init__(self, backend, 'nvidia', None,
            'nvidia', 'nv', {'NoLogo': 'True'},
            add_modules=['glx'], disable_modules=[],
            remove_modules=['dri', 'GLcore'],
            name=_('NVIDIA accelerated graphics driver'),
            description=_('3D-accelerated proprietary graphics driver for '
                'NVIDIA cards.'),
            rationale=_('This driver is required to fully utilise '
                'the 3D potential of NVIDIA graphics cards, as well as provide '
                '2D acceleration of newer cards.\n\n'
                'If you wish to enable desktop effects, this driver is '
                'required.\n\n'
                'If this driver is not enabled, you will not be able to '
                'enable desktop effects and will not be able to run software '
                'that requires 3D acceleration, such as some games.'))

        self._recommended = None
        self._do_rebind = False
Пример #36
0
    def available(self):
        # we don't offer this driver in a life CD environment, as we will run
        # out of RAM trying to download and install all the packages in the RAM
        # disk.
        if os.path.isdir('/rofs'):
            logging.debug('Disabling Nvidia driver on live system')
            return False

        if 'intel' in self.loaded_drivers():
            logging.debug('Disabling Nvidia driver on intel/hybrid system')
            return False

        logging.debug('nvidia.available: falling back to default')
        return XorgDriverHandler.available(self)
Пример #37
0
    def __init__(self, backend, package=None):
        self._free = False

        name = _('PowerVR SGX proprietary graphics driver for OMAP 4')

        XorgDriverHandler.__init__(
            self,
            backend,
            'omapdrm_pvr',
            'pvr-omap4',
            None,
            None,
            name=name,
            description=_('3D-accelerated proprietary graphics driver for '
                          'OMAP 4 SoCs.'),
            rationale=_('This driver is required to fully utilise the 3D '
                        'potential of OMAP 4 powered boards.'))

        self.pkg_alternative = 'pvr-omap4-egl'
        self._module_alias = 'omapdrm_pvr'
        self._alternatives = self._get_alternatives()
        self.omap4_re = re.compile('^Hardware.*OMAP4.*')
        self.needs_kernel_headers = True
Пример #38
0
    def disable(self):
        XorgDriverHandler.disable(self)
        if self.package:
            try:
                self.backend.remove_package('nvidia-settings')
            except SystemError:
                pass

        # Set the alternative back to open drivers
        open_drivers = self._alternatives.get_open_drivers_alternative()
        logging.debug('NVidia.disable(%s): open_drivers: %s', self.module,
                      open_drivers)
        if open_drivers:
            self._alternatives.set_alternative(open_drivers)
        other_open_drivers = self._other_alternatives.get_open_drivers_alternative(
        )
        logging.debug('NVidia.disable(%s): other_open_drivers: %s',
                      self.module, other_open_drivers)
        if other_open_drivers:
            self._other_alternatives.set_alternative(other_open_drivers)
        subprocess.call(['update-initramfs', '-u'])
        subprocess.call(['update-initramfs', '-u', '-k', os.uname()[2]])

        return False
Пример #39
0
    def enabled(self):
        # See if cdv is the current alternative
        target_alternative = \
            self._alternatives.get_alternative_by_name(self.alternative_name)
        current_alternative = self._alternatives.get_current_alternative()

        logging.debug('cdv.enabled(%s): target_alt %s current_alt %s',
                      self.module, target_alternative, current_alternative)

        if current_alternative is None:
            logging.debug('current alternative of %s is None, not enabled',
                          self.module)
            return False
        if current_alternative != target_alternative:
            logging.debug('%s is not the alternative in use', self.module)
            return False

        return XorgDriverHandler.enabled(self)
Пример #40
0
    def enabled(self):
        # See if pvr-omap4 is the current alternative
        target_alternative = \
            self._alternatives.get_alternative_by_name(self.pkg_alternative)
        current_alternative = self._alternatives.get_current_alternative()

        logging.debug('pvr-omap4.enabled(%s): target_alt %s current_alt %s',
                self.module, target_alternative, current_alternative)

        if current_alternative is None:
            logging.debug('current alternative of %s is None, not enabled',
                    self.pkg_alternative)
            return False
        if current_alternative != target_alternative:
            logging.debug('%s is not the alternative in use',
                    self.pkg_alternative)
            return False

        return XorgDriverHandler.enabled(self)
Пример #41
0
    def enabled(self):
        # See if fglrx is the current alternative
        target_alternative = self._alternatives.get_alternative_by_name(self.package)
        current_alternative = self._alternatives.get_current_alternative()
        other_target_alternative = self._other_alternatives.get_alternative_by_name(self.package)
        other_current_alternative = self._other_alternatives.get_current_alternative()

        logging.debug('fglrx.enabled(%s): target_alt %s current_alt %s other target alt %s other current alt %s',
                self.module, target_alternative, current_alternative,
                other_target_alternative, other_current_alternative)

        if current_alternative is None:
            logging.debug('current alternative of %s is None, not enabled', self.module)
            return False
        if current_alternative != target_alternative or \
           other_current_alternative != other_target_alternative:
            logging.debug('%s is not the alternative in use', self.module)
            return False

        return XorgDriverHandler.enabled(self)
Пример #42
0
    def test_xorg_invalid_conf(self):
        """XorgDriverHandler with invalid xorg.conf"""

        # append some breakage
        f = open(OSLib.inst.xorg_conf_path, "a")
        print >> f, """
EndSection

Section "Module"
EndSection
"""
        f.close()

        h = XorgDriverHandler(
            self.backend,
            "vanilla3d",
            "mesa-vanilla",
            "v3d",
            "vanilla",
            extra_conf_options={"SuperSpeed": "true"},
            add_modules=["glx"],
            disable_modules=["dri2"],
            remove_modules=["dri"],
            name="Vanilla accelerated graphics driver",
        )

        self.assertEqual(h.name(), "Vanilla accelerated graphics driver")
        self.assertEqual(h.description(), OSLib.inst.package_description("mesa-vanilla")[1])
        self.assertEqual(h.rationale(), None)
        self.failIf(h.free())
        self.failIf(h.changed())
        self.assert_("xorg.conf is invalid" in h.can_change())
        self.failIf(h.enabled())
        self.assertEqual(h.available(), None)

        self.failIf(h.enable())
        self.failIf(h.changed())
        self.failIf(h.enabled())
        self.failIf(h.disable())
        self.failIf(h.changed())
        self.failIf(h.enabled())
Пример #43
0
    def test_xorg_driver_enable_all_more_serverlayouts(self):
        """XorgDriverHandler enable the proprietary driver with more ServerLayouts in xorg.conf"""

        os.unlink(OSLib.inst.xorg_conf_path)

        f = open(OSLib.inst.xorg_conf_path, "a")
        print >> f, """
Section "Device"
        Identifier "Graphics card 1"
        Driver "via"
EndSection

Section "Device"
        Identifier "Graphics card 2"
        Driver "via"
EndSection

Section "Screen"
        Identifier "Screen 1"
        Device "Graphics card 1"
EndSection

Section "Screen"
        Identifier "Screen 2"
        Device "Graphics card 2"
EndSection

Section "ServerLayout"
        Identifier "Default Layout"
        Option "Whatever"
        Screen "Screen 1" 0 0
        Screen "Screen 2" RightOf "Screen 1"
EndSection

Section "ServerLayout"
        Identifier "Another Layout"
        Option "Whatever"
        Screen "Screen 2" 0 0
EndSection

Section "ServerFlags"
        Option "DefaultServerLayout" "Another Layout"
EndSection
"""
        f.close()

        h = XorgDriverHandler(
            self.backend,
            "vanilla3d",
            "mesa-vanilla",
            "v3d",
            "vanilla",
            extra_conf_options={"SuperSpeed": "true"},
            add_modules=["glx"],
            disable_modules=["dri2"],
            remove_modules=["dri"],
            name="Vanilla accelerated graphics driver",
        )

        # the 2nd serverlayout is used, therefore only the 2nd device section must be
        # changed
        self.failIf(h.enable())
        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*driver\s*"vanilla"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*driver\s*"via"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I | re.M))

        # backup file should have been created
        self.assert_(os.path.isfile(os.path.join(OSLib.inst.backup_dir, "v3d.oldconf")))

        # disabling should restore xorg.conf
        self.failIf(h.disable())
        conf = open(OSLib.inst.xorg_conf_path).read()
        self.failIf(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*driver\s*"vanilla"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*driver\s*"via"\s*$', conf, re.I | re.M))
Пример #44
0
    def test_xorg_driver_modules(self):
        """XorgDriverHandler with default Modules xorg.conf section"""

        # append a Module section
        f = open(OSLib.inst.xorg_conf_path, "a")
        print >> f, """
Section "Module"
        Load            "dri"
        SubSection "extmod"
                Option          "omit xfree86-dga"
        EndSubSection
        Load            "foo"
EndSection
"""
        f.close()

        h = XorgDriverHandler(
            self.backend,
            "vanilla3d",
            "mesa-vanilla",
            "v3d",
            "vanilla",
            extra_conf_options={"SuperSpeed": "true"},
            add_modules=["glx"],
            disable_modules=["dri2"],
            remove_modules=["dri"],
            name="Vanilla accelerated graphics driver",
        )

        self.assertEqual(h.name(), "Vanilla accelerated graphics driver")
        self.assertEqual(h.description(), OSLib.inst.package_description("mesa-vanilla")[1])
        self.assertEqual(h.rationale(), None)
        self.failIf(h.free())
        self.failIf(h.changed())
        self.assertEqual(h.can_change(), None)
        self.failIf(h.enabled())
        self.assertEqual(h.available(), None)

        self.failIf(h.enable())
        self.assert_(h.changed())
        self.assert_(h.enabled())
        self.assert_(OSLib.inst.package_installed("mesa-vanilla"))
        self.failIf(OSLib.inst.module_blacklisted("vanilla3d"))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"foo"\s*$', conf, re.I | re.M))

        # unlink backup file
        os.unlink(os.path.join(OSLib.inst.backup_dir, "v3d.oldconf"))

        # should restore module dri, drop glx and remove dri2
        self.failIf(h.disable())
        self.assert_(h.changed())
        self.failIf(h.enabled())
        self.failIf(OSLib.inst.package_installed("mesa-vanilla"))
        self.assert_(OSLib.inst.module_blacklisted("vanilla3d"))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.failIf(re.search('^\s*load\s*"glx"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"dri"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"foo"\s*$', conf, re.I | re.M))
Пример #45
0
    def test_xorg_driver_no_xorgconf(self):
        """XorgDriverHandler without a default xorg.conf"""

        os.unlink(OSLib.inst.xorg_conf_path)

        h = XorgDriverHandler(
            self.backend,
            "vanilla3d",
            "mesa-vanilla",
            "v3d",
            "vanilla",
            extra_conf_options={"SuperSpeed": "true"},
            add_modules=["glx"],
            disable_modules=["dri2"],
            remove_modules=["dri"],
            name="Vanilla accelerated graphics driver",
        )

        self.failIf(h.free())
        self.failIf(h.changed())
        self.assertEqual(h.can_change(), None)  # should create an xorg.conf from scratch
        self.failIf(h.enabled())
        self.assertEqual(h.available(), None)

        self.failIf(h.enable())
        self.assert_(h.changed())
        self.assert_(h.enabled())
        self.assert_(OSLib.inst.package_installed("mesa-vanilla"))
        self.failIf(OSLib.inst.module_blacklisted("vanilla3d"))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I | re.M))

        # should remove xorg.conf again
        self.failIf(h.disable())
        self.assert_(h.changed())
        self.failIf(h.enabled())
        self.failIf(OSLib.inst.package_installed("mesa-vanilla"))
        self.assert_(OSLib.inst.module_blacklisted("vanilla3d"))
        self.failIf(os.path.exists(OSLib.inst.xorg_conf_path))
Пример #46
0
    def test_xorg_driver_nomodules(self):
        '''XorgDriverHandler with no default Modules xorg.conf section'''
        
        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla', extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'], remove_modules=['dri'],
            name='Vanilla accelerated graphics driver')

        orig_xorg_conf = open(OSLib.inst.xorg_conf_path).read()

        self.assertEqual(h.name(), 'Vanilla accelerated graphics driver')
        self.assertEqual(h.id(), 'xorg:vanilla3d')
        self.assertEqual(h.description(),  OSLib.inst.package_description('mesa-vanilla')[1])
        self.assertEqual(h.rationale(), None)
        self.failIf(h.free())
        self.failIf(h.changed())
        self.assertEqual(h.can_change(), None)
        self.failIf(h.enabled())
        self.failIf(h.used())
        self.assertEqual(h.available(), None)
        self.failIf(h.enables_composite())

        self.failIf(h.enable())
        self.assert_(h.changed())
        self.failIf(h.used()) # X.org needs to be restarted for this to work
        self.assert_(h.enabled())
        self.assert_(OSLib.inst.package_installed('mesa-vanilla')) 
        self.failIf(OSLib.inst.module_blacklisted('vanilla3d'))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I|re.M))

        # driver should be used when loading the module (done in enable()) and
        # starting jockey again
        h2 = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla', extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'], remove_modules=['dri'],
            name='Vanilla accelerated graphics driver')
        self.assert_(h2.enabled())
        self.assert_(h2.used())

        self.failIf(h.disable())
        self.assert_(h.changed())
        self.failIf(h.enabled())
        self.failIf(h.used()) # wasn't used after enabling
        self.failIf(OSLib.inst.package_installed('mesa-vanilla')) 
        self.assert_(OSLib.inst.module_blacklisted('vanilla3d'))

        # restores original backup
        self.assertEqual(open(OSLib.inst.xorg_conf_path).read(), orig_xorg_conf)

        # vendor
        h.driver_vendor = 'Foo Bar'
        self.assertEqual(h.id(), 'xorg:vanilla3d:Foo_Bar')
Пример #47
0
    def test_xorg_driver_modules(self):
        '''XorgDriverHandler with default Modules xorg.conf section'''

        # append a Module section
        f = open(OSLib.inst.xorg_conf_path, 'a')
        print >> f, '''
Section "Module"
        Load            "dri"
        SubSection "extmod"
                Option          "omit xfree86-dga"
        EndSubSection
        Load            "foo"
EndSection
'''
        f.close()

        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla', extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'], remove_modules=['dri'],
            name='Vanilla accelerated graphics driver')

        self.assertEqual(h.name(), 'Vanilla accelerated graphics driver')
        self.assertEqual(h.description(),  OSLib.inst.package_description('mesa-vanilla')[1])
        self.assertEqual(h.rationale(), None)
        self.failIf(h.free())
        self.failIf(h.changed())
        self.assertEqual(h.can_change(), None)
        self.failIf(h.enabled())
        self.assertEqual(h.available(), None)

        self.failIf(h.enable())
        self.assert_(h.changed())
        self.assert_(h.enabled())
        self.assert_(OSLib.inst.package_installed('mesa-vanilla')) 
        self.failIf(OSLib.inst.module_blacklisted('vanilla3d'))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"foo"\s*$', conf, re.I|re.M))

        # unlink backup file
        os.unlink(os.path.join(OSLib.inst.backup_dir, 'v3d.oldconf'))

        # should restore module dri, drop glx and remove dri2
        self.failIf(h.disable())
        self.assert_(h.changed())
        self.failIf(h.enabled())
        self.failIf(OSLib.inst.package_installed('mesa-vanilla')) 
        self.assert_(OSLib.inst.module_blacklisted('vanilla3d'))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.failIf(re.search('^\s*load\s*"glx"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"dri"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"foo"\s*$', conf, re.I|re.M))
Пример #48
0
    def test_xorg_driver_no_xorgconf_nodriver(self):
        '''XorgDriverHandler without a default xorg.conf and no explicit "Driver"'''

        os.unlink(OSLib.inst.xorg_conf_path)

        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', None,
            None, extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'],
            name='Vanilla accelerated graphics driver')

        self.failIf(h.free())
        self.failIf(h.changed())
        self.assertEqual(h.can_change(), None) # should create an xorg.conf from scratch
        self.failIf(h.enabled())
        self.assertEqual(h.available(), None)

        self.failIf(h.enable())
        self.assert_(h.changed())
        self.assert_(h.enabled())
        self.assert_(OSLib.inst.package_installed('mesa-vanilla')) 
        self.failIf(OSLib.inst.module_blacklisted('vanilla3d'))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.failIf(re.search('^\s*driver', conf, re.I|re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I|re.M))

        # should remove xorg.conf again
        self.failIf(h.disable())
        self.assert_(h.changed())
        self.failIf(h.enabled())
        self.failIf(OSLib.inst.package_installed('mesa-vanilla')) 
        self.assert_(OSLib.inst.module_blacklisted('vanilla3d'))
        self.failIf(os.path.exists(OSLib.inst.xorg_conf_path))
Пример #49
0
 def __init__(self, ui):
     XorgDriverHandler.__init__(self, ui, 'vanilla3d',
                                'mesa-vanilla', 'v3d', 'vanilla')
Пример #50
0
    def test_xorg_invalid_conf(self):
        '''XorgDriverHandler with invalid xorg.conf'''

        # append some breakage
        f = open(OSLib.inst.xorg_conf_path, 'a')
        print >> f, '''
EndSection

Section "Module"
EndSection
'''
        f.close()

        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla', extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'], remove_modules=['dri'],
            name='Vanilla accelerated graphics driver')

        self.assertEqual(h.name(), 'Vanilla accelerated graphics driver')
        self.assertEqual(h.description(),  OSLib.inst.package_description('mesa-vanilla')[1])
        self.assertEqual(h.rationale(), None)
        self.failIf(h.free())
        self.failIf(h.changed())
        self.assert_('xorg.conf is invalid' in h.can_change())
        self.failIf(h.enabled())
        self.assertEqual(h.available(), None)

        self.failIf(h.enable())
        self.failIf(h.changed())
        self.failIf(h.enabled())
        self.failIf(h.disable())
        self.failIf(h.changed())
        self.failIf(h.enabled())