[PATCH xf86-video-r128] Consolidate EXA initialization code into R128EXAInit
Kevin Brace
kevinbrace at gmx.com
Tue Jul 31 20:19:56 UTC 2018
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
---
src/r128.h | 2 +-
src/r128_driver.c | 42 +++++++++++++-----------------------------
src/r128_exa.c | 13 ++++++++++++-
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 ed560b7..a3b7ac4 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -1881,38 +1881,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)
--
2.7.4
More information about the xorg-driver-ati
mailing list