summaryrefslogtreecommitdiff
path: root/src/radeon_dri.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/radeon_dri.c')
-rw-r--r--src/radeon_dri.c54
1 files changed, 37 insertions, 17 deletions
diff --git a/src/radeon_dri.c b/src/radeon_dri.c
index 39c72db..b09a8cf 100644
--- a/src/radeon_dri.c
+++ b/src/radeon_dri.c
@@ -409,13 +409,7 @@ static void RADEONLeaveServer(ScreenPtr pScreen)
/* The CP is always running, but if we've generated any CP commands
* we must flush them to the kernel module now.
*/
- if (info->CPInUse) {
- RADEON_FLUSH_CACHE();
- RADEON_WAIT_UNTIL_IDLE();
- RADEONCPReleaseIndirect(pScrn);
-
- info->CPInUse = FALSE;
- }
+ RADEONCP_RELEASE(pScrn, info);
#ifdef USE_EXA
info->engineMode = EXA_ENGINEMODE_UNKNOWN;
@@ -1250,7 +1244,7 @@ Bool RADEONDRIGetVersion(ScrnInfoPtr pScrn)
/* Check the DRI version */
DRIQueryVersion(&major, &minor, &patch);
- if (major != DRIINFO_MAJOR_VERSION || minor < DRIINFO_MINOR_VERSION) {
+ if (major != DRIINFO_MAJOR_VERSION || minor < 0) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[dri] RADEONDRIGetVersion failed because of a version "
"mismatch.\n"
@@ -1258,7 +1252,7 @@ Bool RADEONDRIGetVersion(ScrnInfoPtr pScrn)
"needed.\n"
"[dri] Disabling DRI.\n",
major, minor, patch,
- DRIINFO_MAJOR_VERSION, DRIINFO_MINOR_VERSION);
+ DRIINFO_MAJOR_VERSION, 0);
return FALSE;
}
@@ -1703,13 +1697,7 @@ void RADEONDRIStop(ScreenPtr pScreen)
/* If we've generated any CP commands, we must flush them to the
* kernel module now.
*/
- if (info->CPInUse) {
- RADEON_FLUSH_CACHE();
- RADEON_WAIT_UNTIL_IDLE();
- RADEONCPReleaseIndirect(pScrn);
-
- info->CPInUse = FALSE;
- }
+ RADEONCP_RELEASE(pScrn, info);
RADEONCP_STOP(pScrn, info);
}
info->directRenderingInited = FALSE;
@@ -2078,7 +2066,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 +2081,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;
+}