Commit 23012b52 authored by Kevin Brace's avatar Kevin Brace

Separate EXA and XAA initialization

Starting the process of separating legacy XAA and newer EXA
initialization code.
Signed-off-by: Kevin Brace's avatarKevin Brace <kevinbrace@gmx.com>
parent fbbbcc0d
......@@ -514,7 +514,7 @@ extern void R128EngineFlush(ScrnInfoPtr pScrn);
extern unsigned R128INPLL(ScrnInfoPtr pScrn, int addr);
extern void R128WaitForVerticalSync(ScrnInfoPtr pScrn);
extern Bool R128AccelInit(ScreenPtr pScreen);
extern Bool R128XAAAccelInit(ScreenPtr pScreen);
extern void R128EngineInit(ScrnInfoPtr pScrn);
extern Bool R128CursorInit(ScreenPtr pScreen);
......@@ -601,6 +601,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 R128EXAAccelInit(ScreenPtr pScreen);
extern Bool R128EXAInit(ScreenPtr pScreen);
extern Bool R128GetDatatypeBpp(int bpp, uint32_t *type);
extern Bool R128GetPixmapOffsetPitch(PixmapPtr pPix, uint32_t *pitch_offset);
......
......@@ -1901,55 +1901,25 @@ void R128CopySwap(uint8_t *dst, uint8_t *src, unsigned int size, int swap)
/* Initialize XAA for supported acceleration and also initialize the
graphics hardware for acceleration. */
Bool R128AccelInit(ScreenPtr pScreen)
#ifdef HAVE_XAA_H
Bool
R128XAAAccelInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
R128InfoPtr info = R128PTR(pScrn);
#ifdef USE_EXA
if (info->useEXA) {
int errmaj = 0, errmin = 0;
info->exaReq.majorversion = EXA_VERSION_MAJOR;
info->exaReq.minorversion = EXA_VERSION_MINOR;
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Loading EXA module...\n");
if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL, &info->exaReq, &errmaj, &errmin)) {
LoaderErrorMsg(NULL, "exa", errmaj, errmin);
return FALSE;
}
/* Don't init EXA here because it'll be taken care of in mm init */
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Allocating EXA driver...\n");
info->ExaDriver = exaDriverAlloc();
if (!info->ExaDriver) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Could not allocate EXA driver...\n");
info->accelOn = FALSE;
}
return TRUE;
}
#endif
#ifndef HAVE_XAA_H
return FALSE;
#else
XAAInfoRecPtr a;
if (!info->useEXA) {
if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE;
}
if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE;
if (!(a = info->accel = XAACreateInfoRec())) return FALSE;
#ifdef R128DRI
if (info->directRenderingEnabled)
R128CCEAccelInit(pScrn, a);
R128CCEAccelInit(pScrn, a);
else
#endif
R128MMIOAccelInit(pScrn, a);
R128MMIOAccelInit(pScrn, a);
R128EngineInit(pScrn);
return XAAInit(pScreen, a);
#endif
}
#endif
......@@ -1565,24 +1565,41 @@ Bool R128VerboseInitEXA(ScreenPtr pScreen)
}
#endif
void R128VerboseInitAccel(Bool noAccel, ScreenPtr pScreen)
void
R128AccelInit(Bool noAccel, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
R128InfoPtr info = R128PTR(pScrn);
/* Initially, assume that acceleration is off. */
info->accelOn = FALSE;
if (!noAccel) {
if (R128AccelInit(pScreen)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration enabled\n");
info->accelOn = TRUE;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Acceleration initialization failed\n");
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n");
info->accelOn = FALSE;
}
} else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n");
info->accelOn = FALSE;
if (info->useEXA) {
#ifdef USE_EXA
if (R128EXAAccelInit(pScreen)) {
info->accelOn = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"EXA acceleration enabled.\n");
}
#endif
}
if ((!info->useEXA) ||
((info->useEXA) && (!info->accelOn))) {
#ifdef HAVE_XAA_H
if (R128XAAAccelInit(pScreen)) {
info->accelOn = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"XAA acceleration enabled.\n");
}
#endif
}
if (!info->accelOn) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Acceleration disabled.\n");
}
}
}
......@@ -1826,7 +1843,7 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
width, height);
}
R128VerboseInitAccel(noAccel, pScreen);
R128AccelInit(noAccel, pScreen);
}
}
#ifdef USE_EXA
......@@ -1834,7 +1851,7 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Filling in EXA memory info\n");
R128VerboseInitAccel(noAccel, pScreen);
R128AccelInit(noAccel, pScreen);
info->ExaDriver->offScreenBase = pScrn->virtualY * width_bytes;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
......@@ -1999,7 +2016,7 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
width, height);
}
R128VerboseInitAccel(noAccel, pScreen);
R128AccelInit(noAccel, pScreen);
}
}
#ifdef USE_EXA
......@@ -2007,7 +2024,7 @@ Bool R128ScreenInit(SCREEN_INIT_ARGS_DECL)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Filling in EXA memory info\n");
R128VerboseInitAccel(noAccel, pScreen);
R128AccelInit(noAccel, pScreen);
info->ExaDriver->offScreenBase = pScrn->virtualY * width_bytes;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
......
......@@ -393,6 +393,37 @@ R128CCESync(ScreenPtr pScreen, int marker)
#endif
Bool
R128EXAAccelInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
R128InfoPtr info = R128PTR(pScrn);
int errmaj = 0, errmin = 0;
info->exaReq.majorversion = EXA_VERSION_MAJOR;
info->exaReq.minorversion = EXA_VERSION_MINOR;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Loading EXA module...\n");
if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL,
&info->exaReq, &errmaj, &errmin)) {
LoaderErrorMsg(NULL, "exa", errmaj, errmin);
return FALSE;
}
/* Don't init EXA here because it'll be taken care of in mm init */
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Allocating EXA driver...\n");
info->ExaDriver = exaDriverAlloc();
if (!info->ExaDriver) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Could not allocate EXA driver...\n");
info->accelOn = FALSE;
}
return TRUE;
}
Bool
R128EXAInit(ScreenPtr pScreen)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment