summaryrefslogtreecommitdiffstats
path: root/test/check.pl
blob: a09d143d5365eeeec5780ddeb25281a03e3cf5ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/perl

use lib qw(/usr/lib/libDrakX);
use Xconfig::glx;
use Data::Dumper;

my %free = (
    r300 => [ qw(direct_rendering native) ],
    i810 => [ qw(direct_rendering native Xgl) ],
    nv => [],
);
my %proprietary = (
    nvidia => [ qw(direct_rendering Xgl) ],
    nvidia_legacy => [ qw(direct_rendering Xgl) ],
    nvidia_native => [ qw(direct_rendering native Xgl) ],
    fglrx => [ qw(direct_rendering Xgl) ],
);

sub check_driver {
    my ($driver, $proprietary) = @_;
    foreach my $server (qw(Xorg Xgl)) {
        my $mesa_file = "glxinfo.$driver-mesa-$server.txt";
        -f $mesa_file or warn "unable to read $mesa_file", next;
        my $proprietary_file;
        if ($proprietary) {
            $proprietary_file = "glxinfo.$driver-$driver-$server.txt";
            -f $proprietary_file or die "unable to read $proprietary_file";
        }
        my $glx_status = Xconfig::glx::get_glx_status($mesa_file, $proprietary_file);
        print join("\n",
                   "* $driver, $server",
                   "detected Mesa: $glx_status->{context}{Mesa}",
                   "detected Xgl: $glx_status->{context}{Xgl}",
                   "capabilities: " . join(", ", grep { $glx_status->{capabilities}{$_} } keys %{$glx_status->{capabilities}}),
                   "",
               );
        ($server eq 'Xgl') == $glx_status->{context}{Xgl} or die Dumper($glx_status) . "Xgl detection mismatch for $driver-$server";
    }
}

check_driver($_) foreach sort(keys %free);
check_driver($_, 1) foreach sort(keys %proprietary);