summaryrefslogtreecommitdiffstats
path: root/perl-install/Xconfig
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/Xconfig')
-rw-r--r--perl-install/Xconfig/monitor.pm34
-rw-r--r--perl-install/Xconfig/resolution_and_depth.pm2
-rw-r--r--perl-install/Xconfig/various.pm6
-rw-r--r--perl-install/Xconfig/xfree.pm103
4 files changed, 106 insertions, 39 deletions
diff --git a/perl-install/Xconfig/monitor.pm b/perl-install/Xconfig/monitor.pm
index ccd9b4c50..abd141236 100644
--- a/perl-install/Xconfig/monitor.pm
+++ b/perl-install/Xconfig/monitor.pm
@@ -64,7 +64,7 @@ sub configure_auto_install {
put_in_hash($monitor, $auto_install_monitor);
} $monitors, $old_X->{monitors} if $old_X->{monitors};
- if (!$monitors->[0]{HorizSync}) {
+ if (!$monitors->[0]{HorizSync} && !($monitors->[0]{VendorName} && $monitors->[0]{ModelName})) {
put_in_hash($monitors->[0], getinfoFromDDC());
}
@@ -171,27 +171,23 @@ sub configure_automatic {
}
sub getinfoFromDDC() {
- my ($VideoRam, @l) = any::ddcxinfos() or return;
+ my ($edid, $vbe) = any::monitor_full_edid() or return;
+ my $monitor = eval($edid);
- my @Modes;
- local $_;
- while (($_ = shift @l) ne "\n") {
- my ($depth, $x, $y) = split;
- $depth = int(log($depth) / log(2)) if $depth;
-
- push @Modes, [ $x, $y, $depth ];
+ if ($vbe =~ /Memory: (\d+)k/) {
+ $monitor->{VideoRam_probed} = $1;
+ }
+ $monitor->{ModeLine} = Xconfig::xfree::default_ModeLine();
+ foreach (@{$monitor->{detailed_timings} || []}) {
+ unshift @{$monitor->{ModeLine}},
+ { val => $_->{ModeLine}, pre_comment => $_->{ModeLine_comment} . "\n" };
}
- my ($h, $v, $size, @_modes) = @l;
- {
- VideoRam_probed => to_int($VideoRam),
- HorizSync => first($h =~ /^(\S*)/),
- VertRefresh => first($v =~ /^(\S*)/),
- size => to_float($size),
- if_($size =~ /EISA ID=(\S*)/, EISA_ID => lc($1), VendorName => "Plug'n Play"),
- #- not-used-anymore Modes => \@Modes,
- #- not-used-anymore ModeLines => join('', @m),
- };
+ if ($monitor->{EISA_ID}) {
+ $monitor->{VendorName} = "Plug'n Play";
+ $monitor->{ModelName} = $monitor->{monitor_name};
+ }
+ $monitor;
}
sub monitors_db() {
diff --git a/perl-install/Xconfig/resolution_and_depth.pm b/perl-install/Xconfig/resolution_and_depth.pm
index 4f06c3647..9287ddce4 100644
--- a/perl-install/Xconfig/resolution_and_depth.pm
+++ b/perl-install/Xconfig/resolution_and_depth.pm
@@ -144,7 +144,7 @@ sub choices {
@resolutions = filter_using_VideoRam($card->{VideoRam}, @resolutions) if $card->{VideoRam};
my $x_res = do {
- my $res = $resolution_wanted->{X} || ($monitors->[0]{ModelName} =~ /^Flat Panel (\d+x\d+)$/ ? $1 : size2default_resolution($monitors->[0]{size} || 14));
+ my $res = $resolution_wanted->{X} || ($monitors->[0]{ModelName} =~ /^Flat Panel (\d+x\d+)$/ ? $1 : size2default_resolution($monitors->[0]{diagonal_size} * 1.08 || 14));
my $x_res = first(split 'x', $res);
#- take the first available resolution <= the wanted resolution
max map { if_($_->{X} <= $x_res, $_->{X}) } @resolutions;
diff --git a/perl-install/Xconfig/various.pm b/perl-install/Xconfig/various.pm
index 657c26b2f..6a8a93551 100644
--- a/perl-install/Xconfig/various.pm
+++ b/perl-install/Xconfig/various.pm
@@ -107,13 +107,13 @@ sub configure_FB_TVOUT {
my $raw_X = Xconfig::default::configure($do_pkgs);
return if is_empty_array_ref($raw_X);
- $raw_X->set_monitors({ HorizSync => '30-50', VertRefresh => ($use_FB_TVOUT->{norm} eq 'NTSC' ? 60 : 50) });
- first($raw_X->get_Sections('Monitor'))->{ModeLine} = [
+ $raw_X->set_monitors({ HorizSync => '30-50', VertRefresh => ($use_FB_TVOUT->{norm} eq 'NTSC' ? 60 : 50),
+ ModeLine => [
{ val => '"640x480" 29.50 640 675 678 944 480 530 535 625', pre_comment => "# PAL\n" },
{ val => '"800x600" 36.00 800 818 820 960 600 653 655 750' },
{ val => '"640x480" 28.195793 640 656 658 784 480 520 525 600', pre_comment => "# NTSC\n" },
{ val => '"800x600" 38.769241 800 812 814 880 600 646 649 735' },
- ];
+ ] });
$raw_X->set_devices({ Driver => 'fbdev' });
my ($device) = $raw_X->get_devices;
diff --git a/perl-install/Xconfig/xfree.pm b/perl-install/Xconfig/xfree.pm
index d66c6634d..365343ee2 100644
--- a/perl-install/Xconfig/xfree.pm
+++ b/perl-install/Xconfig/xfree.pm
@@ -258,7 +258,7 @@ sub set_synaptics {
################################################################################
# monitor ######################################################################
################################################################################
-my @monitor_fields = qw(VendorName ModelName HorizSync VertRefresh);
+my @monitor_fields = qw(VendorName ModelName HorizSync VertRefresh ModeLine);
sub get_monitors {
my ($raw_X) = @_;
my @raw_monitors = $raw_X->get_Sections('Monitor');
@@ -285,9 +285,11 @@ sub get_or_new_monitors {
}
sub _new_monitor_sections {
my ($raw_X, $nb_new) = @_;
- my $ModeLine = ModeLine_from_string(qq(Section "Monitor"\n) . (our $default_ModeLine) . qq(EndSection\n));
$raw_X->remove_Section('Monitor');
- map { $raw_X->add_Section('Monitor', { Identifier => { val => "monitor$_" }, ModeLine => $ModeLine }) } (1 .. $nb_new);
+ map { $raw_X->add_Section('Monitor', { Identifier => { val => "monitor$_" }, ModeLine => default_ModeLine() }) } (1 .. $nb_new);
+}
+sub default_ModeLine() {
+ ModeLine_from_string(qq(Section "Monitor"\n) . (our $default_ModeLine) . qq(EndSection\n));
}
@@ -475,21 +477,90 @@ sub ModeLine_from_string {
-our @resolutions = (
- '640x480',
- '800x600',
- '1024x480', '1024x768',
- '1152x768', '1152x864',
- '1280x800', # 16/10,
- '1280x960', '1280x1024',
- '1400x1050',
- '1600x1200',
- '1680x1050', # 16/10
- '1920x1200', # 16/10
- '1920x1440',
- '2048x1536',
+# http://home.comcast.net/~igpl/Aspect.html
+# movies http://www.technosound.co.uk/nav.php?pageid=hcg_widescreen
+
+# www.dell.com/downloads/global/vectors/2003_cvt.pdf
+# file vesamodes in Xorg is DMT Standard Display Modes
+
+# http://www.vesa.org/Public
+# http://www.vesa.org/Public/EEDIDguideV1.pdf
+
+#- http://www.vesa.org/Public/CVT
+our @CVT_ratios = qw(5/4 4/3 3/2 16/10 15/9 16/9);
+our @CVT_vfreqs = qw(50 60 75 85); # and also 60Hz "reduced blanking" in CVT
+
+our @more_vfreq = qw(100 120);
+
+our %ratio2resolutions = (
+
+ # first all the CVT_ratios
+
+ # 1.25
+ '5/4' => [ qw(640x512 720x576 1280x1024 1800x1440) ],
+
+ # 1.33
+ '4/3' => [
+ qw(320x240 480x360 640x480 800x600 832x624
+ 1024x768 1152x864 1280x960 1400x1050
+ 1600x1200 1920x1440 2048x1536),
+ ],
+
+ # 1.5
+ '3/2' => [ qw(360x240 720x480 1152x768) ],
+
+ # 1.6
+ '16/10' => [ qw(1280x800 1440x900 1600x1000 1680x1050 1920x1200) ],
+
+ # 1.67
+ '15/9' => [ qw(1280x768) ],
+
+ # 1.78
+ '16/9' => [ qw(1280x720 1600x900 1920x1080) ],
+
+
+ # now more weird things
+
+ # 1.32
+ # '192/145' => [ qw(1152x870) ],
+
+ # 1.42
+ # '17/12' => [ qw(544x384) ] ,
+
+ # 1.56
+ # '25/16' => [ qw(1600x1024) ],
+
+ # 1.775
+ # '71/15' => [ qw(852x480) ],
+
+ N_("_:weird aspect ratio\nother") => [
+ # 2.13 = 32/15
+ qw(1024x480), # VAIO
+
+ # 2.67 = 8/3
+ qw(2048x768 2560x960 3200x1200),
+
+ # 4.0 = 4/1
+ qw(3072x768 3456x864 3840x960 4800x1200),
+
+ # ?? 352x288
+ ],
);
+our @resolutions;
+foreach my $ratio (keys %ratio2resolutions) {
+ if ($ratio =~ m!^(\d+)/(\d+)$!) {
+ my $eval = $2 / $1;
+ foreach (@{$ratio2resolutions{$ratio}}) {
+ my ($x, $y) = /(\d+)x(\d+)/;
+ my $y2 = round($x * $eval);
+ $y == $y2 or die "bad resolution $_ for ratio $ratio, it should be $x x $y2\n";
+ }
+ }
+ push @resolutions, @{$ratio2resolutions{$ratio}};
+}
+
+
our $default_header = <<'END';
# File generated by XFdrake.