summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgbert Eich <eich@freedesktop.org>2009-11-06 13:18:13 +0100
committerEgbert Eich <eich@freedesktop.org>2009-11-06 15:39:10 +0100
commitfb1f84dd62cfd4e2a550ccc90006f4e75c1b6b86 (patch)
treeb7fba33cf709f8891d3d44b8e82e8443d097c651
parent40fa33f05df863ed98cb43539f237cb90a3a5e38 (diff)
DRI: Get number of pipes from DRM if possible.
-rw-r--r--src/r5xx_accel.c10
-rw-r--r--src/rhd.h10
-rw-r--r--src/rhd_dri.c32
-rw-r--r--src/rhd_dri.h9
4 files changed, 58 insertions, 3 deletions
diff --git a/src/r5xx_accel.c b/src/r5xx_accel.c
index c9382cb..b4483c1 100644
--- a/src/r5xx_accel.c
+++ b/src/r5xx_accel.c
@@ -73,7 +73,9 @@
#include "r5xx_accel.h"
#include "r5xx_regs.h"
#include "r5xx_3dregs.h"
-
+#ifdef USE_DRI
+#include "rhd_dri.h"
+#endif
/*
* Used by both XAA and EXA code.
*/
@@ -423,6 +425,12 @@ R5xx2DFBValid(RHDPtr rhdPtr, CARD16 Width, CARD16 Height, int bpp,
static int
R5xxGBPipesCount(ScrnInfoPtr pScrn)
{
+#ifdef USE_DRI
+ union rhdValue val;
+
+ if (RHDDRIGetHWParam(pScrn, RHD_NUM_GB_PIPES, &val))
+ return val.Int;
+#endif
return ((RHDRegRead(pScrn, R400_GB_PIPE_SELECT) >> 12) & 0x03) + 1;
}
diff --git a/src/rhd.h b/src/rhd.h
index efa6bc2..95103af 100644
--- a/src/rhd.h
+++ b/src/rhd.h
@@ -216,6 +216,16 @@ enum AccelMethod {
RHD_ACCEL_DEFAULT = 5 /* keep as highest. */
};
+union rhdValue {
+ CARD8 Card8;
+ CARD16 Card16;
+ CARD32 Card32;
+ char Char;
+ short Short;
+ int Int;
+ char *String;
+};
+
typedef struct RHDRec {
int scrnIndex;
diff --git a/src/rhd_dri.c b/src/rhd_dri.c
index 27d328b..422fc13 100644
--- a/src/rhd_dri.c
+++ b/src/rhd_dri.c
@@ -1993,3 +1993,35 @@ RHDDRIGetIntGARTLocation(ScrnInfoPtr pScrn)
return rhdDRI->gartLocation + rhdDRI->bufStart;
}
+
+/*
+ *
+ */
+Bool
+RHDDRIGetHWParam(ScrnInfoPtr pScrn, enum RHDDRIHWParam param, union rhdValue *val)
+{
+ RHDPtr rhdPtr = RHDPTR(pScrn);
+ struct rhdDri *rhdDRI = rhdPtr->dri;
+ struct drm_radeon_getparam gp;
+ char *name;
+
+ if (!rhdDRI || rhdDRI->drmFD == 0)
+ return FALSE;
+
+ switch (param) {
+ case RHD_NUM_GB_PIPES:
+ gp.param = RADEON_PARAM_NUM_GB_PIPES;
+ gp.value = &(val->Int);
+ name = "number of pipes";
+ break;
+ }
+ if (drmCommandWriteRead(rhdDRI->drmFD, DRM_RADEON_GETPARAM, &gp,
+ sizeof(gp)) < 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Failed to determine %s from DRM.\n",name);
+ return FALSE;
+ }
+ xf86DrvMsgVerb(pScrn->scrnIndex, 4, X_INFO,
+ "Got %s param from DRM.\n",name);
+ return TRUE;
+}
diff --git a/src/rhd_dri.h b/src/rhd_dri.h
index ac860ef..29c00ae 100644
--- a/src/rhd_dri.h
+++ b/src/rhd_dri.h
@@ -25,6 +25,10 @@
#ifndef _RHD_DRI_
#define _RHD_DRI_
+enum RHDDRIHWParam {
+ RHD_NUM_GB_PIPES
+};
+
extern Bool RHDDRIPreInit(ScrnInfoPtr pScrn);
extern Bool RHDDRIAllocateBuffers(ScrnInfoPtr pScrn);
extern Bool RHDDRIScreenInit(ScreenPtr pScreen);
@@ -34,8 +38,9 @@ extern Bool RHDDRIFinishScreenInit(ScreenPtr pScreen);
extern void RHDDRIEnterVT(ScreenPtr pScreen);
extern void RHDDRILeaveVT(ScreenPtr pScreen);
extern Bool RHDDRIScreenInit(ScreenPtr pScreen);
+extern void RHDDRIContextClaim(ScrnInfoPtr pScrn);
+extern Bool RHDDRIGetHWParam(ScrnInfoPtr pScrn, enum RHDDRIHWParam param, union rhdValue *val);
+
-/* Claim the 3D context */
-void RHDDRIContextClaim(ScrnInfoPtr pScrn);
#endif