[enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
[driglx_direct="$enableval"],
[driglx_direct="yes"])
+dnl ttm support
+AC_ARG_ENABLE([ttm-api],
+ [AS_HELP_STRING([--enable-ttm-api],
+ [enable TTM API users])],
+ [ttmapi="$enableval"],
+ [ttmapi="no"])
+
+if test "x$ttmapi" = "xyes"; then
+ save_CFLAGS=$CFLAGS
+ CFLAGS=$LIBDRM_CFLAGS
+ AC_CHECK_HEADERS([xf86mm.h],[],[AC_MSG_ERROR([xf86mm.h required for TTM.])],[#include "stdint.h"\n#include "drm.h"])
+ CFLAGS=$save_CFLAGS
+fi
dnl Which drivers to build - default is chosen by platform
AC_ARG_WITH([dri-drivers],
DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
fi
+ if test "x$ttmapi" = xyes; then
+ DEFINES="$DEFINES -DTTM_API"
+ fi
+
if test "x$USING_EGL" = x1; then
PROGRAM_DIRS="egl"
fi
dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
echo " DRI drivers: $dri_dirs"
echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
+ echo " TTM API support: $ttmapi"
fi
dnl Libraries
void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence);
int dri_bufmgr_check_aperture_space(dri_bo *bo);
+#ifndef TTM_API
+/* reuse some TTM API */
+
+#define DRM_BO_MEM_LOCAL 0
+#define DRM_BO_MEM_TT 1
+#define DRM_BO_MEM_VRAM 2
+#define DRM_BO_MEM_PRIV0 3
+#define DRM_BO_MEM_PRIV1 4
+#define DRM_BO_MEM_PRIV2 5
+#define DRM_BO_MEM_PRIV3 6
+#define DRM_BO_MEM_PRIV4 7
+
+#define DRM_BO_FLAG_READ (1ULL << 0)
+#define DRM_BO_FLAG_WRITE (1ULL << 1)
+#define DRM_BO_FLAG_EXE (1ULL << 2)
+#define DRM_BO_MASK_ACCESS (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_EXE)
+#define DRM_BO_FLAG_NO_EVICT (1ULL << 4)
+
+#define DRM_BO_FLAG_MAPPABLE (1ULL << 5)
+#define DRM_BO_FLAG_SHAREABLE (1ULL << 6)
+
+#define DRM_BO_FLAG_CACHED (1ULL << 7)
+
+#define DRM_BO_FLAG_NO_MOVE (1ULL << 8)
+#define DRM_BO_FLAG_CACHED_MAPPED (1ULL << 19)
+#define DRM_BO_FLAG_FORCE_CACHING (1ULL << 13)
+#define DRM_BO_FLAG_FORCE_MAPPABLE (1ULL << 14)
+#define DRM_BO_FLAG_TILE (1ULL << 15)
+
+#define DRM_BO_FLAG_MEM_LOCAL (1ULL << 24)
+#define DRM_BO_FLAG_MEM_TT (1ULL << 25)
+#define DRM_BO_FLAG_MEM_VRAM (1ULL << 26)
+
+#define DRM_BO_MASK_MEM 0x00000000FF000000ULL
+
+#define DRM_FENCE_TYPE_EXE 0x00000001
+#endif
+
#endif
(*psp->DriverAPI.DestroyScreen)(psp);
if (psp->dri2.enabled) {
+#ifdef TTM_API
drmBOUnmap(psp->fd, &psp->dri2.sareaBO);
drmBOUnreference(psp->fd, &psp->dri2.sareaBO);
+#endif
} else {
(void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
(void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
const __DRIextension **extensions,
const __DRIconfig ***driver_configs, void *data)
{
+#ifdef TTM_API
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
unsigned int *p;
psp->DriverAPI = driDriverAPI;
return psp;
+#else
+ return NULL;
+#endif
}
static const __DRIextension **driGetExtensions(__DRIscreen *psp)
#include <drm.h>
#include <drm_sarea.h>
#include <xf86drm.h>
-#include <xf86mm.h>
#include "GL/internal/glcore.h"
#include "GL/internal/dri_interface.h"
#include "GL/internal/dri_sarea.h"
/* Flag to indicate that this is a DRI2 screen. Many of the above
* fields will not be valid or initializaed in that case. */
int enabled;
+#ifdef TTM_API
drmBO sareaBO;
+#endif
void *sarea;
__DRIEventBuffer *buffer;
__DRILock *lock;
#include "i915_drm.h"
#include "intel_bufmgr_ttm.h"
+#ifdef TTM_API
#define DBG(...) do { \
if (bufmgr_ttm->bufmgr.debug) \
return &bufmgr_ttm->bufmgr;
}
+#else
+dri_bufmgr *
+intel_bufmgr_ttm_init(int fd, unsigned int fence_type,
+ unsigned int fence_type_flush, int batch_size)
+{
+ return NULL;
+}
+
+dri_bo *
+intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name,
+ unsigned int handle)
+{
+ return NULL;
+}
+void
+intel_ttm_enable_bo_reuse(dri_bufmgr *bufmgr)
+{
+}
+#endif
extern dri_bo *intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name,
unsigned int handle);
+#ifdef TTM_API
dri_fence *intel_ttm_fence_create_from_arg(dri_bufmgr *bufmgr, const char *name,
drm_fence_arg_t *arg);
+#endif
dri_bufmgr *intel_bufmgr_ttm_init(int fd, unsigned int fence_type,
void
intel_ttm_enable_bo_reuse(dri_bufmgr *bufmgr);
+#ifndef TTM_API
+#define DRM_I915_FENCE_CLASS_ACCEL 0
+#define DRM_I915_FENCE_TYPE_RW 2
+#define DRM_I915_FENCE_FLAG_FLUSHED 0x01000000
+#endif
+
#endif
}
}
+#ifdef TTM_API
void
intel_exec_ioctl(struct intel_context *intel,
GLuint used,
}
*fence = fo;
}
+#else
+void
+intel_exec_ioctl(struct intel_context *intel,
+ GLuint used,
+ GLboolean ignore_cliprects, GLboolean allow_unlock,
+ void *start, GLuint count, dri_fence **fence)
+{
+}
+#endif