1 /* $NetBSD: wsdisplay_vconsvar.h,v 1.9 2008/04/28 20:24:01 martin Exp $ */
4 * Copyright (c) 2005, 2006 Michael Lorenz
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
29 #ifndef _WSDISPLAY_VCONS_H_
30 #define _WSDISPLAY_VCONS_H_
32 #include "opt_wsdisplay_compat.h"
33 #include "opt_vcons.h"
38 struct rasops_info scr_ri
;
39 LIST_ENTRY(vcons_screen
) next
;
41 struct vcons_data
*scr_vd
;
42 struct vcons_data
*scr_origvd
;
43 const struct wsscreen_descr
*scr_type
;
47 /* static flags set by the driver */
49 #define VCONS_NO_REDRAW 1 /* don't readraw in switch_screen */
50 #define VCONS_SCREEN_IS_STATIC 2 /* don't free() this vcons_screen */
51 #define VCONS_SWITCH_NEEDS_POLLING 4 /* rasops can overlap so we need to
52 * poll the busy flag when switching
53 * - for drivers that use software
55 #define VCONS_DONT_DRAW 8 /* don't draw on this screen at all */
56 /* status flags used by vcons */
58 #define VCONS_IS_VISIBLE 1 /* this screen is currently visible */
59 /* non zero when some rasops operation is in progress */
61 #ifdef WSDISPLAY_SCROLLSUPPORT
62 int scr_lines_in_buffer
;
65 int scr_offset_to_zero
;
66 int scr_current_offset
;
70 #define SCREEN_IS_VISIBLE(scr) (((scr)->scr_status & VCONS_IS_VISIBLE) != 0)
71 #define SCREEN_IS_BUSY(scr) ((scr)->scr_busy != 0)
72 #define SCREEN_CAN_DRAW(scr) (((scr)->scr_flags & VCONS_DONT_DRAW) == 0)
73 #define SCREEN_BUSY(scr) ((scr)->scr_busy = 1)
74 #define SCREEN_IDLE(scr) ((scr)->scr_busy = 0)
75 #define SCREEN_VISIBLE(scr) ((scr)->scr_status |= VCONS_IS_VISIBLE)
76 #define SCREEN_INVISIBLE(scr) ((scr)->scr_status &= ~VCONS_IS_VISIBLE)
77 #define SCREEN_DISABLE_DRAWING(scr) ((scr)->scr_flags |= VCONS_DONT_DRAW)
78 #define SCREEN_ENABLE_DRAWING(scr) ((scr)->scr_flags &= ~VCONS_DONT_DRAW)
81 /* usually the drivers softc */
85 * setup the rasops part of the passed vcons_screen, like
86 * geometry, framebuffer address, font, characters, acceleration.
87 * we pass the cookie as 1st parameter
89 void (*init_screen
)(void *, struct vcons_screen
*, int,
93 int (*ioctl
)(void *, void *, u_long
, void *, int, struct lwp
*);
96 void (*copycols
)(void *, int, int, int, int);
97 void (*erasecols
)(void *, int, int, int, long);
98 void (*copyrows
)(void *, int, int, int);
99 void (*eraserows
)(void *, int, int, long);
100 void (*putchar
)(void *, int, int, u_int
, long);
101 void (*cursor
)(void *, int, int, int);
102 /* called before vcons_redraw_screen */
103 void (*show_screen_cb
)(struct vcons_screen
*);
104 /* virtual screen management stuff */
105 void (*switch_cb
)(void *, int, int);
107 #ifdef VCONS_SWITCH_ASYNC
108 lwp_t
*redraw_thread
;
109 int start_drawing
, done_drawing
; /* for the drawing thread */
111 struct callout switch_callout
;
112 uint32_t switch_pending
;
113 LIST_HEAD(, vcons_screen
) screens
;
114 struct vcons_screen
*active
, *wanted
;
115 const struct wsscreen_descr
*currenttype
;
116 int switch_poll_count
;
119 int vcons_init(struct vcons_data
*, void *cookie
, struct wsscreen_descr
*,
120 struct wsdisplay_accessops
*);
122 int vcons_init_screen(struct vcons_data
*, struct vcons_screen
*, int,
125 void vcons_redraw_screen(struct vcons_screen
*);
127 void vcons_replay_msgbuf(struct vcons_screen
*);
129 #endif /* _WSDISPLAY_VCONS_H_ */