summaryrefslogtreecommitdiff
path: root/saa/saa_priv.h
diff options
context:
space:
mode:
Diffstat (limited to 'saa/saa_priv.h')
-rw-r--r--saa/saa_priv.h279
1 files changed, 279 insertions, 0 deletions
diff --git a/saa/saa_priv.h b/saa/saa_priv.h
new file mode 100644
index 0000000..6652054
--- /dev/null
+++ b/saa/saa_priv.h
@@ -0,0 +1,279 @@
1/*
2 *
3 * Copyright (C) 2000 Keith Packard, member of The XFree86 Project, Inc.
4 * 2005 Zack Rusin, Trolltech
5 * Copyright 2011 VMWare, inc. All rights reserved.
6 *
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of Keith Packard not be used in
12 * advertising or publicity pertaining to distribution of the software without
13 * specific, written prior permission. Keith Packard makes no
14 * representations about the suitability of this software for any purpose. It
15 * is provided "as is" without express or implied warranty.
16 *
17 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
18 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
19 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
21 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
22 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
23 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
24 * SOFTWARE.
25 *
26 * Authors: Based on exa_priv.h
27 * Authors: Thomas Hellstrom <thellstrom@vmware.com>
28 */
29
30#ifndef _SAA_PRIV_H
31#define _SAA_PRIV_H
32
33#ifdef HAVE_CONFIG_H
34#include <config.h>
35#endif
36#ifdef HAVE_DIX_CONFIG_H
37#include <dix-config.h>
38#else
39#include <xorg-server.h>
40#endif
41#include "xf86.h"
42
43#include "saa.h"
44
45#include <X11/X.h>
46#include <X11/Xproto.h>
47#include "scrnintstr.h"
48#include "pixmapstr.h"
49#include "windowstr.h"
50#include "servermd.h"
51#include "mibstore.h"
52#include "colormapst.h"
53#include "gcstruct.h"
54#include "input.h"
55#include "mipointer.h"
56#include "mi.h"
57#include "dix.h"
58#include "fb.h"
59#ifdef RENDER
60#include "glyphstr.h"
61#endif
62#include "damage.h"
63
64#define SAA_INVALID_ADDRESS \
65 ((void *) ((unsigned long) 0xFFFFFFFF - 1024*1024))
66
67struct saa_gc_priv {
68 /* GC values from the layer below. */
69 GCOps *saved_ops;
70 GCFuncs *saved_funcs;
71};
72
73struct saa_screen_priv {
74 struct saa_driver *driver;
75 CreateGCProcPtr saved_CreateGC;
76 CloseScreenProcPtr saved_CloseScreen;
77 GetImageProcPtr saved_GetImage;
78 GetSpansProcPtr saved_GetSpans;
79 CreatePixmapProcPtr saved_CreatePixmap;
80 DestroyPixmapProcPtr saved_DestroyPixmap;
81 CopyWindowProcPtr saved_CopyWindow;
82 ChangeWindowAttributesProcPtr saved_ChangeWindowAttributes;
83 BitmapToRegionProcPtr saved_BitmapToRegion;
84 ModifyPixmapHeaderProcPtr saved_ModifyPixmapHeader;
85#ifdef RENDER
86 CompositeProcPtr saved_Composite;
87 CompositeRectsProcPtr saved_CompositeRects;
88 TrianglesProcPtr saved_Triangles;
89 GlyphsProcPtr saved_Glyphs;
90 TrapezoidsProcPtr saved_Trapezoids;
91 AddTrapsProcPtr saved_AddTraps;
92 UnrealizeGlyphProcPtr saved_UnrealizeGlyph;
93 SourceValidateProcPtr saved_SourceValidate;
94#endif
95 Bool fallback_debug;
96
97 unsigned int fallback_count;
98
99 RegionRec srcReg;
100 RegionRec maskReg;
101 DrawablePtr srcDraw;
102};
103
104extern GCOps saa_gc_ops;
105
106#if DEBUG_TRACE_FALL
107#define SAA_FALLBACK(x) \
108do { \
109 ErrorF("SAA fallback at %s: ", __FUNCTION__); \
110 ErrorF x; \
111} while (0)
112
113#define saa_drawable_location() ("u")
114#else
115#define SAA_FALLBACK(x)
116#endif
117
118/*
119 * Some macros to deal with function wrapping.
120 */
121#define saa_wrap(priv, real, mem, func) {\
122 (priv)->saved_##mem = (real)->mem; \
123 (real)->mem = func; \
124}
125
126#define saa_unwrap(priv, real, mem) {\
127 (real)->mem = (priv)->saved_##mem; \
128}
129
130#define saa_swap(priv, real, mem) {\
131 void *tmp = (priv)->saved_##mem; \
132 (priv)->saved_##mem = (real)->mem; \
133 (real)->mem = tmp; \
134}
135
136#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 8)
137#define SAA_DEVPRIVATEKEYREC 1
138
139extern DevPrivateKeyRec saa_screen_index;
140extern DevPrivateKeyRec saa_pixmap_index;
141extern DevPrivateKeyRec saa_gc_index;
142
143static inline struct saa_screen_priv *
144saa_screen(ScreenPtr screen)
145{
146 return (struct saa_screen_priv *)dixGetPrivate(&screen->devPrivates,
147 &saa_screen_index);
148}
149
150static inline struct saa_gc_priv *
151saa_gc(GCPtr gc)
152{
153 return (struct saa_gc_priv *)dixGetPrivateAddr(&gc->devPrivates,
154 &saa_gc_index);
155}
156
157static inline struct saa_pixmap *
158saa_pixmap(PixmapPtr pix)
159{
160 return (struct saa_pixmap *)dixGetPrivateAddr(&pix->devPrivates,
161 &saa_pixmap_index);
162}
163#else
164#undef SAA_DEVPRIVATEKEYREC
165extern int saa_screen_index;
166extern int saa_pixmap_index;
167extern int saa_gc_index;
168
169static inline struct saa_screen_priv *
170saa_screen(ScreenPtr screen)
171{
172 return (struct saa_screen_priv *)dixLookupPrivate(&screen->devPrivates,
173 &saa_screen_index);
174}
175
176static inline struct saa_gc_priv *
177saa_gc(GCPtr gc)
178{
179 return (struct saa_gc_priv *)dixLookupPrivateAddr(&gc->devPrivates,
180 &saa_gc_index);
181}
182
183static inline struct saa_pixmap *
184saa_pixmap(PixmapPtr pix)
185{
186 return (struct saa_pixmap *)dixLookupPrivateAddr(&pix->devPrivates,
187 &saa_pixmap_index);
188}
189
190#endif
191
192extern void
193saa_check_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int nspans,
194 DDXPointPtr ppt, int *pwidth, int fSorted);
195extern void
196saa_check_poly_fill_rect(DrawablePtr pDrawable, GCPtr pGC,
197 int nrect, xRectangle * prect);
198extern RegionPtr
199saa_check_copy_area(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
200 int srcx, int srcy, int w, int h, int dstx, int dsty);
201extern void
202saa_check_copy_nton(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
203 BoxPtr pbox, int nbox, int dx, int dy, Bool reverse,
204 Bool upsidedown, Pixel bitplane, void *closure);
205
206extern void
207saa_unaccel_setup(ScreenPtr pScreen);
208
209extern void
210saa_unaccel_takedown(ScreenPtr pScreen);
211
212extern RegionPtr
213saa_copy_area(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
214 int srcx, int srcy, int width, int height, int dstx, int dsty);
215
216extern Bool
217saa_hw_copy_nton(DrawablePtr pSrcDrawable,
218 DrawablePtr pDstDrawable,
219 GCPtr pGC,
220 BoxPtr pbox,
221 int nbox, int dx, int dy, Bool reverse, Bool upsidedown);
222
223#ifdef RENDER
224extern void
225saa_render_setup(ScreenPtr pScreen);
226
227extern void
228saa_render_takedown(ScreenPtr pScreen);
229
230
231extern void
232saa_check_composite(CARD8 op,
233 PicturePtr pSrc,
234 PicturePtr pMask,
235 PicturePtr pDst,
236 INT16 xSrc,
237 INT16 ySrc,
238 INT16 xMask,
239 INT16 yMask,
240 INT16 xDst, INT16 yDst, CARD16 width, CARD16 height,
241 RegionPtr src_region,
242 RegionPtr mask_region,
243 RegionPtr dst_region);
244#endif
245
246extern Bool
247saa_modify_pixmap_header(PixmapPtr pPixmap, int width, int height, int depth,
248 int bitsPerPixel, int devKind, pointer pPixData);
249
250extern PixmapPtr
251saa_create_pixmap(ScreenPtr pScreen, int w, int h, int depth,
252 unsigned usage_hint);
253
254extern Bool
255saa_destroy_pixmap(PixmapPtr pPixmap);
256
257static inline RegionPtr
258saa_pix_damage_pending(struct saa_pixmap *spix)
259{
260 return (spix->damage ? DamagePendingRegion(spix->damage) : NULL);
261}
262
263extern RegionPtr
264saa_boxes_to_region(ScreenPtr pScreen, int nbox, BoxPtr pbox, int ordering);
265
266
267Bool
268saa_compute_composite_regions(ScreenPtr pScreen,
269 PicturePtr pSrc,
270 PicturePtr pMask,
271 PicturePtr pDst,
272 INT16 xSrc, INT16 ySrc, INT16 xMask,
273 INT16 yMask, INT16 xDst,
274 INT16 yDst, INT16 width, INT16 height,
275 RegionPtr dst_reg,
276 RegionPtr *src_reg,
277 RegionPtr *mask_reg);
278
279#endif