1 .\" $NetBSD: grf.4,v 1.8 2002/02/13 08:17:57 ross Exp $
3 .\" Copyright (c) 1990, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" the Systems Programming Group of the University of Utah Computer
8 .\" Science Department.
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
13 .\" 1. Redistributions of source code must retain the above copyright
14 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in the
17 .\" documentation and/or other materials provided with the distribution.
18 .\" 3. Neither the name of the University nor the names of its contributors
19 .\" may be used to endorse or promote products derived from this software
20 .\" without specific prior written permission.
22 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .\" from: @(#)grf.4 8.1 (Berkeley) 6/9/93
36 .Dd September 10, 2001
43 graphics frame buffer device interface
51 This is a generic description of the frame buffer device interface.
52 The devices to which this applies are the 98544, 98545 and 98547
53 Topcat display cards (also known as
56 the 98548, 98549 and 98550
57 Catseye display cards,
59 Gatorbox graphics box,
61 Renaissance graphics box,
65 Use of the devices can be effectively approached from two directions.
69 routines, the second is by direct control in the
72 In order to use the Starbase libraries,
73 code must be compiled in an
75 environment, either by doing so on an
77 machine and transferring the binaries to the
79 machine, or by compilation
83 Applications using Starbase libraries have been run successfully
86 machines using both of these compilation techniques.
89 such as that used for the X Window System servers, has also been successful.
90 Examples of some frame buffer operations can be found in
91 the device dependent X Window system sources, for example the
92 .Pa /usr/src/new/X/libhp.fb
93 directory. These files contain examples of device dependent color map
94 initialization, frame buffer operations, bit moving routines etc.
96 The basic programming of the
98 devices involves opening the device
99 file, mapping the control registers and frame buffer addresses into user
100 space, and then manipulating the device as the application requires.
101 The address mapping is controlled by an
103 call to map the device into user space, and an unmap call when finished.
104 The ioctls supported by
107 .Bl -tag -width indent
111 Get info about device, setting the entries in the
113 structure, as defined in \*[Lt]hpdev/grfioctl.h\*[Gt]:
116 int gd_id; /* HPUX identifier */
117 caddr_t gd_regaddr; /* control registers physaddr */
118 int gd_regsize; /* control registers size */
119 caddr_t gd_fbaddr; /* frame buffer physaddr */
120 int gd_fbsize; /* frame buffer size */
121 short gd_colors; /* number of colors */
122 short gd_planes; /* number of planes */
124 int gd_fbwidth; /* frame buffer width */
125 int gd_fbheight; /* frame buffer height */
126 int gd_dwidth; /* displayed part width */
127 int gd_dheight; /* displayed part height */
128 int gd_pad[6]; /* for future expansion */
134 Turn graphics on by enabling
136 output. The screen will come on, displaying
137 whatever is in the frame buffer, using whatever colormap is in place.
141 Turn graphics off by disabling output to the
143 The frame buffer contents
146 Map Device to user space
148 Map in control registers and framebuffer space. Once the device file is
149 mapped, the frame buffer structure is accessible.
153 Unmap control registers and framebuffer space.
156 For further information about the use of ioctl see the man page.
158 .Bl -tag -width /dev/*crt*? -compact
161 interface special files
165 interface special files
168 This short code fragment is an example of opening some graphics device and
169 mapping in the control and frame buffer space:
171 #define GRF_DEV \*[Lt]some_graphics_device\*[Gt] /* /dev/grfN */
173 struct fbstruct *regs; /* fbstruct = gboxfb, rboxfb, etc. */
174 u_char *Addr, frame_buffer;
178 disp_fd = open(GRF_DEV,1);
179 if (ioctl (disp_fd, GRFIOCGINFO, \*[Am]gi) \*[Lt] 0) return -1;
180 (void) ioctl (disp_fd, GRFIOCON, 0);
183 if (ioctl (disp_fd, GRFIOCMAP, \*[Am]Addr) \*[Lt] 0) {
184 (void) ioctl (disp_fd, GRFIOCOFF, 0);
187 regs = (fbstruct *) Addr; /* Control Registers */
188 frame_buffer = (u_char *) Addr + gi.gd_regsize; /* Frame buffer mem */
196 .Tn CE.utilities/Crtadjust
197 programs must be used for each specific device.
199 .Bl -tag -width [EINVAL]
203 Another process has the device open.
205 Invalid ioctl specification.