Hello,

I've attached some patches for the Savage ddx and the drm. The drm supports two basic ioctls right now. The output in the XFree86.0.log gives me now
[...]
(II) SAVAGE(0): initializing int10
(II) SAVAGE(0): Primary V_BIOS segment is: 0xc000
(II) SAVAGE(0): VESA BIOS detected
(II) SAVAGE(0): VESA VBE Version 3.0
(II) SAVAGE(0): VESA VBE Total Mem: 31680 kB
(II) SAVAGE(0): VESA VBE OEM: S3 Graphics ProSavage DDR Family BIOS
(II) SAVAGE(0): VESA VBE OEM Software Rev: 2.0
(II) SAVAGE(0): VESA VBE OEM Vendor: S3 Garphics Incorporated.
(II) SAVAGE(0): VESA VBE OEM Product: VBE 3.0
(II) SAVAGE(0): VESA VBE OEM Product Rev: Rev 0.0
(--) SAVAGE(0): mapping framebuffer @ 0xd0000000 with size 0x2000000
(==) SAVAGE(0): Write-combining range (0xd0000000,0x2000000)
(--) SAVAGE(0): Chose mode 117 at 60Hz.
(II) SAVAGE(0): [dri] trying to init DRI screen ...
drmOpenDevice: minor is 0
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 6, (OK)
drmOpenDevice: minor is 0
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 6, (OK)
drmOpenDevice: minor is 0
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 6, (OK)
drmGetBusid returned ''
(II) SAVAGE(0): [drm] created "savage" driver at busid "PCI:1:0:0"
(II) SAVAGE(0): [drm] added 8192 byte SAREA at 0xd07f6000
(II) SAVAGE(0): [drm] mapped SAREA 0xd07f6000 to 0x40024000
(II) SAVAGE(0): [drm] framebuffer handle = 0xd0000000
(II) SAVAGE(0): [drm] added 1 reserved context for kernel
(II) SAVAGE(0): [drm] register handle = 0xdfe80000
(II) SAVAGE(0): [drm] bci region handle = 0x4026f000
(II) SAVAGE(0): [dri] Visual configs initialized
(II) SAVAGE(0): Using 997 lines for offscreen memory.
(II) SAVAGE(0): Using XFree86 Acceleration Architecture (XAA)
Screen to screen bit blits
Solid filled rectangles
8x8 mono pattern filled rectangles
Indirect CPU to Screen color expansion
Solid Lines
Image Writes
Offscreen Pixmaps
Setting up tile and stipple cache:
32 128x128 slots
11 256x256 slots
(==) SAVAGE(0): Backing store disabled
(**) Option "dpms"
(**) SAVAGE(0): DPMS enabled
(WW) SAVAGE(0): Option "CalcAlgorithm" is not used
(II) SAVAGE(0): X context handle = 0x00000001
(II) SAVAGE(0): [drm] installed DRM signal handler
(II) SAVAGE(0): [DRI] installation complete
(II) SAVAGE(0): [dri] trying to init kernel driver ...
(II) SAVAGE(0): Direct Rendering enabled!
[...]


But that doesn't mean that we have direct rendering yet. There are lots of thing to do. So, I hope that I get any feedback from some experienced developers what to do next. Actually, I am a bit stuck with this BCI thing. The SavagePtr structure has had a field called
unsigned char* BciMem;
which is also used in the 2D driver. Is this the correct address for mapping the bci region?
I am also confused about the naming: bci/cob/ring. I think I messed this since I have simply copied and pasted from the radeon driver.


Any feedback is appreciated. Especially about what to do next.

Regards,
Andreas Karrenbauer

Index: savage_common.h
===================================================================
RCS file: 
/cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/Attic/savage_common.h,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 savage_common.h
--- savage_common.h     2 Mar 2003 20:43:51 -0000       1.1.2.3
+++ savage_common.h     5 Mar 2003 00:14:15 -0000
@@ -45,6 +45,8 @@
    } func;
    unsigned long sarea_priv_offset;
    int is_pci;
+   int bci_mode;
+   int ring_size;
    int agp_size;
    int usec_timeout;
 
@@ -56,6 +58,8 @@
 
    unsigned long fb_offset;
    unsigned long mmio_offset;
+   unsigned long ring_offset;
+   unsigned long ring_rptr_offset;
    unsigned long bci_offset;
    unsigned long buffers_offset;
    unsigned long agp_textures_offset;
