summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Brace <kevinbrace@gmx.com>2018-08-02 12:38:39 -0700
committerKevin Brace <kevinbrace@gmx.com>2018-08-02 12:38:39 -0700
commitb395a05428831faf7a0502b52c78c99a8a4d6a8e (patch)
treed036047bc7bbdcf82d858940e7ead13b7a732b00
parent78b21efdce6f1231b0c9c8a4e801ee476acd5dc4 (diff)
Consolidate EXA initialization code into R128EXAInit
Signed-off-by: Kevin Brace <kevinbrace@gmx.com>
-rw-r--r--src/r128.h2
-rw-r--r--src/r128_driver.c42
-rw-r--r--src/r128_exa.c13
3 files changed, 26 insertions, 31 deletions
diff --git a/src/r128.h b/src/r128.h
index 2df674f..5e6502b 100644
--- a/src/r128.h
+++ b/src/r128.h
@@ -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,
diff --git a/src/r128_driver.c b/src/r128_driver.c
index 010a3cc..e9115fb 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -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) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Could not allocate EXA driver...\n");
- info->accelOn = FALSE;
- } else {
- info->ExaDriver->offScreenBase = pScrn->virtualY * width_bytes;
+ /*
+ * 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,
- "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;
-
+ "EXA Acceleration enabled.\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "EXA Acceleration initialization "
+ "failed.\n");
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
diff --git a/src/r128_exa.c b/src/r128_exa.c
index b7501ac..cf9b74f 100644
--- a/src/r128_exa.c
+++ b/src/r128_exa.c
@@ -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)