diff options
author | Arthur Huillet <arthur.huillet@free.fr> | 2007-07-11 02:42:24 +0200 |
---|---|---|
committer | Arthur Huillet <arthur.huillet@free.fr> | 2007-07-11 02:42:24 +0200 |
commit | e88b20b392c6972088d88f52b2da83b82b821be5 (patch) | |
tree | 7d689b18ab4d2a9ee94d72a71f6d897f85d4fa3e | |
parent | dff1cce299df636813e8f85109f4556f520620c0 (diff) | |
download | xorg-driver-xf86-video-nouveau-e88b20b392c6972088d88f52b2da83b82b821be5.tar.gz |
added support for PCI GART when no AGP is available - requires DRM interface version 8
-rw-r--r-- | src/nv_dma.c | 8 | ||||
-rw-r--r-- | src/nv_dri.c | 2 | ||||
-rw-r--r-- | src/nv_driver.c | 39 | ||||
-rw-r--r-- | src/nv_exa.c | 21 | ||||
-rw-r--r-- | src/nv_mem.c | 5 | ||||
-rw-r--r-- | src/nv_proto.h | 1 | ||||
-rw-r--r-- | src/nv_type.h | 6 |
7 files changed, 53 insertions, 29 deletions
diff --git a/src/nv_dma.c b/src/nv_dma.c index c29fadc..507a8bf 100644 --- a/src/nv_dma.c +++ b/src/nv_dma.c @@ -152,7 +152,7 @@ void NVResetGraphics(ScrnInfoPtr pScrn) NVDmaSetObjectOnSubchannel(pNv, NvSubImagePattern, NvImagePattern ); NVDmaSetObjectOnSubchannel(pNv, NvSubImageBlit , NvImageBlit ); if (pNv->useEXA) { - if (pNv->AGPScratch) + if (pNv->GARTScratch) NVDmaSetObjectOnSubchannel(pNv, NvSubMemFormat, NvMemFormat); } else if (!pNv->useEXA) { NVDmaSetObjectOnSubchannel(pNv, NvSubClipRectangle, NvClipRectangle); @@ -229,8 +229,8 @@ static void NVInitDmaCB(ScrnInfoPtr pScrn) * on defaults if anything's wrong (ie. out of AGP, invalid sizes) */ #ifndef __powerpc__ - if (pNv->AGPScratch) - cb_location = NOUVEAU_MEM_AGP; + if (pNv->GARTScratch) + cb_location = NOUVEAU_MEM_AGP | NOUVEAU_MEM_PCI_ACCEPTABLE; else #endif cb_location = NOUVEAU_MEM_FB; @@ -239,6 +239,8 @@ static void NVInitDmaCB(ScrnInfoPtr pScrn) cb_location = NOUVEAU_MEM_AGP; else if (!xf86NameCmp(s, "VRAM")) cb_location = NOUVEAU_MEM_FB; + else if (!xf86NameCmp(s, "PCI")) + cb_location = NOUVEAU_MEM_PCI; else xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid value \"%s\" for CBLocation\n", s); } diff --git a/src/nv_dri.c b/src/nv_dri.c index a489e68..bb9987b 100644 --- a/src/nv_dri.c +++ b/src/nv_dri.c @@ -244,7 +244,7 @@ Bool NVDRIGetVersion(ScrnInfoPtr pScrn) } /* temporary lock step versioning */ -#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 7 +#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 8 #error nouveau_drm.h doesn't match expected patchlevel, update libdrm. #endif if (pNv->pKernelDRMVersion->version_patchlevel != diff --git a/src/nv_driver.c b/src/nv_driver.c index f437bee..2e8f8eb 100644 --- a/src/nv_driver.c +++ b/src/nv_driver.c @@ -1728,12 +1728,15 @@ NVMapMem(ScrnInfoPtr pScrn) pNv->VRAMPhysical = NVDRMGetParam(pNv, NOUVEAU_GETPARAM_FB_PHYSICAL); pNv->AGPSize = NVDRMGetParam(pNv, NOUVEAU_GETPARAM_AGP_SIZE); pNv->AGPPhysical = NVDRMGetParam(pNv, NOUVEAU_GETPARAM_AGP_PHYSICAL); + if ( ! pNv->AGPSize ) /*if no AGP*/ + /*use PCI*/ + pNv->SGPhysical = NVDRMGetParam(pNv, NOUVEAU_GETPARAM_PCI_PHYSICAL); - if (pNv->AGPSize) { - int gart_scratch_size; + int gart_scratch_size; + if (pNv->AGPSize) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "GART: %dMiB available\n", + "AGPGART: %dMiB available\n", (unsigned int)(pNv->AGPSize >> 20)); if (pNv->AGPSize > (16*1024*1024)) @@ -1741,19 +1744,29 @@ NVMapMem(ScrnInfoPtr pScrn) else gart_scratch_size = pNv->AGPSize; - pNv->AGPScratch = NVAllocateMemory(pNv, NOUVEAU_MEM_AGP, - gart_scratch_size); - if (!pNv->AGPScratch) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unable to allocate GART memory\n"); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "GART: mapped %dMiB at %p\n", - (unsigned int)(pNv->AGPScratch->size >> 20), - pNv->AGPScratch->map); } + else { + + gart_scratch_size = (4 << 20) - (1 << 18) ; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "GART: PCI DMA - using %dKiB\n", gart_scratch_size >> 10); + } + /*The DRM allocates AGP memory, PCI as a fallback */ + pNv->GARTScratch = NVAllocateMemory(pNv, NOUVEAU_MEM_AGP | NOUVEAU_MEM_PCI_ACCEPTABLE, + gart_scratch_size); + if (!pNv->GARTScratch) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Unable to allocate GART memory\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "GART: mapped %dMiB at %p, offset is %d\n", + (unsigned int)(pNv->GARTScratch->size >> 20), + pNv->GARTScratch->map, pNv->GARTScratch->offset); + } + + pNv->Cursor = NVAllocateMemory(pNv, NOUVEAU_MEM_FB, 64*1024); if (!pNv->Cursor) { ErrorF("Failed to allocate memory for hardware cursor\n"); diff --git a/src/nv_exa.c b/src/nv_exa.c index 4ce44ce..b78997a 100644 --- a/src/nv_exa.c +++ b/src/nv_exa.c @@ -54,6 +54,7 @@ static void setM2MFDirection(ScrnInfoPtr pScrn, int dir) NVPtr pNv = NVPTR(pScrn); if (pNv->M2MFDirection != dir) { + NVDmaStart(pNv, NvSubMemFormat, MEMFORMAT_DMA_OBJECT_IN, 2); NVDmaNext (pNv, dir ? NvDmaTT : NvDmaFB); NVDmaNext (pNv, dir ? NvDmaFB : NvDmaTT); @@ -286,13 +287,13 @@ NVAccelDownloadM2MF(ScrnInfoPtr pScrn, char *dst, uint64_t src_offset, setM2MFDirection(pScrn, 0); while (line_count) { - char *src = pNv->AGPScratch->map; + char *src = pNv->GARTScratch->map; int lc, i; - if (line_count * line_len <= pNv->AGPScratch->size) { + if (line_count * line_len <= pNv->GARTScratch->size) { lc = line_count; } else { - lc = pNv->AGPScratch->size / line_len; + lc = pNv->GARTScratch->size / line_len; if (lc > line_count) lc = line_count; } @@ -306,7 +307,7 @@ NVAccelDownloadM2MF(ScrnInfoPtr pScrn, char *dst, uint64_t src_offset, NVDmaStart(pNv, NvSubMemFormat, NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8); NVDmaNext (pNv, (uint32_t)src_offset); - NVDmaNext (pNv, (uint32_t)pNv->AGPScratch->offset); + NVDmaNext (pNv, (uint32_t)pNv->GARTScratch->offset); NVDmaNext (pNv, src_pitch); NVDmaNext (pNv, line_len); NVDmaNext (pNv, line_len); @@ -349,7 +350,7 @@ static Bool NVDownloadFromScreen(PixmapPtr pSrc, cpp = pSrc->drawable.bitsPerPixel >> 3; offset = (y * src_pitch) + (x * cpp); - if (pNv->AGPScratch) { + if (pNv->GARTScratch) { if (NVAccelDownloadM2MF(pScrn, dst, NVAccelGetPixmapOffset(pSrc) + offset, dst_pitch, src_pitch, w * cpp, h)) @@ -374,14 +375,14 @@ NVAccelUploadM2MF(ScrnInfoPtr pScrn, uint64_t dst_offset, const char *src, setM2MFDirection(pScrn, 1); while (line_count) { - char *dst = pNv->AGPScratch->map; + char *dst = pNv->GARTScratch->map; int lc, i; /* Determine max amount of data we can DMA at once */ - if (line_count * line_len <= pNv->AGPScratch->size) { + if (line_count * line_len <= pNv->GARTScratch->size) { lc = line_count; } else { - lc = pNv->AGPScratch->size / line_len; + lc = pNv->GARTScratch->size / line_len; if (lc > line_count) lc = line_count; } @@ -407,7 +408,7 @@ NVAccelUploadM2MF(ScrnInfoPtr pScrn, uint64_t dst_offset, const char *src, NVDmaStart(pNv, NvSubMemFormat, NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8); - NVDmaNext (pNv, (uint32_t)pNv->AGPScratch->offset); + NVDmaNext (pNv, (uint32_t)pNv->GARTScratch->offset); NVDmaNext (pNv, (uint32_t)dst_offset); NVDmaNext (pNv, line_len); NVDmaNext (pNv, dst_pitch); @@ -439,7 +440,7 @@ static Bool NVUploadToScreen(PixmapPtr pDst, dst_pitch = exaGetPixmapPitch(pDst); cpp = pDst->drawable.bitsPerPixel >> 3; - if (pNv->AGPScratch) { + if (pNv->GARTScratch) { dst_offset += (y * dst_pitch) + (x * cpp); if (NVAccelUploadM2MF(pScrn, dst_offset, src, dst_pitch, src_pitch, w * cpp, h)) diff --git a/src/nv_mem.c b/src/nv_mem.c index 99cb8bc..25dc256 100644 --- a/src/nv_mem.c +++ b/src/nv_mem.c @@ -36,6 +36,8 @@ NVAllocRec *NVAllocateMemory(NVPtr pNv, int type, int size) mem->offset -= pNv->VRAMPhysical; else if (mem->type & NOUVEAU_MEM_AGP) mem->offset -= pNv->AGPPhysical; + else if (mem->type & NOUVEAU_MEM_PCI) + mem->offset -= pNv->SGPhysical; return mem; } @@ -58,6 +60,9 @@ void NVFreeMemory(NVPtr pNv, NVAllocRec *mem) memfree.region_offset += pNv->VRAMPhysical; else if (mem->type & NOUVEAU_MEM_AGP) memfree.region_offset += pNv->AGPPhysical; + else if (mem->type & NOUVEAU_MEM_PCI) + memfree.region_offset += pNv->SGPhysical; + if (drmCommandWriteRead(pNv->drm_fd, DRM_NOUVEAU_MEM_FREE, &memfree, sizeof(memfree))) { diff --git a/src/nv_proto.h b/src/nv_proto.h index 83748c4..83e1f04 100644 --- a/src/nv_proto.h +++ b/src/nv_proto.h @@ -75,6 +75,7 @@ void NVSetRopSolid(ScrnInfoPtr pScrn, CARD32 rop, CARD32 planemask); /* in nv_exa.c */ Bool NVExaInit(ScreenPtr pScreen); +Bool NVAccelUploadM2MF(ScrnInfoPtr, uint64_t, const char * , int, int, int, int); /* in riva_hw.c */ void NVCalcStateExt(NVPtr,struct _riva_hw_state *,int,int,int,int,int,int); diff --git a/src/nv_type.h b/src/nv_type.h index 774300a..d1ddfb6 100644 --- a/src/nv_type.h +++ b/src/nv_type.h @@ -145,13 +145,15 @@ typedef struct _NVRec { unsigned long VRAMSize; /* AGP physical address */ unsigned long AGPPhysical; - /* Accesible AGP size */ + /* Accessible AGP size */ unsigned long AGPSize; + /* PCI buffer virtual address */ + unsigned long SGPhysical; NVAllocRec * FB; NVAllocRec * Cursor; NVAllocRec * ScratchBuffer; - NVAllocRec * AGPScratch; + NVAllocRec * GARTScratch; Bool NoAccel; Bool HWCursor; Bool FpScale; |