Hi!

I'm about to merge this branch tomorrow after some minor fixups on the validation flag checking.
That's of course unless anybody has very strong feelings against this.

The key changes are:

   * The set-pin functionality is removed and replaced with a more
     general hinting functionality that was previously available
     through the validate interface. This includes moving buffers
     around, pinning, unpinning and setting / removing CPU cache coherency.
   * The buffer manager need for the hardware lock is completely
     removed. The hardware lock still needs to be used to guard SAREA
     data, and if there is no other synchronization mechanism present,
     when writing to the front-buffer using the CPU. To make the lock
     usage removal possible, the i915 accelerated moves to and from
     fixed memory regions has been disabled until either the X server
     uses the super-ioctl, or the buffer moving blits are sent on a
     secondary ring-buffer. It's now up to the drivers to ensure that
     any buffer-manager use of the command submission mechanisms
     doesn't require the lock.

I've attached a patch to the xf86-video-intel driver that replaces the currently used setPin functionality with drmBOSetStatus. The xf86-video-intel TTM usage is currently very fragile, as the driver acceleration doesn't seem to cope with changes in front buffer GATT offset. Also XAA/TTM doesn't seem to work well.

If any special procedure is required for i915 drm / xf86-video-intel before merging / patching (bumping version numbers, etc) please let me know.

/Thomas

>From d2c78f82c20f33fc9c22cab8a7ca161e57a34bf8 Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date: Wed, 24 Oct 2007 19:34:12 +0200
Subject: [PATCH] Adapt to DRM Lockfree and setStatus changes.
---
 src/i830_driver.c |   16 ++++++++++++----
 src/i830_memory.c |   26 +++++++++++++++++++++++---
 2 files changed, 35 insertions(+), 7 deletions(-)

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 @@ #endif
     */
 #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 @@ #ifdef XF86DRI_MM
       /* 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 @@ #endif
 
    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 @@ #ifdef XF86DRI_MM
        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 @@ #ifdef XF86DRI_MM
        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 pScr
        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;
 
-- 
1.4.1

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to