Port-mips archive

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

xf86-video-sis changes for mips



[ I'm not subscribed to tech-x11, so please keep either me or port-mips in Cc ]

Hello,
attached is a change against the netbsd-6 xf86-video-sis, which allows me
to run X11 accelerated on a lemote fuloong.
This device has a loongson2 CPU and uses a sis 315Pro as graphic controller.
But here the controller is not in VGA-compatible mode but in framebuffer
mode. We have sisfb(4) in our kernel to use it as text console.
Recently I added support to sisfb(4) for wsfb (this was easy), and
also got xf86-video-sis working (which gives us highter resolutions,
support for the second video output, etc ...). For this, I added
support to sisfb to mmap the video memory, but also the I/O and memory-mapped
registers. The attached patch changes xf86-video-sis to use the services
provided by sisfb for registers access (I couldn't get it working
using the libpciaccess, because our pci(4) doesn't support mmap'ing the
I/O space, and chaning this would be quite intrusive).

Would anyone see a problem with this approach ? I don't think xf86-video-sis
has ever worked on mips hardware on NetBSD so this shouldn't break anything ...

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: xf86-video-sis/dist/src/sis.h
===================================================================
RCS file: /cvsroot/xsrc/external/mit/xf86-video-sis/dist/src/sis.h,v
retrieving revision 1.1.1.3
diff -u -p -u -r1.1.1.3 sis.h
--- xf86-video-sis/dist/src/sis.h       22 Aug 2009 00:04:41 -0000      1.1.1.3
+++ xf86-video-sis/dist/src/sis.h       26 Jan 2014 21:26:49 -0000
@@ -149,7 +149,7 @@
 /* List of architectures likely to be incomplete */
 /* This is BROKEN, see comment in sis_driver.c */
 #undef SIS_NEED_MAP_IOP
-#if 0
+#if defined(__NetBSD__)
 #if defined(__arm32__) || defined(__mips__)
 #define SIS_NEED_MAP_IOP
 #endif
Index: xf86-video-sis/dist/src/sis_driver.c
===================================================================
RCS file: /cvsroot/xsrc/external/mit/xf86-video-sis/dist/src/sis_driver.c,v
retrieving revision 1.1.1.4
diff -u -p -u -r1.1.1.4 sis_driver.c
--- xf86-video-sis/dist/src/sis_driver.c        17 Jul 2010 06:32:06 -0000      
1.1.1.4
+++ xf86-video-sis/dist/src/sis_driver.c        26 Jan 2014 21:26:49 -0000
@@ -118,6 +118,10 @@ static int SiSSProcXineramaDispatch(Clie
 #endif
 #endif
 
+#if defined(__NetBSD__) && defined(__mips__)
+#define SIS_USEMAPVIDMEM
+#endif
+
 /*
  * This is intentionally screen-independent.  It indicates the binding
  * choice made in the first PreInit.
@@ -3271,16 +3275,16 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
     /* we have our own vgaHW routines. However, */
     /* we use /dev/port for now instead.)       */
     /********************************************/
-    pSiS->IOPAddress = pSiS->IODBase + pSiS->PciInfo->ioBase[2];
+    pSiS->IOPAddress = pSiS->IODBase + PCI_REGION_BASE(pSiS->PciInfo, 2, 
REGION_IO);
     if(!SISMapIOPMem(pScrn)) {
        SISErrorLog(pScrn, "Could not map I/O port area at 0x%x\n", 
pSiS->IOPAddress);
        goto my_error_0;
     } else {
-       xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I/O port area mapped to %p, size 
128\n", pSiS->IOPBase);
+       xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I/O port area 0x%x mapped to %p, 
size 128\n", pSiS->IOPAddress,  pSiS->IOPBase);
 #if defined(__mips__) || defined(__arm32__)
        /* inX/outX macros on these use IOPortBase as offset */
        /* This is entirely skrewed. */
-       IOPortBase = (unsigned int)pSiS->IOPBase;
+       IOPortBase = (unsigned int)pSiS->IOPBase - pSiS->IOPAddress;
 #endif
     }
 #endif
@@ -7011,7 +7015,10 @@ SISMapIOPMem(ScrnInfoPtr pScrn)
         pSiSEnt->MapCountIOPBase++;
         if(!(pSiSEnt->IOPBase)) {
             /* Only map if not mapped previously */
-#ifndef XSERVER_LIBPCIACCESS
+#ifdef SIS_USEMAPVIDMEM
+           pSiSEnt->IOPBase = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO,
+               pSiS->IOPAddress, 128);
+#elif !defined(XSERVER_LIBPCIACCESS)
             pSiSEnt->IOPBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
                        pSiS->PciTag, pSiS->IOPAddress, 128);
 #else
@@ -7034,7 +7041,10 @@ SISMapIOPMem(ScrnInfoPtr pScrn)
         pSiS->IOPBase = pSiSEnt->IOPBase;
     } else
 #endif
