/[soft]/drakx-kbd-mouse-x11/trunk/lib/Xconfig/proprietary.pm
ViewVC logotype

Contents of /drakx-kbd-mouse-x11/trunk/lib/Xconfig/proprietary.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3926 - (show annotations) (download)
Thu Apr 5 02:49:56 2012 UTC (12 years ago) by anssi
File size: 5450 byte(s)
add a 'nice' warning message when firmware is not available instead of
a simple "Package not found: radeon-firmware"
1 package Xconfig::proprietary; # $Id: proprietary.pm 269741 2010-06-02 09:25:33Z cfergeau $
2
3 use diagnostics;
4 use strict;
5
6 use common;
7 use Xconfig::card;
8
9 my $lib = arch() =~ /x86_64/ ? "lib64" : "lib";
10 my $libdir = "/usr/$lib";
11
12 sub install_matrox_hal {
13 my ($prefix) = @_;
14 my $tmpdir = "$prefix/root/tmp";
15
16 my $tar = "mgadrivers-2.0.tgz";
17 my $dir_in_tar = "mgadrivers";
18 my $dest_dir = "$prefix/usr/lib/xorg/modules/drivers";
19
20 #- already installed
21 return if -e "$dest_dir/mga_hal_drv.o" || $::testing;
22
23 system("wget -O $tmpdir/$tar ftp://ftp.matrox.com/pub/mga/archive/linux/2002/$tar") if !-e "$tmpdir/$tar";
24 system("tar xzC $tmpdir -f $tmpdir/$tar");
25
26 my $src_dir = "$tmpdir/$dir_in_tar/xfree86/4.2.1/drivers";
27 foreach (all($src_dir)) {
28 my $src = "$src_dir/$_";
29 my $dest = "$dest_dir/$_";
30 rename $dest, "$dest.non_hal";
31 cp_af($src, $dest_dir);
32 }
33 rm_rf("$tmpdir/$tar");
34 rm_rf("$tmpdir/$dir_in_tar");
35 }
36
37 sub handle_DRIVER2_NO_SSE {
38 my ($card) = @_;
39
40 $card->{DRIVER2_NO_SSE} || $card->{DRIVER2_NEEDS_SSE} or return;
41
42 require detect_devices;
43 if (!detect_devices::has_cpu_flag('sse')) {
44 my $driver = $card->{DRIVER2_NEEDS_SSE} ? $card->{DRIVER} : $card->{DRIVER2_NO_SSE};
45 log::l("$card->{Driver2} need a processor featuring SSE, switching back to $driver");
46 $card->{Driver2} = $driver;
47 }
48 }
49
50 sub handle_FIRMWARE {
51 my ($do_pkgs, $card, $o_in) = @_;
52
53 my $pkg = $card->{FIRMWARE} or return;
54
55 $do_pkgs->is_installed($pkg) || ($do_pkgs->is_available($pkg) && $do_pkgs->install($pkg)) and return;
56
57 if ($card->{DRIVER_NO_FIRMWARE}) {
58 log::l("$card->{Driver} need a firmware to work, switching back to $card->{DRIVER_NO_FIRMWARE}");
59
60 # do not show warning if the user selected the proprietary driver
61 !$card->{Driver2} and $o_in and $o_in->ask_warn('', N("The free '%s' driver for your graphics card requires a proprietary firmware package '%s' to be installed, but it was not available on the enabled media.\n\nThe basic non-accelerated '%s' driver will be configured instead.\n\nTo enable full graphics support later, enable the 'nonfree' repository section at \"Install and remove software\" and reconfigure the graphics driver by going to \"Set up the graphical server\" at Mageia Control Center and re-selecting your graphics card.", $card->{Driver}, $card->{FIRMWARE}, $card->{DRIVER_NO_FIRMWARE}));
62
63 $card->{Driver} = $card->{DRIVER_NO_FIRMWARE};
64
65 } else {
66 log::l("$card->{Driver} needs a firmware to work smoothly/better (eg: 3D, KMS) but will still work");
67
68 # do not show warning if the user selected the proprietary driver
69 !$card->{Driver2} and $o_in and $o_in->ask_warn('', N("The free '%s' driver for your graphics card requires a proprietary firmware package '%s' to be installed in order for all features (including 3D acceleration) to work properly, but that package was not available in the enabled media.\n\nTo enable all graphics card features later, enable the 'nonfree' repository section at \"Install and remove software\" and install the firmware package manually or reconfigure your graphics card.", $card->{Driver}, $card->{FIRMWARE}));
70 }
71 }
72
73
74 sub pkgs_for_Driver2 {
75 my ($Driver2, $do_pkgs) = @_;
76
77 my ($pkg, $base_name) = $Driver2 =~ /^fglrx|^nvidia/ ?
78 ("x11-driver-video-$Driver2", $Driver2) : () or return;
79
80 $do_pkgs->is_installed($pkg) || $do_pkgs->is_available($pkg) or
81 log::l("proprietary package $pkg not available"), return;
82
83 my $module_pkgs = $do_pkgs->check_kernel_module_packages($base_name) or
84 log::l("$pkg available, but no kernel module package (for installed kernels, and no dkms)"), return;
85
86 ($pkg, @$module_pkgs);
87 }
88
89 sub may_use_Driver2 {
90 my ($card) = @_;
91
92 my $modules_dir = Xconfig::card::modules_dir();
93 #- make sure everything is correct at this point, packages have really been installed
94 #- and driver and GLX extension is present.
95
96 my $check_drv = sub {
97 my ($drv, $o_subdir) = @_;
98 my @l = (if_($o_subdir, "$modules_dir/drivers/$o_subdir/$drv.so",
99 "$libdir/$o_subdir/xorg/$drv.so"),
100 "$modules_dir/drivers/$drv.so",
101 "$modules_dir/drivers/$drv.o");
102 my $has = find { -e "$::prefix$_" } @l;
103 $has or log::l("proprietary $drv driver missing (we searched for: @l)");
104 $has;
105 };
106
107 my $card2 = {
108 %$card,
109 $card->{Driver2} =~ /^(fglrx|nvidia)(.*)/ ?
110 (Driver => $1, DriverVersion => $2) :
111 (Driver => $card->{Driver2}),
112 };
113
114 if ($card2->{Driver} eq 'nvidia') {
115 $check_drv->('nvidia_drv', "nvidia$card2->{DriverVersion}") or return;
116
117 my $libglx_path = "$libdir/nvidia$card2->{DriverVersion}/xorg";
118 -e "$::prefix$libglx_path/libglx.so" or log::l("special NVIDIA libglx missing"), return;
119
120 log::explanations("Using specific NVIDIA driver and GLX extensions");
121 $card2->{DRI_GLX_SPECIAL} = 1;
122 $card2->{Options}{IgnoreEDID} = 1 if $card2->{DriverVersion} eq "71xx";
123 $card2->{Options}{UseEDID} = 0 if $card2->{DriverVersion} eq "96xx";
124 $card2;
125 } elsif ($card2->{Driver} eq 'fglrx') {
126 $check_drv->('fglrx_drv', "fglrx$card2->{DriverVersion}") or return;
127 find { -e "$::prefix/$_/dri/fglrx_dri.so" } (
128 "$libdir/fglrx$card2->{DriverVersion}", $modules_dir, $libdir) or
129 log::l("proprietary fglrx_dri.so missing"), return;
130
131 log::explanations("Using specific ATI fglrx and DRI drivers");
132 $card2->{DRI_GLX} = 1;
133 $card2;
134 } else {
135 undef;
136 }
137 }
138
139 1;
140

  ViewVC Help
Powered by ViewVC 1.1.30