xf86-video-intel: src/i830_driver.c src/i830_memory.c

Thomas Hellstrom thomash at kemper.freedesktop.org
Thu Oct 25 01:44:33 PDT 2007


 src/i830_driver.c |   16 ++++++++++++----
 src/i830_memory.c |   26 +++++++++++++++++++++++---
 2 files changed, 35 insertions(+), 7 deletions(-)

New commits:
commit d2c78f82c20f33fc9c22cab8a7ca161e57a34bf8
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Wed Oct 24 19:34:12 2007 +0200

    Adapt to DRM Lockfree and setStatus changes.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 4407241..0ab7e8f 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 bdfbba6..91d7beb 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;
 


More information about the xorg-commit mailing list