2001-01-21 16:50:58 +03:00
|
|
|
/* $NetBSD: rasops.h,v 1.14 2001/01/21 13:50:59 takemura Exp $ */
|
1999-04-13 04:17:57 +04:00
|
|
|
|
1999-05-19 01:51:57 +04:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
1999-04-13 04:17:57 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
1999-05-19 01:51:57 +04:00
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
2000-06-13 17:36:42 +04:00
|
|
|
* by Andrew Doran.
|
1999-05-19 01:51:57 +04:00
|
|
|
*
|
1999-04-13 04:17:57 +04:00
|
|
|
* 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.
|
1999-05-19 01:51:57 +04:00
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
1999-04-13 04:17:57 +04:00
|
|
|
*
|
1999-05-19 01:51:57 +04:00
|
|
|
* 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.
|
1999-04-13 04:17:57 +04:00
|
|
|
*/
|
2000-04-12 18:22:28 +04:00
|
|
|
|
1999-04-13 04:17:57 +04:00
|
|
|
#ifndef _RASOPS_H_
|
|
|
|
#define _RASOPS_H_ 1
|
|
|
|
|
|
|
|
struct wsdisplay_font;
|
|
|
|
|
1999-08-24 15:07:31 +04:00
|
|
|
/* For rasops_info::ri_flg */
|
|
|
|
#define RI_FULLCLEAR 0x01 /* eraserows() hack to clear full screen */
|
|
|
|
#define RI_FORCEMONO 0x02 /* monochrome output even if we can do color */
|
|
|
|
#define RI_BSWAP 0x04 /* framebuffer endianness doesn't match CPU */
|
|
|
|
#define RI_CURSOR 0x08 /* cursor is switched on */
|
|
|
|
#define RI_CLEAR 0x10 /* clear display on startup */
|
|
|
|
#define RI_CENTER 0x20 /* center onscreen output */
|
|
|
|
#define RI_CURSORCLIP 0x40 /* cursor is currently clipped */
|
|
|
|
#define RI_CFGDONE 0x80 /* rasops_reconfig() completed successfully */
|
|
|
|
|
1999-04-13 04:17:57 +04:00
|
|
|
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 */
|
|
|
|
|
2000-04-12 18:22:28 +04:00
|
|
|
/*
|
1999-08-24 15:07:31 +04:00
|
|
|
* These can optionally be left zeroed out. If you fill ri_font,
|
1999-04-29 06:49:40 +04:00
|
|
|
* but aren't using wsfont, set ri_wsfcookie to -1.
|
|
|
|
*/
|
1999-04-13 07:02:40 +04:00
|
|
|
struct wsdisplay_font *ri_font;
|
1999-08-24 15:07:31 +04:00
|
|
|
int ri_wsfcookie; /* wsfont cookie */
|
1999-12-15 01:20:28 +03:00
|
|
|
void *ri_hw; /* driver private data; ignored by rasops */
|
1999-08-24 15:07:31 +04:00
|
|
|
int ri_crow; /* cursor row */
|
|
|
|
int ri_ccol; /* cursor column */
|
|
|
|
int ri_flg; /* various operational flags */
|
2000-04-12 18:22:28 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* These are optional and will default if zero. Meaningless
|
1999-04-13 04:17:57 +04:00
|
|
|
* 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, not pels) */
|
|
|
|
int ri_cols; /* number of columns (characters, not pels) */
|
|
|
|
int ri_delta; /* row delta in bytes */
|
1999-04-26 08:27:47 +04:00
|
|
|
int ri_pelbytes; /* bytes per pel (may be zero) */
|
1999-04-13 04:17:57 +04:00
|
|
|
int ri_fontscale; /* fontheight * fontstride */
|
|
|
|
int ri_xscale; /* fontwidth * pelbytes */
|
|
|
|
int ri_yscale; /* fontheight * stride */
|
|
|
|
u_char *ri_origbits; /* where screen bits actually start */
|
1999-04-29 06:49:40 +04:00
|
|
|
int ri_xorigin; /* where ri_bits begins (x) */
|
|
|
|
int ri_yorigin; /* where ri_bits begins (y) */
|
1999-08-24 15:07:31 +04:00
|
|
|
int32_t ri_devcmap[16]; /* color -> framebuffer data */
|
1999-04-13 04:17:57 +04:00
|
|
|
|
1999-04-26 08:27:47 +04:00
|
|
|
/* The emulops you need to use, and the screen caps for wscons */
|
1999-04-13 04:17:57 +04:00
|
|
|
struct wsdisplay_emulops ri_ops;
|
1999-04-26 08:27:47 +04:00
|
|
|
int ri_caps;
|
2000-04-12 18:22:28 +04:00
|
|
|
|
1999-04-13 04:17:57 +04:00
|
|
|
/* Callbacks so we can share some code */
|
1999-04-26 08:27:47 +04:00
|
|
|
void (*ri_do_cursor) __P((struct rasops_info *));
|
1999-04-13 04:17:57 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define DELTA(p, d, cast) ((p) = (cast)((caddr_t)(p) + (d)))
|
|
|
|
|
2000-04-12 18:22:28 +04:00
|
|
|
/*
|
1999-04-13 04:17:57 +04:00
|
|
|
* rasops_init().
|
|
|
|
*
|
2000-04-12 18:22:28 +04:00
|
|
|
* Integer parameters are the number of rows and columns we'd *like*.
|
1999-04-13 04:17:57 +04:00
|
|
|
*
|
|
|
|
* In terms of optimization, fonts that are a multiple of 8 pixels wide
|
1999-08-24 15:07:31 +04:00
|
|
|
* work the best.
|
1999-04-26 08:27:47 +04:00
|
|
|
*
|
2000-04-12 18:22:28 +04:00
|
|
|
* rasops_init() takes care of rasops_reconfig(). The parameters to both
|
1999-08-24 15:07:31 +04:00
|
|
|
* are the same. 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).
|
1999-04-13 04:17:57 +04:00
|
|
|
*/
|
|
|
|
|
2000-04-12 18:22:28 +04:00
|
|
|
/*
|
1999-12-15 01:25:13 +03:00
|
|
|
* Per-depth initalization functions. These should not be called outside
|
|
|
|
* the rasops code.
|
|
|
|
*/
|
1999-10-24 03:14:13 +04:00
|
|
|
void rasops1_init __P((struct rasops_info *));
|
|
|
|
void rasops2_init __P((struct rasops_info *));
|
2001-01-21 16:50:58 +03:00
|
|
|
void rasops4_init __P((struct rasops_info *));
|
1999-10-24 03:14:13 +04:00
|
|
|
void rasops8_init __P((struct rasops_info *));
|
|
|
|
void rasops15_init __P((struct rasops_info *));
|
|
|
|
void rasops24_init __P((struct rasops_info *));
|
|
|
|
void rasops32_init __P((struct rasops_info *));
|
|
|
|
|
1999-04-13 04:17:57 +04:00
|
|
|
/* rasops.c */
|
1999-08-24 15:07:31 +04:00
|
|
|
int rasops_init __P((struct rasops_info *, int, int));
|
|
|
|
int rasops_reconfig __P((struct rasops_info *, int, int));
|
1999-04-13 04:17:57 +04:00
|
|
|
void rasops_unpack_attr __P((long, int *, int *, int *));
|
1999-04-26 08:27:47 +04:00
|
|
|
void rasops_eraserows __P((void *, int, int, long));
|
|
|
|
void rasops_erasecols __P((void *, int, int, int, long));
|
|
|
|
void rasops_copycols __P((void *, int, int, int, int));
|
1999-04-13 04:17:57 +04:00
|
|
|
|
1999-12-03 01:57:13 +03:00
|
|
|
extern const u_char rasops_isgray[16];
|
|
|
|
extern const u_char rasops_cmap[256*3];
|
1999-04-13 04:17:57 +04:00
|
|
|
|
|
|
|
#endif /* _RASOPS_H_ */
|