diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-07-13 10:30:33 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-07-13 10:30:51 +0100 |
commit | 798c3a5fc6e3d44c9b94e6bc4e72385a10939f52 (patch) | |
tree | 27eed41af3dc83d1713b1d1e7e7d700ad6dd8503 /src | |
parent | b2e98227d11a60e90b3ea518f14962f2764ffa68 (diff) |
Teardown the bufmgr on shutdown as well.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel_driver.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/intel_driver.c b/src/intel_driver.c index c02b0040..7761ccf4 100644 --- a/src/intel_driver.c +++ b/src/intel_driver.c @@ -445,43 +445,32 @@ static void intel_close_drm_master(intel_screen_private *intel) } } -static void intel_init_bufmgr(ScrnInfoPtr scrn) +static int intel_init_bufmgr(intel_screen_private *intel) { - intel_screen_private *intel = intel_get_screen_private(scrn); int batch_size; - if (intel->bufmgr) - return; - batch_size = 4096 * 4; - - /* The 865 has issues with larger-than-page-sized batch buffers. */ if (IS_I865G(intel)) + /* The 865 has issues with larger-than-page-sized batch buffers. */ batch_size = 4096; intel->bufmgr = drm_intel_bufmgr_gem_init(intel->drmSubFD, batch_size); + if (!intel->bufmgr) + return FALSE; + drm_intel_bufmgr_gem_enable_reuse(intel->bufmgr); drm_intel_bufmgr_gem_enable_fenced_relocs(intel->bufmgr); list_init(&intel->batch_pixmaps); list_init(&intel->flush_pixmaps); list_init(&intel->in_flight); + + return TRUE; } -static Bool I830DrmModeInit(ScrnInfoPtr scrn) +static void intel_bufmgr_fini(intel_screen_private *intel) { - intel_screen_private *intel = intel_get_screen_private(scrn); - - intel_init_bufmgr(scrn); - - if (drmmode_pre_init(scrn, intel->drmSubFD, intel->cpp) == FALSE) { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, - "Kernel modesetting setup failed\n"); - PreInitCleanup(scrn); - return FALSE; - } - - return TRUE; + drm_intel_bufmgr_destroy(intel->bufmgr); } static void I830XvInit(ScrnInfoPtr scrn) @@ -605,8 +594,15 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags) I830XvInit(scrn); - if (!I830DrmModeInit(scrn)) + if (!intel_init_bufmgr(intel)) { + PreInitCleanup(scrn); return FALSE; + } + + if (!drmmode_pre_init(scrn, intel->drmSubFD, intel->cpp)) { + PreInitCleanup(scrn); + return FALSE; + } if (!xf86SetGamma(scrn, zeros)) { PreInitCleanup(scrn); @@ -1035,6 +1031,7 @@ static void I830FreeScreen(int scrnIndex, int flags) if (intel) { drmmode_fini(intel); intel_close_drm_master(intel); + intel_bufmgr_fini(intel); free(intel); scrn->driverPrivate = NULL; |