summaryrefslogtreecommitdiff
path: root/src/radeon_dri.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2007-03-04 19:11:34 +1100
committerDave Airlie <airlied@linux.ie>2007-03-04 19:11:34 +1100
commite1e55b533d3ae528c8da37dcb77ed906d05697fb (patch)
treef28fa482f9ff88ee0673eb27bfdc0b73fd45684e /src/radeon_dri.c
parent4374895d393bf170134ccffc188521fe515d5a77 (diff)
radeon: add option to set pci aperture size from config file
This requires a drm > 1.26 to work
Diffstat (limited to 'src/radeon_dri.c')
-rw-r--r--src/radeon_dri.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/radeon_dri.c b/src/radeon_dri.c
index 39c72db..ee6192e 100644
--- a/src/radeon_dri.c
+++ b/src/radeon_dri.c
@@ -2078,7 +2078,11 @@ void RADEONDRIAllocatePCIGARTTable(ScreenPtr pScreen)
if (info->FbSecureSize==0)
return;
- info->pciGartSize = RADEON_PCIGART_TABLE_SIZE;
+ /* set the old default size of pci gart table */
+ if (info->pKernelDRMVersion->version_minor < 26)
+ info->pciGartSize = 32768;
+
+ info->pciGartSize = RADEONDRIGetPciAperTableSize(pScrn);
/* allocate space to back up PCIEGART table */
info->pciGartBackup = xnfcalloc(1, info->pciGartSize);
@@ -2089,3 +2093,31 @@ void RADEONDRIAllocatePCIGARTTable(ScreenPtr pScreen)
}
+
+int RADEONDRIGetPciAperTableSize(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ int page_size = getpagesize();
+ int ret_size;
+ int num_pages;
+
+ num_pages = (info->pciAperSize * 1024 * 1024) / page_size;
+
+ ret_size = num_pages * sizeof(unsigned int);
+
+ return ret_size;
+}
+
+int RADEONDRISetParam(ScrnInfoPtr pScrn, unsigned int param, int64_t value)
+{
+ drmRadeonSetParam radeonsetparam;
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ int ret;
+
+ memset(&radeonsetparam, 0, sizeof(drmRadeonSetParam));
+ radeonsetparam.param = param;
+ radeonsetparam.value = value;
+ ret = drmCommandWrite(info->drmFD, DRM_RADEON_SETPARAM,
+ &radeonsetparam, sizeof(drmRadeonSetParam));
+ return ret;
+}