This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / linux / xenfb.h
1 /*
2  * linux/include/linux/xenfb.h -- Xen virtual frame buffer device
3  *
4  * Copyright (C) 2005
5  *
6  *      Anthony Liguori <aliguori@us.ibm.com>
7  *
8  *  This file is subject to the terms and conditions of the GNU General Public
9  *  License. See the file COPYING in the main directory of this archive for
10  *  more details.
11  */
12
13 #ifndef _LINUX_XENFB_H
14 #define _LINUX_XENFB_H
15
16 #include <asm/types.h>
17
18 /* out events */
19
20 #define XENFB_OUT_EVENT_SIZE 40
21
22 #define XENFB_TYPE_MOTION 1
23 #define XENFB_TYPE_UPDATE 2
24
25 struct xenfb_motion         /* currently unused */
26 {
27         __u8 type;          /* XENFB_TYPE_MOTION */
28         __u16 x;            /* The new x coordinate */
29         __u16 y;            /* The new y coordinate */
30 };
31
32 struct xenfb_update
33 {
34         __u8 type;          /* XENFB_TYPE_UPDATE */
35         __u16 x;            /* source x */
36         __u16 y;            /* source y */
37         __u16 width;        /* rect width */
38         __u16 height;       /* rect height */
39 };
40
41 union xenfb_out_event
42 {
43         __u8 type;
44         struct xenfb_motion motion;
45         struct xenfb_update update;
46         char _[XENFB_OUT_EVENT_SIZE];
47 };
48
49 /* in events */
50
51 #define XENFB_IN_EVENT_SIZE 40
52
53 #define XENFB_TYPE_SET_EVENTS 1
54
55 #define XENFB_FLAG_MOTION 1
56 #define XENFB_FLAG_UPDATE 2
57 #define XENFB_FLAG_COPY 4
58 #define XENFB_FLAG_FILL 8
59
60 struct xenfb_set_events
61 {
62         __u8 type;          /* XENFB_TYPE_SET_EVENTS */
63         __u32 flags;        /* combination of XENFB_FLAG_* */
64 };
65
66 union xenfb_in_event
67 {
68         __u8 type;
69         struct xenfb_set_events set_events;
70         char _[XENFB_OUT_EVENT_SIZE];
71 };
72
73 /* shared page */
74
75 #define XENFB_IN_RING_SIZE 1024
76 #define XENFB_IN_RING_LEN (XENFB_IN_RING_SIZE / XENFB_IN_EVENT_SIZE)
77 #define XENFB_IN_RING_OFFS 1024
78 #define XENFB_IN_RING(page) \
79     ((union xenfb_in_event *)((char *)(page) + XENFB_IN_RING_OFFS))
80 #define XENFB_IN_RING_REF(page, idx) \
81     (XENFB_IN_RING((page))[(idx) % XENFB_IN_RING_LEN])
82
83 #define XENFB_OUT_RING_SIZE 2048
84 #define XENFB_OUT_RING_LEN (XENFB_OUT_RING_SIZE / XENFB_OUT_EVENT_SIZE)
85 #define XENFB_OUT_RING_OFFS (XENFB_IN_RING_OFFS + XENFB_IN_RING_SIZE)
86 #define XENFB_OUT_RING(page) \
87     ((union xenfb_out_event *)((char *)(page) + XENFB_OUT_RING_OFFS))
88 #define XENFB_OUT_RING_REF(page, idx) \
89     (XENFB_OUT_RING((page))[(idx) % XENFB_OUT_RING_LEN])
90
91 struct xenfb_page
92 {
93         __u16 width;         /* the width of the framebuffer (in pixels) */
94         __u16 height;        /* the height of the framebuffer (in pixels) */
95         __u32 line_length;   /* the length of a row of pixels (in bytes) */
96         __u32 mem_length;    /* the length of the framebuffer (in bytes) */
97         __u8 depth;          /* the depth of a pixel (in bits) */
98
99         unsigned long pd[2];    /* FIXME rename to pgdir? */
100         /* FIXME pd[1] unused at this time, shrink? */
101
102         __u32 in_cons, in_prod;
103         __u32 out_cons, out_prod;
104 };
105
106 void xenfb_resume(void);
107
108 #endif