summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/common
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2008-05-28 15:55:44 +1000
committerDave Airlie <[email protected]>2008-06-04 14:08:27 +1000
commit0b734bd7cf921592eee441f759687e10f48a2cbc (patch)
tree3659fe5f86b0a1285ae5a6de592994ba8084074c /src/mesa/drivers/dri/common
parentf688827ebdc7fa8ef1160086565f9e109768a250 (diff)
mesa/drm/ttm: allow build against non-TTM aware libdrm
I'll release a libdrm 2.3.1 without TTM apis included from a special drm branch that should allow mesa 7.1 to build against it. I've had to turn off DRI2 stuff.
Diffstat (limited to 'src/mesa/drivers/dri/common')
-rw-r--r--src/mesa/drivers/dri/common/dri_bufmgr.h38
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c6
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h3
3 files changed, 46 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h
index 4593eaf9f7a..0a726dc108a 100644
--- a/src/mesa/drivers/dri/common/dri_bufmgr.h
+++ b/src/mesa/drivers/dri/common/dri_bufmgr.h
@@ -219,4 +219,42 @@ void dri_post_process_relocs(dri_bo *batch_buf);
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
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index daa3fc58149..6efdf4312a5 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -771,8 +771,10 @@ static void driDestroyScreen(__DRIscreen *psp)
(*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);
@@ -904,6 +906,7 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle,
const __DRIextension **extensions,
const __DRIconfig ***driver_configs, void *data)
{
+#ifdef TTM_API
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
unsigned int *p;
@@ -971,6 +974,9 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle,
psp->DriverAPI = driDriverAPI;
return psp;
+#else
+ return NULL;
+#endif
}
static const __DRIextension **driGetExtensions(__DRIscreen *psp)
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 8e1cdfc893f..203479e3267 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -53,7 +53,6 @@
#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"
@@ -524,7 +523,9 @@ struct __DRIscreenRec {
/* 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;