xf86-video-intel: 4 commits - src/i830_dri.c src/i830_driver.c src/i830_memory.c

Eric Anholt anholt at kemper.freedesktop.org
Mon Apr 27 16:32:33 PDT 2009


 src/i830_dri.c    |   16 +++++++++++++++-
 src/i830_driver.c |   36 ++++++++++++++++++++----------------
 src/i830_memory.c |    3 ++-
 3 files changed, 37 insertions(+), 18 deletions(-)

New commits:
commit 3187c7698b93f1d0e07798e9c42ca2877d55e055
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 27 14:50:54 2009 -0700

    Fix assert at startup with DRI initialiation failure.
    
    In this path, we'd make it to allocator_init -> init_bufmgr without
    GEM and without FbBase being initialized, leading to assertion failure
    to catch this mistake.
    
    Comedy ensued when trying to move just the MapMem up, leading to the rest
    of the commit.  Some day (like tomorrow after I rebase intel-cleanup) I'll
    clean this path up.
    
    Tested with 2 X Servers on 2.6.28 (one gets DRI2, one fails successfully),
    2 UMS X Servers on 2.6.30rc2 (each gets DRI2), and 2 KMS X Servers on
    2.6.30rc2 (success all around).

diff --git a/src/i830_driver.c b/src/i830_driver.c
index cc0f76d..e0dbe77 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -670,9 +670,6 @@ I830MapMem(ScrnInfoPtr pScrn)
    for (i = 2; i < pI830->FbMapSize; i <<= 1) ;
    pI830->FbMapSize = i;
 
-   if (!I830MapMMIO(pScrn))
-      return FALSE;
-
 #if XSERVER_LIBPCIACCESS
    err = pci_device_map_range (device, pI830->LinearAddr, pI830->FbMapSize,
 			       PCI_DEV_MAP_FLAG_WRITABLE | PCI_DEV_MAP_FLAG_WRITE_COMBINE,
@@ -3071,14 +3068,21 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    if (!pI830->use_drm_mode)
        I830MapMMIO(pScrn);
 
+   /* Need FB mapped to set up the fake bufmgr if we end up doing that
+    * in i830_memory_init() -> i830_allocator_init().
+    */
+   if (!pI830->use_drm_mode) {
+      if (!I830MapMem(pScrn))
+	 return FALSE;
+      pScrn->memPhysBase = (unsigned long)pI830->FbBase;
+   }
+
    if (!i830_memory_init(pScrn)) {
        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 	       "Couldn't allocate video memory\n");
        return FALSE;
    }
 
-   I830UnmapMMIO(pScrn);
-
    i830_fixup_mtrrs(pScrn);
 
    pI830->starting = TRUE;
@@ -3109,13 +3113,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	   pI830->accel = ACCEL_NONE;
       }
    }
-
-   if (!pI830->use_drm_mode) {
-      DPRINTF(PFX, "assert( if(!I830MapMem(pScrn)) )\n");
-      if (!I830MapMem(pScrn))
-	 return FALSE;
-      pScrn->memPhysBase = (unsigned long)pI830->FbBase;
-   }
    i830_init_bufmgr(pScrn);
 
 #ifdef XF86DRI
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 54cee56..760e07c 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1065,6 +1065,7 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn)
     }
 
     pI830->ring.tail_mask = pI830->ring.mem->size - 1;
+    pI830->ring.virtual_start = pI830->FbBase + pI830->ring.mem->offset;
     return TRUE;
 }
 
commit fbaf13c93511547c563129527797fbef8628652e
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 27 16:05:50 2009 -0700

    Don't clear the framebuffer if it isn't currently bound.
    
    This segfault can be triggered in non-KMS memory init before the EnterVT,
    and will happen anyway at EnterVT time.

diff --git a/src/i830_memory.c b/src/i830_memory.c
index 470734e..54cee56 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1273,7 +1273,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
 	return NULL;
     }
 
-    if (!pI830->use_drm_mode && pI830->FbBase)
+    if (!pI830->use_drm_mode && pI830->FbBase && front_buffer->bound)
 	memset (pI830->FbBase + front_buffer->offset, 0, size);
 
     return front_buffer;
commit ab878118b9fb46c437a02f824d29f4a206e7fd80
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 27 16:00:05 2009 -0700

    Don't initialize DRI2 if the fd we get is not master-capable.

diff --git a/src/i830_dri.c b/src/i830_dri.c
index 70b76ae..93bb340 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1829,8 +1829,22 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen)
 	info.fd = pI830->drmSubFD;
 #endif
 
-    if (info.fd < 0)
+    if (info.fd < 0) {
 	info.fd = drmOpen("i915", buf);
+	drmSetVersion sv;
+	int err;
+
+	/* Check that what we opened was a master or a master-capable FD,
+	 * by setting the version of the interface we'll use to talk to it.
+	 * (see DRIOpenDRMMaster() in DRI1)
+	 */
+	sv.drm_di_major = 1;
+	sv.drm_di_minor = 1;
+	sv.drm_dd_major = -1;
+	err = drmSetInterfaceVersion(info.fd, &sv);
+	if (err != 0)
+	    return FALSE;
+    }
 
     if (info.fd < 0) {
 	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Failed to open DRM device\n");
commit 385ac2197b64574f30620a203e675d8da0e1472f
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 27 15:28:21 2009 -0700

    Fix drmSetMaster/DropMaster error messages.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index b4e1737..cc0f76d 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3452,7 +3452,7 @@ I830LeaveVT(int scrnIndex, int flags)
    ret = drmDropMaster(pI830->drmSubFD);
    if (ret)
       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		 "drmDropMaster failed: %s\n", strerror(ret));
+		 "drmDropMaster failed: %s\n", strerror(errno));
 #endif
 }
 
@@ -3471,9 +3471,16 @@ I830EnterVT(int scrnIndex, int flags)
 
 #ifdef XF86DRI
    ret = drmSetMaster(pI830->drmSubFD);
-   if (ret)
-      xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		 "drmDropMaster failed: %s\n", strerror(ret));
+   if (ret) {
+      if (errno == EINVAL) {
+	 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		    "drmSetMaster failed: 2.6.29 or newer kernel required for "
+		    "multi-server DRI\n");
+      } else {
+	 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		    "drmSetMaster failed: %s\n", strerror(errno));
+      }
+   }
 #endif
 
    /*


More information about the xorg-commit mailing list