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