You are not logged in.

#1 2009-04-18 03:57:36

playdafunkimuzic
Member
Registered: 2008-10-25
Posts: 220

Matrox Card gives "Unable to map BAR0" error on xinerama enable

Hi Everyone:

Back in around November I was running arch on dual monitor on my Matrox G450 Card, everything worked fine. I had it autoconfig X for me, and I was surprised as it was the only distro to work dual monitor xinerama out of the box.

I've used arch on my laptop for quite some time.  I was given an nvidia card the geforce fx5200 and was also away from my main workplace for a few months, so I was only running a single monitor.

I am now back on dual monitor mode and I want to use my matrox G450 again as dual screen. But, when dual screen is enabled I get that error. If I run single screen, it clones both screens.

My only other option was to use the geforcefx5200 which was AGP and then an old PCI nvidia card I have (tntriva2). But, the conflict between the two nvidia drivers didn't work. Even using nv or vesa for the tnt riva didn't work, for some reason.

I really want to get these two monitors back up and running with the matrox card though. It seems to be the new version of Xorg/MGA drivers as mentioned here.

https://bugs.launchpad.net/ubuntu/+sour … bug/292214

I'd be really appreciative if someone was able to solve this, as I've tried to do lots now and have come up empty.

Thanks!

Offline

#2 2009-04-18 18:13:05

playdafunkimuzic
Member
Registered: 2008-10-25
Posts: 220

Re: Matrox Card gives "Unable to map BAR0" error on xinerama enable

Anyone? Please smile

Offline

#3 2009-10-18 17:15:40

scv5
Member
Registered: 2008-10-19
Posts: 109

Re: Matrox Card gives "Unable to map BAR0" error on xinerama enable

did you ever find a solution to this? i'm having the exact same problem.   I can startx (or gdm or whatever) just fine if I don't specify Xinerama in xorg.conf.

But it seems whenever xinerama is enabled I get the BAR 0 error mentioned about.   Quite annoying.

Offline

#4 2010-05-17 14:59:04

tesjo
Member
Registered: 2007-11-30
Posts: 164

Re: Matrox Card gives "Unable to map BAR0" error on xinerama enable

I am using a matrox g550 i bought explicilty for dual monitor support, about two months back and then ran into this problem.  The problem and solution are in a nice thread listed by the orignal poster, essential xrandr is not supported by the driver. I used the patches there, but after an update today decided to make a PKGBUILD so here it is if anyone is interested, along with the patch and my xorg.conf for dual monitors.

Edit: Note LICENSE is from SVN xf86-video-mga

PKGBUILD

pkgname=xf86-video-mga-dual
pkgver=1.4.11
pkgrel=1
pkgdesc="X.org mga video driver with patch for daul monitor support, not xrand"
arch=(i686 x86_64)
url="http://xorg.freedesktop.org/"
license=('custom')
depends=('glibc' 'mga-dri')
makedepends=('pkgconfig' 'xorg-server>=1.7.0' "mesa>=7.6" 'xf86driproto' 'glproto>=1.4.10')
conflicts=('xorg-server<1.7.0' 'xf86-video-mga')
replaces=('xf86-video-mga')
options=('!libtool' 'force')
groups=('xorg-video-drivers')
source=(${url}/releases/individual/driver/xf86-video-mga-${pkgver}.tar.bz2
    mga-dual.patch
        LICENSE)
md5sums=('9d1ca965cedb0856296b47442f3c739d'
     '2ff843b9825f1b617befb7247d368c56'    
         'b71a5cd59dcaa0b7d9bbbfc597915dd6')

build() {
  cd "${srcdir}/xf86-video-mga-${pkgver}"
  patch -Np1 -i $startdir/mga-dual.patch || return 1
  ./configure --prefix=/usr \
              --enable-dri || return 1
  make || return 1
  make DESTDIR="${pkgdir}" install || return 1
  install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/xf86-vide-mga/LICENSE" || return 1
}

mga-dual.patch

diff -c xf86-video-mga-1.4.11/src//mga.h xserver-xorg-video-mga-1.4.11.dfsg-patched/src//mga.h
*** xf86-video-mga-1.4.11/src/mga.h    Mon Jul 27 20:24:51 2009
--- xf86-video-mga-1.4.11-patched/src/mga.h    Tue Mar 16 15:18:37 2010
***************
*** 333,338 ****
--- 333,346 ----
      int            mastervideoRam;
      int            slavevideoRam;
      Bool        directRenderingEnabled;
+ 
+     void  *        mappedIOBase;
+     int            mappedIOUsage;
+ 
+     void  *        mappedILOADBase;
+     int            mappedILOADUsage;
+ 
+ 
      ScrnInfoPtr     pScrn_1;
      ScrnInfoPtr     pScrn_2;
  } MGAEntRec, *MGAEntPtr;
