diff options
author | Keith Packard <keithp@keithp.com> | 2009-09-30 11:40:19 -0700 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-10-01 11:02:25 +1000 |
commit | db98b26ee145f70e732e2cf4a6ac3de77fdf4adc (patch) | |
tree | 5a4f2718d8cc84713889a9c66308571df598bf8a | |
parent | 873467adad479be02cd9cc6b43685919f5612d91 (diff) |
Re-fix DGA removal.
Removing DGA ended up breaking any drivers calling into the old
xf86DiDGAInit function as it tried to see if DGA was already enabled
and ended up crashing if the VT wasn't completely initialized. Oops.
Also, if the driver initializes DGA itself, have the DiDGA
initialization overwrite that information as the DiDGA code will call
ReInit on mode detect.
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | hw/xfree86/common/xf86DGA.c | 29 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86Crtc.c | 4 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86Crtc.h | 8 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86DiDGA.c | 15 |
4 files changed, 38 insertions, 18 deletions
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 42b7c5805..804fd37c1 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -117,14 +117,28 @@ DGAInit( if(!modes || num <= 0) return FALSE; DGAScreenKey = &DGAScreenKeyIndex; - if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec)))) - return FALSE; + pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); + + if (!pScreenPriv) + { + if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec)))) + return FALSE; + dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv); + pScreenPriv->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = DGACloseScreen; + pScreenPriv->DestroyColormap = pScreen->DestroyColormap; + pScreen->DestroyColormap = DGADestroyColormap; + pScreenPriv->InstallColormap = pScreen->InstallColormap; + pScreen->InstallColormap = DGAInstallColormap; + pScreenPriv->UninstallColormap = pScreen->UninstallColormap; + pScreen->UninstallColormap = DGAUninstallColormap; + } pScreenPriv->pScrn = pScrn; pScreenPriv->numModes = num; pScreenPriv->modes = modes; pScreenPriv->current = NULL; @@ -143,23 +157,12 @@ DGAInit( #ifdef PANORAMIX if(!noPanoramiXExtension) for(i = 0; i < num; i++) modes[i].flags &= ~DGA_PIXMAP_AVAILABLE; #endif - dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv); - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = DGACloseScreen; - pScreenPriv->DestroyColormap = pScreen->DestroyColormap; - pScreen->DestroyColormap = DGADestroyColormap; - pScreenPriv->InstallColormap = pScreen->InstallColormap; - pScreen->InstallColormap = DGAInstallColormap; - pScreenPriv->UninstallColormap = pScreen->UninstallColormap; - pScreen->UninstallColormap = DGAUninstallColormap; - - return TRUE; } /* DGAReInitModes allows the driver to re-initialize * the DGA mode list. */ diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index c1e31e003..506fbb9cb 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -803,13 +803,13 @@ xf86CrtcScreenInit (ScreenPtr screen) screen->CreateScreenResources = xf86CrtcCreateScreenResources; config->CloseScreen = screen->CloseScreen; screen->CloseScreen = xf86CrtcCloseScreen; #ifdef XFreeXDGA - xf86DiDGAInit(screen, 0); + _xf86_di_dga_init_internal(screen); #endif #ifdef RANDR_13_INTERFACE return RANDR_INTERFACE_VERSION; #else return TRUE; #endif @@ -1925,13 +1925,13 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn) scrn->modes = scrn->modes->next; } } scrn->currentMode = scrn->modes; #ifdef XFreeXDGA if (scrn->pScreen) - xf86DiDGAReInit(scrn->pScreen); + _xf86_di_dga_reinit_internal(scrn->pScreen); #endif } static void xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, Bool *enabled) diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index 69afaa5d1..9baa956a3 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -830,20 +830,28 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus); */ #ifdef XFreeXDGA extern _X_EXPORT Bool xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address); +/* this is the real function, used only internally */ +_X_INTERNAL Bool +_xf86_di_dga_init_internal (ScreenPtr pScreen); + /** * Re-initialize dga for this screen (as when the set of modes changes) */ extern _X_EXPORT Bool xf86DiDGAReInit (ScreenPtr pScreen); #endif +/* This is the real function, used only internally */ +_X_INTERNAL Bool +_xf86_di_dga_reinit_internal (ScreenPtr pScreen); + /* * Set the subpixel order reported for the screen using * the information from the outputs */ extern _X_EXPORT void diff --git a/hw/xfree86/modes/xf86DiDGA.c b/hw/xfree86/modes/xf86DiDGA.c index 0f7b8342c..60fbdbf05 100644 --- a/hw/xfree86/modes/xf86DiDGA.c +++ b/hw/xfree86/modes/xf86DiDGA.c @@ -172,12 +172,18 @@ static DGAFunctionRec xf86_dga_funcs = { NULL }; Bool xf86DiDGAReInit (ScreenPtr pScreen) { + return TRUE; +} + +Bool +_xf86_di_dga_reinit_internal (ScreenPtr pScreen) +{ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); if (!DGAAvailable(pScreen->myNum)) return TRUE; @@ -187,18 +193,21 @@ xf86DiDGAReInit (ScreenPtr pScreen) return DGAReInitModes (pScreen, xf86_config->dga_modes, xf86_config->dga_nmode); } Bool xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address) { + return TRUE; +} + +Bool +_xf86_di_dga_init_internal (ScreenPtr pScreen) +{ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); - if (DGAAvailable(pScreen->myNum)) - return TRUE; - xf86_config->dga_flags = 0; xf86_config->dga_address = 0; xf86_config->dga_width = 0; xf86_config->dga_height = 0; xf86_config->dga_stride = 0; |