Manual browser: rasops_reconfig(9)

Section:
Page:
RASOPS(9) Kernel Developer's Manual RASOPS(9)

NAME

rasops, rasops_init, rasops_reconfigraster display operations

SYNOPSIS

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

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

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

DESCRIPTION

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

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 */ 
 
	/* 
	 * If you want shadow framebuffer support, point ri_hwbits 
	 * to the real framebuffer, and ri_bits to the shadow framebuffer 
	 */ 
	u_char	*ri_hwbits; 
 
	/* 
	 * 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 */ 
	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 *); 
};

Valid values for the ri_flg member are:

RI_FULLCLEAR
eraserows() hack to clear full screen
RI_FORCEMONO
monochrome output even if we can do color
RI_BSWAP
framebuffer endianness doesn't match CPU
RI_CURSOR
cursor is switched on
RI_CLEAR
clear display on startup
RI_CENTER
center onscreen output
RI_CURSORCLIP
cursor is currently clipped
RI_CFGDONE
rasops_reconfig() completed successfully
RI_NO_AUTO
do not generate box drawing characters for ISO fonts. Use this when it is not safe to allocate memory, for example when setting up an early console.
RI_ENABLE_ALPHA
set this if the caller supports anti-aliased fonts in the given colour depth. Without this flag rasops_init() will only pick bitmap fonts.
RI_8BIT_IS_RGB
set this if the caller uses an R3G3B2 colour map in 8 bit. rasops_init() will generate an appropriate ri_devcmap[] but the caller still needs to set up the actual colour map.

FUNCTIONS

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. Passing zero for either one of them uses the default - normally 80x25 but it can be changed with

options RASOPS_DEFAULT_WIDTH=80 
options RASOPS_DEFAULT_HEIGHT=25
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).

CODE REFERENCES

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.

HISTORY

The rasops subsystem appeared in NetBSD 1.5.

AUTHORS

The rasops subsystem was written by Andrew Doran <ad@NetBSD.org>.
January 13, 2012 NetBSD 7.0