diff options
author | Keith Packard <keithp@bouzouki.jf.intel.com> | 2006-12-04 14:02:30 -0800 |
---|---|---|
committer | Keith Packard <keithp@bouzouki.jf.intel.com> | 2006-12-04 14:02:30 -0800 |
commit | 2e8c927f9308069a82f25b65bb0c62bc5a156832 (patch) | |
tree | da916562cf71dc2c6cb8af093f151f822a84ed52 | |
parent | 8fcf9a81179ee8577ddab5e904c58fbfd14cf59c (diff) |
Re-create RandR Crtc/output structures on server regen.
RandR structures must be re-created when the server reinitializes,
but the driver PreInit function is not re-invoked. Recreate them
manually in this case during ScreenInit.
-rw-r--r-- | src/i830_driver.c | 1 | ||||
-rw-r--r-- | src/i830_randr.c | 3 | ||||
-rw-r--r-- | src/i830_xf86Crtc.c | 58 | ||||
-rw-r--r-- | src/i830_xf86Crtc.h | 6 |
4 files changed, 66 insertions, 2 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c index 3aafe3aa..c85fe4e6 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -3805,6 +3805,7 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen) DPRINTF(PFX, "\nUnmapping memory\n"); I830UnmapMem(pScrn); vgaHWUnmapMem(pScrn); + xf86CrtcCloseScreen (pScreen); if (pI830->ScanlineColorExpandBuffers) { xfree(pI830->ScanlineColorExpandBuffers); diff --git a/src/i830_randr.c b/src/i830_randr.c index da8d7460..00770201 100644 --- a/src/i830_randr.c +++ b/src/i830_randr.c @@ -900,6 +900,9 @@ xf86RandR12Init12 (ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; rrScrPrivPtr rp = rrGetScrPriv(pScreen); + if (xf86CrtcScreenInit (pScreen)) + return FALSE; + rp->rrGetInfo = xf86RandR12GetInfo12; rp->rrScreenSetSize = xf86RandR12ScreenSetSize; rp->rrCrtcSet = xf86RandR12CrtcSet; diff --git a/src/i830_xf86Crtc.c b/src/i830_xf86Crtc.c index 2eb775bf..7eb581c9 100644 --- a/src/i830_xf86Crtc.c +++ b/src/i830_xf86Crtc.c @@ -68,7 +68,8 @@ xf86CrtcDestroy (xf86CrtcPtr crtc) (*crtc->funcs->destroy) (crtc); #ifdef RANDR_12_INTERFACE - RRCrtcDestroy (crtc->randr_crtc); + if (crtc->randr_crtc) + RRCrtcDestroy (crtc->randr_crtc); #endif for (c = 0; c < xf86_config->num_crtc; c++) if (xf86_config->crtc[c] == crtc) @@ -122,7 +123,8 @@ xf86OutputDestroy (xf86OutputPtr output) (*output->funcs->destroy) (output); #ifdef RANDR_12_INTERFACE - RROutputDestroy (output->randr_output); + if (output->randr_output) + RROutputDestroy (output->randr_output); #endif while (output->probed_modes) xf86DeleteMode (&output->probed_modes, output->probed_modes); @@ -138,3 +140,55 @@ xf86OutputDestroy (xf86OutputPtr output) xfree (output); } +Bool +xf86CrtcScreenInit (ScreenPtr pScreen) +{ +#ifdef RANDR_12_INTERFACE + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + int i; + + for (i = 0; i < xf86_config->num_crtc; i++) + { + xf86CrtcPtr crtc = xf86_config->crtc[i]; + + if (!crtc->randr_crtc) + crtc->randr_crtc = RRCrtcCreate (crtc); + if (!crtc->randr_crtc) + return FALSE; + } + for (i = 0; i < xf86_config->num_output; i++) + { + xf86OutputPtr output = xf86_config->output[i]; + + if (!output->randr_output) + output->randr_output = RROutputCreate (output->name, + strlen (output->name), + output); + if (!output->randr_output) + return FALSE; + } +#endif + return TRUE; +} + +void +xf86CrtcCloseScreen (ScreenPtr pScreen) +{ +#ifdef RANDR_12_INTERFACE + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + int i; + + for (i = 0; i < xf86_config->num_crtc; i++) + { + xf86CrtcPtr crtc = xf86_config->crtc[i]; + crtc->randr_crtc = NULL; + } + for (i = 0; i < xf86_config->num_output; i++) + { + xf86OutputPtr output = xf86_config->output[i]; + output->randr_output = NULL; + } +#endif +} diff --git a/src/i830_xf86Crtc.h b/src/i830_xf86Crtc.h index 2952c8d5..21ba1fcf 100644 --- a/src/i830_xf86Crtc.h +++ b/src/i830_xf86Crtc.h @@ -307,4 +307,10 @@ xf86OutputCreate (ScrnInfoPtr scrn, void xf86OutputDestroy (xf86OutputPtr output); +Bool +xf86CrtcScreenInit (ScreenPtr pScreen); + +void +xf86CrtcCloseScreen (ScreenPtr pScreen); + #endif /* _XF86CRTC_H_ */ |