|
|
1.1 ! root 1: .\" Copyright (c) 1990 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: .\" ! 8: .\" Redistribution and use in source and binary forms are permitted provided ! 9: .\" that: (1) source distributions retain this entire copyright notice and ! 10: .\" comment, and (2) distributions including binaries display the following ! 11: .\" acknowledgement: ``This product includes software developed by the ! 12: .\" University of California, Berkeley and its contributors'' in the ! 13: .\" documentation or other materials provided with the distribution and in ! 14: .\" all advertising materials mentioning features or use of this software. ! 15: .\" Neither the name of the University nor the names of its contributors may ! 16: .\" be used to endorse or promote products derived from this software without ! 17: .\" specific prior written permission. ! 18: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 19: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 20: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 21: .\" ! 22: .\" @(#)grf.4 5.1 (Berkeley) 6/29/90 ! 23: .\" ! 24: .TH GRF 4 "June 29, 1990" ! 25: .UC 7 ! 26: .SH NAME ! 27: grf \- HP graphics frame buffer device interface ! 28: .SH DESCRIPTION ! 29: This is a generic description of the frame buffer device interface. ! 30: The devices to which this applies are the 98544, 98545 and 98547 ! 31: Topcat display cards (also known as HP300H devices), ! 32: the 98548, 98549 and 98550 ! 33: Catseye display cards, ! 34: the 98700 ! 35: Gatorbox graphics box, ! 36: the 98720 ! 37: Renaissance graphics box, ! 38: and the 98730 ! 39: DaVinci graphics box. ! 40: .PP ! 41: Use of the devices can be effectively approached from two directions. ! 42: The first is through HP-UX ! 43: .I Starbase ! 44: routines, the second is by direct control in the BSD environment. ! 45: In order to use the Starbase libraries, ! 46: code must be compiled in an HP-UX environment, either by doing so on an HP-UX ! 47: machine and transferring the binaries to the BSD machine, or by compilation ! 48: with the use of the ! 49: .IR hpux (1) ! 50: command. ! 51: Applications using Starbase libraries have been run successfully ! 52: on BSD machines using both of these compilation techniques. ! 53: .PP ! 54: Direct compilation, ! 55: such as that used for the X Window System servers, has also been successful. ! 56: Examples of some frame buffer operations can be found in ! 57: the device dependent X Window system sources, for example the ! 58: .I /usr/src/new/X/libhp.fb ! 59: directory. These files contain examples of device dependent color map ! 60: initialization, frame buffer operations, bit moving routines etc. ! 61: .PP ! 62: The basic programming of the ! 63: .IR grf \? ! 64: devices involves opening the device ! 65: file, mapping the control registers and frame buffer addresses into user ! 66: space, and then manipulating the device as the application requires. ! 67: The address mapping is controlled by an ! 68: .IR ioctl (2) ! 69: call to map the device into user space, and an unmap call when finished. ! 70: The ioctls supported by BSD are: ! 71: .TP ! 72: GRFIOCGINFO ! 73: Get Graphics Info ! 74: .sp ! 75: Get info about device, setting the entries in the ! 76: .I grfinfo ! 77: structure, as defined in <hpdev/grfioctl.h>: ! 78: .DS ! 79: struct grfinfo { ! 80: int gd_id; /* HPUX identifier */ ! 81: caddr_t gd_regaddr; /* control registers physaddr */ ! 82: int gd_regsize; /* control registers size */ ! 83: caddr_t gd_fbaddr; /* frame buffer physaddr */ ! 84: int gd_fbsize; /* frame buffer size */ ! 85: short gd_colors; /* number of colors */ ! 86: short gd_planes; /* number of planes */ ! 87: /* new stuff */ ! 88: int gd_fbwidth; /* frame buffer width */ ! 89: int gd_fbheight; /* frame buffer height */ ! 90: int gd_dwidth; /* displayed part width */ ! 91: int gd_dheight; /* displayed part height */ ! 92: int gd_pad[6]; /* for future expansion */ ! 93: }; ! 94: .DE ! 95: .TP ! 96: GRFIOCON ! 97: Graphics On ! 98: .sp ! 99: Turn graphics on by enabling CRT output. The screen will come on, displaying ! 100: whatever is in the frame buffer, using whatever colormap is in place. ! 101: .TP ! 102: GRFIOCOFF ! 103: Graphics Off ! 104: .sp ! 105: Turn graphics off by disabling output to the CRT. The frame buffer contents ! 106: are not affected. ! 107: .TP ! 108: GRFIOCMAP ! 109: Map Device to user space ! 110: .sp ! 111: Map in control registers and framebuffer space. Once the device file is ! 112: mapped, the frame buffer structure is accessible. ! 113: .TP ! 114: GRFIOCUNMAP ! 115: Unmap Device ! 116: .sp ! 117: Unmap control registers and framebuffer space. ! 118: .PP ! 119: For further information about the use of ioctl see the man page. ! 120: .SH EXAMPLE ! 121: This short code fragment is an example of opening some graphics device and ! 122: mapping in the control and frame buffer space: ! 123: .DS ! 124: #define GRF_DEV <some_graphics_device> /* /dev/grfN */ ! 125: { ! 126: struct fbstruct *regs; /* fbstruct = gboxfb, rboxfb, etc. */ ! 127: u_char *Addr, frame_buffer; ! 128: struct grfinfo gi; ! 129: int disp_fd; ! 130: ! 131: disp_fd = open(GRF_DEV,1); ! 132: if (ioctl (disp_fd, GRFIOCGINFO, &gi) < 0) return -1; ! 133: (void) ioctl (disp_fd, GRFIOCON, 0); ! 134: ! 135: Addr = (u_char *) 0; ! 136: if (ioctl (disp_fd, GRFIOCMAP, &Addr) < 0) { ! 137: (void) ioctl (disp_fd, GRFIOCOFF, 0); ! 138: return -1; ! 139: } ! 140: regs = (fbstruct *) Addr; /* Control Registers */ ! 141: frame_buffer = (u_char *) Addr + gi.gd_regsize; /* Frame buffer memory */ ! 142: } ! 143: .DE ! 144: .SH SEE ALSO ! 145: ioctl(2), dv(4), gb(4), rb(4), tc(4), hil(4) ! 146: .SH FILES ! 147: .ta \w'/dev/*crt* 'u ! 148: /dev/grf? BSD interface special files ! 149: .br ! 150: /dev/*crt* HP-UX \fIstarbase\fP interface special files ! 151: .SH ERRORS ! 152: .TP 15 ! 153: [ENODEV] ! 154: no such device. ! 155: .TP 15 ! 156: [EBUSY] ! 157: Another process has the device open. ! 158: .TP 15 ! 159: [EINVAL] ! 160: Invalid ioctl specification. ! 161: .SH DIAGNOSTICS ! 162: None under BSD. ! 163: .br ! 164: HP-UX CE.utilities/Crtadjust programs must be used for each specific device.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.