xref: /csrg-svn/share/man/man4/man4.hp300/grf.4 (revision 62980)
1*62980Sbostic.\" Copyright (c) 1990, 1991, 1993
2*62980Sbostic.\"	The Regents of the University of California.  All rights reserved.
344677Sbostic.\"
444677Sbostic.\" This code is derived from software contributed to Berkeley by
544677Sbostic.\" the Systems Programming Group of the University of Utah Computer
644677Sbostic.\" Science Department.
762979Sbostic.\"
844677Sbostic.\" %sccs.include.redist.man%
944677Sbostic.\"
10*62980Sbostic.\"     @(#)grf.4	8.1 (Berkeley) 06/09/93
1144677Sbostic.\"
1247672Scael.Dd
1347672Scael.Dt GRF 4 hp300
1447672Scael.Os
1547672Scael.Sh NAME
1647672Scael.Nm grf
1747672Scael.Nd
1847672Scael.Tn HP
1947672Scaelgraphics frame buffer device interface
2047672Scael.Sh DESCRIPTION
2144677SbosticThis is a generic description of the frame buffer device interface.
2244677SbosticThe devices to which this applies are the 98544, 98545 and 98547
2347672ScaelTopcat display cards (also known as
2447672Scael.Tn HP300H
2547672Scaeldevices),
2644677Sbosticthe 98548, 98549 and 98550
2744677SbosticCatseye display cards,
2844677Sbosticthe 98700
2944677SbosticGatorbox graphics box,
3044677Sbosticthe 98720
3144677SbosticRenaissance graphics box,
3244677Sbosticand the 98730
3344677SbosticDaVinci graphics box.
3447672Scael.Pp
3544677SbosticUse of the devices can be effectively approached from two directions.
3647672ScaelThe first is through
3747672Scael.Tn HP-UX
3847672Scael.Em Starbase
3947672Scaelroutines, the second is by direct control in the
4047672Scael.Bx
4147672Scaelenvironment.
4244677SbosticIn order to use the Starbase libraries,
4347672Scaelcode must be compiled in an
4447672Scael.Tn HP-UX
4547672Scaelenvironment, either by doing so on an
4647672Scael.Tn HP-UX
4747672Scaelmachine and transferring the binaries to the
4847672Scael.Bx
4947672Scaelmachine, or by compilation
5044677Sbosticwith the use of the
5147672Scael.Xr hpux 1
5244677Sbosticcommand.
5344677SbosticApplications using Starbase libraries have been run successfully
5447672Scaelon
5547672Scael.Bx
5647672Scaelmachines using both of these compilation techniques.
5747672Scael.Pp
5844677SbosticDirect compilation,
5944677Sbosticsuch as that used for the X Window System servers, has also been successful.
6044677SbosticExamples of some frame buffer operations can be found in
6144677Sbosticthe device dependent X Window system sources, for example the
6247672Scael.Pa /usr/src/new/X/libhp.fb
6344677Sbosticdirectory.  These files contain examples of device dependent color map
6444677Sbosticinitialization, frame buffer operations, bit moving routines etc.
6547672Scael.Pp
6644677SbosticThe basic programming of the
6750731Scael.Nm grf Ns ?
6844677Sbosticdevices involves opening the device
6944677Sbosticfile, mapping the control registers and frame buffer addresses into user
7044677Sbosticspace, and then manipulating the device as the application requires.
7144677SbosticThe address mapping is controlled by an
7247672Scael.Xr ioctl 2
7344677Sbosticcall to map the device into user space, and an unmap call when finished.
7447672ScaelThe ioctls supported by
7547672Scael.Bx
7647672Scaelare:
7747672Scael.Bl -tag -width indent
7847672Scael.It Dv GRFIOCGINFO
7944677SbosticGet Graphics Info
8047672Scael.Pp
8144677SbosticGet info about device, setting the entries in the
8247672Scael.Em grfinfo
8344677Sbosticstructure, as defined in <hpdev/grfioctl.h>:
8447672Scael.Bd -literal
8544677Sbosticstruct	grfinfo {
8647672Scael	int	gd_id;		/* HPUX identifier */
8747672Scael	caddr_t	gd_regaddr;	/* control registers physaddr */
8847672Scael	int	gd_regsize;	/* control registers size */
8947672Scael	caddr_t	gd_fbaddr;	/* frame buffer physaddr */
9047672Scael	int	gd_fbsize;	/* frame buffer size */
9147672Scael	short	gd_colors;	/* number of colors */
9247672Scael	short	gd_planes;	/* number of planes */
9344677Sbostic/* new stuff */
9447672Scael	int	gd_fbwidth;	/* frame buffer width */
9547672Scael	int	gd_fbheight;	/* frame buffer height */
9647672Scael	int	gd_dwidth;	/* displayed part width */
9747672Scael	int	gd_dheight;	/* displayed part height */
9847672Scael	int	gd_pad[6];	/* for future expansion */
9944677Sbostic};
10047672Scael.Ed
10147672Scael.It Dv GRFIOCON
10244677SbosticGraphics On
10347672Scael.Pp
10447672ScaelTurn graphics on by enabling
10547672Scael.Tn CRT
10647672Scaeloutput.  The screen will come on, displaying
10744677Sbosticwhatever is in the frame buffer, using whatever colormap is in place.
10847672Scael.It Dv GRFIOCOFF
10944677SbosticGraphics Off
11047672Scael.Pp
11147672ScaelTurn graphics off by disabling output to the
11247672Scael.Tn CRT .
11347672ScaelThe frame buffer contents
11444677Sbosticare not affected.
11547672Scael.It Dv GRFIOCMAP
11644677SbosticMap Device to user space
11747672Scael.Pp
11844677SbosticMap in control registers and framebuffer space. Once the device file is
11944677Sbosticmapped, the frame buffer structure is accessible.
12047672Scael.It Dv GRFIOCUNMAP
12144677SbosticUnmap Device
12247672Scael.Pp
12344677SbosticUnmap control registers and framebuffer space.
12447672Scael.El
12547672Scael.Pp
12644677SbosticFor further information about the use of ioctl see the man page.
12747672Scael.Sh EXAMPLE
12844677SbosticThis short code fragment is an example of opening some graphics device and
12944677Sbosticmapping in the control and frame buffer space:
13047672Scael.Bd -literal
13144677Sbostic#define GRF_DEV <some_graphics_device>  /* /dev/grfN */
13244677Sbostic{
13347672Scael	struct fbstruct *regs;  /*  fbstruct = gboxfb, rboxfb, etc. */
13447672Scael	u_char *Addr, frame_buffer;
13547672Scael	struct grfinfo gi;
13647672Scael	int disp_fd;
13744677Sbostic
13847672Scael	disp_fd = open(GRF_DEV,1);
13947672Scael	if (ioctl (disp_fd, GRFIOCGINFO, &gi) < 0) return -1;
14047672Scael	(void) ioctl (disp_fd, GRFIOCON, 0);
14144677Sbostic
14247672Scael	Addr = (u_char *) 0;
14347672Scael	if (ioctl (disp_fd, GRFIOCMAP, &Addr) < 0) {
14447672Scael		(void) ioctl (disp_fd, GRFIOCOFF, 0);
14547672Scael		return -1;
14647672Scael	}
14747672Scael	regs = (fbstruct *) Addr;               /* Control Registers   */
14847672Scael	frame_buffer = (u_char *) Addr + gi.gd_regsize; /* Frame buffer mem */
14944677Sbostic}
15047672Scael.Ed
15147672Scael.Sh FILES
15247672Scael.Bl -tag -width /dev/*crt*? -compact
15347672Scael.It Pa /dev/grf?
15447672Scael.Bx
15547672Scaelinterface special files
15647672Scael.It Pa /dev/*crt*
15747672Scael.Tn HP-UX
15847672Scael.Em starbase
15947672Scaelinterface special files
16047672Scael.El
16147672Scael.Sh DIAGNOSTICS
16247672ScaelNone under
16347672Scael.Bx .
16447672Scael.Tn HP-UX
16547672ScaelThe
16647672Scael.Tn CE.utilities/Crtadjust
16747672Scaelprograms must be used for each specific device.
16847672Scael.Sh ERRORS
16947672Scael.Bl -tag -width [EINVAL]
17047672Scael.It Bq Er ENODEV
17144677Sbosticno such device.
17247672Scael.It Bq Er EBUSY
17344677SbosticAnother process has the device open.
17447672Scael.It Bq Er EINVAL
17544677SbosticInvalid ioctl specification.
17647672Scael.El
17747672Scael.Sh SEE ALSO
17847672Scael.Xr ioctl 2 ,
17947672Scael.Xr dv 4 ,
18047672Scael.Xr gb 4 ,
18147672Scael.Xr rb 4 ,
18247672Scael.Xr tc 4 ,
18347672Scael.Xr hil 4
184