diff options
author | Jakob Bornecrantz <jakob@vmware.com> | 2010-04-29 13:05:49 +0100 |
---|---|---|
committer | Jakob Bornecrantz <jakob@vmware.com> | 2010-04-29 14:27:35 +0100 |
commit | 366798ac6f10daae059d299b92ddf709875cc7ca (patch) | |
tree | 5205c6bb2b80d3f0e99df78a84c2b076c55acc2e | |
parent | d8f09ddf1e711f5bc801a8926931ebfba5b0ce7f (diff) |
st/xorg: Try hard to not touch hardware after dropping the master
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_driver.c | 37 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_exa.c | 2 |
2 files changed, 27 insertions, 12 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 459d0083ec..44520b81b6 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -334,17 +334,9 @@ static Bool drv_close_resource_management(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); - int i; if (ms->screen) { assert(ms->ctx == NULL); - - for (i = 0; i < XORG_NR_FENCES; i++) { - if (ms->fence[i]) { - ms->screen->fence_finish(ms->screen, ms->fence[i], 0); - ms->screen->fence_reference(ms->screen, &ms->fence[i], NULL); - } - } ms->screen->destroy(ms->screen); } ms->screen = NULL; @@ -357,6 +349,22 @@ drv_close_resource_management(ScrnInfoPtr pScrn) return TRUE; } +static void +drv_cleanup_fences(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + int i; + + assert(ms->screen); + + for (i = 0; i < XORG_NR_FENCES; i++) { + if (ms->fence[i]) { + ms->screen->fence_finish(ms->screen, ms->fence[i], 0); + ms->screen->fence_reference(ms->screen, &ms->fence[i], NULL); + } + } +} + static Bool drv_pre_init(ScrnInfoPtr pScrn, int flags) { @@ -824,6 +832,10 @@ drv_leave_vt(int scrnIndex, int flags) drmModeRmFB(ms->fd, ms->fb_id); ms->fb_id = -1; + /* idle hardware */ + if (!ms->kms) + drv_cleanup_fences(pScrn); + if (drmDropMaster(ms->fd)) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "drmDropMaster failed: %s\n", strerror(errno)); @@ -882,10 +894,6 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen) modesettingPtr ms = modesettingPTR(pScrn); CustomizerPtr cust = ms->cust; - if (pScrn->vtSema) { - drv_leave_vt(scrnIndex, 0); - } - if (ms->cursor) { FreeCursor(ms->cursor, None); ms->cursor = NULL; @@ -917,6 +925,11 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen) xorg_exa_close(pScrn); ms->exa = NULL; + /* calls drop master make sure we don't talk to 3D HW after that */ + if (pScrn->vtSema) { + drv_leave_vt(scrnIndex, 0); + } + drv_close_resource_management(pScrn); drv_close_drm(pScrn); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 65be8c332a..31140f13bb 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -981,6 +981,8 @@ xorg_exa_close(ScrnInfoPtr pScrn) renderer_destroy(exa->renderer); + xorg_exa_finish(exa); + if (exa->pipe) exa->pipe->destroy(exa->pipe); exa->pipe = NULL; |