[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-mga: Changes to 'debian-unstable'



 debian/changelog                                     |    8 
 debian/patches/02_tentatively_unbreak_dual_head.diff |  175 +++++++++++++++++++
 debian/patches/series                                |    1 
 3 files changed, 184 insertions(+)

New commits:
commit 0d291278a7c4cb645d915b8e44112c76625f95c7
Author: Cyril Brulebois <kibi@debian.org>
Date:   Mon Nov 22 18:06:09 2010 +0100

    Upload to unstable.

diff --git a/debian/changelog b/debian/changelog
index 1718585..47672ec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,10 @@
-xserver-xorg-video-mga (1:1.4.11.dfsg-4+squeeze1) UNRELEASED; urgency=low
+xserver-xorg-video-mga (1:1.4.11.dfsg-4+squeeze1) unstable; urgency=low
 
   * Add patch: 02_tentatively_unbreak_dual_head.diff, tested by Ferenc
     Wágner (thanks!). Patch by Andy MacLean, stolen from LP's #292214
     (hopefully closes: #562209).
 
- -- Cyril Brulebois <kibi@debian.org>  Mon, 22 Nov 2010 16:37:47 +0100
+ -- Cyril Brulebois <kibi@debian.org>  Mon, 22 Nov 2010 18:05:24 +0100
 
 xserver-xorg-video-mga (1:1.4.11.dfsg-4) unstable; urgency=low
 

commit e276d587f460c0b23ba4e5c72a68b698ce43ac5b
Author: Cyril Brulebois <kibi@debian.org>
Date:   Mon Nov 22 17:54:22 2010 +0100

    Tentatively unbreak dual head setups (Closes: #562209).
    
    Apply mga-driver-3.patch from Ubuntu's LP #292214 by Andy MacLean. First
    hunk dropped, tiny whitespace cleanup for the other hunks.

diff --git a/debian/changelog b/debian/changelog
index 4b78c44..1718585 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+xserver-xorg-video-mga (1:1.4.11.dfsg-4+squeeze1) UNRELEASED; urgency=low
+
+  * Add patch: 02_tentatively_unbreak_dual_head.diff, tested by Ferenc
+    Wágner (thanks!). Patch by Andy MacLean, stolen from LP's #292214
+    (hopefully closes: #562209).
+
+ -- Cyril Brulebois <kibi@debian.org>  Mon, 22 Nov 2010 16:37:47 +0100
+
 xserver-xorg-video-mga (1:1.4.11.dfsg-4) unstable; urgency=low
 
   * Add support for G200EH, cherry-picked from upstream git (closes: #575271).
diff --git a/debian/patches/02_tentatively_unbreak_dual_head.diff b/debian/patches/02_tentatively_unbreak_dual_head.diff
new file mode 100644
index 0000000..0253448
--- /dev/null
+++ b/debian/patches/02_tentatively_unbreak_dual_head.diff
@@ -0,0 +1,175 @@
+From: Cyril Brulebois <kibi@debian.org>
+Patch-By: Andy MacLean
+Patch-Name: mga-driver-3.patch
+Patch-URL: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-mga/+bug/292214
+--- a/src/mga.h
++++ b/src/mga.h
+@@ -337,6 +337,13 @@ typedef struct {
+     int			mastervideoRam;
+     int			slavevideoRam;
+     Bool		directRenderingEnabled;
++
++    void *		mappedIOBase;
++    int			mappedIOUsage;
++
++    void *		mappedILOADBase;
++    int			mappedILOADUsage;
++
+     ScrnInfoPtr 	pScrn_1;
+     ScrnInfoPtr 	pScrn_2;
+ } MGAEntRec, *MGAEntPtr;
+--- a/src/mga_driver.c
++++ b/src/mga_driver.c
+@@ -2820,30 +2820,55 @@ MGAMapMem(ScrnInfoPtr pScrn)
+ #ifdef XSERVER_LIBPCIACCESS
+     struct pci_device *const dev = pMga->PciInfo;
+     struct pci_mem_region *region;
+-    void **memory[2];
+     int i, err;
+ #endif
+ 
+ 
+     if (!pMga->FBDev) {
+ #ifdef XSERVER_LIBPCIACCESS
+-        memory[pMga->io_bar] = &pMga->IOBase;
+-        memory[pMga->framebuffer_bar] = &pMga->FbBase;
++	pciaddr_t fbaddr = pMga->FbAddress;
++	pciaddr_t fbsize = pMga->FbMapSize;
++	err = pci_device_map_range(dev,
++				   fbaddr, fbsize,
++				   PCI_DEV_MAP_FLAG_WRITABLE,
++				   (void **)&pMga->FbBase);
+ 
+-        for (i = 0; i < 2; i++) {
+-            region = &dev->regions[i];
+-            err = pci_device_map_range(dev,
+-                                       region->base_addr, region->size,
+-                                       PCI_DEV_MAP_FLAG_WRITABLE,
+-                                       memory[i]);
++	if (err) {
++	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
++		       "Unable to map Framebuffer %08llX %llx.  %s (%d)\n",
++		       (long long)fbaddr, (long long)fbsize,
++		       strerror(err), err);
++	    return FALSE;
++	}
++	else
++	    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
++		       "MAPPED Framebuffer %08llX %llx to %08llX.\n",
++		       (long long)fbaddr, (long long)fbsize,
++		       (long long)pMga->FbBase);
++
++	if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedIOUsage == 0) {
++	    region = &dev->regions[pMga->io_bar];
++	    err = pci_device_map_range(dev,
++				       region->base_addr, region->size,
++				       PCI_DEV_MAP_FLAG_WRITABLE,
++				       &pMga->IOBase);
++
++	    if (err) {
++	      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
++			 "Unable to map IO Region %i.  %s (%d)\n",
++			 pMga->io_bar, strerror(err), err);
++	      return FALSE;
++	    }
++
++	    if(pMga->entityPrivate != NULL)
++		pMga->entityPrivate->mappedIOBase = pMga->IOBase;
++	}
++	else
++		pMga->IOBase = pMga->entityPrivate->mappedIOBase;
++
++	if(pMga->entityPrivate != NULL)
++		pMga->entityPrivate->mappedIOUsage ++;
+ 
+-            if (err) {
+-                xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+-                           "Unable to map BAR %i.  %s (%d)\n",
+-                           i, strerror(err), err);
+-                return FALSE;
+-            }
+-        }
+ #else
+ 	/*
+ 	 * For Alpha, we need to map SPARSE memory, since we need
+@@ -2885,16 +2910,27 @@ MGAMapMem(ScrnInfoPtr pScrn)
+     if (pMga->iload_bar != -1) {
+ #ifdef XSERVER_LIBPCIACCESS
+         region = &dev->regions[pMga->iload_bar];
+-        err = pci_device_map_range(dev,
+-                                   region->base_addr, region->size,
+-                                   PCI_DEV_MAP_FLAG_WRITABLE,
+-                                   (void *) &pMga->ILOADBase);
+-	if (err) {
+-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+-		       "Unable to map BAR 2 (ILOAD region).  %s (%d)\n",
+-		       strerror(err), err);
+-	    return FALSE;
++
++	if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedILOADUsage == 0) {
++	    err = pci_device_map_range(dev,
++				       region->base_addr, region->size,
++				       PCI_DEV_MAP_FLAG_WRITABLE,
++				       (void *) &pMga->ILOADBase);
++	    if (err) {
++	      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
++			 "Unable to map BAR 2 (ILOAD region).  %s (%d)\n",
++			 strerror(err), err);
++	      return FALSE;
++	    }
++
++	    if(pMga->entityPrivate != NULL)
++		pMga->entityPrivate->mappedILOADBase = pMga->ILOADBase;
+ 	}
++	else
++		pMga->ILOADBase = pMga->entityPrivate->mappedILOADBase;
++
++	if(pMga->entityPrivate != NULL)
++		pMga->entityPrivate->mappedILOADUsage ++;
+ #else
+ 	pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex,
+ 					VIDMEM_MMIO | VIDMEM_MMIO_32BIT |
+@@ -2924,10 +2960,20 @@ MGAUnmapMem(ScrnInfoPtr pScrn)
+     
+     if (!pMga->FBDev) {
+ #ifdef XSERVER_LIBPCIACCESS
+-        pci_device_unmap_range(dev, pMga->IOBase, 
+-			       dev->regions[pMga->io_bar].size);
++	    if(pMga->entityPrivate != NULL)
++		pMga->entityPrivate->mappedIOUsage--;
++
++	    if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedIOUsage == 0) {
++		pci_device_unmap_range(dev, pMga->IOBase,
++				       dev->regions[pMga->io_bar].size);
++
++		if(pMga->entityPrivate != NULL)
++			pMga->entityPrivate->mappedIOBase = NULL;
++	    }
++
++	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "UNMAPPING framebuffer 0x%08llX, 0x%llX.\n", (long long)pMga->FbBase, (long long)pMga->FbMapSize);
+         pci_device_unmap_range(dev, pMga->FbBase, 
+-			       dev->regions[pMga->framebuffer_bar].size);
++			       pMga->FbMapSize);
+ #else
+ 	xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->IOBase, 0x4000);
+ 	xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->FbBase, pMga->FbMapSize);
+@@ -2940,8 +2986,17 @@ MGAUnmapMem(ScrnInfoPtr pScrn)
+ 
+     if ((pMga->iload_bar != -1) && (pMga->ILOADBase != NULL)) {
+ #ifdef XSERVER_LIBPCIACCESS
+-        pci_device_unmap_range(dev, pMga->ILOADBase,
+-			       dev->regions[pMga->iload_bar].size);
++	    if(pMga->entityPrivate != NULL)
++		pMga->entityPrivate->mappedILOADUsage--;
++
++	    if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedILOADUsage == 0) {
++		pci_device_unmap_range(dev, pMga->ILOADBase,
++				       dev->regions[pMga->iload_bar].size);
++
++		if(pMga->entityPrivate != NULL)
++		    pMga->entityPrivate->mappedILOADBase = NULL;
++	    }
++
+ #else
+ 	xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->ILOADBase, 0x800000);
+ #endif
diff --git a/debian/patches/series b/debian/patches/series
index b7e34e9..7b69d6a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 01_no_nonfree.diff
+02_tentatively_unbreak_dual_head.diff


Reply to: