Imported Upstream version 1.15.1
[deb_xorg-server.git] / hw / xfree86 / dri / dristruct.h
1 /**************************************************************************
2
3 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
4 All Rights Reserved.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the
8 "Software"), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sub license, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
13
14 The above copyright notice and this permission notice (including the
15 next paragraph) shall be included in all copies or substantial portions
16 of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
22 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
26 **************************************************************************/
27
28 /*
29 * Authors:
30 * Jens Owen <jens@tungstengraphics.com>
31 *
32 */
33
34 #ifndef DRI_STRUCT_H
35 #define DRI_STRUCT_H
36
37 #include "xf86drm.h"
38 #include "xf86Crtc.h"
39
40 #define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
41 dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey))
42 #define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
43 dixLookupPrivate(&(pPix)->devPrivates, DRIWindowPrivKey))
44
45 typedef struct _DRIDrawablePrivRec {
46 drm_drawable_t hwDrawable;
47 int drawableIndex;
48 ScreenPtr pScreen;
49 int refCount;
50 int nrects;
51 } DRIDrawablePrivRec, *DRIDrawablePrivPtr;
52
53 struct _DRIContextPrivRec {
54 drm_context_t hwContext;
55 ScreenPtr pScreen;
56 Bool valid3D;
57 DRIContextFlags flags;
58 void **pContextStore;
59 };
60
61 #define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \
62 (dixPrivateKeyRegistered(DRIScreenPrivKey) ? \
63 dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey) : NULL))
64
65 #define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
66 dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \
67 DRIScreenPrivKey))
68
69 #define DRI_ENT_PRIV(pScrn) \
70 ((DRIEntPrivIndex < 0) ? \
71 NULL: \
72 ((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \
73 DRIEntPrivIndex)->ptr)))
74
75 typedef struct _DRIScreenPrivRec {
76 Bool directRenderingSupport;
77 int drmFD; /* File descriptor for /dev/video/? */
78 drm_handle_t hSAREA; /* Handle to SAREA, for mapping */
79 XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */
80 drm_context_t myContext; /* DDX Driver's context */
81 DRIContextPrivPtr myContextPriv; /* Pointer to server's private area */
82 DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */
83 void **hiddenContextStore; /* hidden X context */
84 void **partial3DContextStore; /* parital 3D context */
85 DRIInfoPtr pDriverInfo;
86 int nrWindows;
87 int nrWindowsVisible;
88 int nrWalked;
89 drm_clip_rect_t private_buffer_rect; /* management of private buffers */
90 DrawablePtr fullscreen; /* pointer to fullscreen drawable */
91 drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
92 DRIWrappedFuncsRec wrap;
93 DestroyWindowProcPtr DestroyWindow;
94 DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
95 DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */
96 Bool createDummyCtx;
97 Bool createDummyCtxPriv;
98 Bool grabbedDRILock;
99 Bool drmSIGIOHandlerInstalled;
100 Bool wrapped;
101 Bool windowsTouched;
102 int lockRefCount;
103 drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */
104 XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */
105 int *pLockRefCount;
106 int *pLockingContext;
107 xf86_crtc_notify_proc_ptr xf86_crtc_notify;
108 } DRIScreenPrivRec, *DRIScreenPrivPtr;
109
110 typedef struct _DRIEntPrivRec {
111 int drmFD;
112 Bool drmOpened;
113 Bool sAreaGrabbed;
114 drm_handle_t hLSAREA;
115 XF86DRILSAREAPtr pLSAREA;
116 unsigned long sAreaSize;
117 int lockRefCount;
118 int lockingContext;
119 ScreenPtr resOwner;
120 Bool keepFDOpen;
121 int refCount;
122 } DRIEntPrivRec, *DRIEntPrivPtr;
123
124 #endif /* DRI_STRUCT_H */