HP-UX Reference (11i v3 07/02) - 7 Device (Special) Files, 9 General Information, Index (vol 10)
f
framebuf(7) framebuf(7)
NAME
framebuf - information for raster frame-buffer devices
SYNOPSIS
#include <sys/framebuf.h>
DESCRIPTION
Frame-buffer devices are raster-based displays. These devices use memory-mapped I/O to obtain much
higher performance than possible with tty-based graphic terminals. Frame-buffer devices can be accessed
directly using this interface, although access through the graphics libraries is recommended. Direct access
to frame-buffer devices entails precise knowledge of the frame-buffer architecture being used. Input cannot
be piped into or redirected to frame-buffer devices because they are not serial devices.
Each frame-buffer device is associated with a character special file. Major and minor numbers for frame-
buffer devices are implementation-dependent. The minor numbers for these devices denote different frame
buffers. Implementation-specific details are discussed in the appropriate systems administrator’s manuals.
Communication with a frame-buffer device begins with an
open() system call. Multiple processes can
have the frame-buffer device open concurrently.
close() invalidates the file descriptor associated with the frame-buffer device. After a close() system
call, any access to the frame-buffer device address range might result in a memory fault and the signal SIG-
SEGV being sent to the process (see signal(2)). A process cannot unmap the frame buffer from its address
space after the frame-buffer special file is closed. To unmap a frame buffer, use the
GCUNMAP ioctl()
call (see below).
Once a process acquires a lock for the frame-buffer device, it must unlock it explicitly before calling
close(); see GCUNLOCK below.
read() and write() system calls are undefined and always return an error. In this case
errno is set
to [ENODEV].
The
ioctl() system call is used to control a frame-buffer device. The select() system call is used to
test the frame-buffer device for exceptional conditions. Interrupts from the graphic hardware are con-
sidered exceptional conditions. An exceptional condition is automatically cleared after any process that
opens the frame-buffer device is notified of the exception by a
select() call. A call to
select() for
read or write on the file descriptor associated with the frame-buffer device returns a false condition in the
read and write bit masks (see select(2)).
A frame-buffer device can be accessed by multiple processes at once. However, each process overwrites the
output of the others unless one of the lock mechanisms described here or some other synchronization
mechanism is used. The lock mechanisms described here are intended for cooperating processes only.
For all frame buffers, data bytes scan from left to right and from top to bottom. A pixel, which is a visible
dot on the screen, is associated with a location in the frame buffer. Each device maps one or more bits in
memory to a pixel on the screen, although the bits in the frame buffer might not be continuous. Informa-
tion describing the frame-buffer structure and attributes is found in the
crt_frame_buffer_t
data
structure. The
crt_frame_buffer_t
data structure includes the following fields:
int crt_id; /*display identifier*/
unsigned int crt_attributes; /*flags denoting attributes*/
char *crt_frame_base; /*first byte in frame-buffer memory*/
char *crt_control_base; /*first byte of the control*/
/*registers*/
char *crt_region [ CRT_MAX_REGIONS ];
/*other regions associated with the*/
/*frame-buffer device*/
The following are valid
ioctl() requests:
GCDESCRIBE Describe the size, characteristics, and mapped regions of the frame buffer. The infor-
mation is returned to the calling process in a crt_frame_buffer_t data struc-
ture, and the parameter is defined as crt_frame_buffer_t *arg;. Although
some structure fields contain addresses of one or more frame-buffer device regions,
the values of these fields are not always defined. Only after a successful
GCMAP com-
mand is issued (see below) are the correct addresses returned so the user can access
the frame-buffer regions directly using the returned addresses.
44 Hewlett-Packard Company − 1 − HP-UX 11i Version 3: February 2007