[comp.sys.sgi] Iris 4D questions

tom@mims-iris.waterloo.edu (Tom Haapanen) (09/07/89)

Two questions about booting an Iris 4D70:

    1.  Is it possible to make the machine boot automatically?  Right
	now I have to type 'auto' on the console before it starts up.
	This means I have to come in to start it up if we have a power
	failure on a weekend, for example.

    2.  When the machine boots up, it starts a NeWS session with one
	window, containing the login.  However, the 'tools' icon lets
	me create a shell, which automatically signs on as root!!!
	So anybody could get superuser access by rebooting the machine.
	Is there a way to make the system not generate a NeWS session?
	We're running 3.1G ...

And one more:

    3.  Did anyone get the recent GIF viewer working on a 4D70?  It
	compiled, and igif creates a window, but then says:
	    ERROR #91 : <lrectwrite> is not implemented.
	What does this mean?  Who didn't implement it?

Thanks in advance!

					\tom haapanen
"now, you didn't really expect          tom@mims-iris.waterloo.edu
 my views to have anything to do        watmims research group
 with my employer's, did you?"          university of waterloo

Amount taken in the average bank robbery in Canada in 1988:  $  4,000
In the average computer fraud in the same period:            $ 42,000
			-Report on Business Magazine, Sept/89

moss@BRL.MIL ("Gary S. Moss", VLD/VMB) (09/08/89)

[from Message-Id: <3268@watale.waterloo.edu>]
<    3.  Did anyone get the recent GIF viewer working on a 4D70?  It
<	compiled, and igif creates a window, but then says:
<	    ERROR #91 : <lrectwrite> is not implemented.
<	What does this mean?  Who didn't implement it?
Well, I got it running on a 4D60T by replacing the call to lrectwrite() with
some code from the BRL-CAD package.  Here is a patch that should do the
trick, though I really wish 'lrectwrite' would get implemented the rest of
the way...

-moss

*** igif.c	Thu Sep  7 16:17:25 1989
--- igif.c.save	Thu Sep  7 16:17:25 1989
***************
*** 303,309 ****
  
  screen_manage()
  {
! 	lrectwrite(0, 0, s_width - 1, s_height - 1, screen);
  
  	qdevice(REDRAW);
  	qdevice(PIECECHANGE);
--- 303,309 ----
  
  screen_manage()
  {
! 	fake_rectwrite(0, 0, s_width - 1, s_height - 1, screen );
  
  	qdevice(REDRAW);
  	qdevice(PIECECHANGE);
***************
*** 315,321 ****
  		switch (qread(&data)) {
  		case REDRAW:
  		case PIECECHANGE:
! 			lrectwrite(0, 0, s_width - 1, s_height - 1, screen);
  			break;
  		case WINQUIT:
  			exit(0);
--- 315,321 ----
  		switch (qread(&data)) {
  		case REDRAW:
  		case PIECECHANGE:
! 			fake_rectwrite(0, 0, s_width - 1, s_height - 1, screen);
  			break;
  		case WINQUIT:
  			exit(0);
***************
*** 325,327 ****
--- 325,385 ----
  	}
  }
  
+ 
+ /*
+  *  This is the format of the buffer for lrectwrite(),
+  *  and thus defines the format of the in-memory framebuffer copy.
+  */
+ struct sgi_pixel {
+ 	unsigned char alpha;	/* this will always be zero */
+ 	unsigned char blue;
+ 	unsigned char green;
+ 	unsigned char red;
+ };
+ 
+ /*
+  *			F A K E _ L R E C T W R I T E
+  *
+  * fake_rectwrite is necessary as lrectwrite is not yet supported
+  * for non-GT hardware in IRIX version 3.1 or earlier. There is
+  * however, a stub in the library which states that lrectwrite is not yet
+  * available for these systems. To allow us to still use
+  * shared libraries and have the same executables across the
+  * 4D series of workstations, if the system does not contain
+  * the GT hardware upgrade then this fake routine is used.
+  *
+  * Note that the real lrectwrite() subroutine operates in the pixel
+  * coordinates of the WINDOW, not the current viewport.
+  * To simplify things, this fake_rectwrite() subroutine operates in
+  * the coordinates of the VIEWPORT, because cmov2i() and writeRGB() do.
+  * Having the callers convert to window, and then to convert back in here,
+  * is more inefficient than is necessary.  However, this required the
+  * calling sequences to be somewhat altered -vs- the lrectwrite() replaced.
+  */
+ fake_rectwrite( x1, y1, x2, y2, pixels)
+ short	x1, y1;
+ short	x2, y2;
+ register struct sgi_pixel * pixels;
+ {
+ 	register struct sgi_pixel * p;
+ 	register short	n;
+ 	register short	scan;
+ 	register short	i;
+ 	static unsigned char Red_pixels[1280];
+ 	static unsigned char Green_pixels[1280];
+ 	static unsigned char Blue_pixels[1280];
+ 
+ 	p = pixels;
+ 	n = x2  - x1 + 1;
+ 	for( scan = y1; scan <= y2; scan++)  {
+ 		for ( i = 0; i < n; i++)  {
+ 			Red_pixels[i] =   p->red;
+ 			Green_pixels[i] = p->green;
+ 			Blue_pixels[i] =  p->blue;
+ 			p++;
+ 		}
+ 	
+ 		cmov2i( x1, scan);
+ 		writeRGB( n, Red_pixels, Green_pixels, Blue_pixels);
+ 	}
+ }