diff options
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i915/i830_vtbl.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_vtbl.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_draw.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_state_cache.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vtbl.c | 34 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_context.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_context.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_regions.c | 10 |
8 files changed, 83 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 0ab27704d5..773a8b4dd0 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -566,6 +566,13 @@ i830_destroy_context(struct intel_context *intel) GLuint i; struct i830_context *i830 = i830_context(&intel->ctx); + intel_region_release(&i830->state.draw_region); + intel_region_release(&i830->state.depth_region); + intel_region_release(&i830->meta.draw_region); + intel_region_release(&i830->meta.depth_region); + intel_region_release(&i830->initial.draw_region); + intel_region_release(&i830->initial.depth_region); + for (i = 0; i < I830_TEX_UNITS; i++) { if (i830->state.tex_buffer[i] != NULL) { dri_bo_unreference(i830->state.tex_buffer[i]); diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index edbbe23e09..7431a9cf76 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -490,6 +490,13 @@ i915_destroy_context(struct intel_context *intel) GLuint i; struct i915_context *i915 = i915_context(&intel->ctx); + intel_region_release(&i915->state.draw_region); + intel_region_release(&i915->state.depth_region); + intel_region_release(&i915->meta.draw_region); + intel_region_release(&i915->meta.depth_region); + intel_region_release(&i915->initial.draw_region); + intel_region_release(&i915->initial.depth_region); + for (i = 0; i < I915_TEX_UNITS; i++) { if (i915->state.tex_buffer[i] != NULL) { dri_bo_unreference(i915->state.tex_buffer[i]); diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 9a353fc7b6..39ce8eb4b6 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -409,8 +409,18 @@ void brw_draw_init( struct brw_context *brw ) void brw_draw_destroy( struct brw_context *brw ) { + int i; + if (brw->vb.upload.bo != NULL) { dri_bo_unreference(brw->vb.upload.bo); brw->vb.upload.bo = NULL; } + + for (i = 0; i < VERT_ATTRIB_MAX; i++) { + dri_bo_unreference(brw->vb.inputs[i].bo); + brw->vb.inputs[i].bo = NULL; + } + + dri_bo_unreference(brw->ib.bo); + brw->ib.bo = NULL; } diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index 1318dea594..d5b5166406 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -497,9 +497,10 @@ void brw_destroy_cache( struct brw_context *brw ) GLuint i; brw_clear_cache(brw); - for (i = 0; i < BRW_MAX_CACHE; i++) + for (i = 0; i < BRW_MAX_CACHE; i++) { + dri_bo_unreference(brw->cache.last_bo[i]); free(brw->cache.name[i]); - + } free(brw->cache.items); brw->cache.items = NULL; brw->cache.size = 0; diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 2a03fc59f3..3780d3dad2 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -51,6 +51,12 @@ #include "brw_vs.h" #include <stdarg.h> +static void +dri_bo_release(dri_bo **bo) +{ + dri_bo_unreference(*bo); + *bo = NULL; +} /* called from intelDestroyContext() */ @@ -58,6 +64,7 @@ static void brw_destroy_context( struct intel_context *intel ) { GLcontext *ctx = &intel->ctx; struct brw_context *brw = brw_context(&intel->ctx); + int i; brw_destroy_metaops(brw); brw_destroy_state(brw); @@ -65,6 +72,33 @@ static void brw_destroy_context( struct intel_context *intel ) brw_ProgramCacheDestroy( ctx ); brw_FrameBufferTexDestroy( brw ); + + for (i = 0; i < brw->state.nr_draw_regions; i++) + intel_region_release(&brw->state.draw_regions[i]); + brw->state.nr_draw_regions = 0; + intel_region_release(&brw->state.depth_region); + + dri_bo_release(&brw->curbe.curbe_bo); + dri_bo_release(&brw->vs.prog_bo); + dri_bo_release(&brw->vs.state_bo); + dri_bo_release(&brw->gs.prog_bo); + dri_bo_release(&brw->gs.state_bo); + dri_bo_release(&brw->clip.prog_bo); + dri_bo_release(&brw->clip.state_bo); + dri_bo_release(&brw->clip.vp_bo); + dri_bo_release(&brw->sf.prog_bo); + dri_bo_release(&brw->sf.state_bo); + dri_bo_release(&brw->sf.vp_bo); + for (i = 0; i < BRW_MAX_TEX_UNIT; i++) + dri_bo_release(&brw->wm.sdc_bo[i]); + dri_bo_release(&brw->wm.bind_bo); + for (i = 0; i < BRW_WM_MAX_SURF; i++) + dri_bo_release(&brw->wm.surf_bo[i]); + dri_bo_release(&brw->wm.prog_bo); + dri_bo_release(&brw->wm.state_bo); + dri_bo_release(&brw->cc.prog_bo); + dri_bo_release(&brw->cc.state_bo); + dri_bo_release(&brw->cc.vp_bo); } /* called from intelDrawBuffer() diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 57e574447a..ccd74baa7c 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -810,7 +810,12 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) intel->Fallback = 0; /* don't call _swrast_Flush later */ intel_batchbuffer_free(intel->batch); + intel->batch = NULL; + free(intel->prim.vb); + intel->prim.vb = NULL; + dri_bo_unreference(intel->prim.vb_bo); + intel->prim.vb_bo = NULL; if (release_texture_heaps) { /* This share group is about to go away, free our private @@ -820,6 +825,13 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) fprintf(stderr, "do something to free texture heaps\n"); } + intel_region_release(&intel->front_region); + intel_region_release(&intel->back_region); + intel_region_release(&intel->third_region); + intel_region_release(&intel->depth_region); + + driDestroyOptionCache(&intel->optionCache); + /* free the Mesa context */ _mesa_free_context_data(&intel->ctx); } diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 4af4cb9c96..554159ac44 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -226,7 +226,6 @@ struct intel_context GLenum reduced_primitive; GLuint vertex_size; GLubyte *verts; /* points to tnl->clipspace.vertex_buf */ - struct intel_region *draw_region; /* Fallback rasterization functions */ diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index cb0f4ba083..45faf64c71 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -478,6 +478,11 @@ intel_recreate_static(struct intel_context *intel, region->pitch = intelScreen->pitch; region->height = intelScreen->height; /* needed? */ + if (region->buffer != NULL) { + dri_bo_unreference(region->buffer); + region->buffer = NULL; + } + if (intel->ttm) { assert(region_desc->bo_handle != -1); region->buffer = intel_bo_gem_create_from_name(intel->bufmgr, @@ -486,6 +491,11 @@ intel_recreate_static(struct intel_context *intel, intel_set_region_tiling_gem(intel, region, region_desc->bo_handle); } else { + if (region->classic_map != NULL) { + drmUnmap(region->classic_map, + region->pitch * region->cpp * region->height); + region->classic_map = NULL; + } ret = drmMap(intel->driFd, region_desc->handle, region->pitch * region->cpp * region->height, ®ion->classic_map); |