Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Mar 1999 10:10:41 +0900
From:      Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
To:        Jonathan Walther <krooger@debian.org>
Cc:        freebsd-hackers@freebsd.org, yokota@zodiac.mech.utsunomiya-u.ac.jp
Subject:   Re: /dev/vesa usage 
Message-ID:  <199903010110.KAA07570@zodiac.mech.utsunomiya-u.ac.jp>
In-Reply-To: Your message of "Sun, 28 Feb 1999 15:43:36 PST." <Pine.LNX.3.96.990228154214.8128B-100000@localhost> 
References:  <Pine.LNX.3.96.990228154214.8128B-100000@localhost> 

next in thread | previous in thread | raw e-mail | index | archive | help
>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903010110.KAA07570>