wsdisplay_vconsvar.h revision 1.4.8.3 1 1.4.8.3 yamt /* $NetBSD: wsdisplay_vconsvar.h,v 1.4.8.3 2006/12/30 20:49:51 yamt Exp $ */
2 1.4.8.2 yamt
3 1.4.8.2 yamt /*-
4 1.4.8.2 yamt * Copyright (c) 2005, 2006 Michael Lorenz
5 1.4.8.2 yamt * All rights reserved.
6 1.4.8.2 yamt *
7 1.4.8.2 yamt * Redistribution and use in source and binary forms, with or without
8 1.4.8.2 yamt * modification, are permitted provided that the following conditions
9 1.4.8.2 yamt * are met:
10 1.4.8.2 yamt * 1. Redistributions of source code must retain the above copyright
11 1.4.8.2 yamt * notice, this list of conditions and the following disclaimer.
12 1.4.8.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
13 1.4.8.2 yamt * notice, this list of conditions and the following disclaimer in the
14 1.4.8.2 yamt * documentation and/or other materials provided with the distribution.
15 1.4.8.2 yamt * 3. All advertising materials mentioning features or use of this software
16 1.4.8.2 yamt * must display the following acknowledgement:
17 1.4.8.2 yamt * This product includes software developed by the NetBSD
18 1.4.8.2 yamt * Foundation, Inc. and its contributors.
19 1.4.8.2 yamt * 4. Neither the name of The NetBSD Foundation nor the names of its
20 1.4.8.2 yamt * contributors may be used to endorse or promote products derived
21 1.4.8.2 yamt * from this software without specific prior written permission.
22 1.4.8.2 yamt *
23 1.4.8.2 yamt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
24 1.4.8.2 yamt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 1.4.8.2 yamt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 1.4.8.2 yamt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
27 1.4.8.2 yamt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 1.4.8.2 yamt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 1.4.8.2 yamt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 1.4.8.2 yamt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 1.4.8.2 yamt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 1.4.8.2 yamt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 1.4.8.2 yamt * POSSIBILITY OF SUCH DAMAGE.
34 1.4.8.2 yamt */
35 1.4.8.2 yamt
36 1.4.8.2 yamt #ifndef _WSDISPLAY_VCONS_H_
37 1.4.8.2 yamt #define _WSDISPLAY_VCONS_H_
38 1.4.8.2 yamt
39 1.4.8.2 yamt struct vcons_data;
40 1.4.8.2 yamt
41 1.4.8.2 yamt struct vcons_screen {
42 1.4.8.2 yamt struct rasops_info scr_ri;
43 1.4.8.2 yamt LIST_ENTRY(vcons_screen) next;
44 1.4.8.2 yamt void *scr_cookie;
45 1.4.8.2 yamt struct vcons_data *scr_vd;
46 1.4.8.2 yamt struct vcons_data *scr_origvd;
47 1.4.8.2 yamt const struct wsscreen_descr *scr_type;
48 1.4.8.2 yamt uint16_t *scr_chars;
49 1.4.8.2 yamt long *scr_attrs;
50 1.4.8.2 yamt long scr_defattr;
51 1.4.8.2 yamt /* static flags set by the driver */
52 1.4.8.2 yamt uint32_t scr_flags;
53 1.4.8.2 yamt #define VCONS_NO_REDRAW 1 /* don't readraw in switch_screen */
54 1.4.8.2 yamt #define VCONS_SCREEN_IS_STATIC 2 /* don't free() this vcons_screen */
55 1.4.8.2 yamt #define VCONS_SWITCH_NEEDS_POLLING 4 /* rasops can overlap so we need to
56 1.4.8.2 yamt * poll the busy flag when switching
57 1.4.8.2 yamt * - for drivers that use software
58 1.4.8.2 yamt * drawing */
59 1.4.8.2 yamt #define VCONS_DONT_DRAW 8 /* don't draw on this screen at all */
60 1.4.8.2 yamt /* status flags used by vcons */
61 1.4.8.2 yamt uint32_t scr_status;
62 1.4.8.2 yamt #define VCONS_IS_VISIBLE 1 /* this screen is currently visible */
63 1.4.8.2 yamt /* non zero when some rasops operation is in progress */
64 1.4.8.2 yamt int scr_busy;
65 1.4.8.2 yamt };
66 1.4.8.2 yamt
67 1.4.8.2 yamt #define SCREEN_IS_VISIBLE(scr) (((scr)->scr_status & VCONS_IS_VISIBLE) != 0)
68 1.4.8.2 yamt #define SCREEN_IS_BUSY(scr) ((scr)->scr_busy != 0)
69 1.4.8.2 yamt #define SCREEN_CAN_DRAW(scr) (((scr)->scr_flags & VCONS_DONT_DRAW) == 0)
70 1.4.8.2 yamt #define SCREEN_BUSY(scr) ((scr)->scr_busy = 1)
71 1.4.8.2 yamt #define SCREEN_IDLE(scr) ((scr)->scr_busy = 0)
72 1.4.8.2 yamt #define SCREEN_VISIBLE(scr) ((scr)->scr_status |= VCONS_IS_VISIBLE)
73 1.4.8.2 yamt #define SCREEN_INVISIBLE(scr) ((scr)->scr_status &= ~VCONS_IS_VISIBLE)
74 1.4.8.2 yamt #define SCREEN_DISABLE_DRAWING(scr) ((scr)->scr_flags |= VCONS_DONT_DRAW)
75 1.4.8.2 yamt #define SCREEN_ENABLE_DRAWING(scr) ((scr)->scr_flags &= ~VCONS_DONT_DRAW)
76 1.4.8.2 yamt struct vcons_data {
77 1.4.8.2 yamt /* usually the drivers softc */
78 1.4.8.2 yamt void *cookie;
79 1.4.8.2 yamt
80 1.4.8.2 yamt /*
81 1.4.8.2 yamt * setup the rasops part of the passed vcons_screen, like
82 1.4.8.2 yamt * geometry, framebuffer address, font, characters, acceleration.
83 1.4.8.2 yamt * we pass the cookie as 1st parameter
84 1.4.8.2 yamt */
85 1.4.8.2 yamt void (*init_screen)(void *, struct vcons_screen *, int,
86 1.4.8.2 yamt long *);
87 1.4.8.2 yamt
88 1.4.8.2 yamt /* accessops */
89 1.4.8.2 yamt int (*ioctl)(void *, void *, u_long, caddr_t, int, struct lwp *);
90 1.4.8.2 yamt
91 1.4.8.2 yamt /* rasops */
92 1.4.8.2 yamt void (*copycols)(void *, int, int, int, int);
93 1.4.8.2 yamt void (*erasecols)(void *, int, int, int, long);
94 1.4.8.2 yamt void (*copyrows)(void *, int, int, int);
95 1.4.8.2 yamt void (*eraserows)(void *, int, int, long);
96 1.4.8.2 yamt void (*putchar)(void *, int, int, u_int, long);
97 1.4.8.2 yamt void (*cursor)(void *, int, int, int);
98 1.4.8.2 yamt /* called before cvons_redraw_screen */
99 1.4.8.2 yamt void (*show_screen_cb)(struct vcons_screen *);
100 1.4.8.2 yamt /* virtual screen management stuff */
101 1.4.8.2 yamt void (*switch_cb)(void *, int, int);
102 1.4.8.2 yamt void *switch_cb_arg;
103 1.4.8.2 yamt struct callout switch_callout;
104 1.4.8.2 yamt uint32_t switch_pending;
105 1.4.8.2 yamt LIST_HEAD(, vcons_screen) screens;
106 1.4.8.2 yamt struct vcons_screen *active, *wanted;
107 1.4.8.2 yamt const struct wsscreen_descr *currenttype;
108 1.4.8.2 yamt int switch_poll_count;
109 1.4.8.2 yamt };
110 1.4.8.2 yamt
111 1.4.8.2 yamt int vcons_init(struct vcons_data *, void *cookie, struct wsscreen_descr *,
112 1.4.8.2 yamt struct wsdisplay_accessops *);
113 1.4.8.2 yamt
114 1.4.8.2 yamt int vcons_init_screen(struct vcons_data *, struct vcons_screen *, int,
115 1.4.8.2 yamt long *);
116 1.4.8.2 yamt
117 1.4.8.2 yamt void vcons_redraw_screen(struct vcons_screen *);
118 1.4.8.2 yamt
119 1.4.8.2 yamt
120 1.4.8.2 yamt
121 1.4.8.2 yamt #endif /* _WSDISPLAY_VCONS_H_ */
122