[openchrome-devel] xf86-video-openchrome: 5 commits - configure.ac src/Makefile.am src/via_driver.c src/via_driver.h src/via_options.c
Kevin Brace
kevinbrace at kemper.freedesktop.org
Mon Dec 23 17:58:08 UTC 2019
configure.ac | 2
src/Makefile.am | 1
src/via_driver.c | 436 ----------------------------------------
src/via_driver.h | 4
src/via_options.c | 582 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 597 insertions(+), 428 deletions(-)
New commits:
commit e83086a7bdc5bc03e990df384d166fb4c21948aa
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Dec 23 11:57:33 2019 -0600
Version bumped to 0.6.198
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/configure.ac b/configure.ac
index ad241a9..3feaedc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-video-openchrome],
- [0.6.197],
+ [0.6.198],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
[xf86-video-openchrome])
commit dc683fc67b7ef13533f2c2c39c96e538c1522b6a
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Dec 23 11:51:05 2019 -0600
Move UMS option processing into viaProcessUMSOptions()
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_options.c b/src/via_options.c
index 8a17eae..755b776 100644
--- a/src/via_options.c
+++ b/src/via_options.c
@@ -185,8 +185,8 @@ viaSetupDefaultOptions(ScrnInfoPtr pScrn)
"Exiting %s.\n", __func__));
}
-void
-viaProcessOptions(ScrnInfoPtr pScrn)
+static void
+viaProcessUMSOptions(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
@@ -196,162 +196,6 @@ viaProcessOptions(ScrnInfoPtr pScrn)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Entered %s.\n", __func__));
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Processing DDX options . . .\n");
-
- xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, VIAOptions);
-
- /*
- * When rotating, switch shadow frame buffer on and acceleration
- * off.
- */
- if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATION_TYPE))) {
- if (!xf86NameCmp(s, "SWRandR")) {
- pVia->shadowFB = TRUE;
- pVia->NoAccel = TRUE;
- pVia->RandRRotation = TRUE;
- pVia->rotate = RR_Rotate_0;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Rotating screen RandR enabled, "
- "acceleration disabled\n");
- } else if (!xf86NameCmp(s, "HWRandR")) {
- pVia->shadowFB = TRUE;
- pVia->NoAccel = TRUE;
- pVia->RandRRotation = TRUE;
- pVia->rotate = RR_Rotate_0;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Hardware accelerated rotating screen is not "
- "implemented. Using SW RandR.\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "\"%s\" is not a valid"
- "value for Option \"RotationType\".\n", s);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Valid options are \"SWRandR\" and "
- "\"HWRandR\".\n");
- }
- }
-
- /*
- * When rotating, switch shadow frame buffer on and acceleration
- * off.
- */
- if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATE))) {
- if (!xf86NameCmp(s, "CW")) {
- pVia->shadowFB = TRUE;
- pVia->NoAccel = TRUE;
- pVia->RandRRotation = TRUE;
- pVia->rotate = RR_Rotate_270;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Rotating screen clockwise -- "
- "acceleration is disabled.\n");
- } else if (!xf86NameCmp(s, "CCW")) {
- pVia->shadowFB = TRUE;
- pVia->NoAccel = TRUE;
- pVia->RandRRotation = TRUE;
- pVia->rotate = RR_Rotate_90;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Rotating screen counterclockwise -- "
- "acceleration is disabled.\n");
- } else if (!xf86NameCmp(s, "UD")) {
- pVia->shadowFB = TRUE;
- pVia->NoAccel = TRUE;
- pVia->RandRRotation = TRUE;
- pVia->rotate = RR_Rotate_180;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Rotating screen upside-down -- "
- "acceleration is disabled.\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "\"%s\" is not a valid value for "
- "Option \"Rotate\".\n", s);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Valid options are \"CW\", \"CCW\" "
- "or \"UD\".\n");
- }
- }
-
- from = (xf86GetOptValBool(VIAOptions,
- OPTION_SHADOW_FB, &pVia->shadowFB)
- ? X_CONFIG : X_DEFAULT);
- xf86DrvMsg(pScrn->scrnIndex, from,
- "Shadow framebuffer is %s.\n",
- pVia->shadowFB ? "enabled" : "disabled");
-
- /*
- * Use hardware acceleration, unless on shadow frame buffer.
- */
- from = (xf86GetOptValBool(VIAOptions,
- OPTION_NOACCEL, &pVia->NoAccel) ?
- X_CONFIG : X_DEFAULT);
- if (!pVia->NoAccel && pVia->shadowFB) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Acceleration is not supported when using shadow "
- "frame buffer.\n");
- pVia->NoAccel = TRUE;
- from = X_DEFAULT;
- }
-
- /*
- * Disable EXA for KMS case
- */
- if (pVia->KMS)
- pVia->NoAccel = TRUE;
-
- xf86DrvMsg(pScrn->scrnIndex, from,
- "Hardware acceleration is %s.\n",
- !pVia->NoAccel ? "enabled" : "disabled");
-
- if (!pVia->NoAccel) {
- from = X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from,
- "Using EXA acceleration architecture.\n");
-/*
- pVia->noComposite = FALSE;
-*/
- if (pVia->useEXA) {
- from = xf86GetOptValBool(VIAOptions,
- OPTION_EXA_NOCOMPOSITE,
- &pVia->noComposite) ?
- X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from,
- "EXA composite acceleration %s.\n",
- !pVia->noComposite ? "enabled" : "disabled");
-
-/*
- pVia->exaScratchSize = VIA_SCRATCH_SIZE / 1024;
-*/
- from = xf86GetOptValInteger(VIAOptions,
- OPTION_EXA_SCRATCH_SIZE,
- &pVia->exaScratchSize) ?
- X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from,
- "EXA scratch area size is %d KB.\n",
- pVia->exaScratchSize);
- }
- }
-
- /*
- * Use a hardware cursor, unless on secondary or on shadow
- * frame buffer.
- */
- from = X_DEFAULT;
- if (pVia->IsSecondary || pVia->shadowFB)
- pVia->drmmode.hwcursor = FALSE;
- else if (xf86GetOptValBool(VIAOptions, OPTION_SWCURSOR,
- &pVia->drmmode.hwcursor)) {
- pVia->drmmode.hwcursor = !pVia->drmmode.hwcursor;
- from = X_CONFIG;
- }
-
- if (pVia->drmmode.hwcursor)
- xf86DrvMsg(pScrn->scrnIndex, from,
- "Using hardware two-color cursors and software "
- "full-color cursors.\n");
- else
- xf86DrvMsg(pScrn->scrnIndex, from,
- "Using software cursors.\n");
-
/*
pVia->VQEnable = TRUE;
*/
@@ -458,7 +302,24 @@ viaProcessOptions(ScrnInfoPtr pScrn)
"Will try to allocate %d KB of AGP memory.\n",
pVia->agpMem);
- pVIADisplay = pVia->pVIADisplay;
+#ifdef HAVE_DEBUG
+/*
+ pVia->PrintVGARegs = FALSE;
+*/
+ from = xf86GetOptValBool(VIAOptions,
+ OPTION_PRINTVGAREGS,
+ &pVia->PrintVGARegs) ?
+ X_CONFIG : X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Will %sprint VGA registers.\n",
+ pVia->PrintVGARegs ? "" : "not ");
+ if (pVia->PrintVGARegs)
+ /*
+ * Do this as early as possible.
+ */
+ ViaVgahwPrint(VGAHWPTR(pScrn));
+#endif /* HAVE_DEBUG */
+
pVIADisplay->TVDotCrawl = FALSE;
from = xf86GetOptValBool(VIAOptions,
OPTION_TVDOTCRAWL,
@@ -542,23 +403,179 @@ viaProcessOptions(ScrnInfoPtr pScrn)
"No default TV output signal type is set.\n");
}
-#ifdef HAVE_DEBUG
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting %s.\n", __func__));
+}
+
+void
+viaProcessOptions(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ MessageType from = X_DEFAULT;
+ const char *s = NULL;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered %s.\n", __func__));
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Processing DDX options . . .\n");
+
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, VIAOptions);
+
+ /*
+ * When rotating, switch shadow frame buffer on and acceleration
+ * off.
+ */
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATION_TYPE))) {
+ if (!xf86NameCmp(s, "SWRandR")) {
+ pVia->shadowFB = TRUE;
+ pVia->NoAccel = TRUE;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_0;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen RandR enabled, "
+ "acceleration disabled\n");
+ } else if (!xf86NameCmp(s, "HWRandR")) {
+ pVia->shadowFB = TRUE;
+ pVia->NoAccel = TRUE;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_0;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Hardware accelerated rotating screen is not "
+ "implemented. Using SW RandR.\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "\"%s\" is not a valid"
+ "value for Option \"RotationType\".\n", s);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Valid options are \"SWRandR\" and "
+ "\"HWRandR\".\n");
+ }
+ }
+
+ /*
+ * When rotating, switch shadow frame buffer on and acceleration
+ * off.
+ */
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATE))) {
+ if (!xf86NameCmp(s, "CW")) {
+ pVia->shadowFB = TRUE;
+ pVia->NoAccel = TRUE;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_270;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen clockwise -- "
+ "acceleration is disabled.\n");
+ } else if (!xf86NameCmp(s, "CCW")) {
+ pVia->shadowFB = TRUE;
+ pVia->NoAccel = TRUE;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_90;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen counterclockwise -- "
+ "acceleration is disabled.\n");
+ } else if (!xf86NameCmp(s, "UD")) {
+ pVia->shadowFB = TRUE;
+ pVia->NoAccel = TRUE;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_180;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen upside-down -- "
+ "acceleration is disabled.\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "\"%s\" is not a valid value for "
+ "Option \"Rotate\".\n", s);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Valid options are \"CW\", \"CCW\" "
+ "or \"UD\".\n");
+ }
+ }
+
+ from = (xf86GetOptValBool(VIAOptions,
+ OPTION_SHADOW_FB, &pVia->shadowFB)
+ ? X_CONFIG : X_DEFAULT);
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Shadow framebuffer is %s.\n",
+ pVia->shadowFB ? "enabled" : "disabled");
+
+ /*
+ * Use hardware acceleration, unless on shadow frame buffer.
+ */
+ from = (xf86GetOptValBool(VIAOptions,
+ OPTION_NOACCEL, &pVia->NoAccel) ?
+ X_CONFIG : X_DEFAULT);
+ if (!pVia->NoAccel && pVia->shadowFB) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Acceleration is not supported when using shadow "
+ "frame buffer.\n");
+ pVia->NoAccel = TRUE;
+ from = X_DEFAULT;
+ }
+
+ /*
+ * Disable EXA for KMS case
+ */
+ if (pVia->KMS)
+ pVia->NoAccel = TRUE;
+
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Hardware acceleration is %s.\n",
+ !pVia->NoAccel ? "enabled" : "disabled");
+
+ if (!pVia->NoAccel) {
+ from = X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Using EXA acceleration architecture.\n");
/*
- pVia->PrintVGARegs = FALSE;
+ pVia->noComposite = FALSE;
*/
- from = xf86GetOptValBool(VIAOptions,
- OPTION_PRINTVGAREGS,
- &pVia->PrintVGARegs) ?
- X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from,
- "Will %sprint VGA registers.\n",
- pVia->PrintVGARegs ? "" : "not ");
- if (pVia->PrintVGARegs)
- /*
- * Do this as early as possible.
- */
- ViaVgahwPrint(VGAHWPTR(pScrn));
-#endif /* HAVE_DEBUG */
+ if (pVia->useEXA) {
+ from = xf86GetOptValBool(VIAOptions,
+ OPTION_EXA_NOCOMPOSITE,
+ &pVia->noComposite) ?
+ X_CONFIG : X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "EXA composite acceleration %s.\n",
+ !pVia->noComposite ? "enabled" : "disabled");
+
+/*
+ pVia->exaScratchSize = VIA_SCRATCH_SIZE / 1024;
+*/
+ from = xf86GetOptValInteger(VIAOptions,
+ OPTION_EXA_SCRATCH_SIZE,
+ &pVia->exaScratchSize) ?
+ X_CONFIG : X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "EXA scratch area size is %d KB.\n",
+ pVia->exaScratchSize);
+ }
+ }
+
+ /*
+ * Use a hardware cursor, unless on secondary or on shadow
+ * frame buffer.
+ */
+ from = X_DEFAULT;
+ if (pVia->IsSecondary || pVia->shadowFB)
+ pVia->drmmode.hwcursor = FALSE;
+ else if (xf86GetOptValBool(VIAOptions, OPTION_SWCURSOR,
+ &pVia->drmmode.hwcursor)) {
+ pVia->drmmode.hwcursor = !pVia->drmmode.hwcursor;
+ from = X_CONFIG;
+ }
+
+ if (pVia->drmmode.hwcursor)
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Using hardware two-color cursors and software "
+ "full-color cursors.\n");
+ else
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Using software cursors.\n");
+
+ if (!pVia->KMS) {
+ viaProcessUMSOptions(pScrn);
+ }
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Exiting %s.\n", __func__));
commit 3838058ae1409bc698ccdb69380c01a20cd1746a
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Dec 23 11:00:34 2019 -0600
Tweak how DDX options are processed
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_driver.c b/src/via_driver.c
index 34f4130..da93ddb 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -1110,6 +1110,8 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
option = xf86NewOption(strEXAOptionName, strEXAValue);
xf86CollectOptions(pScrn, option);
+ viaSetupDefaultOptions(pScrn);
+
viaProcessOptions(pScrn);
VIAVidHWDiffInit(pScrn);
diff --git a/src/via_driver.h b/src/via_driver.h
index 920d9e2..6da2f59 100644
--- a/src/via_driver.h
+++ b/src/via_driver.h
@@ -357,6 +357,7 @@ typedef struct
const OptionInfoRec *VIAAvailableOptions(int chipid, int busid);
+void viaSetupDefaultOptions(ScrnInfoPtr pScrn);
void viaProcessOptions(ScrnInfoPtr pScrn);
/* In via_display.c. */
diff --git a/src/via_options.c b/src/via_options.c
index f0bdd39..8a17eae 100644
--- a/src/via_options.c
+++ b/src/via_options.c
@@ -97,14 +97,13 @@ VIAAvailableOptions(int chipid, int busid)
}
-static void
+void
viaSetupDefaultOptions(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s - Setting up default chipset options.\n",
- __func__));
+ "Entered %s.\n", __func__));
pVia->shadowFB = FALSE;
pVia->NoAccel = FALSE;
@@ -181,6 +180,9 @@ viaSetupDefaultOptions(ScrnInfoPtr pScrn)
pVia->dmaXV = FALSE;
break;
}
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting %s.\n", __func__));
}
void
@@ -194,7 +196,8 @@ viaProcessOptions(ScrnInfoPtr pScrn)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Entered %s.\n", __func__));
- viaSetupDefaultOptions(pScrn);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Processing DDX options . . .\n");
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, VIAOptions);
commit 9bb3ef1493621dfb879bebf9bdee05e21d17d986
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Dec 23 10:25:15 2019 -0600
Move up configuration setup before calling umsPreInit()
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_driver.c b/src/via_driver.c
index a4fade4..34f4130 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -1107,6 +1107,13 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
}
#endif
+ option = xf86NewOption(strEXAOptionName, strEXAValue);
+ xf86CollectOptions(pScrn, option);
+
+ viaProcessOptions(pScrn);
+
+ VIAVidHWDiffInit(pScrn);
+
/* After umsPreInit function succeeds, PCI hardware resources are
* memory mapped. If there is an error from this point on, they will
* need to be explicitly relinquished. */
@@ -1117,13 +1124,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
}
}
- option = xf86NewOption(strEXAOptionName, strEXAValue);
- xf86CollectOptions(pScrn, option);
-
- viaProcessOptions(pScrn);
-
- VIAVidHWDiffInit(pScrn);
-
/* CRTC handling */
xf86CrtcConfigInit(pScrn, &via_xf86crtc_config_funcs);
commit cbd54a975d9c53fe11c5ce3810a0ceb5d7a8cf33
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Dec 23 10:25:03 2019 -0600
Move DDX option processing code into via_options.c
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/Makefile.am b/src/Makefile.am
index 21e43c7..553b9ab 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -58,6 +58,7 @@ openchrome_drv_la_SOURCES = \
via_memcpy.c \
via_memmgr.h \
via_memmgr.c \
+ via_options.c \
via_outputs.c \
via_priv.h \
via_regs.h \
diff --git a/src/via_driver.c b/src/via_driver.c
index a1a46b8..a4fade4 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -79,10 +79,8 @@ static Bool via_pci_probe(DriverPtr drv, int entity_num,
static Bool VIAProbe(DriverPtr drv, int flags);
#endif
-static Bool VIASetupDefaultOptions(ScrnInfoPtr pScrn);
static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags);
static Bool VIAScreenInit(SCREEN_INIT_ARGS_DECL);
-static const OptionInfoRec *VIAAvailableOptions(int chipid, int busid);
int gVIAEntityIndex = -1;
@@ -166,61 +164,6 @@ static PciChipsets VIAPciChipsets[] = {
static char strEXAOptionName[] = "MigrationHeuristic";
static char strEXAValue[] = "greedy";
-typedef enum
-{
-#ifdef HAVE_DEBUG
- OPTION_PRINTVGAREGS,
- OPTION_PRINTTVREGS,
-#endif
- OPTION_NOACCEL,
- OPTION_EXA_NOCOMPOSITE,
- OPTION_EXA_SCRATCH_SIZE,
- OPTION_SWCURSOR,
- OPTION_SHADOW_FB,
- OPTION_ROTATION_TYPE,
- OPTION_ROTATE,
- OPTION_CENTER,
- OPTION_TVDOTCRAWL,
- OPTION_TVTYPE,
- OPTION_TVOUTPUT,
- OPTION_DISABLEVQ,
- OPTION_DISABLEIRQ,
- OPTION_TVDEFLICKER,
- OPTION_AGP_DMA,
- OPTION_2D_DMA,
- OPTION_XV_DMA,
- OPTION_MAX_DRIMEM,
- OPTION_AGPMEM,
- OPTION_DISABLE_XV_BW_CHECK
-} VIAOpts;
-
-static OptionInfoRec VIAOptions[] = {
-#ifdef HAVE_DEBUG /* Don't document these three. */
- {OPTION_PRINTVGAREGS, "PrintVGARegs", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_PRINTTVREGS, "PrintTVRegs", OPTV_BOOLEAN, {0}, FALSE},
-#endif
- {OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_EXA_NOCOMPOSITE, "ExaNoComposite", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_EXA_SCRATCH_SIZE, "ExaScratchSize", OPTV_INTEGER, {0}, FALSE},
- {OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_ROTATION_TYPE, "RotationType", OPTV_ANYSTR, {0}, FALSE},
- {OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE},
- {OPTION_TVDOTCRAWL, "TVDotCrawl", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_TVDEFLICKER, "TVDeflicker", OPTV_INTEGER, {0}, FALSE},
- {OPTION_TVTYPE, "TVType", OPTV_ANYSTR, {0}, FALSE},
- {OPTION_TVOUTPUT, "TVOutput", OPTV_ANYSTR, {0}, FALSE},
- {OPTION_DISABLEVQ, "DisableVQ", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_DISABLEIRQ, "DisableIRQ", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_AGP_DMA, "EnableAGPDMA", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_2D_DMA, "NoAGPFor2D", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_XV_DMA, "NoXVDMA", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_DISABLE_XV_BW_CHECK, "DisableXvBWCheck", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_MAX_DRIMEM, "MaxDRIMem", OPTV_INTEGER, {0}, FALSE},
- {OPTION_AGPMEM, "AGPMem", OPTV_INTEGER, {0}, FALSE},
- {-1, NULL, OPTV_NONE, {0}, FALSE}
-};
-
#ifdef XFree86LOADER
static MODULESETUPPROTO(VIASetup);
@@ -270,12 +213,6 @@ VIASetup(pointer module, pointer opts, int *errmaj, int *errmin)
#endif /* XFree86LOADER */
-static const OptionInfoRec *
-VIAAvailableOptions(int chipid, int busid)
-{
- return VIAOptions;
-}
-
static Bool
VIASwitchMode(SWITCH_MODE_ARGS_DECL)
{
@@ -649,87 +586,6 @@ LookupChipID(PciChipsets *pset, int ChipID)
return -1;
}
-static Bool
-VIASetupDefaultOptions(ScrnInfoPtr pScrn)
-{
- VIAPtr pVia = VIAPTR(pScrn);
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIASetupDefaultOptions - Setting up default chipset options.\n"));
-
- pVia->shadowFB = FALSE;
- pVia->NoAccel = FALSE;
- pVia->noComposite = FALSE;
- pVia->useEXA = TRUE;
- pVia->exaScratchSize = VIA_SCRATCH_SIZE / 1024;
- pVia->drmmode.hwcursor = TRUE;
- pVia->VQEnable = TRUE;
- pVia->DRIIrqEnable = TRUE;
- pVia->agpEnable = TRUE;
- pVia->dma2d = TRUE;
- pVia->dmaXV = TRUE;
-#ifdef HAVE_DEBUG
- pVia->disableXvBWCheck = FALSE;
-#endif
- pVia->maxDriSize = 0;
- pVia->agpMem = AGP_SIZE / 1024;
- pVia->VideoEngine = VIDEO_ENGINE_CLE;
-#ifdef HAVE_DEBUG
- pVia->PrintVGARegs = FALSE;
-#endif
-
- /* Disable vertical interpolation because the size of */
- /* line buffer (limited to 800) is too small to do interpolation. */
- pVia->swov.maxWInterp = 800;
- pVia->swov.maxHInterp = 600;
-
- switch (pVia->Chipset) {
- case VIA_CLE266:
- break;
- case VIA_KM400:
- /* IRQ is not broken on KM400A, but testing (pVia->ChipRev < 0x80)
- * is not enough to make sure we have an older, broken KM400. */
- pVia->DRIIrqEnable = FALSE;
- break;
- case VIA_K8M800:
- pVia->DRIIrqEnable = FALSE;
- break;
- case VIA_PM800:
- pVia->VideoEngine = VIDEO_ENGINE_CME;
- break;
- case VIA_P4M800PRO:
- break;
- case VIA_CX700:
- pVia->VideoEngine = VIDEO_ENGINE_CME;
- pVia->swov.maxWInterp = 1920;
- pVia->swov.maxHInterp = 1080;
- break;
- case VIA_P4M890:
- pVia->VideoEngine = VIDEO_ENGINE_CME;
- pVia->dmaXV = FALSE;
- break;
- case VIA_K8M890:
- pVia->VideoEngine = VIDEO_ENGINE_CME;
- pVia->agpEnable = FALSE;
- pVia->dmaXV = FALSE;
- break;
- case VIA_P4M900:
- pVia->VideoEngine = VIDEO_ENGINE_CME;
- pVia->agpEnable = FALSE;
- /* FIXME: this needs to be tested */
- pVia->dmaXV = FALSE;
- break;
- case VIA_VX800:
- case VIA_VX855:
- case VIA_VX900:
- pVia->VideoEngine = VIDEO_ENGINE_CME;
- pVia->agpEnable = FALSE;
- pVia->dmaXV = FALSE;
- break;
- }
-
- return TRUE;
-}
-
static Bool
VIAGetRec(ScrnInfoPtr pScrn)
{
@@ -953,9 +809,7 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
{
EntityInfoPtr pEnt;
VIAPtr pVia;
- VIADisplayPtr pVIADisplay;
MessageType from = X_DEFAULT;
- const char *s = NULL;
#ifdef HAVE_DRI
char *busId = NULL;
drmVersionPtr drmVer;
@@ -1266,284 +1120,10 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
option = xf86NewOption(strEXAOptionName, strEXAValue);
xf86CollectOptions(pScrn, option);
- if (!VIASetupDefaultOptions(pScrn)) {
- goto fail;
- }
-
- xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, VIAOptions);
-
- /* When rotating, switch shadow framebuffer on and acceleration off. */
- if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATION_TYPE))) {
- if (!xf86NameCmp(s, "SWRandR")) {
- pVia->shadowFB = TRUE;
- pVia->NoAccel = TRUE;
- pVia->RandRRotation = TRUE;
- pVia->rotate = RR_Rotate_0;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen "
- "RandR enabled, acceleration disabled\n");
- } else if (!xf86NameCmp(s, "HWRandR")) {
- pVia->shadowFB = TRUE;
- pVia->NoAccel = TRUE;
- pVia->RandRRotation = TRUE;
- pVia->rotate = RR_Rotate_0;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Hardware accelerated "
- "rotating screen is not implemented. Using SW RandR.\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid"
- "value for Option \"RotationType\".\n", s);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Valid options are \"SWRandR\" and \"HWRandR\".\n");
- }
- }
-
- /* When rotating, switch shadow framebuffer on and acceleration off. */
- if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATE))) {
- if (!xf86NameCmp(s, "CW")) {
- pVia->shadowFB = TRUE;
- pVia->NoAccel = TRUE;
- pVia->RandRRotation = TRUE;
- pVia->rotate = RR_Rotate_270;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen "
- "clockwise -- acceleration is disabled.\n");
- } else if (!xf86NameCmp(s, "CCW")) {
- pVia->shadowFB = TRUE;
- pVia->NoAccel = TRUE;
- pVia->RandRRotation = TRUE;
- pVia->rotate = RR_Rotate_90;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen "
- "counterclockwise -- acceleration is disabled.\n");
- } else if (!xf86NameCmp(s, "UD")) {
- pVia->shadowFB = TRUE;
- pVia->NoAccel = TRUE;
- pVia->RandRRotation = TRUE;
- pVia->rotate = RR_Rotate_180;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen "
- "upside-down -- acceleration is disabled.\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid"
- "value for Option \"Rotate\".\n", s);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Valid options are \"CW\", \"CCW\" or \"UD\".\n");
- }
- }
-
- from = (xf86GetOptValBool(VIAOptions, OPTION_SHADOW_FB, &pVia->shadowFB)
- ? X_CONFIG : X_DEFAULT);
- xf86DrvMsg(pScrn->scrnIndex, from, "Shadow framebuffer is %s.\n",
- pVia->shadowFB ? "enabled" : "disabled");
-
- /* Use hardware acceleration, unless on shadow framebuffer. */
- from = (xf86GetOptValBool(VIAOptions, OPTION_NOACCEL, &pVia->NoAccel)
- ? X_CONFIG : X_DEFAULT);
- if (!pVia->NoAccel && pVia->shadowFB) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Acceleration is "
- "not supported when using shadow framebuffer.\n");
- pVia->NoAccel = TRUE;
- from = X_DEFAULT;
- }
-
- /* Disable EXA for KMS case */
- if (pVia->KMS)
- pVia->NoAccel = TRUE;
-
- xf86DrvMsg(pScrn->scrnIndex, from, "Hardware acceleration is %s.\n",
- !pVia->NoAccel ? "enabled" : "disabled");
-
- if (!pVia->NoAccel) {
- from = X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from,
- "Using EXA acceleration architecture.\n");
-
- //pVia->noComposite = FALSE;
- if (pVia->useEXA) {
- from = xf86GetOptValBool(VIAOptions, OPTION_EXA_NOCOMPOSITE,
- &pVia->noComposite) ? X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from,
- "EXA composite acceleration %s.\n",
- !pVia->noComposite ? "enabled" : "disabled");
-
- //pVia->exaScratchSize = VIA_SCRATCH_SIZE / 1024;
- from = xf86GetOptValInteger(VIAOptions, OPTION_EXA_SCRATCH_SIZE,
- &pVia->exaScratchSize)
- ? X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from,
- "EXA scratch area size is %d KB.\n",
- pVia->exaScratchSize);
- }
- }
-
- /* Use a hardware cursor, unless on secondary or on shadow framebuffer. */
- from = X_DEFAULT;
- if (pVia->IsSecondary || pVia->shadowFB)
- pVia->drmmode.hwcursor = FALSE;
- else if (xf86GetOptValBool(VIAOptions, OPTION_SWCURSOR,
- &pVia->drmmode.hwcursor)) {
- pVia->drmmode.hwcursor = !pVia->drmmode.hwcursor;
- from = X_CONFIG;
- }
- if (pVia->drmmode.hwcursor)
- xf86DrvMsg(pScrn->scrnIndex, from, "Using hardware two-color "
- "cursors and software full-color cursors.\n");
- else
- xf86DrvMsg(pScrn->scrnIndex, from, "Using software cursors.\n");
-
- //pVia->VQEnable = TRUE;
- from = xf86GetOptValBool(VIAOptions, OPTION_DISABLEVQ, &pVia->VQEnable)
- ? X_CONFIG : X_DEFAULT;
- if (from == X_CONFIG)
- pVia->VQEnable = !pVia->VQEnable;
- xf86DrvMsg(pScrn->scrnIndex, from,
- "GPU virtual command queue will be %s.\n",
- (pVia->VQEnable) ? "enabled" : "disabled");
-
- //pVia->DRIIrqEnable = TRUE;
- from = xf86GetOptValBool(VIAOptions, OPTION_DISABLEIRQ, &pVia->DRIIrqEnable)
- ? X_CONFIG : X_DEFAULT;
- if (from == X_CONFIG)
- pVia->DRIIrqEnable = !pVia->DRIIrqEnable;
- xf86DrvMsg(pScrn->scrnIndex, from,
- "DRI IRQ will be %s if DRI is enabled.\n",
- (pVia->DRIIrqEnable) ? "enabled" : "disabled");
-
- //pVia->agpEnable = FALSE;
- from = xf86GetOptValBool(VIAOptions, OPTION_AGP_DMA, &pVia->agpEnable)
- ? X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from,
- "AGP DMA will be %s if DRI is enabled.\n",
- (pVia->agpEnable) ? "enabled" : "disabled");
-
- //pVia->dma2d = TRUE;
- if (pVia->agpEnable) {
- from = xf86GetOptValBool(VIAOptions, OPTION_2D_DMA, &pVia->dma2d)
- ? X_CONFIG : X_DEFAULT;
- if (from == X_CONFIG)
- pVia->dma2d = !pVia->dma2d;
- xf86DrvMsg(pScrn->scrnIndex, from, "AGP DMA will %sbe used for "
- "2D acceleration.\n", (pVia->dma2d) ? "" : "not ");
- }
- //pVia->dmaXV = TRUE;
- from = xf86GetOptValBool(VIAOptions, OPTION_XV_DMA, &pVia->dmaXV)
- ? X_CONFIG : X_DEFAULT;
- if (from == X_CONFIG)
- pVia->dmaXV = !pVia->dmaXV;
- xf86DrvMsg(pScrn->scrnIndex, from, "PCI DMA will %sbe used for XV "
- "image transfer if DRI is enabled.\n",
- (pVia->dmaXV) ? "" : "not ");
-
-#ifdef HAVE_DEBUG
- //pVia->disableXvBWCheck = FALSE;
- from = xf86GetOptValBool(VIAOptions, OPTION_DISABLE_XV_BW_CHECK,
- &pVia->disableXvBWCheck)
- ? X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from, "Xv Bandwidth check is %s.\n",
- pVia->disableXvBWCheck ? "disabled" : "enabled");
- if (pVia->disableXvBWCheck) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "You may get a \"snowy\" screen"
- " when using the Xv overlay.\n");
- }
-#endif
-
- //pVia->maxDriSize = 0;
- from = xf86GetOptValInteger(VIAOptions, OPTION_MAX_DRIMEM,
- &pVia->maxDriSize)
- ? X_CONFIG : X_DEFAULT;
- if (pVia->maxDriSize > 0)
- xf86DrvMsg(pScrn->scrnIndex, from,
- "Will impose a %d kB limit on video RAM reserved for DRI.\n",
- pVia->maxDriSize);
- else
- xf86DrvMsg(pScrn->scrnIndex, from,
- "Will not impose a limit on video RAM reserved for DRI.\n");
-
- //pVia->agpMem = AGP_SIZE / 1024;
- from = xf86GetOptValInteger(VIAOptions, OPTION_AGPMEM, &pVia->agpMem)
- ? X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from,
- "Will try to allocate %d KB of AGP memory.\n", pVia->agpMem);
-
- pVIADisplay = pVia->pVIADisplay;
- pVIADisplay->TVDotCrawl = FALSE;
- from = xf86GetOptValBool(VIAOptions, OPTION_TVDOTCRAWL,
- &pVIADisplay->TVDotCrawl)
- ? X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from, "TV dotCrawl is %s.\n",
- pVIADisplay->TVDotCrawl ? "enabled" : "disabled");
-
- /* TV Deflicker */
- pVIADisplay->TVDeflicker = 0;
- from = xf86GetOptValInteger(VIAOptions, OPTION_TVDEFLICKER,
- &pVIADisplay->TVDeflicker)
- ? X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from, "TV deflicker is set to %d.\n",
- pVIADisplay->TVDeflicker);
-
- pVIADisplay->TVType = TVTYPE_NONE;
- if ((s = xf86GetOptValString(VIAOptions, OPTION_TVTYPE))) {
- if (!xf86NameCmp(s, "NTSC")) {
- pVIADisplay->TVType = TVTYPE_NTSC;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is NTSC.\n");
- } else if (!xf86NameCmp(s, "PAL")) {
- pVIADisplay->TVType = TVTYPE_PAL;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is PAL.\n");
- } else if (!xf86NameCmp(s, "480P")) {
- pVIADisplay->TVType = TVTYPE_480P;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is SDTV 480P.\n");
- } else if (!xf86NameCmp(s, "576P")) {
- pVIADisplay->TVType = TVTYPE_576P;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is SDTV 576P.\n");
- } else if (!xf86NameCmp(s, "720P")) {
- pVIADisplay->TVType = TVTYPE_720P;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is HDTV 720P.\n");
- } else if (!xf86NameCmp(s, "1080I")) {
- pVIADisplay->TVType = TVTYPE_1080I;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is HDTV 1080i.\n");
- }
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "No default TV type is set.\n");
- }
-
- /* TV output signal Option */
- pVIADisplay->TVOutput = TVOUTPUT_NONE;
- if ((s = xf86GetOptValString(VIAOptions, OPTION_TVOUTPUT))) {
- if (!xf86NameCmp(s, "S-Video")) {
- pVIADisplay->TVOutput = TVOUTPUT_SVIDEO;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "TV Output Signal is S-Video.\n");
- } else if (!xf86NameCmp(s, "Composite")) {
- pVIADisplay->TVOutput = TVOUTPUT_COMPOSITE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "TV Output Signal is Composite.\n");
- } else if (!xf86NameCmp(s, "SC")) {
- pVIADisplay->TVOutput = TVOUTPUT_SC;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Output Signal is SC.\n");
- } else if (!xf86NameCmp(s, "RGB")) {
- pVIADisplay->TVOutput = TVOUTPUT_RGB;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "TV Output Signal is RGB.\n");
- } else if (!xf86NameCmp(s, "YCbCr")) {
- pVIADisplay->TVOutput = TVOUTPUT_YCBCR;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "TV Output Signal is YCbCr.\n");
- }
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT,
- "No default TV output signal type is set.\n");
- }
+ viaProcessOptions(pScrn);
VIAVidHWDiffInit(pScrn);
-#ifdef HAVE_DEBUG
- //pVia->PrintVGARegs = FALSE;
- from = xf86GetOptValBool(VIAOptions, OPTION_PRINTVGAREGS,
- &pVia->PrintVGARegs)
- ? X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from, "Will %sprint VGA registers.\n",
- pVia->PrintVGARegs ? "" : "not ");
- if (pVia->PrintVGARegs)
- ViaVgahwPrint(VGAHWPTR(pScrn)); /* Do this as early as possible */
-#endif /* HAVE_DEBUG */
-
/* CRTC handling */
xf86CrtcConfigInit(pScrn, &via_xf86crtc_config_funcs);
diff --git a/src/via_driver.h b/src/via_driver.h
index f9262b6..920d9e2 100644
--- a/src/via_driver.h
+++ b/src/via_driver.h
@@ -356,6 +356,9 @@ typedef struct
} VIAEntRec, *VIAEntPtr;
+const OptionInfoRec *VIAAvailableOptions(int chipid, int busid);
+void viaProcessOptions(ScrnInfoPtr pScrn);
+
/* In via_display.c. */
const xf86CrtcFuncsRec iga1_crtc_funcs;
const xf86CrtcFuncsRec iga2_crtc_funcs;
diff --git a/src/via_options.c b/src/via_options.c
new file mode 100644
index 0000000..f0bdd39
--- /dev/null
+++ b/src/via_options.c
@@ -0,0 +1,562 @@
+/*
+ * Copyright 2005-2019 OpenChrome Project
+ * [https://www.freedesktop.org/wiki/Openchrome]
+ * Copyright 2004-2006 Luc Verhaegen.
+ * Copyright 2004-2005 The Unichrome Project [unichrome.sf.net]
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sub license, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including
+ * the next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "via_driver.h"
+
+
+typedef enum
+{
+#ifdef HAVE_DEBUG
+ OPTION_PRINTVGAREGS,
+ OPTION_PRINTTVREGS,
+#endif
+ OPTION_NOACCEL,
+ OPTION_EXA_NOCOMPOSITE,
+ OPTION_EXA_SCRATCH_SIZE,
+ OPTION_SWCURSOR,
+ OPTION_SHADOW_FB,
+ OPTION_ROTATION_TYPE,
+ OPTION_ROTATE,
+ OPTION_CENTER,
+ OPTION_TVDOTCRAWL,
+ OPTION_TVTYPE,
+ OPTION_TVOUTPUT,
+ OPTION_DISABLEVQ,
+ OPTION_DISABLEIRQ,
+ OPTION_TVDEFLICKER,
+ OPTION_AGP_DMA,
+ OPTION_2D_DMA,
+ OPTION_XV_DMA,
+ OPTION_MAX_DRIMEM,
+ OPTION_AGPMEM,
+ OPTION_DISABLE_XV_BW_CHECK
+} VIAOpts;
+
+static OptionInfoRec VIAOptions[] = {
+#ifdef HAVE_DEBUG /* Don't document these three. */
+ {OPTION_PRINTVGAREGS, "PrintVGARegs", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_PRINTTVREGS, "PrintTVRegs", OPTV_BOOLEAN, {0}, FALSE},
+#endif
+ {OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_EXA_NOCOMPOSITE, "ExaNoComposite", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_EXA_SCRATCH_SIZE, "ExaScratchSize", OPTV_INTEGER, {0}, FALSE},
+ {OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_ROTATION_TYPE, "RotationType", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_TVDOTCRAWL, "TVDotCrawl", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_TVDEFLICKER, "TVDeflicker", OPTV_INTEGER, {0}, FALSE},
+ {OPTION_TVTYPE, "TVType", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_TVOUTPUT, "TVOutput", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_DISABLEVQ, "DisableVQ", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_DISABLEIRQ, "DisableIRQ", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_AGP_DMA, "EnableAGPDMA", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_2D_DMA, "NoAGPFor2D", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_XV_DMA, "NoXVDMA", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_DISABLE_XV_BW_CHECK, "DisableXvBWCheck", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_MAX_DRIMEM, "MaxDRIMem", OPTV_INTEGER, {0}, FALSE},
+ {OPTION_AGPMEM, "AGPMem", OPTV_INTEGER, {0}, FALSE},
+ {-1, NULL, OPTV_NONE, {0}, FALSE}
+};
+
+const OptionInfoRec *
+VIAAvailableOptions(int chipid, int busid)
+{
+ return VIAOptions;
+}
+
+
+static void
+viaSetupDefaultOptions(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s - Setting up default chipset options.\n",
+ __func__));
+
+ pVia->shadowFB = FALSE;
+ pVia->NoAccel = FALSE;
+ pVia->noComposite = FALSE;
+ pVia->useEXA = TRUE;
+ pVia->exaScratchSize = VIA_SCRATCH_SIZE / 1024;
+ pVia->drmmode.hwcursor = TRUE;
+ pVia->VQEnable = TRUE;
+ pVia->DRIIrqEnable = TRUE;
+ pVia->agpEnable = TRUE;
+ pVia->dma2d = TRUE;
+ pVia->dmaXV = TRUE;
+#ifdef HAVE_DEBUG
+ pVia->disableXvBWCheck = FALSE;
+#endif
+ pVia->maxDriSize = 0;
+ pVia->agpMem = AGP_SIZE / 1024;
+ pVia->VideoEngine = VIDEO_ENGINE_CLE;
+#ifdef HAVE_DEBUG
+ pVia->PrintVGARegs = FALSE;
+#endif
+
+ /*
+ * Disable vertical interpolation because the size of
+ * line buffer (limited to 800) is too small to do interpolation.
+ */
+ pVia->swov.maxWInterp = 800;
+ pVia->swov.maxHInterp = 600;
+
+ switch (pVia->Chipset) {
+ case VIA_CLE266:
+ break;
+ case VIA_KM400:
+ /*
+ * IRQ is not broken on KM400A, but testing
+ * (pVia->ChipRev < 0x80) is not enough to make sure we
+ * have an older, broken KM400.
+ */
+ pVia->DRIIrqEnable = FALSE;
+ break;
+ case VIA_K8M800:
+ pVia->DRIIrqEnable = FALSE;
+ break;
+ case VIA_PM800:
+ pVia->VideoEngine = VIDEO_ENGINE_CME;
+ break;
+ case VIA_P4M800PRO:
+ break;
+ case VIA_CX700:
+ pVia->VideoEngine = VIDEO_ENGINE_CME;
+ pVia->swov.maxWInterp = 1920;
+ pVia->swov.maxHInterp = 1080;
+ break;
+ case VIA_P4M890:
+ pVia->VideoEngine = VIDEO_ENGINE_CME;
+ pVia->dmaXV = FALSE;
+ break;
+ case VIA_K8M890:
+ pVia->VideoEngine = VIDEO_ENGINE_CME;
+ pVia->agpEnable = FALSE;
+ pVia->dmaXV = FALSE;
+ break;
+ case VIA_P4M900:
+ pVia->VideoEngine = VIDEO_ENGINE_CME;
+ pVia->agpEnable = FALSE;
+ /* FIXME: this needs to be tested */
+ pVia->dmaXV = FALSE;
+ break;
+ case VIA_VX800:
+ case VIA_VX855:
+ case VIA_VX900:
+ pVia->VideoEngine = VIDEO_ENGINE_CME;
+ pVia->agpEnable = FALSE;
+ pVia->dmaXV = FALSE;
+ break;
+ }
+}
+
+void
+viaProcessOptions(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ MessageType from = X_DEFAULT;
+ const char *s = NULL;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered %s.\n", __func__));
+
+ viaSetupDefaultOptions(pScrn);
+
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, VIAOptions);
+
+ /*
+ * When rotating, switch shadow frame buffer on and acceleration
+ * off.
+ */
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATION_TYPE))) {
+ if (!xf86NameCmp(s, "SWRandR")) {
+ pVia->shadowFB = TRUE;
+ pVia->NoAccel = TRUE;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_0;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen RandR enabled, "
+ "acceleration disabled\n");
+ } else if (!xf86NameCmp(s, "HWRandR")) {
+ pVia->shadowFB = TRUE;
+ pVia->NoAccel = TRUE;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_0;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Hardware accelerated rotating screen is not "
+ "implemented. Using SW RandR.\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "\"%s\" is not a valid"
+ "value for Option \"RotationType\".\n", s);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Valid options are \"SWRandR\" and "
+ "\"HWRandR\".\n");
+ }
+ }
+
+ /*
+ * When rotating, switch shadow frame buffer on and acceleration
+ * off.
+ */
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATE))) {
+ if (!xf86NameCmp(s, "CW")) {
+ pVia->shadowFB = TRUE;
+ pVia->NoAccel = TRUE;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_270;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen clockwise -- "
+ "acceleration is disabled.\n");
+ } else if (!xf86NameCmp(s, "CCW")) {
+ pVia->shadowFB = TRUE;
+ pVia->NoAccel = TRUE;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_90;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen counterclockwise -- "
+ "acceleration is disabled.\n");
+ } else if (!xf86NameCmp(s, "UD")) {
+ pVia->shadowFB = TRUE;
+ pVia->NoAccel = TRUE;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_180;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Rotating screen upside-down -- "
+ "acceleration is disabled.\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "\"%s\" is not a valid value for "
+ "Option \"Rotate\".\n", s);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Valid options are \"CW\", \"CCW\" "
+ "or \"UD\".\n");
+ }
+ }
+
+ from = (xf86GetOptValBool(VIAOptions,
+ OPTION_SHADOW_FB, &pVia->shadowFB)
+ ? X_CONFIG : X_DEFAULT);
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Shadow framebuffer is %s.\n",
+ pVia->shadowFB ? "enabled" : "disabled");
+
+ /*
+ * Use hardware acceleration, unless on shadow frame buffer.
+ */
+ from = (xf86GetOptValBool(VIAOptions,
+ OPTION_NOACCEL, &pVia->NoAccel) ?
+ X_CONFIG : X_DEFAULT);
+ if (!pVia->NoAccel && pVia->shadowFB) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Acceleration is not supported when using shadow "
+ "frame buffer.\n");
+ pVia->NoAccel = TRUE;
+ from = X_DEFAULT;
+ }
+
+ /*
+ * Disable EXA for KMS case
+ */
+ if (pVia->KMS)
+ pVia->NoAccel = TRUE;
+
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Hardware acceleration is %s.\n",
+ !pVia->NoAccel ? "enabled" : "disabled");
+
+ if (!pVia->NoAccel) {
+ from = X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Using EXA acceleration architecture.\n");
+/*
+ pVia->noComposite = FALSE;
+*/
+ if (pVia->useEXA) {
+ from = xf86GetOptValBool(VIAOptions,
+ OPTION_EXA_NOCOMPOSITE,
+ &pVia->noComposite) ?
+ X_CONFIG : X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "EXA composite acceleration %s.\n",
+ !pVia->noComposite ? "enabled" : "disabled");
+
+/*
+ pVia->exaScratchSize = VIA_SCRATCH_SIZE / 1024;
+*/
+ from = xf86GetOptValInteger(VIAOptions,
+ OPTION_EXA_SCRATCH_SIZE,
+ &pVia->exaScratchSize) ?
+ X_CONFIG : X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "EXA scratch area size is %d KB.\n",
+ pVia->exaScratchSize);
+ }
+ }
+
+ /*
+ * Use a hardware cursor, unless on secondary or on shadow
+ * frame buffer.
+ */
+ from = X_DEFAULT;
+ if (pVia->IsSecondary || pVia->shadowFB)
+ pVia->drmmode.hwcursor = FALSE;
+ else if (xf86GetOptValBool(VIAOptions, OPTION_SWCURSOR,
+ &pVia->drmmode.hwcursor)) {
+ pVia->drmmode.hwcursor = !pVia->drmmode.hwcursor;
+ from = X_CONFIG;
+ }
+
+ if (pVia->drmmode.hwcursor)
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Using hardware two-color cursors and software "
+ "full-color cursors.\n");
+ else
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Using software cursors.\n");
+
+/*
+ pVia->VQEnable = TRUE;
+*/
+ from = xf86GetOptValBool(VIAOptions,
+ OPTION_DISABLEVQ, &pVia->VQEnable) ?
+ X_CONFIG : X_DEFAULT;
+ if (from == X_CONFIG)
+ pVia->VQEnable = !pVia->VQEnable;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "GPU virtual command queue will be %s.\n",
+ (pVia->VQEnable) ? "enabled" : "disabled");
+
+/*
+ pVia->DRIIrqEnable = TRUE;
+*/
+ from = xf86GetOptValBool(VIAOptions,
+ OPTION_DISABLEIRQ,
+ &pVia->DRIIrqEnable) ?
+ X_CONFIG : X_DEFAULT;
+ if (from == X_CONFIG)
+ pVia->DRIIrqEnable = !pVia->DRIIrqEnable;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "DRI IRQ will be %s if DRI is enabled.\n",
+ (pVia->DRIIrqEnable) ? "enabled" : "disabled");
+
+/*
+ pVia->agpEnable = FALSE;
+*/
+ from = xf86GetOptValBool(VIAOptions,
+ OPTION_AGP_DMA, &pVia->agpEnable) ?
+ X_CONFIG : X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "AGP DMA will be %s if DRI is enabled.\n",
+ (pVia->agpEnable) ? "enabled" : "disabled");
+
+/*
+ pVia->dma2d = TRUE;
+*/
+ if (pVia->agpEnable) {
+ from = xf86GetOptValBool(VIAOptions,
+ OPTION_2D_DMA, &pVia->dma2d) ?
+ X_CONFIG : X_DEFAULT;
+ if (from == X_CONFIG)
+ pVia->dma2d = !pVia->dma2d;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "AGP DMA will %sbe used for 2D acceleration.\n",
+ (pVia->dma2d) ? "" : "not ");
+ }
+
+/*
+ pVia->dmaXV = TRUE;
+*/
+ from = xf86GetOptValBool(VIAOptions,
+ OPTION_XV_DMA, &pVia->dmaXV) ?
+ X_CONFIG : X_DEFAULT;
+ if (from == X_CONFIG)
+ pVia->dmaXV = !pVia->dmaXV;
+ xf86DrvMsg(pScrn->scrnIndex, from, "PCI DMA will %sbe used for XV "
+ "image transfer if DRI is enabled.\n",
+ (pVia->dmaXV) ? "" : "not ");
+
+#ifdef HAVE_DEBUG
+/*
+ pVia->disableXvBWCheck = FALSE;
+*/
+ from = xf86GetOptValBool(VIAOptions,
+ OPTION_DISABLE_XV_BW_CHECK,
+ &pVia->disableXvBWCheck) ?
+ X_CONFIG : X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Xv Bandwidth check is %s.\n",
+ pVia->disableXvBWCheck ? "disabled" : "enabled");
+ if (pVia->disableXvBWCheck) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "You may get a \"snowy\" screen when using the Xv "
+ "overlay.\n");
+ }
+#endif
+
+/*
+ pVia->maxDriSize = 0;
+*/
+ from = xf86GetOptValInteger(VIAOptions,
+ OPTION_MAX_DRIMEM,
+ &pVia->maxDriSize) ?
+ X_CONFIG : X_DEFAULT;
+ if (pVia->maxDriSize > 0)
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Will impose a %d kB limit on video RAM reserved "
+ "for DRI.\n",
+ pVia->maxDriSize);
+ else
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Will not impose a limit on video RAM reserved "
+ "for DRI.\n");
+
+/*
+ pVia->agpMem = AGP_SIZE / 1024;
+*/
+ from = xf86GetOptValInteger(VIAOptions,
+ OPTION_AGPMEM, &pVia->agpMem) ?
+ X_CONFIG : X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Will try to allocate %d KB of AGP memory.\n",
+ pVia->agpMem);
+
+ pVIADisplay = pVia->pVIADisplay;
+ pVIADisplay->TVDotCrawl = FALSE;
+ from = xf86GetOptValBool(VIAOptions,
+ OPTION_TVDOTCRAWL,
+ &pVIADisplay->TVDotCrawl) ?
+ X_CONFIG : X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "TV dotCrawl is %s.\n",
+ pVIADisplay->TVDotCrawl ? "enabled" : "disabled");
+
+ /*
+ * TV Deflicker
+ */
+ pVIADisplay->TVDeflicker = 0;
+ from = xf86GetOptValInteger(VIAOptions, OPTION_TVDEFLICKER,
+ &pVIADisplay->TVDeflicker) ?
+ X_CONFIG : X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "TV deflicker is set to %d.\n",
+ pVIADisplay->TVDeflicker);
+
+ pVIADisplay->TVType = TVTYPE_NONE;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_TVTYPE))) {
+ if (!xf86NameCmp(s, "NTSC")) {
+ pVIADisplay->TVType = TVTYPE_NTSC;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Type is NTSC.\n");
+ } else if (!xf86NameCmp(s, "PAL")) {
+ pVIADisplay->TVType = TVTYPE_PAL;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Type is PAL.\n");
+ } else if (!xf86NameCmp(s, "480P")) {
+ pVIADisplay->TVType = TVTYPE_480P;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Type is SDTV 480P.\n");
+ } else if (!xf86NameCmp(s, "576P")) {
+ pVIADisplay->TVType = TVTYPE_576P;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Type is SDTV 576P.\n");
+ } else if (!xf86NameCmp(s, "720P")) {
+ pVIADisplay->TVType = TVTYPE_720P;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Type is HDTV 720P.\n");
+ } else if (!xf86NameCmp(s, "1080I")) {
+ pVIADisplay->TVType = TVTYPE_1080I;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Type is HDTV 1080i.\n");
+ }
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT,
+ "No default TV type is set.\n");
+ }
+
+ /*
+ * TV output signal option
+ */
+ pVIADisplay->TVOutput = TVOUTPUT_NONE;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_TVOUTPUT))) {
+ if (!xf86NameCmp(s, "S-Video")) {
+ pVIADisplay->TVOutput = TVOUTPUT_SVIDEO;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Output Signal is S-Video.\n");
+ } else if (!xf86NameCmp(s, "Composite")) {
+ pVIADisplay->TVOutput = TVOUTPUT_COMPOSITE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Output Signal is Composite.\n");
+ } else if (!xf86NameCmp(s, "SC")) {
+ pVIADisplay->TVOutput = TVOUTPUT_SC;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Output Signal is SC.\n");
+ } else if (!xf86NameCmp(s, "RGB")) {
+ pVIADisplay->TVOutput = TVOUTPUT_RGB;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Output Signal is RGB.\n");
+ } else if (!xf86NameCmp(s, "YCbCr")) {
+ pVIADisplay->TVOutput = TVOUTPUT_YCBCR;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Output Signal is YCbCr.\n");
+ }
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT,
+ "No default TV output signal type is set.\n");
+ }
+
+#ifdef HAVE_DEBUG
+/*
+ pVia->PrintVGARegs = FALSE;
+*/
+ from = xf86GetOptValBool(VIAOptions,
+ OPTION_PRINTVGAREGS,
+ &pVia->PrintVGARegs) ?
+ X_CONFIG : X_DEFAULT;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Will %sprint VGA registers.\n",
+ pVia->PrintVGARegs ? "" : "not ");
+ if (pVia->PrintVGARegs)
+ /*
+ * Do this as early as possible.
+ */
+ ViaVgahwPrint(VGAHWPTR(pScrn));
+#endif /* HAVE_DEBUG */
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting %s.\n", __func__));
+}
More information about the openchrome-devel
mailing list