diff options
author | Ian Romanick <idr@umwelt.(none)> | 2006-07-26 11:46:52 -0700 |
---|---|---|
committer | Ian Romanick <idr@umwelt.(none)> | 2006-07-26 11:46:52 -0700 |
commit | 95e0722ff2e8878cdd6bb0e349eecab042b879db (patch) | |
tree | 03b801974e76f5feb3df4755f434952cb1faf6a8 /src/mga_dri.c | |
parent | 78c12368fa1c1985f41ce856ff453a967429870a (diff) |
Current state of MGA driver modified to work with the xserver
pci-rework branch.
Diffstat (limited to 'src/mga_dri.c')
-rw-r--r-- | src/mga_dri.c | 70 |
1 files changed, 23 insertions, 47 deletions
diff --git a/src/mga_dri.c b/src/mga_dri.c index c675a63..b099c7d 100644 --- a/src/mga_dri.c +++ b/src/mga_dri.c @@ -653,8 +653,8 @@ static Bool MGADRIBootstrapDMA(ScreenPtr pScreen) xf86DrvMsg( pScreen->myNum, X_INFO, "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n", mode, vendor, device, - pMga->PciInfo->vendor, - pMga->PciInfo->chipType ); + pMga->PciInfo->vendor_id, + pMga->PciInfo->device_id ); if ( drmAgpEnable( pMga->drmFD, mode ) < 0 ) { xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not enabled\n" ); @@ -801,7 +801,7 @@ static Bool MGADRIBootstrapDMA(ScreenPtr pScreen) pMGADRIServer->registers.size = MGAIOMAPSIZE; if ( drmAddMap( pMga->drmFD, - (drm_handle_t)pMga->IOAddress, + (drm_handle_t)pMga->PciInfo->regions[ pMga->io_bar ].base_addr, pMGADRIServer->registers.size, DRM_REGISTERS, DRM_READ_ONLY, &pMGADRIServer->registers.handle ) < 0 ) { @@ -838,23 +838,16 @@ static Bool MGADRIKernelInit( ScreenPtr pScreen ) drm_mga_init_t init; int ret; + + if (!pMga->chip_attribs->dri_capable) { + return FALSE; + } + memset( &init, 0, sizeof(drm_mga_init_t) ); init.func = MGA_INIT_DMA; init.sarea_priv_offset = sizeof(XF86DRISAREARec); - - switch ( pMga->Chipset ) { - case PCI_CHIP_MGAG550: - case PCI_CHIP_MGAG400: - init.chipset = MGA_CARD_TYPE_G400; - break; - case PCI_CHIP_MGAG200: - case PCI_CHIP_MGAG200_PCI: - init.chipset = MGA_CARD_TYPE_G200; - break; - default: - return FALSE; - } + init.chipset = pMga->chip_attribs->dri_chipset; init.sgram = !pMga->HasSDRAM; init.maccess = pMga->MAccess; @@ -894,20 +887,19 @@ static Bool MGADRIKernelInit( ScreenPtr pScreen ) return TRUE; } +/* FIXME: This function uses the DRM to get the IRQ, but the pci_device + * FIXME: structure (PciInfo) already has that information. + */ static void MGADRIIrqInit(MGAPtr pMga, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - /* version = drmGetVersion(pMga->drmFD); - if ( version ) { - if ( version->version_major != 3 || - version->version_minor < 0 ) {*/ if (!pMga->irq) { - pMga->irq = drmGetInterruptFromBusID( - pMga->drmFD, - ((pciConfigPtr)pMga->PciInfo->thisCard)->busnum, - ((pciConfigPtr)pMga->PciInfo->thisCard)->devnum, - ((pciConfigPtr)pMga->PciInfo->thisCard)->funcnum); + pMga->irq = drmGetInterruptFromBusID(pMga->drmFD, + ((pMga->PciInfo->domain << 8) | + pMga->PciInfo->bus), + pMga->PciInfo->dev, + pMga->PciInfo->func); if((drmCtlInstHandler(pMga->drmFD, pMga->irq)) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -955,13 +947,7 @@ Bool MGADRIScreenInit( ScreenPtr pScreen ) MGADRIPtr pMGADRI; MGADRIServerPrivatePtr pMGADRIServer; - switch(pMga->Chipset) { - case PCI_CHIP_MGAG550: - case PCI_CHIP_MGAG400: - case PCI_CHIP_MGAG200: - case PCI_CHIP_MGAG200_PCI: - break; - default: + if (!pMga->chip_attribs->dri_capable) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Direct rendering only supported with G200/G400/G450/G550.\n"); return FALSE; } @@ -1018,9 +1004,10 @@ Bool MGADRIScreenInit( ScreenPtr pScreen ) } else { pDRIInfo->busIdString = xalloc(64); sprintf( pDRIInfo->busIdString, "PCI:%d:%d:%d", - ((pciConfigPtr)pMga->PciInfo->thisCard)->busnum, - ((pciConfigPtr)pMga->PciInfo->thisCard)->devnum, - ((pciConfigPtr)pMga->PciInfo->thisCard)->funcnum ); + ((pMga->PciInfo->domain << 8) | + pMga->PciInfo->bus), + pMga->PciInfo->dev, + pMga->PciInfo->func ); } pDRIInfo->ddxDriverMajorVersion = MGA_MAJOR_VERSION; pDRIInfo->ddxDriverMinorVersion = MGA_MINOR_VERSION; @@ -1254,18 +1241,7 @@ Bool MGADRIFinishScreenInit( ScreenPtr pScreen ) MGADRIIrqInit(pMga, pScreen); - switch(pMga->Chipset) { - case PCI_CHIP_MGAG550: - case PCI_CHIP_MGAG400: - pMGADRI->chipset = MGA_CARD_TYPE_G400; - break; - case PCI_CHIP_MGAG200: - case PCI_CHIP_MGAG200_PCI: - pMGADRI->chipset = MGA_CARD_TYPE_G200; - break; - default: - return FALSE; - } + pMGADRI->chipset = pMga->chip_attribs->dri_chipset; pMGADRI->width = pScrn->virtualX; pMGADRI->height = pScrn->virtualY; pMGADRI->cpp = pScrn->bitsPerPixel / 8; |