1 commit d3f7b463c3975c070503053e4ad70af99016a756
2 Author: Dave Airlie <airlied@linux.ie>
3 Date: Tue Jul 1 18:22:12 2008 +1000
5 dri: drop asserts to make build against stable libdrm
7 These asserts are of questionable use at the moment with things in flux.
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)
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);
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)
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);
35 return bufmgr->bo_alloc_static(bufmgr, name, offset, size, virtual,
38 commit 0b734bd7cf921592eee441f759687e10f48a2cbc
39 Author: Dave Airlie <airlied@redhat.com>
40 Date: Wed May 28 15:55:44 2008 +1000
42 mesa/drm/ttm: allow build against non-TTM aware libdrm
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.
47 I've had to turn off DRI2 stuff.
49 diff --git a/configure.ac b/configure.ac
50 index a250f75..a73c754 100644
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"])
58 +AC_ARG_ENABLE([ttm-api],
59 + [AS_HELP_STRING([--enable-ttm-api],
60 + [enable TTM API users])],
61 + [ttmapi="$enableval"],
64 +if test "x$ttmapi" = "xyes"; then
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"])
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"
77 + if test "x$ttmapi" = xyes; then
78 + DEFINES="$DEFINES -DTTM_API"
81 if test "x$USING_EGL" = x1; then
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"
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);
101 +/* reuse some TTM API */
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
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)
118 +#define DRM_BO_FLAG_MAPPABLE (1ULL << 5)
119 +#define DRM_BO_FLAG_SHAREABLE (1ULL << 6)
121 +#define DRM_BO_FLAG_CACHED (1ULL << 7)
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)
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)
133 +#define DRM_BO_MASK_MEM 0x00000000FF000000ULL
135 +#define DRM_FENCE_TYPE_EXE 0x00000001
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);
146 if (psp->dri2.enabled) {
148 drmBOUnmap(psp->fd, &psp->dri2.sareaBO);
149 drmBOUnreference(psp->fd, &psp->dri2.sareaBO);
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)
159 static const __DRIextension *emptyExtensionList[] = { NULL };
162 @@ -971,6 +974,9 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle,
163 psp->DriverAPI = driDriverAPI;
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
178 #include <drm_sarea.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. */
192 __DRIEventBuffer *buffer;
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
199 #include "i915_drm.h"
201 #include "intel_bufmgr_ttm.h"
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,
208 return &bufmgr_ttm->bufmgr;
212 +intel_bufmgr_ttm_init(int fd, unsigned int fence_type,
213 + unsigned int fence_type_flush, int batch_size)
219 +intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name,
220 + unsigned int handle)
226 +intel_ttm_enable_bo_reuse(dri_bufmgr *bufmgr)
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
235 extern dri_bo *intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name,
236 unsigned int handle);
239 dri_fence *intel_ttm_fence_create_from_arg(dri_bufmgr *bufmgr, const char *name,
240 drm_fence_arg_t *arg);
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,
247 intel_ttm_enable_bo_reuse(dri_bufmgr *bufmgr);
250 +#define DRM_I915_FENCE_CLASS_ACCEL 0
251 +#define DRM_I915_FENCE_TYPE_RW 2
252 +#define DRM_I915_FENCE_FLAG_FLUSHED 0x01000000
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,
266 intel_exec_ioctl(struct intel_context *intel,
268 @@ -211,3 +212,12 @@ intel_exec_ioctl(struct intel_context *intel,
274 +intel_exec_ioctl(struct intel_context *intel,
276 + GLboolean ignore_cliprects, GLboolean allow_unlock,
277 + void *start, GLuint count, dri_fence **fence)