]>
Commit | Line | Data |
---|---|---|
79f6b4f7 AM |
1 | commit d3f7b463c3975c070503053e4ad70af99016a756 |
2 | Author: Dave Airlie <airlied@linux.ie> | |
3 | Date: Tue Jul 1 18:22:12 2008 +1000 | |
4 | ||
5 | dri: drop asserts to make build against stable libdrm | |
6 | ||
7 | These asserts are of questionable use at the moment with things in flux. | |
8 | ||
9 | diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c | |
10 | index 4df006f..8b5cb76 100644 | |
11 | --- a/src/mesa/drivers/dri/common/dri_bufmgr.c | |
12 | +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c | |
13 | @@ -40,11 +40,6 @@ dri_bo * | |
14 | dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size, | |
15 | unsigned int alignment, uint64_t location_mask) | |
16 | { | |
17 | - assert((location_mask & ~(DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_MEM_TT | | |
18 | - DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0 | | |
19 | - DRM_BO_FLAG_MEM_PRIV1 | DRM_BO_FLAG_MEM_PRIV2 | | |
20 | - DRM_BO_FLAG_MEM_PRIV3 | DRM_BO_FLAG_MEM_PRIV4 | | |
21 | - DRM_BO_FLAG_CACHED | DRM_BO_FLAG_CACHED_MAPPED)) == 0); | |
22 | return bufmgr->bo_alloc(bufmgr, name, size, alignment, location_mask); | |
23 | } | |
24 | ||
25 | @@ -53,12 +48,6 @@ dri_bo_alloc_static(dri_bufmgr *bufmgr, const char *name, unsigned long offset, | |
26 | unsigned long size, void *virtual, | |
27 | uint64_t location_mask) | |
28 | { | |
29 | - assert((location_mask & ~(DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_MEM_TT | | |
30 | - DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0 | | |
31 | - DRM_BO_FLAG_MEM_PRIV1 | DRM_BO_FLAG_MEM_PRIV2 | | |
32 | - DRM_BO_FLAG_MEM_PRIV3 | | |
33 | - DRM_BO_FLAG_MEM_PRIV4)) == 0); | |
34 | - | |
35 | return bufmgr->bo_alloc_static(bufmgr, name, offset, size, virtual, | |
36 | location_mask); | |
37 | } | |
38 | commit 0b734bd7cf921592eee441f759687e10f48a2cbc | |
39 | Author: Dave Airlie <airlied@redhat.com> | |
40 | Date: Wed May 28 15:55:44 2008 +1000 | |
41 | ||
42 | mesa/drm/ttm: allow build against non-TTM aware libdrm | |
43 | ||
44 | I'll release a libdrm 2.3.1 without TTM apis included from a special | |
45 | drm branch that should allow mesa 7.1 to build against it. | |
46 | ||
47 | I've had to turn off DRI2 stuff. | |
48 | ||
49 | diff --git a/configure.ac b/configure.ac | |
50 | index a250f75..a73c754 100644 | |
51 | --- a/configure.ac | |
52 | +++ b/configure.ac | |
53 | @@ -478,6 +478,19 @@ AC_ARG_ENABLE([driglx-direct], | |
54 | [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])], | |
55 | [driglx_direct="$enableval"], | |
56 | [driglx_direct="yes"]) | |
57 | +dnl ttm support | |
58 | +AC_ARG_ENABLE([ttm-api], | |
59 | + [AS_HELP_STRING([--enable-ttm-api], | |
60 | + [enable TTM API users])], | |
61 | + [ttmapi="$enableval"], | |
62 | + [ttmapi="no"]) | |
63 | + | |
64 | +if test "x$ttmapi" = "xyes"; then | |
65 | + save_CFLAGS=$CFLAGS | |
66 | + CFLAGS=$LIBDRM_CFLAGS | |
67 | + AC_CHECK_HEADERS([xf86mm.h],[],[AC_MSG_ERROR([xf86mm.h required for TTM.])],[#include "stdint.h"\n#include "drm.h"]) | |
68 | + CFLAGS=$save_CFLAGS | |
69 | +fi | |
70 | ||
71 | dnl Which drivers to build - default is chosen by platform | |
72 | AC_ARG_WITH([dri-drivers], | |
73 | @@ -516,6 +529,10 @@ if test "$mesa_driver" = dri; then | |
74 | DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS" | |
75 | fi | |
76 | ||
77 | + if test "x$ttmapi" = xyes; then | |
78 | + DEFINES="$DEFINES -DTTM_API" | |
79 | + fi | |
80 | + | |
81 | if test "x$USING_EGL" = x1; then | |
82 | PROGRAM_DIRS="egl" | |
83 | fi | |
84 | @@ -934,6 +951,7 @@ if test "$mesa_driver" = dri; then | |
85 | dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` | |
86 | echo " DRI drivers: $dri_dirs" | |
87 | echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR" | |
88 | + echo " TTM API support: $ttmapi" | |
89 | fi | |
90 | ||
91 | dnl Libraries | |
92 | diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h | |
93 | index 4593eaf..0a726dc 100644 | |
94 | --- a/src/mesa/drivers/dri/common/dri_bufmgr.h | |
95 | +++ b/src/mesa/drivers/dri/common/dri_bufmgr.h | |
96 | @@ -219,4 +219,42 @@ void dri_post_process_relocs(dri_bo *batch_buf); | |
97 | void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence); | |
98 | int dri_bufmgr_check_aperture_space(dri_bo *bo); | |
99 | ||
100 | +#ifndef TTM_API | |
101 | +/* reuse some TTM API */ | |
102 | + | |
103 | +#define DRM_BO_MEM_LOCAL 0 | |
104 | +#define DRM_BO_MEM_TT 1 | |
105 | +#define DRM_BO_MEM_VRAM 2 | |
106 | +#define DRM_BO_MEM_PRIV0 3 | |
107 | +#define DRM_BO_MEM_PRIV1 4 | |
108 | +#define DRM_BO_MEM_PRIV2 5 | |
109 | +#define DRM_BO_MEM_PRIV3 6 | |
110 | +#define DRM_BO_MEM_PRIV4 7 | |
111 | + | |
112 | +#define DRM_BO_FLAG_READ (1ULL << 0) | |
113 | +#define DRM_BO_FLAG_WRITE (1ULL << 1) | |
114 | +#define DRM_BO_FLAG_EXE (1ULL << 2) | |
115 | +#define DRM_BO_MASK_ACCESS (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_EXE) | |
116 | +#define DRM_BO_FLAG_NO_EVICT (1ULL << 4) | |
117 | + | |
118 | +#define DRM_BO_FLAG_MAPPABLE (1ULL << 5) | |
119 | +#define DRM_BO_FLAG_SHAREABLE (1ULL << 6) | |
120 | + | |
121 | +#define DRM_BO_FLAG_CACHED (1ULL << 7) | |
122 | + | |
123 | +#define DRM_BO_FLAG_NO_MOVE (1ULL << 8) | |
124 | +#define DRM_BO_FLAG_CACHED_MAPPED (1ULL << 19) | |
125 | +#define DRM_BO_FLAG_FORCE_CACHING (1ULL << 13) | |
126 | +#define DRM_BO_FLAG_FORCE_MAPPABLE (1ULL << 14) | |
127 | +#define DRM_BO_FLAG_TILE (1ULL << 15) | |
128 | + | |
129 | +#define DRM_BO_FLAG_MEM_LOCAL (1ULL << 24) | |
130 | +#define DRM_BO_FLAG_MEM_TT (1ULL << 25) | |
131 | +#define DRM_BO_FLAG_MEM_VRAM (1ULL << 26) | |
132 | + | |
133 | +#define DRM_BO_MASK_MEM 0x00000000FF000000ULL | |
134 | + | |
135 | +#define DRM_FENCE_TYPE_EXE 0x00000001 | |
136 | +#endif | |
137 | + | |
138 | #endif | |
139 | diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c | |
140 | index daa3fc5..6efdf43 100644 | |
141 | --- a/src/mesa/drivers/dri/common/dri_util.c | |
142 | +++ b/src/mesa/drivers/dri/common/dri_util.c | |
143 | @@ -771,8 +771,10 @@ static void driDestroyScreen(__DRIscreen *psp) | |
144 | (*psp->DriverAPI.DestroyScreen)(psp); | |
145 | ||
146 | if (psp->dri2.enabled) { | |
147 | +#ifdef TTM_API | |
148 | drmBOUnmap(psp->fd, &psp->dri2.sareaBO); | |
149 | drmBOUnreference(psp->fd, &psp->dri2.sareaBO); | |
150 | +#endif | |
151 | } else { | |
152 | (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); | |
153 | (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); | |
154 | @@ -904,6 +906,7 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle, | |
155 | const __DRIextension **extensions, | |
156 | const __DRIconfig ***driver_configs, void *data) | |
157 | { | |
158 | +#ifdef TTM_API | |
159 | static const __DRIextension *emptyExtensionList[] = { NULL }; | |
160 | __DRIscreen *psp; | |
161 | unsigned int *p; | |
162 | @@ -971,6 +974,9 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle, | |
163 | psp->DriverAPI = driDriverAPI; | |
164 | ||
165 | return psp; | |
166 | +#else | |
167 | + return NULL; | |
168 | +#endif | |
169 | } | |
170 | ||
171 | static const __DRIextension **driGetExtensions(__DRIscreen *psp) | |
172 | diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h | |
173 | index 8e1cdfc..203479e 100644 | |
174 | --- a/src/mesa/drivers/dri/common/dri_util.h | |
175 | +++ b/src/mesa/drivers/dri/common/dri_util.h | |
176 | @@ -53,7 +53,6 @@ | |
177 | #include <drm.h> | |
178 | #include <drm_sarea.h> | |
179 | #include <xf86drm.h> | |
180 | -#include <xf86mm.h> | |
181 | #include "GL/internal/glcore.h" | |
182 | #include "GL/internal/dri_interface.h" | |
183 | #include "GL/internal/dri_sarea.h" | |
184 | @@ -524,7 +523,9 @@ struct __DRIscreenRec { | |
185 | /* Flag to indicate that this is a DRI2 screen. Many of the above | |
186 | * fields will not be valid or initializaed in that case. */ | |
187 | int enabled; | |
188 | +#ifdef TTM_API | |
189 | drmBO sareaBO; | |
190 | +#endif | |
191 | void *sarea; | |
192 | __DRIEventBuffer *buffer; | |
193 | __DRILock *lock; | |
194 | diff --git a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c | |
195 | index 545913f..194814e 100644 | |
196 | --- a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c | |
197 | +++ b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c | |
198 | @@ -50,6 +50,7 @@ | |
199 | #include "i915_drm.h" | |
200 | ||
201 | #include "intel_bufmgr_ttm.h" | |
202 | +#ifdef TTM_API | |
203 | ||
204 | #define DBG(...) do { \ | |
205 | if (bufmgr_ttm->bufmgr.debug) \ | |
206 | @@ -1099,4 +1100,23 @@ intel_bufmgr_ttm_init(int fd, unsigned int fence_type, | |
207 | ||
208 | return &bufmgr_ttm->bufmgr; | |
209 | } | |
210 | +#else | |
211 | +dri_bufmgr * | |
212 | +intel_bufmgr_ttm_init(int fd, unsigned int fence_type, | |
213 | + unsigned int fence_type_flush, int batch_size) | |
214 | +{ | |
215 | + return NULL; | |
216 | +} | |
217 | + | |
218 | +dri_bo * | |
219 | +intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, | |
220 | + unsigned int handle) | |
221 | +{ | |
222 | + return NULL; | |
223 | +} | |
224 | ||
225 | +void | |
226 | +intel_ttm_enable_bo_reuse(dri_bufmgr *bufmgr) | |
227 | +{ | |
228 | +} | |
229 | +#endif | |
230 | diff --git a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.h b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.h | |
231 | index d267a16..f5bd64c 100644 | |
232 | --- a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.h | |
233 | +++ b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.h | |
234 | @@ -7,8 +7,10 @@ | |
235 | extern dri_bo *intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, | |
236 | unsigned int handle); | |
237 | ||
238 | +#ifdef TTM_API | |
239 | dri_fence *intel_ttm_fence_create_from_arg(dri_bufmgr *bufmgr, const char *name, | |
240 | drm_fence_arg_t *arg); | |
241 | +#endif | |
242 | ||
243 | ||
244 | dri_bufmgr *intel_bufmgr_ttm_init(int fd, unsigned int fence_type, | |
245 | @@ -17,4 +19,10 @@ dri_bufmgr *intel_bufmgr_ttm_init(int fd, unsigned int fence_type, | |
246 | void | |
247 | intel_ttm_enable_bo_reuse(dri_bufmgr *bufmgr); | |
248 | ||
249 | +#ifndef TTM_API | |
250 | +#define DRM_I915_FENCE_CLASS_ACCEL 0 | |
251 | +#define DRM_I915_FENCE_TYPE_RW 2 | |
252 | +#define DRM_I915_FENCE_FLAG_FLUSHED 0x01000000 | |
253 | +#endif | |
254 | + | |
255 | #endif | |
256 | diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.c b/src/mesa/drivers/dri/intel/intel_ioctl.c | |
257 | index 66e3610..f4566ba 100644 | |
258 | --- a/src/mesa/drivers/dri/intel/intel_ioctl.c | |
259 | +++ b/src/mesa/drivers/dri/intel/intel_ioctl.c | |
260 | @@ -147,6 +147,7 @@ intel_batch_ioctl(struct intel_context *intel, | |
261 | } | |
262 | } | |
263 | ||
264 | +#ifdef TTM_API | |
265 | void | |
266 | intel_exec_ioctl(struct intel_context *intel, | |
267 | GLuint used, | |
268 | @@ -211,3 +212,12 @@ intel_exec_ioctl(struct intel_context *intel, | |
269 | } | |
270 | *fence = fo; | |
271 | } | |
272 | +#else | |
273 | +void | |
274 | +intel_exec_ioctl(struct intel_context *intel, | |
275 | + GLuint used, | |
276 | + GLboolean ignore_cliprects, GLboolean allow_unlock, | |
277 | + void *start, GLuint count, dri_fence **fence) | |
278 | +{ | |
279 | +} | |
280 | +#endif |