summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-10-24 19:34:12 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-10-24 20:56:50 +0200
commitd2c78f82c20f33fc9c22cab8a7ca161e57a34bf8 (patch)
tree6cd6f127c1908c9e96ea89fe0ad32a8bad99a7c0
parent78aaec0ffc711742bf8ad77757ed8c15cc3f7a9f (diff)
Adapt to DRM Lockfree and setStatus changes.
-rw-r--r--src/i830_driver.c16
-rw-r--r--src/i830_memory.c26
2 files changed, 35 insertions, 7 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 44072413..0ab7e8f3 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3004,8 +3004,8 @@ I830LeaveVT(int scrnIndex, int flags)
*/
#ifdef XF86DRI_MM
if (pI830->directRenderingOpen) {
- if (pI830->memory_manager != NULL) {
- drmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT);
+ if (pI830->memory_manager != NULL && pScrn->vtSema) {
+ drmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT, 1, 0);
}
}
#endif /* XF86DRI_MM */
@@ -3043,8 +3043,8 @@ I830EnterVT(int scrnIndex, int flags)
/* Unlock the memory manager first of all so that we can pin our
* buffer objects
*/
- if (pI830->memory_manager != NULL) {
- drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT);
+ if (pI830->memory_manager != NULL && pScrn->vtSema) {
+ drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT, 1);
}
}
#endif /* XF86DRI_MM */
@@ -3157,6 +3157,14 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
if (pScrn->vtSema == TRUE) {
I830LeaveVT(scrnIndex, 0);
+#ifdef XF86DRI_MM
+ if (pI830->directRenderingEnabled) {
+ if (pI830->memory_manager != NULL) {
+ drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT, 1);
+ }
+ }
+#endif /* XF86DRI_MM */
+
}
if (pI830->devicesTimer)
diff --git a/src/i830_memory.c b/src/i830_memory.c
index bdfbba67..91d7bebb 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -165,7 +165,17 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
I830Ptr pI830 = I830PTR(pScrn);
int ret;
- ret = drmBOSetPin(pI830->drmSubFD, &mem->bo, 1);
+ ret = drmBOSetStatus(pI830->drmSubFD, &mem->bo,
+ DRM_BO_FLAG_MEM_VRAM |
+ DRM_BO_FLAG_MEM_TT |
+ DRM_BO_FLAG_READ |
+ DRM_BO_FLAG_WRITE |
+ DRM_BO_FLAG_NO_EVICT,
+ DRM_BO_MASK_MEM |
+ DRM_BO_FLAG_READ |
+ DRM_BO_FLAG_WRITE |
+ DRM_BO_FLAG_NO_EVICT,
+ 0, 0, 0);
if (ret != 0)
return FALSE;
@@ -226,7 +236,10 @@ i830_unbind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
I830Ptr pI830 = I830PTR(pScrn);
int ret;
- ret = drmBOSetPin(pI830->drmSubFD, &mem->bo, 0);
+ ret = drmBOSetStatus(pI830->drmSubFD, &mem->bo,
+ 0, DRM_BO_FLAG_NO_EVICT,
+ 0, 0, 0);
+
if (ret == 0) {
mem->bound = FALSE;
/* Give buffer obviously wrong offset/end until it's re-pinned. */
@@ -739,8 +752,15 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
return NULL;
}
+ /*
+ * Create buffers in local memory to avoid having the creation order
+ * determine the TT offset. Driver acceleration
+ * cannot handle changed front buffer TT offsets yet ,
+ * so let's keep our fingers crossed.
+ */
+
mask = DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE |
- DRM_BO_FLAG_MEM_TT;
+ DRM_BO_FLAG_MEM_LOCAL;
if (flags & ALLOW_SHARING)
mask |= DRM_BO_FLAG_SHAREABLE;