mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 19:50:11 +01:00
Fixes lockups initializing AGP DMA.
This commit is contained in:
parent
4676a6ab7b
commit
7ea2084513
1 changed files with 56 additions and 47 deletions
|
|
@ -81,7 +81,7 @@ static int VIADRIFinishScreenInit(DRIDriverContext * ctx);
|
||||||
#define AGP_CMDBUF_SIZE (AGP_PAGE_SIZE * AGP_CMDBUF_PAGES)
|
#define AGP_CMDBUF_SIZE (AGP_PAGE_SIZE * AGP_CMDBUF_PAGES)
|
||||||
|
|
||||||
static char VIAKernelDriverName[] = "via";
|
static char VIAKernelDriverName[] = "via";
|
||||||
static char VIAClientDriverName[] = "via";
|
static char VIAClientDriverName[] = "unichrome";
|
||||||
|
|
||||||
static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia);
|
static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia);
|
||||||
static int VIADRIPciInit(DRIDriverContext * ctx, VIAPtr pVia);
|
static int VIADRIPciInit(DRIDriverContext * ctx, VIAPtr pVia);
|
||||||
|
|
@ -195,7 +195,7 @@ static int VIADRIRingBufferInit(DRIDriverContext *ctx)
|
||||||
static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia)
|
static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia)
|
||||||
{
|
{
|
||||||
unsigned long agp_phys;
|
unsigned long agp_phys;
|
||||||
unsigned int agpaddr;
|
drmAddress agpaddr;
|
||||||
VIADRIPtr pVIADRI;
|
VIADRIPtr pVIADRI;
|
||||||
pVIADRI = pVia->devPrivate;
|
pVIADRI = pVia->devPrivate;
|
||||||
pVia->agpSize = 0;
|
pVia->agpSize = 0;
|
||||||
|
|
@ -248,15 +248,10 @@ static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
/* Map AGP from kernel to Xserver - Not really needed */
|
/* Map AGP from kernel to Xserver - Not really needed */
|
||||||
drmMap(pVia->drmFD, pVIADRI->agp.handle,pVIADRI->agp.size,
|
drmMap(pVia->drmFD, pVIADRI->agp.handle,pVIADRI->agp.size, &agpaddr);
|
||||||
(drmAddressPtr)&agpaddr);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
xf86DrvMsg(pScreen->myNum, X_INFO,
|
|
||||||
"[drm] agpBase = 0x%08lx\n", pVia->agpBase);
|
|
||||||
xf86DrvMsg(pScreen->myNum, X_INFO,
|
xf86DrvMsg(pScreen->myNum, X_INFO,
|
||||||
"[drm] agpAddr = 0x%08lx\n", pVia->agpAddr);
|
"[drm] agpAddr = 0x%08lx\n", pVia->agpAddr);
|
||||||
#endif
|
|
||||||
xf86DrvMsg(pScreen->myNum, X_INFO,
|
xf86DrvMsg(pScreen->myNum, X_INFO,
|
||||||
"[drm] agpSize = 0x%08lx\n", pVia->agpSize);
|
"[drm] agpSize = 0x%08lx\n", pVia->agpSize);
|
||||||
xf86DrvMsg(pScreen->myNum, X_INFO,
|
xf86DrvMsg(pScreen->myNum, X_INFO,
|
||||||
|
|
@ -394,6 +389,46 @@ static int VIADRIScreenInit(DRIDriverContext * ctx)
|
||||||
ctx->driverClientMsg = pVIADRI;
|
ctx->driverClientMsg = pVIADRI;
|
||||||
ctx->driverClientMsgSize = sizeof(*pVIADRI);
|
ctx->driverClientMsgSize = sizeof(*pVIADRI);
|
||||||
|
|
||||||
|
/* DRIScreenInit doesn't add all the common mappings. Add additional mappings here. */
|
||||||
|
if (!VIADRIMapInit(ctx, pVia)) {
|
||||||
|
VIADRICloseScreen(ctx);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pVIADRI->regs.size = VIA_MMIO_REGSIZE;
|
||||||
|
pVIADRI->regs.map = 0;
|
||||||
|
pVIADRI->regs.handle = pVia->registerHandle;
|
||||||
|
xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] mmio Registers = 0x%08lx\n",
|
||||||
|
pVIADRI->regs.handle);
|
||||||
|
|
||||||
|
if (drmMap(pVia->drmFD,
|
||||||
|
pVIADRI->regs.handle,
|
||||||
|
pVIADRI->regs.size,
|
||||||
|
(drmAddress *)&pVia->MapBase) != 0)
|
||||||
|
{
|
||||||
|
VIADRICloseScreen(ctx);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] mmio mapped.\n" );
|
||||||
|
|
||||||
|
VIAEnableMMIO(ctx);
|
||||||
|
|
||||||
|
/* Get video memory clock. */
|
||||||
|
VGAOUT8(0x3D4, 0x3D);
|
||||||
|
pVia->MemClk = (VGAIN8(0x3D5) & 0xF0) >> 4;
|
||||||
|
xf86DrvMsg(0, X_INFO, "[dri] MemClk (0x%x)\n", pVia->MemClk);
|
||||||
|
|
||||||
|
/* 3D rendering has noise if not enabled. */
|
||||||
|
VIAEnableExtendedFIFO(ctx);
|
||||||
|
|
||||||
|
VIAInitialize2DEngine(ctx);
|
||||||
|
|
||||||
|
/* Must disable MMIO or 3D won't work. */
|
||||||
|
VIADisableMMIO(ctx);
|
||||||
|
|
||||||
|
VIAInitialize3DEngine(ctx);
|
||||||
|
|
||||||
pVia->IsPCI = !VIADRIAgpInit(ctx, pVia);
|
pVia->IsPCI = !VIADRIAgpInit(ctx, pVia);
|
||||||
|
|
||||||
if (pVia->IsPCI) {
|
if (pVia->IsPCI) {
|
||||||
|
|
@ -411,32 +446,10 @@ static int VIADRIScreenInit(DRIDriverContext * ctx)
|
||||||
|
|
||||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] frame buffer initialized.\n" );
|
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] frame buffer initialized.\n" );
|
||||||
|
|
||||||
/* DRIScreenInit doesn't add all the common mappings. Add additional mappings here. */
|
|
||||||
if (!VIADRIMapInit(ctx, pVia)) {
|
|
||||||
VIADRICloseScreen(ctx);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
pVIADRI->regs.size = VIA_MMIO_REGSIZE;
|
|
||||||
pVIADRI->regs.map = 0;
|
|
||||||
pVIADRI->regs.handle = pVia->registerHandle;
|
|
||||||
xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] mmio Registers = 0x%08lx\n",
|
|
||||||
pVIADRI->regs.handle);
|
|
||||||
|
|
||||||
/*pVIADRI->drixinerama = pVia->drixinerama;*/
|
/*pVIADRI->drixinerama = pVia->drixinerama;*/
|
||||||
/*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
|
/*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
|
||||||
pVIADRI->VQEnable = pVia->VQEnable;
|
pVIADRI->VQEnable = pVia->VQEnable;
|
||||||
|
|
||||||
if (drmMap(pVia->drmFD,
|
|
||||||
pVIADRI->regs.handle,
|
|
||||||
pVIADRI->regs.size,
|
|
||||||
(drmAddress *)&pVia->MapBase) != 0)
|
|
||||||
{
|
|
||||||
VIADRICloseScreen(ctx);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] mmio mapped.\n" );
|
|
||||||
|
|
||||||
return VIADRIFinishScreenInit(ctx);
|
return VIADRIFinishScreenInit(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1020,6 +1033,7 @@ static void VIAInitialize2DEngine(DRIDriverContext *ctx)
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
dwGEMode |= VIA_GEM_32bpp;
|
dwGEMode |= VIA_GEM_32bpp;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
dwGEMode |= VIA_GEM_8bpp;
|
dwGEMode |= VIA_GEM_8bpp;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1203,28 +1217,23 @@ static int viaInitFBDev(DRIDriverContext *ctx)
|
||||||
|
|
||||||
pVia->FBFreeStart = ctx->shared.virtualWidth * ctx->cpp *
|
pVia->FBFreeStart = ctx->shared.virtualWidth * ctx->cpp *
|
||||||
ctx->shared.virtualHeight;
|
ctx->shared.virtualHeight;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Alloc a second framebuffer for the second head */
|
||||||
|
pVia->FBFreeStart += ctx->shared.virtualWidth * ctx->cpp *
|
||||||
|
ctx->shared.virtualHeight;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
pVia->VQStart = pVia->FBFreeStart;
|
||||||
|
pVia->VQEnd = pVia->FBFreeStart + VIA_VQ_SIZE - 1;
|
||||||
|
|
||||||
|
pVia->FBFreeStart += VIA_VQ_SIZE;
|
||||||
|
|
||||||
pVia->FBFreeEnd = pVia->videoRambytes;
|
pVia->FBFreeEnd = pVia->videoRambytes;
|
||||||
|
|
||||||
if (!VIADRIScreenInit(ctx))
|
if (!VIADRIScreenInit(ctx))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
VIAEnableMMIO(ctx);
|
|
||||||
|
|
||||||
/* Get video memory clock. */
|
|
||||||
VGAOUT8(0x3D4, 0x3D);
|
|
||||||
pVia->MemClk = (VGAIN8(0x3D5) & 0xF0) >> 4;
|
|
||||||
xf86DrvMsg(0, X_INFO, "[dri] MemClk (0x%x)\n", pVia->MemClk);
|
|
||||||
|
|
||||||
/* 3D rendering has noise if not enabled. */
|
|
||||||
VIAEnableExtendedFIFO(ctx);
|
|
||||||
|
|
||||||
VIAInitialize2DEngine(ctx);
|
|
||||||
|
|
||||||
/* Must disable MMIO or 3D won't work. */
|
|
||||||
VIADisableMMIO(ctx);
|
|
||||||
|
|
||||||
VIAInitialize3DEngine(ctx);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue