diff options
-rw-r--r-- | src/r5xx_accel.c | 10 | ||||
-rw-r--r-- | src/rhd.h | 10 | ||||
-rw-r--r-- | src/rhd_dri.c | 36 | ||||
-rw-r--r-- | src/rhd_dri.h | 9 |
4 files changed, 60 insertions, 5 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; } @@ -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 @@ -978,7 +978,7 @@ static void RHDDRIIrqInit(RHDPtr rhdPtr, ScreenPtr pScreen) "[drm] falling back to irq-free operation\n"); rhdDRI->irq = 0; } else { -/* FIXME +/* FIXME rhdDRI->ModeReg->gen_int_cntl = RHDRegRead (rhdDRI, RADEON_GEN_INT_CNTL ); */ } } @@ -1771,7 +1771,7 @@ static void RHDDRITransitionSingleToMulti3d(ScreenPtr pScreen) static void RHDDRITransitionMultiToSingle3d(ScreenPtr pScreen) { - /* Let the remaining 3d app start page flipping again + /* Let the remaining 3d app start page flipping again * RHDEnablePageFlip(pScreen); */ } @@ -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 |