summaryrefslogtreecommitdiffstats
path: root/ddcprobe
diff options
context:
space:
mode:
Diffstat (limited to 'ddcprobe')
-rw-r--r--ddcprobe/ddcprobe.c48
-rw-r--r--ddcprobe/svgamodes.c79
-rw-r--r--ddcprobe/vbe.c70
3 files changed, 127 insertions, 70 deletions
diff --git a/ddcprobe/ddcprobe.c b/ddcprobe/ddcprobe.c
index 2389ddf5d..b3fd7d1d6 100644
--- a/ddcprobe/ddcprobe.c
+++ b/ddcprobe/ddcprobe.c
@@ -99,10 +99,10 @@ int main(int argc, char **argv)
edid_info->week, edid_info->year + 1990);
printf("Input signal type: %s%s%s%s.\n",
- edid_info->video_input & 0x01 ? "separate sync, " : "",
- edid_info->video_input & 0x02 ? "composite sync, " : "",
- edid_info->video_input & 0x04 ? "sync on green, " : "",
- edid_info->video_input & 0x80 ?
+ edid_info->video_input.separate_sync ? "separate sync, " : "",
+ edid_info->video_input.composite_sync ? "composite sync, " : "",
+ edid_info->video_input.sync_on_green ? "sync on green, " : "",
+ edid_info->video_input.digital ?
"digital signal" : "analog signal");
printf("Screen size max %d cm horizontal, %d cm vertical.\n",
@@ -112,43 +112,43 @@ int main(int argc, char **argv)
printf("Gamma: %f.\n", edid_info->gamma / 100.0 + 1);
printf("DPMS flags: %s, %s%s, %s%s, %s%s.\n",
- edid_info->dpms_flags & 0x08 ? "RGB" : "non-RGB",
- edid_info->dpms_flags & 0x20 ? "" : "no ", "active off",
- edid_info->dpms_flags & 0x40 ? "" : "no ", "suspend",
- edid_info->dpms_flags & 0x80 ? "" : "no ", "standby");
+ edid_info->dpms_flags.rgb ? "RGB" : "non-RGB",
+ edid_info->dpms_flags.active_off ? "" : "no ", "active off",
+ edid_info->dpms_flags.suspend ? "" : "no ", "suspend",
+ edid_info->dpms_flags.standby ? "" : "no ", "standby");
printf("Established timings:\n");
- if(edid_info->established_timings1 & 0x01)
+ if(edid_info->established_timings.timing_720x400_70)
printf("\t720x400 @ 70 Hz (VGA 640x400, IBM)\n");
- if(edid_info->established_timings1 & 0x02)
+ if(edid_info->established_timings.timing_720x400_88)
printf("\t720x400 @ 88 Hz (XGA2)\n");
- if(edid_info->established_timings1 & 0x04)
+ if(edid_info->established_timings.timing_640x480_60)
printf("\t640x480 @ 60 Hz (VGA)\n");
- if(edid_info->established_timings1 & 0x08)
+ if(edid_info->established_timings.timing_640x480_67)
printf("\t640x480 @ 67 Hz (Mac II, Apple)\n");
- if(edid_info->established_timings1 & 0x10)
+ if(edid_info->established_timings.timing_640x480_72)
printf("\t640x480 @ 72 Hz (VESA)\n");
- if(edid_info->established_timings1 & 0x20)
+ if(edid_info->established_timings.timing_640x480_75)
printf("\t640x480 @ 75 Hz (VESA)\n");
- if(edid_info->established_timings1 & 0x40)
+ if(edid_info->established_timings.timing_800x600_56)
printf("\t800x600 @ 56 Hz (VESA)\n");
- if(edid_info->established_timings1 & 0x80)
+ if(edid_info->established_timings.timing_800x600_60)
printf("\t800x600 @ 60 Hz (VESA)\n");
- if(edid_info->established_timings2 & 0x01)
+ if(edid_info->established_timings.timing_800x600_72)
printf("\t800x600 @ 72 Hz (VESA)\n");
- if(edid_info->established_timings2 & 0x02)
+ if(edid_info->established_timings.timing_800x600_75)
printf("\t800x600 @ 75 Hz (VESA)\n");
- if(edid_info->established_timings2 & 0x04)
+ if(edid_info->established_timings.timing_832x624_75)
printf("\t832x624 @ 75 Hz (Mac II)\n");
- if(edid_info->established_timings2 & 0x08)
+ if(edid_info->established_timings.timing_1024x768_87i)
printf("\t1024x768 @ 87 Hz Interlaced (8514A)\n");
- if(edid_info->established_timings2 & 0x10)
+ if(edid_info->established_timings.timing_1024x768_60)
printf("\t1024x768 @ 60 Hz (VESA)\n");
- if(edid_info->established_timings2 & 0x20)
+ if(edid_info->established_timings.timing_1024x768_70)
printf("\t1024x768 @ 70 Hz (VESA)\n");
- if(edid_info->established_timings2 & 0x40)
+ if(edid_info->established_timings.timing_1024x768_75)
printf("\t1024x768 @ 75 Hz (VESA)\n");
- if(edid_info->established_timings2 & 0x80)
+ if(edid_info->established_timings.timing_1280x1024_75)
printf("\t1280x1024 @ 75 Hz (VESA)\n");
/* Standard timings. */
diff --git a/ddcprobe/svgamodes.c b/ddcprobe/svgamodes.c
index 5902db60d..4fa3f0020 100644
--- a/ddcprobe/svgamodes.c
+++ b/ddcprobe/svgamodes.c
@@ -18,22 +18,32 @@
#include "bioscall.h"
#ident "$Id$"
+int compare_16(const void *i1, const void *i2)
+{
+ const u_int16_t *I1, *I2;
+ I1 = (const u_int16_t*) i1;
+ I2 = (const u_int16_t*) i2;
+ if(*I1 < *I2) return -1;
+ if(*I1 > *I2) return 1;
+ return 0;
+}
+
int main(int argc, char **argv)
{
struct vbe_info *vbe_info = NULL;
struct vbe_mode_info *mode_info = NULL;
u_int16_t *mode_list = NULL;
+ int mode_count = 0;
float vesa_version;
- /* Interpret results. */
+ /* Get basic information. */
vbe_info = vbe_get_vbe_info();
-
if(vbe_info == NULL) {
printf("VESA BIOS Extensions not detected.\n");
exit(0);
}
- /* Signature. */
+ /* Print the signature, should be "VESA <digit>.<digit>". */
printf("%c%c%c%c %d.%d detected.\n",
vbe_info->signature[0], vbe_info->signature[1],
vbe_info->signature[2], vbe_info->signature[3],
@@ -43,27 +53,42 @@ int main(int argc, char **argv)
/* List supported standard modes. */
mode_list = vbe_info->mode_list.list;
if(*mode_list != 0xffff) {
- printf("Supported standard modes:\n");
+ printf("Supported modes:\n");
+ }
+ /* Count the number of modes. */
+ for(;*mode_list != 0xffff; mode_list++) {
+ mode_count++;
+ }
+ /* Sort the mode list, because my ATI doesn't. Grrr... */
+ mode_list = vbe_info->mode_list.list;
+ if(*mode_list != 0xffff) {
+ qsort(mode_list, mode_count, sizeof(u_int16_t), compare_16);
}
+ /* Dump info about the video mode. */
for(;*mode_list != 0xffff; mode_list++) {
int j;
+ /* Mode number. */
printf("0x%03x\t", *mode_list);
for(j = 0; known_vesa_modes[j].x != 0; j++) {
+ /* If it's a standard mode, print info about it. */
if(known_vesa_modes[j].number == *mode_list) {
- printf("%dx%d, %d colors",
+ printf("Specs list this as %dx%d, %d colors.",
known_vesa_modes[j].x,
known_vesa_modes[j].y,
known_vesa_modes[j].colors);
}}
printf("\n");
+ /* Get mode information from the BIOS. Should never fail. */
mode_info = vbe_get_mode_info(*mode_list);
if(mode_info == NULL) {
- printf("Get mode information not supported.\n");
+ printf("Get mode information not supported by BIOS.\n");
exit(0);
}
+ /* Report what the BIOS says about the mode, should agree
+ with VESA on standard modes. */
if(mode_info->w && mode_info->h && mode_info->bpp) {
- printf("\tBIOS reports %dx%d, %d bpp",
+ printf("\tBIOS reports this as %dx%d, %d bpp",
mode_info->w, mode_info->h,
mode_info->bpp);
}
@@ -72,20 +97,44 @@ int main(int argc, char **argv)
mode_info->bytes_per_scanline);
}
printf("\n");
- printf("\t%s, ", mode_info->mode_attributes & 0x01 ?
+ /* Check the 'supported' bit. Should be set, because this is
+ in the main supported modes list. */
+ printf("\t%s, ", mode_info->mode_attributes.supported ?
"Supported" : "Not supported");
- printf("%s ", mode_info->mode_attributes & 0x08 ?
+ /* Color? Graphics? */
+ printf("%s ", mode_info->mode_attributes.color ?
"Color" : "Monochrome");
- printf("%s.\n", mode_info->mode_attributes & 0x10 ?
+ printf("%s.\n", mode_info->mode_attributes.graphics ?
"Graphics" : "Text");
+ /* Check for LFB stuff. Ralf's list says that you need to
+ query with bit 14 set to check if an LFB version of the mode
+ is available, but the ATI always returns true. */
if(vesa_version >= 2.0) {
- printf("\tLFB mode %s.\n",
- mode_info->mode_attributes & 0x80 ?
- "supported" : "not supported");
+ /* Regular info about the current mode. */
+ struct vbe_mode_info *info = NULL;
printf("\t%sVGA compatible.\n",
- mode_info->mode_attributes & 0x20 ?
- "" : "Not ");
+ mode_info->mode_attributes.not_vga_compatible ?
+ "Not " : "");
+ printf("\tThis is %san LFB mode.\n",
+ mode_info->mode_attributes.lfb ?
+ "" : "not ");
+ /* Info about the LFB variant mode (bit 14 set). */
+ info = vbe_get_mode_info(*mode_list |
+ VBE_LINEAR_FRAMEBUFFER);
+ if(info) {
+ if(info->mode_attributes.lfb) {
+ printf("\tLFB variant available.\n");
+ }
+ free(info);
+ }
+ if((mode_info->mode_attributes.lfb) ||
+ (info && (info->mode_attributes.lfb))) {
+ printf("\tLFB at address 0x%8x.\n",
+ mode_info->linear_buffer_address);
+ }
}
+ /* Memory model: EGA = icky bit planes, packed-pixel = palette,
+ direct color = LFB compatible but needs bank switches. */
printf("\tMemory model: ");
switch(mode_info->memory_model) {
case memory_model_text: {
diff --git a/ddcprobe/vbe.c b/ddcprobe/vbe.c
index 6f4a2d7c2..23bec4fd8 100644
--- a/ddcprobe/vbe.c
+++ b/ddcprobe/vbe.c
@@ -314,15 +314,21 @@ struct vbe_modeline *vbe_get_edid_modelines()
return NULL;
}
- for(i = 0; i < 8; i++) {
- if(edid->established_timings1 & (1 << i)) {
- modeline_count++;
- }
- if(edid->established_timings2 & (1 << i)) {
+ memcpy(buf, &edid->established_timings,
+ sizeof(edid->established_timings));
+ for(i = 0; i < (8 * sizeof(edid->established_timings)); i++) {
+ if(buf[i / 8] & (1 << (i % 8))) {
modeline_count++;
}
- if((edid->standard_timing[i].xresolution >= 2) ||
- (edid->standard_timing[i].vfreq >= 2)) {
+ }
+
+ /* Count the number of standard timings. */
+ for(i = 0; i < 8; i++) {
+ int x, v;
+ x = edid->standard_timing[i].xresolution;
+ v = edid->standard_timing[i].vfreq;
+ if(((edid->standard_timing[i].xresolution & 0x01) != x) &&
+ ((edid->standard_timing[i].vfreq & 0x01) != v)) {
modeline_count++;
}
}
@@ -336,98 +342,98 @@ struct vbe_modeline *vbe_get_edid_modelines()
modeline_count = 0;
/* Fill out established timings. */
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING1_720x400_70) {
+ if(edid->established_timings.timing_720x400_70) {
ret[modeline_count].width = 720;
ret[modeline_count].height = 400;
ret[modeline_count].refresh = 70;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING1_720x400_88) {
+ if(edid->established_timings.timing_720x400_88) {
ret[modeline_count].width = 720;
ret[modeline_count].height = 400;
ret[modeline_count].refresh = 88;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING1_640x480_60) {
+ if(edid->established_timings.timing_640x480_60) {
ret[modeline_count].width = 640;
ret[modeline_count].height = 480;
ret[modeline_count].refresh = 60;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING1_640x480_67) {
+ if(edid->established_timings.timing_640x480_67) {
ret[modeline_count].width = 640;
ret[modeline_count].height = 480;
ret[modeline_count].refresh = 67;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING1_640x480_72) {
+ if(edid->established_timings.timing_640x480_72) {
ret[modeline_count].width = 640;
ret[modeline_count].height = 480;
ret[modeline_count].refresh = 72;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING1_640x480_75) {
+ if(edid->established_timings.timing_640x480_75) {
ret[modeline_count].width = 640;
ret[modeline_count].height = 480;
ret[modeline_count].refresh = 75;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING1_800x600_56) {
+ if(edid->established_timings.timing_800x600_56) {
ret[modeline_count].width = 800;
ret[modeline_count].height = 600;
ret[modeline_count].refresh = 56;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING1_800x600_60) {
+ if(edid->established_timings.timing_800x600_60) {
ret[modeline_count].width = 800;
ret[modeline_count].height = 600;
ret[modeline_count].refresh = 60;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING2_800x600_72) {
+ if(edid->established_timings.timing_800x600_72) {
ret[modeline_count].width = 800;
ret[modeline_count].height = 600;
ret[modeline_count].refresh = 72;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING2_800x600_75) {
+ if(edid->established_timings.timing_800x600_75) {
ret[modeline_count].width = 800;
ret[modeline_count].height = 600;
ret[modeline_count].refresh = 75;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING2_832x624_75) {
+ if(edid->established_timings.timing_832x624_75) {
ret[modeline_count].width = 832;
ret[modeline_count].height = 624;
ret[modeline_count].refresh = 75;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING2_1024x768_87i) {
+ if(edid->established_timings.timing_1024x768_87i) {
ret[modeline_count].width = 1024;
ret[modeline_count].height = 768;
ret[modeline_count].refresh = 87;
ret[modeline_count].interlaced = 1;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING2_1024x768_60){
+ if(edid->established_timings.timing_1024x768_60){
ret[modeline_count].width = 1024;
ret[modeline_count].height = 768;
ret[modeline_count].refresh = 60;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING2_1024x768_70){
+ if(edid->established_timings.timing_1024x768_70){
ret[modeline_count].width = 1024;
ret[modeline_count].height = 768;
ret[modeline_count].refresh = 70;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING2_1024x768_75){
+ if(edid->established_timings.timing_1024x768_75){
ret[modeline_count].width = 1024;
ret[modeline_count].height = 768;
ret[modeline_count].refresh = 75;
modeline_count++;
}
- if(edid->established_timings1&VBE_EDID_ESTABLISHED_TIMING2_1280x1024_75) {
+ if(edid->established_timings.timing_1280x1024_75) {
ret[modeline_count].width = 1280;
ret[modeline_count].height = 1024;
ret[modeline_count].refresh = 75;
@@ -437,20 +443,22 @@ struct vbe_modeline *vbe_get_edid_modelines()
/* Add in standard timings. */
for(i = 0; i < 8; i++) {
float aspect = 1;
- int x;
- if((edid->standard_timing[i].xresolution >= 2) ||
- (edid->standard_timing[i].vfreq >= 2)) {
- switch(edid->standard_timing[i].vfreq >> 6) {
- case 1: aspect = 0.7500; break;
- case 2: aspect = 0.8000; break;
- case 3: aspect = 0.5625; break;
+ int x, v;
+ x = edid->standard_timing[i].xresolution;
+ v = edid->standard_timing[i].vfreq;
+ if(((edid->standard_timing[i].xresolution & 0x01) != x) &&
+ ((edid->standard_timing[i].vfreq & 0x01) != v)) {
+ switch(edid->standard_timing[i].aspect) {
+ case aspect_75: aspect = 0.7500; break;
+ case aspect_8: aspect = 0.8000; break;
+ case aspect_5625: aspect = 0.5625; break;
default: aspect = 1; break;
}
x = (edid->standard_timing[i].xresolution + 31) * 8;
ret[modeline_count].width = x;
ret[modeline_count].height = x * aspect;
ret[modeline_count].refresh =
- (edid->standard_timing[i].vfreq & 0x1f) + 60;
+ edid->standard_timing[i].vfreq + 60;
modeline_count++;
}
}