diff -c xf86-video-mga-1.4.11/src//mga_driver.c xserver-xorg-video-mga-1.4.11.dfsg-patched/src//mga_driver.c
*** xf86-video-mga-1.4.11/src/mga_driver.c    Tue Jul 28 01:11:40 2009
--- xf86-video-mga-1.4.11-patched/src/mga_driver.c    Tue Mar 16 15:16:39 2010
***************
*** 2791,2805 ****
  #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;
  
          for (i = 0; i < 2; i++) {
              region = &dev->regions[i];
--- 2791,2806 ----
  #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;
  
          for (i = 0; i < 2; i++) {
              region = &dev->regions[i];
***************
*** 2807,2820 ****
                                         region->base_addr, region->size,
                                         PCI_DEV_MAP_FLAG_WRITABLE,
                                         memory[i]);
  
-             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
--- 2808,2859 ----
                                         region->base_addr, region->size,
                                         PCI_DEV_MAP_FLAG_WRITABLE,
                                         memory[i]);
+       */
+       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);
+       
+       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 ++;
! 
  #else
      /*
       * For Alpha, we need to map SPARSE memory, since we need
***************
*** 2856,2871 ****
      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;
!     }
  #else
      pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex,
                      VIDMEM_MMIO | VIDMEM_MMIO_32BIT |
--- 2895,2922 ----
      if (pMga->iload_bar != -1) {
  #ifdef XSERVER_LIBPCIACCESS
          region = &dev->regions[pMga->iload_bar];
! 
!     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 |
***************
*** 2895,2904 ****
      
      if (!pMga->FBDev) {
  #ifdef XSERVER_LIBPCIACCESS
!         pci_device_unmap_range(dev, pMga->IOBase, 
!                    dev->regions[pMga->io_bar].size);
          pci_device_unmap_range(dev, pMga->FbBase, 
!                    dev->regions[pMga->framebuffer_bar].size);
  #else
      xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->IOBase, 0x4000);
      xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->FbBase, pMga->FbMapSize);
--- 2946,2966 ----
      
      if (!pMga->FBDev) {
  #ifdef XSERVER_LIBPCIACCESS
!         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, 
!                    pMga->FbMapSize);
  #else
      xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->IOBase, 0x4000);
      xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->FbBase, pMga->FbMapSize);
***************
*** 2911,2918 ****
  
      if ((pMga->iload_bar != -1) && (pMga->ILOADBase != NULL)) {
  #ifdef XSERVER_LIBPCIACCESS
!         pci_device_unmap_range(dev, pMga->ILOADBase,
                     dev->regions[pMga->iload_bar].size);
  #else
      xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->ILOADBase, 0x800000);
  #endif
--- 2973,2990 ----
  
      if ((pMga->iload_bar != -1) && (pMga->ILOADBase != NULL)) {
  #ifdef XSERVER_LIBPCIACCESS
!         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

xorg.conf

# /etc/X11/xorg.conf (xorg X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the /etc/X11/xorg.conf manual page.
# (Type "man /etc/X11/xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg
Section "Files"
    ModulePath   "/usr/lib/xorg/modules"
    FontPath     "/usr/share/fonts/misc"
    FontPath     "/usr/share/fonts/100dpi:unscaled"
    FontPath     "/usr/share/fonts/75dpi:unscaled"
    FontPath     "/usr/share/fonts/TTF"
    FontPath     "/usr/share/fonts/Type1"
EndSection
Section "Module"
    Load  "dri"
    Load  "glx"
    Load  "dri2"
    Load  "dbe"

    Load  "extmod"
    Load  "record"
EndSection

Section "InputDevice"
    Identifier  "Keyboard0"
    Driver      "kbd"
EndSection

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "mouse"
    Option        "Protocol" "auto"
    Option        "Device" "/dev/input/mice"
    Option        "ZAxisMapping" "4 5 6 7"
EndSection

Section "ServerFlags"
 Option "Xinerama" "on"
EndSection

Section "Device"
 Identifier     "Matrox0"
 Driver        "mga"
 BusID        "PCI:1:0:0"    #check this with lspci. first entry, probably called a video controller
 Screen 0
EndSection
Section "Device"
 Identifier     "Matrox1"
 Driver        "mga"
 BusID        "PCI:1:0:0"    #check this with lspci, probably won't be called a video controller
 Screen 1
EndSection

Section "Screen"
 Identifier  "Screen 0"
 Device      "Matrox0"
 Monitor     "MyMonitor"
 DefaultDepth 24
   Subsection "Display"
       Depth       24
       Modes       "1024x768" "800x600" "640x480"
       #ViewPort    0 0
   EndSubsection
EndSection
Section "Screen"
 Identifier  "Screen 1"
 Device      "Matrox1"
 Monitor     "MyMonitor"
 DefaultDepth 24
   Subsection "Display"
       Depth       24
       Modes       "1280x1024" "1024x768" "800x600" "640x480"
       #ViewPort    0 0
   EndSubsection
EndSection

Section "ServerLayout"
 # These bits as per your current settings
 Identifier      "Default Layout"
 InputDevice     "Keyboard0"
 InputDevice     "Mouse0"
 # Replace 'Screen "Screen 0"' with this
 #Screen "Screen 1"
 Screen "Screen 0" LeftOf "Screen 1"
 Screen "Screen 1"
EndSection

Last edited by tesjo (2010-05-17 15:03:35)

Offline

Board footer

Powered by FluxBB