1 /* $NetBSD: fbif.h,v 1.2 2007/09/23 16:25:30 bouyer Exp $ */
3 * fbif.h -- Xen virtual frame buffer device
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
23 * Copyright (C) 2005 Anthony Liguori <aliguori@us.ibm.com>
24 * Copyright (C) 2006 Red Hat, Inc., Markus Armbruster <armbru@redhat.com>
27 #ifndef __XEN_PUBLIC_IO_FBIF_H__
28 #define __XEN_PUBLIC_IO_FBIF_H__
30 /* Out events (frontend -> backend) */
33 * Out events may be sent only when requested by backend, and receipt
34 * of an unknown out event is an error.
37 /* Event type 1 currently not used */
39 * Framebuffer update notification event
40 * Capable frontend sets feature-update in xenstore.
41 * Backend requests it by setting request-update in xenstore.
43 #define XENFB_TYPE_UPDATE 2
47 uint8_t type
; /* XENFB_TYPE_UPDATE */
48 int32_t x
; /* source x */
49 int32_t y
; /* source y */
50 int32_t width
; /* rect width */
51 int32_t height
; /* rect height */
55 * Framebuffer resize notification event
56 * Capable backend sets feature-resize in xenstore.
58 #define XENFB_TYPE_RESIZE 3
62 uint8_t type
; /* XENFB_TYPE_RESIZE */
63 int32_t width
; /* width in pixels */
64 int32_t height
; /* height in pixels */
65 int32_t stride
; /* stride in bytes */
66 int32_t depth
; /* depth in bits */
67 int32_t offset
; /* offset of the framebuffer in bytes */
70 #define XENFB_OUT_EVENT_SIZE 40
75 struct xenfb_update update
;
76 struct xenfb_resize resize
;
77 char pad
[XENFB_OUT_EVENT_SIZE
];
80 /* In events (backend -> frontend) */
83 * Frontends should ignore unknown in events.
87 * Framebuffer refresh period advice
88 * Backend sends it to advise the frontend their preferred period of
89 * refresh. Frontends that keep the framebuffer constantly up-to-date
90 * just ignore it. Frontends that use the advice should immediately
91 * refresh the framebuffer (and send an update notification event if
92 * those have been requested), then use the update frequency to guide
93 * their periodical refreshs.
95 #define XENFB_TYPE_REFRESH_PERIOD 1
96 #define XENFB_NO_REFRESH 0
98 struct xenfb_refresh_period
100 uint8_t type
; /* XENFB_TYPE_UPDATE_PERIOD */
101 uint32_t period
; /* period of refresh, in ms,
102 * XENFB_NO_REFRESH if no refresh is needed */
105 #define XENFB_IN_EVENT_SIZE 40
110 struct xenfb_refresh_period refresh_period
;
111 char pad
[XENFB_IN_EVENT_SIZE
];
116 #define XENFB_IN_RING_SIZE 1024
117 #define XENFB_IN_RING_LEN (XENFB_IN_RING_SIZE / XENFB_IN_EVENT_SIZE)
118 #define XENFB_IN_RING_OFFS 1024
119 #define XENFB_IN_RING(page) \
120 ((union xenfb_in_event *)((char *)(page) + XENFB_IN_RING_OFFS))
121 #define XENFB_IN_RING_REF(page, idx) \
122 (XENFB_IN_RING((page))[(idx) % XENFB_IN_RING_LEN])
124 #define XENFB_OUT_RING_SIZE 2048
125 #define XENFB_OUT_RING_LEN (XENFB_OUT_RING_SIZE / XENFB_OUT_EVENT_SIZE)
126 #define XENFB_OUT_RING_OFFS (XENFB_IN_RING_OFFS + XENFB_IN_RING_SIZE)
127 #define XENFB_OUT_RING(page) \
128 ((union xenfb_out_event *)((char *)(page) + XENFB_OUT_RING_OFFS))
129 #define XENFB_OUT_RING_REF(page, idx) \
130 (XENFB_OUT_RING((page))[(idx) % XENFB_OUT_RING_LEN])
134 uint32_t in_cons
, in_prod
;
135 uint32_t out_cons
, out_prod
;
137 int32_t width
; /* the width of the framebuffer (in pixels) */
138 int32_t height
; /* the height of the framebuffer (in pixels) */
139 uint32_t line_length
; /* the length of a row of pixels (in bytes) */
140 uint32_t mem_length
; /* the length of the framebuffer (in bytes) */
141 uint8_t depth
; /* the depth of a pixel (in bits) */
144 * Framebuffer page directory
146 * Each directory page holds PAGE_SIZE / sizeof(*pd)
147 * framebuffer pages, and can thus map up to PAGE_SIZE *
148 * PAGE_SIZE / sizeof(*pd) bytes. With PAGE_SIZE == 4096 and
149 * sizeof(unsigned long) == 4/8, that's 4 Megs 32 bit and 2 Megs
150 * 64 bit. 256 directories give enough room for a 512 Meg
151 * framebuffer with a max resolution of 12,800x10,240. Should
152 * be enough for a while with room leftover for expansion.
154 unsigned long pd
[256];
158 * Wart: xenkbd needs to know default resolution. Put it here until a
159 * better solution is found, but don't leak it to the backend.
162 #define XENFB_WIDTH 800
163 #define XENFB_HEIGHT 600
164 #define XENFB_DEPTH 32
175 * indent-tabs-mode: nil