/*-
* Copyright (c) 2005, 2006 Michael Lorenz
* All rights reserved.
*
* 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.
*/
struct vcons_screen {
struct rasops_info scr_ri;
LIST_ENTRY(vcons_screen) next;
void *scr_cookie;
struct vcons_data *scr_vd;
struct vcons_data *scr_origvd;
struct wsscreen_descr *scr_type;
uint32_t *scr_chars;
long *scr_attrs;
void (*putchar)(void *, int, int, u_int, long);
long scr_defattr;
/* static flags set by the driver */
uint32_t scr_flags;
#define VCONS_NO_REDRAW 1 /* don't readraw in switch_screen */
#define VCONS_SCREEN_IS_STATIC 2 /* don't free() this vcons_screen */
#define VCONS_SWITCH_NEEDS_POLLING 4 /* rasops can overlap so we need to
* poll the busy flag when switching
* - for drivers that use software
* drawing */
#define VCONS_DONT_DRAW 8 /* don't draw on this screen at all */
/*
* the following flags are for drivers which either can't accelerate (all) copy
* operations or where drawing characters is faster than the blitter
* for example, Sun's Creator boards can't accelerate copycols()
*/
#define VCONS_NO_COPYCOLS 0x10 /* use putchar() based copycols() */
#define VCONS_NO_COPYROWS 0x20 /* use putchar() based copyrows() */
#define VCONS_DONT_READ (VCONS_NO_COPYCOLS|VCONS_NO_COPYROWS|VCONS_NO_CURSOR)
/* avoid framebuffer reads */
#define VCONS_LOADFONT 0x40 /* driver can load_font() */
#define VCONS_NO_CURSOR 0x80 /* use putchar() based cursor(), to
* avoid fb reads */
#define VCONS_FONT_BITS_R2L 0x100 /* request right-to-left bitorder in
* wsfont_find() */
#define VCONS_FONT_BYTES_R2L 0x200 /* request right-to-left byteorder in
* wsfont_find() */
/* status flags used by vcons */
uint32_t scr_status;
#define VCONS_IS_VISIBLE 1 /* this screen is currently visible */
/* non zero when some rasops operation is in progress */
int scr_busy;
#ifdef WSDISPLAY_SCROLLSUPPORT
int scr_lines_in_buffer;
int scr_current_line;
int scr_line_wanted;
int scr_offset_to_zero;
int scr_current_offset;
#endif
#ifdef VCONS_DRAW_INTR
unsigned int scr_dirty;
#endif
};
struct vcons_data {
/* usually the drivers softc */
void *cookie;
/*
* setup the rasops part of the passed vcons_screen, like
* geometry, framebuffer address, font, characters, acceleration.
* we pass the cookie as 1st parameter
*/
void (*init_screen)(void *, struct vcons_screen *, int,
long *);
/* called before vcons_redraw_screen */
void *show_screen_cookie;
void (*show_screen_cb)(struct vcons_screen *, void *);