Consolidate EXA initialization code into R128EXAInit

Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
This commit is contained in:
Kevin Brace
2018-08-02 12:38:39 -07:00
parent 78b21efdce
commit b395a05428
3 changed files with 26 additions and 31 deletions

View File

@@ -604,7 +604,7 @@ extern int R128CCEStop(ScrnInfoPtr pScrn);
extern void R128CopySwap(uint8_t *dst, uint8_t *src, unsigned int size, int swap);
#ifdef USE_EXA
extern Bool R128EXAInit(ScreenPtr pScreen);
extern Bool R128EXAInit(ScreenPtr pScreen, int total);
extern Bool R128GetDatatypeBpp(int bpp, uint32_t *type);
extern Bool R128GetPixmapOffsetPitch(PixmapPtr pPix, uint32_t *pitch_offset);
extern void R128DoPrepareCopy(ScrnInfoPtr pScrn, uint32_t src_pitch_offset,

View File

@@ -1880,38 +1880,22 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Filling in EXA memory info\n");
info->ExaDriver = exaDriverAlloc();
if (!info->ExaDriver) {
/*
* Don't give EXA the true full memory size, because
* the textureSize sized chunk on the end is handled
* by DRI.
*/
if (R128EXAInit(pScreen, total)) {
info->accelOn = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Could not allocate EXA driver...\n");
info->accelOn = FALSE;
"EXA Acceleration enabled.\n");
} else {
info->ExaDriver->offScreenBase = pScrn->virtualY * width_bytes;
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"EXA Acceleration initialization "
"failed.\n");
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Filled in offs\n");
/*
* Don't give EXA the true full memory size, because
* the textureSize sized chunk on the end is handled
* by DRI.
*/
info->ExaDriver->memorySize = total;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Going to init EXA...\n");
if (R128EXAInit(pScreen)) {
info->accelOn = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"EXA Acceleration enabled.\n");
} else {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"EXA Acceleration initialization "
"failed.\n");
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"EXA Acceleration disabled.\n");
}
"Acceleration disabled.\n");
}
}
#endif

View File

@@ -394,15 +394,26 @@ R128CCESync(ScreenPtr pScreen, int marker)
#endif
Bool
R128EXAInit(ScreenPtr pScreen)
R128EXAInit(ScreenPtr pScreen, int total)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
R128InfoPtr info = R128PTR(pScrn);
info->ExaDriver = exaDriverAlloc();
if (!info->ExaDriver) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Could not allocate EXA driver...\n");
return FALSE;
}
info->ExaDriver->exa_major = EXA_VERSION_MAJOR;
info->ExaDriver->exa_minor = EXA_VERSION_MINOR;
info->ExaDriver->memoryBase = info->FB + pScrn->fbOffset;
info->ExaDriver->offScreenBase = pScrn->virtualY *
(pScrn->displayWidth *
info->CurrentLayout.pixel_bytes);
info->ExaDriver->memorySize = total;
info->ExaDriver->flags = EXA_OFFSCREEN_PIXMAPS | EXA_OFFSCREEN_ALIGN_POT;
#if EXA_VERSION_MAJOR > 2 || (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 3)