[PATCH xf86-video-r128] Move loading of EXA and XAA modules into R128PreInitAccel
Kevin Brace
kevinbrace at gmx.com
Fri Jul 27 18:15:25 UTC 2018
Moving them away from R128ScreenInit callback function. This is how
other DDXs do it.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
---
src/r128_accel.c | 1 -
src/r128_driver.c | 48 +++++++++++++++++++++++++++++++++++++++++++-----
src/r128_exa.c | 12 ------------
3 files changed, 43 insertions(+), 18 deletions(-)
diff --git a/src/r128_accel.c b/src/r128_accel.c
index bfadaf6..589f49b 100644
--- a/src/r128_accel.c
+++ b/src/r128_accel.c
@@ -1909,7 +1909,6 @@ R128XAAAccelInit(ScreenPtr pScreen)
R128InfoPtr info = R128PTR(pScrn);
XAAInfoRecPtr a;
- if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE;
if (!(a = info->accel = XAACreateInfoRec())) return FALSE;
#ifdef R128DRI
diff --git a/src/r128_driver.c b/src/r128_driver.c
index 773038c..afa41ca 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -1325,6 +1325,46 @@ exit:
return ret;
}
+static void
+R128PreInitAccel(ScrnInfoPtr pScrn)
+{
+ R128InfoPtr info = R128PTR(pScrn);
+#ifdef USE_EXA
+ int errmaj, errmin;
+#endif
+
+ if (!info->noAccel) {
+ if (info->useEXA) {
+#ifdef USE_EXA
+ 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)) {
+ info->accelOn = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "EXA acceleration enabled.\n");
+ } else {
+ LoaderErrorMsg(NULL, "exa", errmaj, errmin);
+ }
+#endif
+ }
+
+ if ((!info->useEXA) ||
+ ((info->useEXA) && (!info->accelOn))) {
+#ifdef HAVE_XAA_H
+ if (xf86LoadSubModule(pScrn, "xaa")) {
+ info->accelOn = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "XAA acceleration enabled.\n");
+ }
+#endif
+ }
+ }
+}
+
/* R128PreInit is called once at server startup. */
Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
{
@@ -1404,6 +1444,7 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, info->Options);
info->noAccel = FALSE;
+ info->accelOn = FALSE;
info->useEXA = FALSE;
#ifdef USE_EXA
@@ -1467,6 +1508,8 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
/* Get ScreenInit function */
if (!xf86LoadSubModule(pScrn, "fb")) return FALSE;
+ R128PreInitAccel(pScrn);
+
info->CurrentLayout.displayWidth = pScrn->displayWidth;
if (!xf86RandR12PreInit(pScrn)) {
@@ -1630,14 +1673,10 @@ 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 (info->useEXA) {
#ifdef USE_EXA
if (R128EXAAccelInit(pScreen)) {
- info->accelOn = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"EXA acceleration enabled.\n");
}
@@ -1648,7 +1687,6 @@ R128AccelInit(Bool noAccel, ScreenPtr pScreen)
((info->useEXA) && (!info->accelOn))) {
#ifdef HAVE_XAA_H
if (R128XAAAccelInit(pScreen)) {
- info->accelOn = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"XAA acceleration enabled.\n");
}
diff --git a/src/r128_exa.c b/src/r128_exa.c
index 425fd64..5a54740 100644
--- a/src/r128_exa.c
+++ b/src/r128_exa.c
@@ -398,18 +398,6 @@ 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,
--
2.7.4
More information about the xorg-driver-ati
mailing list