9fans archive / 1997 / 07 / 24 /    prev next

From: Scott Schwartz schwartz@fin...
Subject: No subject
Date: Tue, 08 Jul 1997 18:05:00 EDT

Here are some suggested changes to devvga to attempt to support screen
blanking, in the style of XFree86 3.3.  (Doing this completely right
requires chipset specific code, and more extensive changes.)  The
generic vga mechanisms could probably be used via aux/vga, but
/dev/vgactl is such a nice interface that I couldn't resist using it.
(Is that the wrong approach?)

-- Scott

diff devvga.c- devvga.c
292a293,329
> vga_blank(int mode)
> {
> 	uchar clocking_mode, mode_control;
> 
> 	if (mode == 0) {
> 		clocking_mode = 0;
> 		mode_control = Not_Hardware_Reset;
> 	}
> 	else if (mode == 1) {
> 		clocking_mode = Screen_Off;
> 		mode_control = Not_Hardware_Reset;
> 		/* Inspired by xfree86 3.3 vgaHW.c */
> 	}
> 	else if (mode == 2) {
> 		clocking_mode = 0;
> 		mode_control = 0;
> 		/* Wild guess.  Probably not useful. */
> 	}
> 	else if (mode == 3) {
> 		clocking_mode = Screen_Off;
> 		mode_control = 0;
> 	}
> 	else {
> 		SET(clocking_mode);
> 		SET(mode_control);
> 		error(Ebadarg);
> 	}
> 
> 	vgaxo(Seqx, Sync_Reset, Reset_Start);
> 	vgaxo(Seqx, Clocking_Mode,
> 		clocking_mode | (vgaxi(Seqx, Clocking_Mode) & ~Screen_Off));
> 	vgaxo(Crtx, Mode_Ctrl, 
> 		mode_control | (vgaxi(Crtx, Mode_Ctrl) & ~Not_Hardware_Reset));
> 	vgaxo(Seqx, Sync_Reset, Reset_End);
> }
> 
> static void
305c342,360
< 	if(strcmp(field[0], "hwgc") == 0){
- ---
> 	if(strcmp(field[0], "screen") == 0) {
> 		int mode = 0;
> 
> 		if (strcmp(field[1], "on") == 0)
> 			mode = 0;
> 		else if (strcmp(field[1], "standby") == 0)
> 			mode = 1;
> 		else if (strcmp(field[1], "suspend") == 0)
> 			mode = 2;
> 		else if (strcmp(field[1], "off") == 0)
> 			mode = 3;
> 		else
> 			error(Ebadarg);
> 
> 		/* if (vgac->blank) (vgac->blank)(mode); else */
> 		vga_blank(mode);
> 		return;
> 	}
> 	else if(strcmp(field[0], "hwgc") == 0){
1187a1243
> 

diff vga.h- vga.h
31a32,43
> enum {
> 	/* Seqx */
> 	Sync_Reset = 0x0,
> 		Reset_Start = 0x1,
> 		Reset_End = 0x3,
> 	Clocking_Mode = 0x1,
> 		Screen_Off = 0x20,
> 	/* Crtx */
> 	Mode_Ctrl = 0x17,
> 		Not_Hardware_Reset = 0x80,
> };
>