Index: savage_dri.c
===================================================================
RCS file: 
/cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/Attic/savage_dri.c,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 savage_dri.c
--- savage_dri.c        2 Mar 2003 20:43:51 -0000       1.1.2.4
+++ savage_dri.c        5 Mar 2003 00:14:16 -0000
@@ -592,13 +592,13 @@
                                /* Map bci region */
     /* FIXME: lookup BCI region size */
     psav->bciSize = SAVAGE_NEWMMIO_REGSIZE;
-    if (drmAddMap(psav->drmFD, psav->bciBase, psav->bciSize,
+    if (drmAddMap(psav->drmFD, (unsigned long) psav->BciMem, psav->bciSize,
                  DRM_REGISTERS, DRM_READ_ONLY, &psav->bciHandle) < 0) {
        return FALSE;
     }
     xf86DrvMsg(pScreen->myNum, X_INFO,
-              "[drm] bci region handle = 0x%08lx\n", psav->registerHandle);
-
+              "[drm] bci region handle = 0x%08lx\n", psav->bciHandle);
+    
     return TRUE;
 }
 
@@ -609,14 +609,18 @@
     int            cpp   = ( pScrn->bitsPerPixel + 1 ) / 8;
     drmSavageInit  drmInfo;
 
+    xf86DrvMsg( pScreen->myNum, X_INFO, "[dri] trying to init kernel driver ...\n" );
+
     memset(&drmInfo, 0, sizeof(drmSavageInit));
 
     drmInfo.func                = DRM_SAVAGE_INIT_BCI;
     
     drmInfo.sarea_priv_offset   = sizeof(XF86DRISAREARec);
     drmInfo.is_pci              = psav->IsPCI;
+    drmInfo.bci_mode            = psav->BCIMode; 
     drmInfo.agp_size            = psav->agpSize*1024*1024;
-    drmInfo.usec_timeout        = psav->BCIusecTimeout;
+    drmInfo.ring_size           = psav->cobSize*1024*1024;
+    drmInfo.usec_timeout        = SAVAGE_DEFAULT_BCI_TIMEOUT; /* FIXME: 
psav->BCIusecTimeout; */
 
     drmInfo.fb_bpp              = pScrn->bitsPerPixel;
     drmInfo.depth_bpp           = pScrn->bitsPerPixel;
@@ -630,6 +634,9 @@
 
     drmInfo.fb_offset           = psav->FrameBufferBase;
     drmInfo.mmio_offset         = psav->registerHandle;
+    drmInfo.ring_offset         = psav->bciHandle; 
+    /* FIXME:    drmInfo.ring_rptr_offset    = psav->ringReadPtrHandle; */
+    /* FIXME:    drmInfo.buffers_offset      = psav->bufHandle; */
     drmInfo.bci_offset          = psav->bciHandle;
     drmInfo.agp_textures_offset = psav->agpTexHandle;
 
@@ -934,7 +941,7 @@
                                            < SAVAGE_MAX_DRAWABLES
                                            ? SAREA_MAX_DRAWABLES
                                            : SAVAGE_MAX_DRAWABLES);
-    
+
 #ifdef PER_CONTEXT_SAREA
     /* This is only here for testing per-context SAREAs.  When used, the
        magic number below would be properly defined in a header file. */
@@ -984,6 +991,8 @@
     pDRIInfo->createDummyCtx     = TRUE;
     pDRIInfo->createDummyCtxPriv = FALSE;
 
+       xf86DrvMsg( pScreen->myNum, X_INFO,
+               "[dri] trying to init DRI screen ...\n" );
     if (!DRIScreenInit(pScreen, pDRIInfo, &psav->drmFD)) {
        xf86DrvMsg(pScreen->myNum, X_ERROR,
                   "[dri] DRIScreenInit failed.  Disabling DRI.\n");
@@ -1109,6 +1118,8 @@
                                 * mappings here.
                                 */
     if (!SAVAGEDRIMapInit(psav, pScreen)) {
+       xf86DrvMsg( pScreen->myNum, X_ERROR, 
+               "[dri] dri map init has failed!\n" );
        SAVAGEDRICloseScreen(pScreen);
        return FALSE;
     }
Index: savage_dri.h
===================================================================
RCS file: 
/cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/Attic/savage_dri.h,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 savage_dri.h
--- savage_dri.h        1 Mar 2003 11:18:10 -0000       1.1.2.3
+++ savage_dri.h        5 Mar 2003 00:14:16 -0000
@@ -12,7 +12,7 @@
 #define SAVAGE_DEFAULT_BUFFER_SIZE  2 /* MB (must be page aligned) */
 #define SAVAGE_DEFAULT_AGP_TEX_SIZE 1 /* MB (must be page aligned) */
 
-#define SAVAGE_DEFAULT_CP_TIMEOUT   10000  /* usecs */
+#define SAVAGE_DEFAULT_BCI_TIMEOUT   10000  /* usecs */
 
 #define SAVAGE_AGP_MAX_MODE         4
 
Index: savage_driver.c
===================================================================
RCS file: 
/cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v
retrieving revision 1.9.2.1
diff -u -r1.9.2.1 savage_driver.c
--- savage_driver.c     2 Mar 2003 20:43:51 -0000       1.9.2.1
+++ savage_driver.c     5 Mar 2003 00:14:16 -0000
@@ -2261,8 +2261,8 @@
     }
     psav->ShadowCounter = 0;
 
