From owner-freebsd-hackers Sun Feb 28 17:10: 4 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from outmail.utsunomiya-u.ac.jp (outmail.utsunomiya-u.ac.jp [160.12.196.3]) by hub.freebsd.org (Postfix) with ESMTP id ADA8A154A6 for ; Sun, 28 Feb 1999 17:09:33 -0800 (PST) (envelope-from yokota@zodiac.mech.utsunomiya-u.ac.jp) Received: from zodiac.mech.utsunomiya-u.ac.jp (IDENT:J+QOIblHlrtMyhI8OUDr3Q9p3P1uwe5f@zodiac.mech.utsunomiya-u.ac.jp [160.12.42.1]) by outmail.utsunomiya-u.ac.jp (8.9.1/8.9.1) with ESMTP id KAA26577; Mon, 1 Mar 1999 10:07:41 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp (zodiac.mech.utsunomiya-u.ac.jp [160.12.42.1]) by zodiac.mech.utsunomiya-u.ac.jp (8.7.6+2.6Wbeta7/3.4W/zodiac-May96) with ESMTP id KAA07570; Mon, 1 Mar 1999 10:10:42 +0900 (JST) Message-Id: <199903010110.KAA07570@zodiac.mech.utsunomiya-u.ac.jp> To: Jonathan Walther Cc: freebsd-hackers@freebsd.org, yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: Re: /dev/vesa usage In-reply-to: Your message of "Sun, 28 Feb 1999 15:43:36 PST." References: Date: Mon, 01 Mar 1999 10:10:41 +0900 From: Kazutaka YOKOTA Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >On Sun, 28 Feb 1999, Crist J. Clark wrote in reply: >> Jonathan Walther wrote to freebsd-questions: >> > Does anyone know how to use /dev/vesa to flip into vesa modes, and just in >> > general make VESA function calls? Hunting has revealed no documentation, >no >> > example source code. I apologize for not being god enough to understand t >he >> > interface by looking at the lkm source. >> >> You might want to try this on -hackers. Some more specific questions >> might aid your chances of some useful responses. > >Has anyone here been using /dev/vesa? I want to use it to switch banks and >switch video modes. There is no such thing as /dev/vesa. If you want to set a video mode of your VESA-compliant VGA card, just issue ioctl to stdin. To change the current vide mode, use one of SW_XXX ioctls. ioctl(0, SW_XXXX, 0); To switch banks, use CONS_SETWINORG ioctl. ioctl(0, CONS_SETWINORG, offset); where `offset' is byte-offset from the beginning of the video memory. Then, the bank containing that byte position will appear in the bank window (usually 0xa0000). The window location and the bank size can be obtained by CONS_MODEINFO ioctl. See the following example. video_info_t mode_info; u_char *vid_mem; int vid_fd; int window; int bank_size; int offset; int w_offset; /* obtain mode information */ mode_info.vi_mode = M_VESA_CG1024x768; ioctl(0, CONS_MODEINFO, &mode_info); window = mode_info.vi_window; bank_size = mode_info.vi_window_size; /* set the new mode */ ioctl(0, SW_VESA_CG_1024x768); /* mmap the window */ vid_fd = open("/dev/mem", O_RDWR); vid_mem = mmap(0, bank_size, PROT_READ | PROT_WRITE, MAP_FILE, vid_fd, window); /* byte-offset from the beginning of the video memory */ offset = what_ever_offset; /* switch banks */ ioctl(0, CONS_SETWINORG, offset); /* write to that location */ w_offset = offset % bank_size; /* offset within the window */ vid_mem[w_offset] = what_ever_value; See /usr/include/machine/console.h for ioctls. Hope this will give you some info. Kazu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message