|
|
|
@ -36,6 +36,14 @@ class VideoVariable(Variable):
|
|
|
|
|
Video variables not using for flash installation
|
|
|
|
|
"""
|
|
|
|
|
xorg_need = True
|
|
|
|
|
default_video = "default"
|
|
|
|
|
driver_names = {'nvidia': _("Nvidia proprietary video driver"),
|
|
|
|
|
'fglrx': _("Ati proprietary video driver"),
|
|
|
|
|
'intel': _("Intel video driver"),
|
|
|
|
|
'radeon': _("Ati open source video driver"),
|
|
|
|
|
'nouveau': _("Nvidia open source video driver"),
|
|
|
|
|
'default': _("X.Org Server auto-detect")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def uncompatible(self):
|
|
|
|
|
"""
|
|
|
|
@ -103,8 +111,7 @@ class VariableOsInstallX11VideoAvailable(VideoVariable):
|
|
|
|
|
Get available (already installed or installable drivers
|
|
|
|
|
"""
|
|
|
|
|
type = "list"
|
|
|
|
|
supported = ["nvidia","vboxvideo","sis","nv",
|
|
|
|
|
"fglrx","nouveau","intel","ati","radeon"]
|
|
|
|
|
supported = ["nvidia", "fglrx", "nouveau", "intel", "radeon"]
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
image = self.Get('cl_image')
|
|
|
|
@ -113,20 +120,26 @@ class VariableOsInstallX11VideoAvailable(VideoVariable):
|
|
|
|
|
try:
|
|
|
|
|
distrPath = image.getDirectory()
|
|
|
|
|
if isPkgInstalled('xorg-server',prefix=distrPath):
|
|
|
|
|
return sorted(filter(self.supported.__contains__,
|
|
|
|
|
getAvailableVideo(prefix=distrPath)))+['other']
|
|
|
|
|
return (sorted(filter(self.supported.__contains__,
|
|
|
|
|
getAvailableVideo(prefix=distrPath))) +
|
|
|
|
|
[self.default_video])
|
|
|
|
|
except DistributiveError as e:
|
|
|
|
|
pass
|
|
|
|
|
return []
|
|
|
|
|
|
|
|
|
|
def humanReadable(self):
|
|
|
|
|
return map(lambda x: self.driver_names.get(x, x), self.Get())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsX11KmsVideoDrv(ReadonlyVariable):
|
|
|
|
|
"""
|
|
|
|
|
Список KMS драйверов
|
|
|
|
|
"""
|
|
|
|
|
type = "list"
|
|
|
|
|
value = ["radeon","i915","intel","nouveau","ati"]
|
|
|
|
|
value = ["radeon", "intel", "nouveau"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallX11VideoDrv(Variable):
|
|
|
|
|
class VariableOsInstallX11VideoDrv(VideoVariable):
|
|
|
|
|
"""
|
|
|
|
|
Video driver used by xorg
|
|
|
|
|
"""
|
|
|
|
@ -141,16 +154,17 @@ class VariableOsInstallX11VideoDrv(Variable):
|
|
|
|
|
def choice(self):
|
|
|
|
|
"""Get available (already installed or installable drivers"""
|
|
|
|
|
if self.Get('os_install_x11_server_set') == 'on':
|
|
|
|
|
return self.Get('os_install_x11_video_available')
|
|
|
|
|
values = self.Get('os_install_x11_video_available')
|
|
|
|
|
else:
|
|
|
|
|
return self.Get('os_x11_kms_video_drv') + ["other"]
|
|
|
|
|
values = self.Get('os_x11_kms_video_drv') + [self.default_video]
|
|
|
|
|
return map(lambda x: (x, self.driver_names.get(x, x)), values)
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
if self.Get('os_install_x11_server_set') == 'on':
|
|
|
|
|
# get available videodriver list from install or configure distributive
|
|
|
|
|
list_video = self.Choice('os_install_x11_video_drv')
|
|
|
|
|
if not list_video:
|
|
|
|
|
return "other"
|
|
|
|
|
return self.default_video
|
|
|
|
|
# if type system is usb-hdd then get detect video driver
|
|
|
|
|
if self.Get('os_install_root_type') == 'usb-hdd':
|
|
|
|
|
methods = ((getVideoFromModules,()),
|
|
|
|
@ -167,7 +181,7 @@ class VariableOsInstallX11VideoDrv(Variable):
|
|
|
|
|
drv = func(*args)
|
|
|
|
|
if drv in list_video:
|
|
|
|
|
return drv
|
|
|
|
|
return "other"
|
|
|
|
|
return self.default_video
|
|
|
|
|
else:
|
|
|
|
|
for drv in self.choice():
|
|
|
|
|
videoSysPath = path.join("/sys/module",drv,"refcnt")
|
|
|
|
@ -175,7 +189,7 @@ class VariableOsInstallX11VideoDrv(Variable):
|
|
|
|
|
if refcnt.isdigit() and int(refcnt) > 0:
|
|
|
|
|
return {'i915':'intel'}.get(drv,drv)
|
|
|
|
|
else:
|
|
|
|
|
return "other"
|
|
|
|
|
return self.default_video
|
|
|
|
|
|
|
|
|
|
pkgDrvMap = {'nvidia':('NVidia','x11-drivers/nvidia-drivers'),
|
|
|
|
|
'fglrx':('ATI','x11-drivers/ati-drivers'),
|
|
|
|
@ -190,7 +204,7 @@ class VariableOsInstallX11VideoDrv(Variable):
|
|
|
|
|
",".join(availDrvs))
|
|
|
|
|
else:
|
|
|
|
|
if not value in getInstalledVideo(prefix="/") and \
|
|
|
|
|
not value in ("auto","other"):
|
|
|
|
|
not value in ("auto",self.default_video):
|
|
|
|
|
error =_("video driver %s is unavailable")%value
|
|
|
|
|
if value in self.pkgDrvMap:
|
|
|
|
|
error += ". " + (_("Install driver %s with:")
|
|
|
|
@ -198,7 +212,7 @@ class VariableOsInstallX11VideoDrv(Variable):
|
|
|
|
|
error += "\n" + ("emerge %s"%self.pkgDrvMap[value][1])
|
|
|
|
|
raise VariableError(error)
|
|
|
|
|
else:
|
|
|
|
|
availDrivers = self.Get('os_x11_kms_video_drv') + ["other"]
|
|
|
|
|
availDrivers = self.Get('os_x11_kms_video_drv') + [self.default_video]
|
|
|
|
|
if not value in availDrivers:
|
|
|
|
|
raise VariableError("Only %s drivers are available" %
|
|
|
|
|
",".join(availDrivers))
|
|
|
|
|