-#if XF86DRI
-    psav->directRenderingEnabled = FALSE;
+#ifdef XF86DRI
+       psav->directRenderingEnabled = FALSE;
 #endif
 
     SavageSave(pScrn);
@@ -2310,15 +2310,10 @@
        }
     }
 
-#if XF86DRI
-    if ( psav->directRenderingEnabled ) 
-       psav->directRenderingEnabled = SAVAGEDRIFinishScreenInit( pScreen );
-    if ( psav->directRenderingEnabled )
-       xf86DrvMsg( pScrn->scrnIndex, X_INFO, "Direct Rendering enabled!\n" );
-    else 
-       xf86DrvMsg( pScrn->scrnIndex, X_INFO, "Direct Rendering disabled!\n" ); 
+#ifdef XF86DRI
+       psav->directRenderingEnabled = SAVAGEDRIScreenInit( pScreen );
 #endif
-    
+
     /* must be after RGB ordering fixed */
     fbPictureInit (pScreen, 0, 0);
 
@@ -2394,6 +2389,13 @@
     if (serverGeneration == 1)
        xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
 
+#ifdef XF86DRI
+       if ( psav->directRenderingEnabled ) 
+               psav->directRenderingEnabled = SAVAGEDRIFinishScreenInit( pScreen );
+       if ( psav->directRenderingEnabled )
+               xf86DrvMsg( pScrn->scrnIndex, X_INFO, "Direct Rendering enabled!\n" );
+       else xf86DrvMsg( pScrn->scrnIndex, X_INFO, "Direct Rendering disabled!\n" );   
 
+#endif
     return TRUE;
 }
 
@@ -2822,6 +2824,13 @@
     SavageRegPtr SavageSavePtr = &psav->SavedReg;
 
     TRACE(("SavageCloseScreen\n"));
+
+#ifdef XF86DRI
+    if ( psav->directRenderingEnabled ) {
+       SAVAGEDRICloseScreen( pScreen );
+       psav->directRenderingEnabled = FALSE;
+    }  
+#endif
 
     if (psav->pVbe)
       vbeFree(psav->pVbe);
Index: savage_driver.h
===================================================================
RCS file: 
/cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v
retrieving revision 1.7.2.4
diff -u -r1.7.2.4 savage_driver.h
--- savage_driver.h     2 Mar 2003 20:43:51 -0000       1.7.2.4
+++ savage_driver.h     5 Mar 2003 00:14:18 -0000
@@ -261,6 +261,13 @@
     int                        textureOffset;
     int                        textureSize;
     int                        log2TexGran;
+  
+   /* I don't know wether we ever will use this stuff
+   */
+  Bool noBackBuffer;
+  int  BCIMode;           /* BCI mode that server/clients use */
+  unsigned long bciBase;
+  drmHandle pciMemHandle;
 #endif
     
     /* Support for XVideo */
