diff options
author | Tilman Sauerbeck <tilman@code-monkey.de> | 2007-08-01 22:31:47 +0200 |
---|---|---|
committer | Tilman Sauerbeck <tilman@code-monkey.de> | 2007-08-01 22:31:47 +0200 |
commit | cda9ccbe2723c13052f48aed516f07263a02d347 (patch) | |
tree | 88b9c34fa2490f6ef9d0da1774e9219f0649d745 /src | |
parent | 71c5c6de8c1fa39cfd668348ad0c02b913eb205e (diff) |
Fixed CRTC and output instantiation.
Now the G-class crtc and outputs are actually only used on G-class
cards. Also hooked up the 2064 crtc and output.
Diffstat (limited to 'src')
-rw-r--r-- | src/mga.h | 3 | ||||
-rw-r--r-- | src/mga_2064_crtc.c | 21 | ||||
-rw-r--r-- | src/mga_2064_output.c | 2 | ||||
-rw-r--r-- | src/mga_driver.c | 31 |
4 files changed, 47 insertions, 10 deletions
@@ -636,6 +636,9 @@ void MGAG200SESaveMode(ScrnInfoPtr, vgaRegPtr); void MGAG200SERestoreMode(ScrnInfoPtr, vgaRegPtr); void MGAG200SEHWProtect(ScrnInfoPtr, Bool); +Bool Mga2064CrtcInit(ScrnInfoPtr pScrn); +xf86OutputPtr Mga2064OutputInit(ScrnInfoPtr pScrn); + Bool MgaGCrtc1Init(ScrnInfoPtr pScrn); Bool MgaGCrtc2Init(ScrnInfoPtr pScrn); diff --git a/src/mga_2064_crtc.c b/src/mga_2064_crtc.c index fa4fb1f..1230420 100644 --- a/src/mga_2064_crtc.c +++ b/src/mga_2064_crtc.c @@ -919,3 +919,24 @@ crtc_destroy(xf86CrtcPtr crtc) if (crtc->driver_private) xfree (crtc->driver_private); } + +Bool +Mga2064CrtcInit(ScrnInfoPtr scrn) +{ + xf86CrtcPtr crtc; + MgaCrtcDataPtr data; + + data = xnfcalloc (sizeof (MgaCrtcDataRec), 1); + if (!data) + return FALSE; + + crtc = xf86CrtcCreate (scrn, &crtc_funcs); + if (!crtc) { + xfree(data); + return FALSE; + } + + crtc->driver_private = data; + + return TRUE; +} diff --git a/src/mga_2064_output.c b/src/mga_2064_output.c index d4c655c..d2d148c 100644 --- a/src/mga_2064_output.c +++ b/src/mga_2064_output.c @@ -172,7 +172,7 @@ output_destroy(xf86OutputPtr output) } xf86OutputPtr -MgaOutput2064New(ScrnInfoPtr scrn) +Mga2064OutputInit(ScrnInfoPtr scrn) { MGAPtr pMga = MGAPTR(scrn); xf86OutputPtr output; diff --git a/src/mga_driver.c b/src/mga_driver.c index 71b9857..ac23634 100644 --- a/src/mga_driver.c +++ b/src/mga_driver.c @@ -1076,7 +1076,7 @@ MGAMavenRead(ScrnInfoPtr pScrn, I2CByte reg, I2CByte *val) } static void -setup_outputs(ScrnInfoPtr scrn) +setup_g_outputs(ScrnInfoPtr scrn) { MGAPtr pMga; xf86OutputPtr output; @@ -1126,7 +1126,8 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) ClockRangePtr clockRanges; const char *s; int flags24; - Bool Default; + Bool Default, is_2064 = FALSE; + xf86OutputPtr output; /* * Note: This function is only called once at server startup, and @@ -1529,8 +1530,8 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) case PCI_CHIP_MGA2064: case PCI_CHIP_MGA2164: case PCI_CHIP_MGA2164_AGP: + is_2064 = TRUE; MGA2064SetupFuncs(pScrn); - /* register 2064 CRTC and output */ break; case PCI_CHIP_MGA1064: case PCI_CHIP_MGAG100: @@ -1748,17 +1749,29 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) xf86CrtcSetSizeRange(pScrn, 320, 200, 2560, 1024); - /* FIXME: - * Obviously, this cannot be done unconditionally. - */ - MgaGCrtc1Init (pScrn); - MgaGCrtc2Init (pScrn); + if (is_2064) + Mga2064CrtcInit (pScrn); + else { + switch(pMga->Chipset) { + case PCI_CHIP_MGAG400: + case PCI_CHIP_MGAG550: + MgaGCrtc1Init (pScrn); + MgaGCrtc2Init (pScrn); + break; + default: + MgaGCrtc1Init (pScrn); + } + } if (pMga->i2cInit) { pMga->i2cInit(pScrn); } - setup_outputs(pScrn); + if (is_2064) { + output = Mga2064OutputInit (pScrn); + output->possible_crtcs = 1; + } else + setup_g_outputs (pScrn); /* * fill MGAdac struct |