diff -Nru /tmp/xZ9d29VZOF/vbetool-0.5/debian/changelog /tmp/5P81qzCs8L/vbetool-0.6/debian/changelog --- /tmp/xZ9d29VZOF/vbetool-0.5/debian/changelog 2005-11-30 00:12:08.000000000 +0000 +++ /tmp/5P81qzCs8L/vbetool-0.6/debian/changelog 2006-03-15 21:40:33.000000000 +0000 @@ -1,3 +1,11 @@ +vbetool (0.6-1) unstable; urgency=low + + * Add code to get the flat panel-id and native resolution via 0x4ff/0x01 + use: vbetool vbecall panelsize + * Remove extranous copying of config.{sub,guess} on build + + -- Paul Sladen Wed, 15 Mar 2006 21:32:35 +0000 + vbetool (0.5-1) unstable; urgency=low * Fix non-i386 build issues diff -Nru /tmp/xZ9d29VZOF/vbetool-0.5/debian/rules /tmp/5P81qzCs8L/vbetool-0.6/debian/rules --- /tmp/xZ9d29VZOF/vbetool-0.5/debian/rules 2005-11-23 02:51:05.000000000 +0000 +++ /tmp/5P81qzCs8L/vbetool-0.6/debian/rules 2006-03-15 21:20:39.000000000 +0000 @@ -56,14 +56,6 @@ -$(MAKE) clean -$(MAKE) distclean -ifneq "$(wildcard /usr/share/misc/config.sub)" "" - cp -f /usr/share/misc/config.sub config.sub -endif -ifneq "$(wildcard /usr/share/misc/config.guess)" "" - cp -f /usr/share/misc/config.guess config.guess -endif - - dh_clean install: build diff -Nru /tmp/xZ9d29VZOF/vbetool-0.5/vbetool.c /tmp/5P81qzCs8L/vbetool-0.6/vbetool.c --- /tmp/xZ9d29VZOF/vbetool-0.5/vbetool.c 2005-07-21 18:14:55.000000000 +0100 +++ /tmp/5P81qzCs8L/vbetool-0.6/vbetool.c 2006-03-13 18:55:37.000000000 +0000 @@ -38,8 +38,12 @@ int main(int argc, char *argv[]) { + /* Don't bother checking for privilege if they only want usage() */ + if (argc < 2) + goto usage; + if (!LRMI_init()) { - fprintf(stderr, "Failed to initialise LRMI.\n"); + fprintf(stderr, "Failed to initialise LRMI (Linux Real-Mode Interface).\n"); return 1; } @@ -50,9 +54,7 @@ pacc->numeric_ids = 1; pci_init(pacc); - if (argc < 2) { - goto usage; - } else if (!strcmp(argv[1], "vbestate")) { + if (!strcmp(argv[1], "vbestate")) { /* VBE save/restore tends to break when done underneath X */ int err = check_console(); @@ -111,10 +113,18 @@ } else { return disable_vga(); } + } else if (!strcmp(argv[1], "vbecall")) { + if (!strcmp(argv[2], "panelid")) { + return do_get_panel_id(0); + } else if (!strcmp(argv[2], "panelsize")) { + return do_get_panel_id(1); + } else { + return 1; + } } else { usage: fprintf(stderr, - "%s: Usage %s [[vbestate save|restore]|[vbemode set|get]|[vgamode]|[dpms on|off|standby|suspend|reduced]|[post]|[vgastate on|off]]\n", + "%s: Usage %s [[vbestate save|restore]|[vbemode set|get]|[vgamode]|[dpms on|off|standby|suspend|reduced]|[post]|[vgastate on|off]|[vbecall panelid|panelsize]]\n", argv[0], argv[0]); return 1; } @@ -389,3 +399,65 @@ outb(~0x01 & inb(0x102), 0x102); return 0; } + +/* Based on xserver-xorg-driver-i810/src/i830_driver.c */ +struct panel_id { + int hsize:16, vsize:16; + int fptype:16; + int redbpp:8, greenbpp:8, bluebpp:8, reservedbpp:8; + int rsvdoffscrnmemsize:32, rsvdoffscrnmemptr:32; + char reserved[14]; +} __attribute__((packed)); + +int do_get_panel_id(int just_dimensions) +{ + reg_frame r = { + .eax = 0x4f11, + .ebx = 0x0001 + }; + struct panel_id *id = LRMI_alloc_real(sizeof(struct panel_id)); + r.es = (unsigned short)(((int)(id-LRMI_base_addr()) >> 4) & 0xffff); + r.edi = (unsigned long)(id-LRMI_base_addr()) & 0xf; + + if(sizeof(struct panel_id) != 32) + return fprintf(stderr, "oops: panel_id, sizeof struct panel_id != 32, it's %d...\n", sizeof(struct panel_id)), 7; + + if(real_mode_int(0x10, &r)) + return fprintf(stderr, "Can't get panel id (vm86 failure)\n"), 8; + + if((r.eax & 0xff) != 0x4f) + return fprintf(stderr, "Panel id function not supported\n"), 9; + + if(r.eax & 0xff00) + { + if((r.eax & 0xff00) == 0x100) + fprintf(stderr, "Panel id read failed\n"); + else + fprintf(stderr, "Panel id function not successful\n"); + return 10; + } + + if(!just_dimensions) + printf("size:\t%d %d\n" + "type:\t%d\n" + "bpp:\t%d %d %d %d\n", + id->hsize, id->vsize, + id->fptype, + id->redbpp, id->greenbpp, id->bluebpp, id->reservedbpp); + else + printf("%dx%d\n", id->hsize, id->vsize); + +#if 0 + + /* Don't have a use for these and they don't seem to be documented. + * 320 appears to be 320kB of mapped memory and the following + * pointer is 0x1ffb8000 which is kernel mapping + 0xb8000 offset. + */ + printf("ram:\t%dkB\n" + "offset:\t%p\n", + id->rsvdoffscrnmemsize, + (void *)id->rsvdoffscrnmemptr); +#endif + + return 0; +} diff -Nru /tmp/xZ9d29VZOF/vbetool-0.5/vbetool.h /tmp/5P81qzCs8L/vbetool-0.6/vbetool.h --- /tmp/xZ9d29VZOF/vbetool-0.5/vbetool.h 2005-07-21 18:14:55.000000000 +0100 +++ /tmp/5P81qzCs8L/vbetool-0.6/vbetool.h 2006-03-13 14:09:41.000000000 +0000 @@ -12,4 +12,5 @@ int check_console(void); int enable_vga(void); int disable_vga(void); +int do_get_panel_id();