-#ifndef XSERVER_LIBPCIACCESS
+#ifdef SIS_USEMAPVIDMEM
+           pSiS->IOPBase = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO,
+               pSiS->IOPAddress, 128);
+#elif !defined(XSERVER_LIBPCIACCESS)
             pSiS->IOPBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
                                           pSiS->PciTag, pSiS->IOPAddress, 128);
 #else
@@ -7122,7 +7132,10 @@ SISMapMem(ScrnInfoPtr pScrn)
         pSiSEnt->MapCountIOBase++;
         if(!(pSiSEnt->IOBase)) {
             /* Only map if not mapped previously */
-#ifndef XSERVER_LIBPCIACCESS
+#ifdef SIS_USEMAPVIDMEM
+            pSiSEnt->IOBase = xf86MapVidMem(pScrn->scrnIndex, mmioFlags,
+               pSiS->IOAddress, (pSiS->mmioSize * 1024));
+#elif !defined(XSERVER_LIBPCIACCESS)
             pSiSEnt->IOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
                          pSiS->PciTag, pSiS->IOAddress, (pSiS->mmioSize * 
1024));
 #else
@@ -7143,7 +7156,10 @@ SISMapMem(ScrnInfoPtr pScrn)
         pSiS->IOBase = pSiSEnt->IOBase;
     } else
 #endif
-#ifndef XSERVER_LIBPCIACCESS
+#ifdef SIS_USEMAPVIDMEM
+       pSiS->IOBase = xf86MapVidMem(pScrn->scrnIndex, mmioFlags,
+               pSiS->IOAddress, (pSiS->mmioSize * 1024));
+#elif !defined(XSERVER_LIBPCIACCESS)
        pSiS->IOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
                         pSiS->PciTag, pSiS->IOAddress, (pSiS->mmioSize * 
1024));
 #else
@@ -7178,7 +7194,10 @@ SISMapMem(ScrnInfoPtr pScrn)
         pSiSEnt->MapCountIOBaseDense++;
         if(!(pSiSEnt->IOBaseDense)) {
             /* Only map if not mapped previously */
-#ifndef XSERVER_LIBPCIACCESS
+#ifdef SIS_USEMAPVIDMEM
+            pSiSEnt->IOBaseDense = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO,
+               pSiS->IOAddress, (pSiS->mmioSize * 1024));
+#elif !defined(XSERVER_LIBPCIACCESS)
             pSiSEnt->IOBaseDense = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
                     pSiS->PciTag, pSiS->IOAddress, (pSiS->mmioSize * 1024));
 #else
@@ -7199,7 +7218,10 @@ SISMapMem(ScrnInfoPtr pScrn)
        pSiS->IOBaseDense = pSiSEnt->IOBaseDense;
     } else {
 #endif /* SISDUALHEAD */
-#ifndef XSERVER_LIBPCIACCESS
+#ifdef SIS_USEMAPVIDMEM
+            pSiS->IOBaseDense = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO,
+               pSiS->IOAddress, (pSiS->mmioSize * 1024));
+#elif !defined(XSERVER_LIBPCIACCESS)
             pSiS->IOBaseDense = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
                     pSiS->PciTag, pSiS->IOAddress, (pSiS->mmioSize * 1024));
 #else
@@ -7230,7 +7252,11 @@ SISMapMem(ScrnInfoPtr pScrn)
        pSiSEnt->MapCountFbBase++;
        if(!(pSiSEnt->FbBase)) {
             /* Only map if not mapped previously */
-#ifndef XSERVER_LIBPCIACCESS
+#ifdef SIS_USEMAPVIDMEM
+            pSiSEnt->FbBase = pSiSEnt->RealFbBase =
+               xf86MapVidMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
+               pSiS->realFbAddress, pSiS->FbMapSize);
+#elif !defined(XSERVER_LIBPCIACCESS)
             pSiSEnt->FbBase = pSiSEnt->RealFbBase =
                        xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
                         pSiS->PciTag, (ULong)pSiS->realFbAddress,
@@ -7257,7 +7283,11 @@ SISMapMem(ScrnInfoPtr pScrn)
     } else {
 #endif
 
-#ifndef XSERVER_LIBPCIACCESS
+#ifdef SIS_USEMAPVIDMEM
+      pSiS->FbBase = pSiS->RealFbBase =
+                       xf86MapVidMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
+                        pSiS->realFbAddress, pSiS->FbMapSize);
+#elif !defined(XSERVER_LIBPCIACCESS)
       pSiS->FbBase = pSiS->RealFbBase =
                        xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
                         pSiS->PciTag, (ULong)pSiS->realFbAddress,


Home | Main Index | Thread Index | Old Index