Manual Page Search Parameters

RASOPS(9) Kernel Developer's Manual RASOPS(9)

rasops, rasops_init, rasops_reconfig
raster display operations

#include <dev/wscons/wsdisplayvar.h>
#include <dev/rasops/rasops.h>

rasops_init(struct rasops_info *ri, int wantrows, int wantcols);

rasops_reconfig(struct rasops_info *ri, int wantrows, int wantcols);


The rasops subsystem is a set of raster operations for wscons(4).

The primary data type for using the raster operations is the rasops_info structure in dev/rasops/rasops.h:

struct rasops_info {

	 * These must be filled in by the caller
	int	ri_depth;	/* depth in bits */
	u_char	*ri_bits;	/* ptr to bits */
	int	ri_width;	/* width (pels) */
	int	ri_height;	/* height (pels) */
	int	ri_stride;	/* stride in bytes */

	 * These can optionally be left zeroed out. If you fill ri_font,
	 * but aren't using wsfont, set ri_wsfcookie to -1.
	struct	wsdisplay_font *ri_font;
	int	ri_wsfcookie;	/* wsfont cookie */
	void	*ri_hw;		/* driver private data */
	struct wsdisplay_charcell *ri_bs; /* character backing store */
	int	ri_crow;	/* cursor row */
	int	ri_ccol;	/* cursor column */
	int	ri_flg;		/* various operational flags */

	 * These are optional and will default if zero. Meaningless
	 * on depths other than 15, 16, 24 and 32 bits per pel. On
	 * 24 bit displays, ri_{r,g,b}num must be 8.
	u_char	ri_rnum;	/* number of bits for red */
	u_char	ri_gnum;	/* number of bits for green */
	u_char	ri_bnum;	/* number of bits for blue */
	u_char	ri_rpos;	/* which bit red starts at */
	u_char	ri_gpos;	/* which bit green starts at */
	u_char	ri_bpos;	/* which bit blue starts at */

	 * These are filled in by rasops_init()
	int	ri_emuwidth;	/* width we actually care about */
	int	ri_emuheight;	/* height we actually care about */
	int	ri_emustride;	/* bytes per row we actually care about */
	int	ri_rows;	/* number of rows (characters) */
	int	ri_cols;	/* number of columns (characters) */
	int	ri_delta;	/* row delta in bytes */
	int	ri_pelbytes;	/* bytes per pel (may be zero) */
	int	ri_fontscale;	/* fontheight * fontstride */
	int	ri_xscale;	/* fontwidth * pelbytes */
	int	ri_yscale;	/* fontheight * stride */
	u_char  *ri_origbits;	/* where screen bits actually start */
	int	ri_xorigin;	/* where ri_bits begins (x) */
	int	ri_yorigin;	/* where ri_bits begins (y) */
	int32_t	ri_devcmap[16]; /* color -> framebuffer data */

	 * The emulops you need to use, and the screen caps for wscons
	struct	wsdisplay_emulops ri_ops;
	int	ri_caps;

	 * Callbacks so we can share some code
	void	(*ri_do_cursor)(struct rasops_info *);
	void	(*ri_updatecursor)(struct rasops_info *);

	/* Used to intercept putchar to permit display rotation */
	struct	wsdisplay_emulops ri_real_ops;

The value of the ri_flg member is formed by OR'ing the following values:

Force eraserows() to clear the whole screen instead of only text lines, when invoked with an nrows parameter equal to the number of text lines.
Do not output coloured text, even if the display supports it.
Specifies that the frame buffer endianness is different from the CPU's.
Set when the text cursor is enabled.
Clear the display upon initialization.
Clear display margins upon initialization.
Center the text area.
Rotate the text display quarter clockwise.
Rotate the text display quarter counter-clockwise.
rasops_reconfig() completed successfully
Support the use of multiple screens.
Do not read back pixels from the frame buffer memory when performing screen-to-screen copy operations. This flag is ignored unless RI_VCONS is set or the ri_bs member is set.

rasops_init(ri, wantrows, wantcols)
Initialise a rasops_info descriptor. The arguments wantrows and wantcols are the number of rows and columns we'd like. In terms of optimization, fonts that are a multiple of 8 pixels wide work the best.
rasops_reconfig(ri, wantrows, wantcols)
Reconfigure a rasops_info descriptor because parameters have changed in some way. The arguments wantrows and wantcols are the number of rows and columns we'd like. If calling rasops_reconfig() to change the font and ri_wsfcookie ≥ 0, you must call wsfont_unlock() on it, and reset it to -1 (or a new, valid cookie).

This section describes places within the OpenBSD source tree where actual code implementing or utilising the rasops subsystem can be found. All pathnames are relative to /usr/src.

The rasops subsystem is implemented within the directory sys/dev/rasops. The rasops module itself is implemented within the file sys/dev/rasops/rasops.c.


The rasops subsystem appeared in NetBSD 1.5 and OpenBSD first support appeared in OpenBSD 2.9.

The rasops subsystem was written by Andrew Doran <ad@NetBSD.org>. Display rotation was written by Christopher Pascoe <pascoe@openbsd.org>.

Display rotation only works for 16bpp displays.
August 21, 2017 OpenBSD-current