summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTormod Volden <debian.tormod@gmail.com>2012-05-18 13:08:58 +0200
committerTormod Volden <debian.tormod@gmail.com>2013-05-09 16:09:27 +0200
commite2b50200ad7a332ccc72ea54a388c45256cd304a (patch)
treebdb18b50fdd8eb9abacb9bb380396005d3a492a5
parentfdaa5d9aa856512f161cd23dea6f3f77162fd7d8 (diff)
Add "TVStandard" configuration optiontvformats
There used to be two configuration options "TvOn" and "PAL". They would both enable TV output, the first would set NTSC format. Change the "TvOn" option to simply enable TV, and drop the "PAL" option. Instead introduce the "TVStandard" option (seen in many other drivers) to choose a TV format. Also add support for NTSC-J format (as figured out from the s3switch sources). If the "TVStandard" option is not used, the driver will not try to set any format, so the default setting from the card, BIOS or from use of the s3switch utility will stay active. To force a format, add one of the following lines to xorg.conf: Option "TVStandard" "pal" Option "TVStandard" "ntsc" Option "TVStandard" "ntsc-j"
-rw-r--r--src/savage_driver.c26
-rw-r--r--src/savage_driver.h9
-rw-r--r--src/savage_vbe.c12
-rw-r--r--src/savage_vbe.h1
4 files changed, 34 insertions, 14 deletions
diff --git a/src/savage_driver.c b/src/savage_driver.c
index 4c8386d..658c925 100644
--- a/src/savage_driver.c
+++ b/src/savage_driver.c
@@ -269,7 +269,7 @@ typedef enum {
,OPTION_SHADOW_STATUS
,OPTION_CRT_ONLY
,OPTION_TV_ON
- ,OPTION_TV_PAL
+ ,OPTION_TVSTD
,OPTION_FORCE_INIT
,OPTION_OVERLAY
,OPTION_T_KEY
@@ -302,7 +302,7 @@ static const OptionInfoRec SavageOptions[] =
{ OPTION_SHADOW_STATUS, "ShadowStatus", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_CRT_ONLY, "CrtOnly", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_TV_ON, "TvOn", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_TV_PAL, "PAL", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_TVSTD, "TVStandard", OPTV_STRING, {0}, FALSE },
{ OPTION_FORCE_INIT,"ForceInit", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_OVERLAY, "Overlay", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_T_KEY, "TransparencyKey", OPTV_ANYSTR, {0}, FALSE },
@@ -1374,20 +1374,26 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg( pScrn->scrnIndex, X_CONFIG,
"Option: CrtOnly enabled\n" );
- if( xf86GetOptValBool( psav->Options, OPTION_TV_ON, &psav->TvOn)) {
- psav->PAL = FALSE;
- SavageGetTvMaxSize(psav);
+ psav->tvStd = TV_STD_UNDEFINED;
+ if ((s = xf86GetOptValString(psav->Options, OPTION_TVSTD))) {
+ if (!strcasecmp("pal", s))
+ psav->tvStd = TV_STD_PAL;
+ else if (!strcasecmp("ntsc", s))
+ psav->tvStd = TV_STD_NTSC;
+ else if (!strcasecmp("ntsc-j", s) || (!strcasecmp("ntscj", s)))
+ psav->tvStd = TV_STD_NTSC_J;
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid TV Standard: %s\n", s);
+ }
}
- if( xf86GetOptValBool( psav->Options, OPTION_TV_PAL, &psav->PAL)) {
+ if( xf86GetOptValBool( psav->Options, OPTION_TV_ON, &psav->TvOn)) {
SavageGetTvMaxSize(psav);
- psav->TvOn = TRUE;
}
if( psav->TvOn )
xf86DrvMsg( pScrn->scrnIndex, X_CONFIG,
- "TV enabled in %s format\n",
- psav->PAL ? "PAL" : "NTSC" );
+ "TV enabled\n");
psav->ForceInit = 0;
if( xf86GetOptValBool( psav->Options, OPTION_FORCE_INIT, &psav->ForceInit))
@@ -4608,7 +4614,7 @@ SavageDDC1(ScrnInfoPtr pScrn)
static void
SavageGetTvMaxSize(SavagePtr psav)
{
- if( psav->PAL ) {
+ if( psav->tvStd == TV_STD_PAL) {
psav->TVSizeX = 800;
psav->TVSizeY = 600;
}
diff --git a/src/savage_driver.h b/src/savage_driver.h
index d5b1a46..c5d755f 100644
--- a/src/savage_driver.h
+++ b/src/savage_driver.h
@@ -170,6 +170,13 @@ typedef struct
} SavageEntRec, *SavageEntPtr;
+typedef enum {
+ TV_STD_UNDEFINED,
+ TV_STD_PAL,
+ TV_STD_NTSC,
+ TV_STD_NTSC_J
+} SavageTVStdType;
+
#define VGAIN8(addr) MMIO_IN8(psav->MapBase+0x8000, addr)
#define VGAIN16(addr) MMIO_IN16(psav->MapBase+0x8000, addr)
#define VGAIN(addr) MMIO_IN32(psav->MapBase+0x8000, addr)
@@ -367,7 +374,7 @@ typedef struct _Savage {
Bool ForceShadowStatus; /* true if explicitly set in conf */
Bool CrtOnly;
Bool TvOn;
- Bool PAL;
+ SavageTVStdType tvStd;
Bool ForceInit;
int iDevInfo;
int iDevInfoPrim;
diff --git a/src/savage_vbe.c b/src/savage_vbe.c
index 06796b4..81ea289 100644
--- a/src/savage_vbe.c
+++ b/src/savage_vbe.c
@@ -154,12 +154,18 @@ SavageSetVESAMode( SavagePtr psav, int n, int Refresh )
xf86ExecX86int10( psav->pVbe->pInt10 );
- /* Set TV type if TV is on. */
- if( psav->TvOn ) {
+ /* Set TV type if TV is on and user configured the type */
+ if( psav->TvOn && psav->tvStd != TV_STD_UNDEFINED ) {
+ int tv_format = BIOS_TV_PAL;
+
+ if (psav->tvStd == TV_STD_NTSC)
+ tv_format = BIOS_TV_NTSC;
+ else if (psav->tvStd == TV_STD_NTSC_J)
+ tv_format = BIOS_TV_NTSC_J;
SavageClearVM86Regs( psav->pVbe->pInt10 );
psav->pVbe->pInt10->ax = 0x4f14; /* S3 extensions */
psav->pVbe->pInt10->bx = 0x0007; /* TV extensions */
- psav->pVbe->pInt10->cx = psav->PAL ? 0x08 : 0x04;
+ psav->pVbe->pInt10->cx = tv_format;
psav->pVbe->pInt10->dx = 0x0c;
xf86ExecX86int10( psav->pVbe->pInt10 );
}
diff --git a/src/savage_vbe.h b/src/savage_vbe.h
index 45d4a51..f8b882d 100644
--- a/src/savage_vbe.h
+++ b/src/savage_vbe.h
@@ -61,6 +61,7 @@ This software has NO WARRANTY. Use it at your own risk.
#define BIOS_CRT1_ONLY 0x01
#define BIOS_LCD_ONLY 0x02
+#define BIOS_TV_NTSC_J 0x00
#define BIOS_TV_NTSC 0x04
#define BIOS_TV_PAL 0x08
#define BIOS_TV_ONLY 0x0c