Index: savage_bci.c
===================================================================
RCS file: 
/cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Attic/savage_bci.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 savage_bci.c
--- savage_bci.c        2 Mar 2003 21:44:26 -0000       1.1.2.1
+++ savage_bci.c        5 Mar 2003 00:15:35 -0000
@@ -42,11 +42,13 @@
 {
        drm_savage_private_t *dev_priv;
        u32 tmp;
-       DRM_INFO( "[drm] initializing bci ...\n" );
+       DRM_INFO( "initializing bci ...\n" );
 
        dev_priv = DRM(alloc)( sizeof(drm_savage_private_t), DRM_MEM_DRIVER );
-       if ( dev_priv == NULL )
+       if ( dev_priv == NULL ) {
+               DRM_ERROR( "memory allocation for dev_priv failed!\n" );
                return DRM_ERR(ENOMEM);
+       }
 
        memset( dev_priv, 0, sizeof(drm_savage_private_t) );
 
@@ -62,7 +64,7 @@
        dev_priv->usec_timeout = init->usec_timeout;
        if ( dev_priv->usec_timeout < 1 ||
             dev_priv->usec_timeout > SAVAGE_MAX_USEC_TIMEOUT ) {
-               DRM_DEBUG( "TIMEOUT problem!\n" );
+               DRM_ERROR( "TIMEOUT problem!\n" );
                dev->dev_private = (void *)dev_priv;
                savage_do_cleanup_bci(dev);
                return DRM_ERR(EINVAL);
@@ -104,6 +106,7 @@
        dev_priv->depth_pitch_offset = (((dev_priv->depth_pitch/64) << 22) |
                                        (dev_priv->depth_offset >> 10));
 
+       DRM_INFO( "looking for sarea ...\n" );
        DRM_GETSAREA();
        
        if(!dev_priv->sarea) {
@@ -113,6 +116,7 @@
                return DRM_ERR(EINVAL);
        }
 
+       DRM_INFO( "looking for framebuffer ...\n" );
        DRM_FIND_MAP( dev_priv->fb, init->fb_offset );
        if(!dev_priv->fb) {
                DRM_ERROR("could not find framebuffer!\n");
@@ -120,6 +124,8 @@
                savage_do_cleanup_bci(dev);
                return DRM_ERR(EINVAL);
        }
+
+       DRM_INFO( "looking for mmio region ...\n" );
        DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset );
        if(!dev_priv->mmio) {
                DRM_ERROR("could not find mmio region!\n");
@@ -127,6 +133,8 @@
                savage_do_cleanup_bci(dev);
                return DRM_ERR(EINVAL);
        }
+
+       DRM_INFO( "looking for cob region ...\n" );
        DRM_FIND_MAP( dev_priv->bci_ring, init->ring_offset );
        if(!dev_priv->bci_ring) {
                DRM_ERROR("could not find bci ring region!\n");
@@ -134,6 +142,9 @@
                savage_do_cleanup_bci(dev);
                return DRM_ERR(EINVAL);
        }
+/* FIXME: we do not support this right now */
+#if 0
+       DRM_INFO( "looking for ring read pointer ...\n" );
        DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset );
        if(!dev_priv->ring_rptr) {
                DRM_ERROR("could not find ring read pointer!\n");
@@ -150,6 +161,7 @@
        }
 
        if ( !dev_priv->is_pci ) {
+               DRM_INFO( "looking for agp texture region ...\n" );
                DRM_FIND_MAP( dev_priv->agp_textures,
                              init->agp_textures_offset );
                if(!dev_priv->agp_textures) {
@@ -160,11 +172,15 @@
                }
        }
 
+#endif
+
        dev_priv->sarea_priv =
                (drm_savage_sarea_t *)((u8 *)dev_priv->sarea->handle +
                                       init->sarea_priv_offset);
 
        if ( !dev_priv->is_pci ) {
+               /* FIXME: we do not support this right now */
+#if 0
                DRM_IOREMAP( dev_priv->bci_ring );
                DRM_IOREMAP( dev_priv->ring_rptr );
                DRM_IOREMAP( dev_priv->buffers );
@@ -176,6 +192,7 @@
                        savage_do_cleanup_bci(dev);
                        return DRM_ERR(EINVAL);
                }
+#endif
        } else {
                dev_priv->bci_ring->handle =
                        (void *)dev_priv->bci_ring->offset;
@@ -279,15 +296,15 @@
 
 int savage_do_cleanup_bci( drm_device_t *dev )
 {
-       DRM_DEBUG( "\n" );
+       DRM_INFO( "cleaning up bci ...\n" );
 
        if ( dev->dev_private ) {
                drm_savage_private_t *dev_priv = dev->dev_private;
 
                if ( !dev_priv->is_pci ) {
-                       DRM_IOREMAPFREE( dev_priv->bci_ring );
-                       DRM_IOREMAPFREE( dev_priv->ring_rptr );
-                       DRM_IOREMAPFREE( dev_priv->buffers );
+                       /* FIXME: DRM_IOREMAPFREE( dev_priv->bci_ring ); */
+                       /* FIXME: DRM_IOREMAPFREE( dev_priv->ring_rptr ); */
+                       /* FIXME: DRM_IOREMAPFREE( dev_priv->buffers ); */
                } else {
 #if __REALLY_HAVE_SG
                        if (!DRM(ati_pcigart_cleanup)( dev,

Reply via email to