Gentoo Archives: gentoo-commits

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