i965: Add support for non-color render target write data to new FS backend.
[mesa.git] / src / mesa / drivers / dri / common / drisw_util.h
1 /*
2 * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3 * All Rights Reserved.
4 * Copyright 2010 George Sapountzis <gsapountzis@gmail.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24 /**
25 * @file
26 * Binding of the DRI interface (dri_interface.h) for DRISW.
27 *
28 * The DRISW structs are 'base classes' of the corresponding DRI1 / DRI2 (DRM)
29 * structs. The bindings for SW and DRM can be unified by making the DRM structs
30 * 'sub-classes' of the SW structs, either proper or with field re-ordering.
31 *
32 * The code can also be unified but that requires cluttering the common code
33 * with ifdef's and guarding with (__DRIscreen::fd >= 0) for DRM.
34 */
35
36 #ifndef _DRISW_UTIL_H
37 #define _DRISW_UTIL_H
38
39 #include "main/mtypes.h"
40
41 #include <GL/gl.h>
42 #include <GL/internal/glcore.h>
43 #include <GL/internal/dri_interface.h>
44 typedef struct _drmLock drmLock;
45
46
47 /**
48 * Extensions
49 */
50 extern const __DRIcoreExtension driCoreExtension;
51 extern const __DRIswrastExtension driSWRastExtension;
52
53
54 /**
55 * Driver callback functions
56 */
57 struct __DriverAPIRec {
58 const __DRIconfig **(*InitScreen) (__DRIscreen * priv);
59
60 void (*DestroyScreen)(__DRIscreen *driScrnPriv);
61
62 GLboolean (*CreateContext)(gl_api glapi,
63 const __GLcontextModes *glVis,
64 __DRIcontext *driContextPriv,
65 void *sharedContextPrivate);
66
67 void (*DestroyContext)(__DRIcontext *driContextPriv);
68
69 GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv,
70 __DRIdrawable *driDrawPriv,
71 const __GLcontextModes *glVis,
72 GLboolean pixmapBuffer);
73
74 void (*DestroyBuffer)(__DRIdrawable *driDrawPriv);
75
76 void (*SwapBuffers)(__DRIdrawable *driDrawPriv);
77
78 GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv,
79 __DRIdrawable *driDrawPriv,
80 __DRIdrawable *driReadPriv);
81
82 GLboolean (*UnbindContext)(__DRIcontext *driContextPriv);
83 };
84
85 extern const struct __DriverAPIRec driDriverAPI;
86
87
88 /**
89 * Data types
90 */
91 struct __DRIscreenRec {
92 int myNum;
93
94 int fd;
95
96 void *private;
97
98 const __DRIextension **extensions;
99
100 const __DRIswrastLoaderExtension *swrast_loader;
101 };
102
103 struct __DRIcontextRec {
104
105 void *driverPrivate;
106
107 void *loaderPrivate;
108
109 __DRIdrawable *driDrawablePriv;
110
111 __DRIdrawable *driReadablePriv;
112
113 __DRIscreen *driScreenPriv;
114 };
115
116 struct __DRIdrawableRec {
117
118 void *driverPrivate;
119
120 void *loaderPrivate;
121
122 __DRIcontext *driContextPriv;
123
124 __DRIscreen *driScreenPriv;
125
126 int refcount;
127
128 /* gallium */
129 unsigned int lastStamp;
130
131 int w;
132 int h;
133 };
134
135 #endif /* _DRISW_UTIL_H */