diff options
Diffstat (limited to 'saa/saa.h')
-rw-r--r-- | saa/saa.h | 209 |
1 files changed, 209 insertions, 0 deletions
diff --git a/saa/saa.h b/saa/saa.h new file mode 100644 index 0000000..c7aa3b6 --- /dev/null +++ b/saa/saa.h | |||
@@ -0,0 +1,209 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright (C) 2000 Keith Packard | ||
4 | * 2004 Eric Anholt | ||
5 | * 2005 Zack Rusin | ||
6 | * | ||
7 | * Copyright 2011 VMWare, Inc. All rights reserved. | ||
8 | * | ||
9 | * Permission to use, copy, modify, distribute, and sell this software and its | ||
10 | * documentation for any purpose is hereby granted without fee, provided that | ||
11 | * the above copyright notice appear in all copies and that both that | ||
12 | * copyright notice and this permission notice appear in supporting | ||
13 | * documentation, and that the name of copyright holders not be used in | ||
14 | * advertising or publicity pertaining to distribution of the software without | ||
15 | * specific, written prior permission. Copyright holders make no | ||
16 | * representations about the suitability of this software for any purpose. It | ||
17 | * is provided "as is" without express or implied warranty. | ||
18 | * | ||
19 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS | ||
20 | * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
21 | * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
22 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
23 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN | ||
24 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING | ||
25 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | ||
26 | * SOFTWARE. | ||
27 | * | ||
28 | * Author: Based on "exa.h" | ||
29 | * Author: Thomas Hellstrom <thellstrom@vmware.com> | ||
30 | */ | ||
31 | |||
32 | #ifndef _SAA_H_ | ||
33 | #define _SAA_H_ | ||
34 | |||
35 | #ifdef HAVE_CONFIG_H | ||
36 | #include <config.h> | ||
37 | #endif | ||
38 | #ifdef HAVE_DIX_CONFIG_H | ||
39 | #include <dix-config.h> | ||
40 | #else | ||
41 | #include <xorg-server.h> | ||
42 | #endif | ||
43 | #include <xf86.h> | ||
44 | #include <damage.h> | ||
45 | #include <picturestr.h> | ||
46 | |||
47 | #define SAA_VERSION_MAJOR 0 | ||
48 | #define SAA_VERSION_MINOR 1 | ||
49 | |||
50 | #define SAA_ACCESS_R (1 << 0) | ||
51 | #define SAA_ACCESS_W (1 << 1) | ||
52 | #define SAA_ACCESS_RW (SAA_ACCESS_R | SAA_ACCESS_W) | ||
53 | |||
54 | #define SAA_PIXMAP_HINT_CREATE_HW (1 << 25) | ||
55 | #define SAA_PIXMAP_PREFER_SHADOW (1 << 0) | ||
56 | |||
57 | typedef unsigned int saa_access_t; | ||
58 | |||
59 | enum saa_pixmap_loc { | ||
60 | saa_loc_driver, | ||
61 | saa_loc_override, | ||
62 | }; | ||
63 | |||
64 | struct saa_pixmap { | ||
65 | PixmapPtr pixmap; | ||
66 | int read_access; | ||
67 | int write_access; | ||
68 | unsigned int mapped_access; | ||
69 | Bool fallback_created; | ||
70 | RegionRec dirty_shadow; | ||
71 | RegionRec dirty_hw; | ||
72 | RegionRec shadow_damage; | ||
73 | DamagePtr damage; | ||
74 | void *addr; | ||
75 | void *override; | ||
76 | enum saa_pixmap_loc auth_loc; | ||
77 | PictFormatShort src_format; | ||
78 | PictFormatShort dst_format; | ||
79 | uint32_t pad[16]; | ||
80 | }; | ||
81 | |||
82 | struct saa_driver { | ||
83 | unsigned int saa_major; | ||
84 | unsigned int saa_minor; | ||
85 | size_t pixmap_size; | ||
86 | Bool(*damage) (struct saa_driver * driver, PixmapPtr pixmap, | ||
87 | Bool hw, RegionPtr damage); | ||
88 | void (*operation_complete) (struct saa_driver * driver, PixmapPtr pixmap); | ||
89 | Bool(*download_from_hw) (struct saa_driver * driver, PixmapPtr pixmap, | ||
90 | RegionPtr readback); | ||
91 | void (*release_from_cpu) (struct saa_driver * driver, PixmapPtr pixmap, | ||
92 | saa_access_t access); | ||
93 | void *(*sync_for_cpu) (struct saa_driver * driver, PixmapPtr pixmap, | ||
94 | saa_access_t access); | ||
95 | void *(*map) (struct saa_driver * driver, PixmapPtr pixmap, | ||
96 | saa_access_t access); | ||
97 | void (*unmap) (struct saa_driver * driver, PixmapPtr pixmap, | ||
98 | saa_access_t access); | ||
99 | Bool(*create_pixmap) (struct saa_driver * driver, struct saa_pixmap * spix, | ||
100 | int w, int h, int depth, unsigned int usage_hint, | ||
101 | int bpp, int *new_pitch); | ||
102 | void (*destroy_pixmap) (struct saa_driver * driver, PixmapPtr pixmap); | ||
103 | Bool (*modify_pixmap_header) (PixmapPtr pixmap, int w, int h, int depth, | ||
104 | int bpp, int devkind, void *pPixData); | ||
105 | |||
106 | Bool (*copy_prepare) (struct saa_driver * driver, PixmapPtr src_pixmap, | ||
107 | PixmapPtr dst_pixmap, int dx, int dy, int alu, | ||
108 | RegionPtr scr_reg, uint32_t plane_mask); | ||
109 | void (*copy) (struct saa_driver * driver, int src_x, int src_y, int dst_x, | ||
110 | int dst_y, int w, int h); | ||
111 | void (*copy_done) (struct saa_driver * driver); | ||
112 | Bool (*composite_prepare) (struct saa_driver *driver, CARD8 op, | ||
113 | PicturePtr src_pict, PicturePtr mask_pict, | ||
114 | PicturePtr dst_pict, | ||
115 | PixmapPtr src_pix, PixmapPtr mask_pix, | ||
116 | PixmapPtr dst_pix, | ||
117 | RegionPtr src_region, | ||
118 | RegionPtr mask_region, | ||
119 | RegionPtr dst_region); | ||
120 | void (*composite) (struct saa_driver *driver, | ||
121 | int src_x, int src_y, int mask_x, int mask_y, | ||
122 | int dst_x, int dst_y, | ||
123 | int width, int height); | ||
124 | void (*composite_done) (struct saa_driver *driver); | ||
125 | |||
126 | void (*takedown) (struct saa_driver * driver); | ||
127 | uint32_t pad[16]; | ||
128 | }; | ||
129 | |||
130 | extern _X_EXPORT PixmapPtr | ||
131 | saa_get_drawable_pixmap(DrawablePtr pDrawable); | ||
132 | |||
133 | extern _X_EXPORT void | ||
134 | saa_get_drawable_deltas(DrawablePtr pDrawable, PixmapPtr pPixmap, | ||
135 | int *xp, int *yp); | ||
136 | |||
137 | extern _X_EXPORT PixmapPtr | ||
138 | saa_get_pixmap(DrawablePtr drawable, int *xp, int *yp); | ||
139 | |||
140 | extern _X_EXPORT Bool | ||
141 | saa_prepare_access_pixmap(PixmapPtr pix, saa_access_t access, | ||
142 | RegionPtr read_reg); | ||
143 | |||
144 | extern _X_EXPORT Bool | ||
145 | saa_pad_read(DrawablePtr draw); | ||
146 | |||
147 | Bool | ||
148 | saa_pad_read_box(DrawablePtr draw, int x, int y, int w, int h); | ||
149 | |||
150 | extern _X_EXPORT Bool | ||
151 | saa_pad_write(DrawablePtr draw, GCPtr pGC, Bool check_read, | ||
152 | saa_access_t * access); | ||
153 | |||
154 | extern _X_EXPORT void | ||
155 | saa_finish_access_pixmap(PixmapPtr pix, saa_access_t access); | ||
156 | |||
157 | extern _X_EXPORT void | ||
158 | saa_fad_read(DrawablePtr draw); | ||
159 | |||
160 | extern _X_EXPORT void | ||
161 | saa_fad_write(DrawablePtr draw, saa_access_t access); | ||
162 | |||
163 | extern _X_EXPORT Bool | ||
164 | saa_resources_init(ScreenPtr screen); | ||
165 | |||
166 | extern _X_EXPORT void | ||
167 | saa_driver_fini(ScreenPtr pScreen); | ||
168 | |||
169 | extern _X_EXPORT int | ||
170 | saa_create_gc(GCPtr pGC); | ||
171 | |||
172 | extern _X_EXPORT RegionPtr | ||
173 | saa_bitmap_to_region(PixmapPtr pPix); | ||
174 | |||
175 | extern _X_EXPORT Bool | ||
176 | saa_close_screen(int i, ScreenPtr pScreen); | ||
177 | |||
178 | extern _X_EXPORT Bool | ||
179 | saa_gc_reads_destination(DrawablePtr pDrawable, GCPtr pGC); | ||
180 | |||
181 | extern _X_EXPORT Bool | ||
182 | saa_op_reads_destination(CARD8 op); | ||
183 | |||
184 | extern _X_EXPORT void | ||
185 | saa_set_fallback_debug(ScreenPtr screen, Bool enable); | ||
186 | |||
187 | extern _X_EXPORT | ||
188 | struct saa_pixmap *saa_get_saa_pixmap(PixmapPtr pPixmap); | ||
189 | |||
190 | extern _X_EXPORT Bool | ||
191 | saa_add_damage(PixmapPtr pixmap); | ||
192 | |||
193 | extern _X_EXPORT struct saa_driver * | ||
194 | saa_get_driver(ScreenPtr pScreen); | ||
195 | |||
196 | extern _X_EXPORT Bool | ||
197 | saa_driver_init(ScreenPtr screen, struct saa_driver *saa_driver); | ||
198 | |||
199 | extern _X_EXPORT void | ||
200 | saa_pixmap_dirty(PixmapPtr pixmap, Bool hw, RegionPtr reg); | ||
201 | |||
202 | extern _X_EXPORT void | ||
203 | saa_drawable_dirty(DrawablePtr draw, Bool hw, RegionPtr reg); | ||
204 | |||
205 | #define SAA_PM_IS_SOLID(_pDrawable, _pm) \ | ||
206 | (((_pm) & FbFullMask((_pDrawable)->depth)) == \ | ||
207 | FbFullMask((_pDrawable)->depth)) | ||
208 | |||
209 | #endif | ||