Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

.\"     $NetBSD: rasops.9,v 1.19 2019/08/08 00:20:54 uwe Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Gregory McGarry.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd August 7, 2019
.Dt RASOPS 9
.Os
.Sh NAME
.Nm rasops ,
.Nm rasops_init ,
.Nm rasops_reconfig
.Nd raster display operations
.Sh SYNOPSIS
.In dev/wscons/wsdisplayvar.h
.In dev/rasops/rasops.h
.Ft int
.Fn rasops_init "struct rasops_info *ri" "int wantrows" "int wantcols"
.Ft int
.Fn rasops_reconfig "struct rasops_info *ri" "int wantrows" "int wantcols"
.Pp
.Cd options RASOPS_DEFAULT_WIDTH=80
.Cd options RASOPS_DEFAULT_HEIGHT=25
.Sh DESCRIPTION
The
.Nm
subsystem is a set of raster operations for
.Xr wscons 9 .
.Pp
The primary data type for using the raster operations is the
.Vt rasops_info
structure in
.In dev/rasops/rasops.h .
.Pp
Valid values for the
.Fa ri_flg
member are:
.Pp
.Bl -tag -width ".Dv RI_ENABLE_ALPHA" -offset indent -compact
.It Dv RI_FULLCLEAR
.Fn eraserows
hack to clear full screen
.It Dv RI_FORCEMONO
monochrome output even if we can do color
.It Dv RI_BSWAP
framebuffer endianness doesn't match CPU
.It Dv RI_CURSOR
cursor is switched on
.It Dv RI_CLEAR
clear display on startup
.It Dv RI_CENTER
center onscreen output
.It Dv RI_CURSORCLIP
cursor is currently clipped
.It Dv RI_CFGDONE
.Fn rasops_reconfig
completed successfully
.It Dv 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.
.It Dv RI_ENABLE_ALPHA
the caller supports anti-aliased fonts in the given colour depth.
Without this flag
.Fn rasops_init
will only pick bitmap fonts.
.It Dv RI_8BIT_IS_RGB
the caller uses an R3G3B2 colour map in 8 bit.
.Fn rasops_init
will generate an appropriate
.Fa ri_devcmap Ns Li []
but the caller still needs to set up the actual colour map.
.El
.Sh FUNCTIONS
.Fn rasops_init
initialises a
.Vt rasops_info
descriptor.
.Fn rasops_reconfig
is used to reconfigure it if parameters have changed in some way.
.Pp
The arguments
.Fa wantrows
and
.Fa wantcols
are the number of rows and columns we'd like.
Passing zero for either one of them uses the default \(em normally
80 by 25 but it can be changed with config options
.Dv RASOPS_DEFAULT_WIDTH
and
.Dv RASOPS_DEFAULT_HEIGHT .
.Pp
In terms of optimization, bitmap fonts of width 8 or 16 work the best
for all depths.
For depths other than 1 the fonts of width 12 are also optimized.
.Pp
If calling
.Fn rasops_reconfig
to change the font and
.Fa ri_wsfcookie
is non-negative, you must call
.Fn wsfont_unlock
on it, and reset it to \-1 or a new, valid cookie.
.Sh CODE REFERENCES
The rasops subsystem is implemented within the directory
.Pa sys/dev/rasops .
The
.Nm
module itself is implemented within the file
.Pa sys/dev/rasops/rasops.c .
.Sh SEE ALSO
.Xr intro 9 ,
.Xr wscons 9 ,
.Xr wsdisplay 9 ,
.Xr wsfont 9
.Sh HISTORY
The
.Nm
subsystem appeared in
.Nx 1.5 .
.Sh AUTHORS
The
.Nm
subsystem was written by
.An Andrew Doran
.Aq ad@NetBSD.org .