1.\" Copyright (c) 1990, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" the Systems Programming Group of the University of Utah Computer 6.\" Science Department. 7.\" 8.\" %sccs.include.redist.man% 9.\" 10.\" @(#)grf.4 8.1 (Berkeley) 06/09/93 11.\" 12.Dd 13.Dt GRF 4 hp300 14.Os 15.Sh NAME 16.Nm grf 17.Nd 18.Tn HP 19graphics frame buffer device interface 20.Sh DESCRIPTION 21This is a generic description of the frame buffer device interface. 22The devices to which this applies are the 98544, 98545 and 98547 23Topcat display cards (also known as 24.Tn HP300H 25devices), 26the 98548, 98549 and 98550 27Catseye display cards, 28the 98700 29Gatorbox graphics box, 30the 98720 31Renaissance graphics box, 32and the 98730 33DaVinci graphics box. 34.Pp 35Use of the devices can be effectively approached from two directions. 36The first is through 37.Tn HP-UX 38.Em Starbase 39routines, the second is by direct control in the 40.Bx 41environment. 42In order to use the Starbase libraries, 43code must be compiled in an 44.Tn HP-UX 45environment, either by doing so on an 46.Tn HP-UX 47machine and transferring the binaries to the 48.Bx 49machine, or by compilation 50with the use of the 51.Xr hpux 1 52command. 53Applications using Starbase libraries have been run successfully 54on 55.Bx 56machines using both of these compilation techniques. 57.Pp 58Direct compilation, 59such as that used for the X Window System servers, has also been successful. 60Examples of some frame buffer operations can be found in 61the device dependent X Window system sources, for example the 62.Pa /usr/src/new/X/libhp.fb 63directory. These files contain examples of device dependent color map 64initialization, frame buffer operations, bit moving routines etc. 65.Pp 66The basic programming of the 67.Nm grf Ns ? 68devices involves opening the device 69file, mapping the control registers and frame buffer addresses into user 70space, and then manipulating the device as the application requires. 71The address mapping is controlled by an 72.Xr ioctl 2 73call to map the device into user space, and an unmap call when finished. 74The ioctls supported by 75.Bx 76are: 77.Bl -tag -width indent 78.It Dv GRFIOCGINFO 79Get Graphics Info 80.Pp 81Get info about device, setting the entries in the 82.Em grfinfo 83structure, as defined in <hpdev/grfioctl.h>: 84.Bd -literal 85struct grfinfo { 86 int gd_id; /* HPUX identifier */ 87 caddr_t gd_regaddr; /* control registers physaddr */ 88 int gd_regsize; /* control registers size */ 89 caddr_t gd_fbaddr; /* frame buffer physaddr */ 90 int gd_fbsize; /* frame buffer size */ 91 short gd_colors; /* number of colors */ 92 short gd_planes; /* number of planes */ 93/* new stuff */ 94 int gd_fbwidth; /* frame buffer width */ 95 int gd_fbheight; /* frame buffer height */ 96 int gd_dwidth; /* displayed part width */ 97 int gd_dheight; /* displayed part height */ 98 int gd_pad[6]; /* for future expansion */ 99}; 100.Ed 101.It Dv GRFIOCON 102Graphics On 103.Pp 104Turn graphics on by enabling 105.Tn CRT 106output. The screen will come on, displaying 107whatever is in the frame buffer, using whatever colormap is in place. 108.It Dv GRFIOCOFF 109Graphics Off 110.Pp 111Turn graphics off by disabling output to the 112.Tn CRT . 113The frame buffer contents 114are not affected. 115.It Dv GRFIOCMAP 116Map Device to user space 117.Pp 118Map in control registers and framebuffer space. Once the device file is 119mapped, the frame buffer structure is accessible. 120.It Dv GRFIOCUNMAP 121Unmap Device 122.Pp 123Unmap control registers and framebuffer space. 124.El 125.Pp 126For further information about the use of ioctl see the man page. 127.Sh EXAMPLE 128This short code fragment is an example of opening some graphics device and 129mapping in the control and frame buffer space: 130.Bd -literal 131#define GRF_DEV <some_graphics_device> /* /dev/grfN */ 132{ 133 struct fbstruct *regs; /* fbstruct = gboxfb, rboxfb, etc. */ 134 u_char *Addr, frame_buffer; 135 struct grfinfo gi; 136 int disp_fd; 137 138 disp_fd = open(GRF_DEV,1); 139 if (ioctl (disp_fd, GRFIOCGINFO, &gi) < 0) return -1; 140 (void) ioctl (disp_fd, GRFIOCON, 0); 141 142 Addr = (u_char *) 0; 143 if (ioctl (disp_fd, GRFIOCMAP, &Addr) < 0) { 144 (void) ioctl (disp_fd, GRFIOCOFF, 0); 145 return -1; 146 } 147 regs = (fbstruct *) Addr; /* Control Registers */ 148 frame_buffer = (u_char *) Addr + gi.gd_regsize; /* Frame buffer mem */ 149} 150.Ed 151.Sh FILES 152.Bl -tag -width /dev/*crt*? -compact 153.It Pa /dev/grf? 154.Bx 155interface special files 156.It Pa /dev/*crt* 157.Tn HP-UX 158.Em starbase 159interface special files 160.El 161.Sh DIAGNOSTICS 162None under 163.Bx . 164.Tn HP-UX 165The 166.Tn CE.utilities/Crtadjust 167programs must be used for each specific device. 168.Sh ERRORS 169.Bl -tag -width [EINVAL] 170.It Bq Er ENODEV 171no such device. 172.It Bq Er EBUSY 173Another process has the device open. 174.It Bq Er EINVAL 175Invalid ioctl specification. 176.El 177.Sh SEE ALSO 178.Xr ioctl 2 , 179.Xr dv 4 , 180.Xr gb 4 , 181.Xr rb 4 , 182.Xr tc 4 , 183.Xr hil 4 184