Merge remote branch 'origin/7.8'
[mesa.git] / src / mesa / drivers / dri / i965 / brw_vtbl.c
index e08f32c4e27b0ceff8afb235af0cd2f3a3e3d122..96a44bfbec74f09d59e461c3cf0a2a500e425ad1 100644 (file)
@@ -67,11 +67,11 @@ static void brw_destroy_context( struct intel_context *intel )
    brw_draw_destroy( brw );
    brw_clear_validated_bos(brw);
    if (brw->wm.compile_data) {
-      _mesa_free(brw->wm.compile_data->instruction);
-      _mesa_free(brw->wm.compile_data->vreg);
-      _mesa_free(brw->wm.compile_data->refs);
-      _mesa_free(brw->wm.compile_data->prog_instructions);
-      _mesa_free(brw->wm.compile_data);
+      free(brw->wm.compile_data->instruction);
+      free(brw->wm.compile_data->vreg);
+      free(brw->wm.compile_data->refs);
+      free(brw->wm.compile_data->prog_instructions);
+      free(brw->wm.compile_data);
    }
 
    for (i = 0; i < brw->state.nr_color_regions; i++)
@@ -102,6 +102,9 @@ static void brw_destroy_context( struct intel_context *intel )
    dri_bo_release(&brw->cc.prog_bo);
    dri_bo_release(&brw->cc.state_bo);
    dri_bo_release(&brw->cc.vp_bo);
+   dri_bo_release(&brw->cc.blend_state_bo);
+   dri_bo_release(&brw->cc.depth_stencil_state_bo);
+   dri_bo_release(&brw->cc.color_calc_state_bo);
 }
 
 
@@ -139,6 +142,12 @@ static void brw_finish_batch(struct intel_context *intel)
 {
    struct brw_context *brw = brw_context(&intel->ctx);
    brw_emit_query_end(brw);
+
+   if (brw->curbe.curbe_bo) {
+      drm_intel_gem_bo_unmap_gtt(brw->curbe.curbe_bo);
+      drm_intel_bo_unreference(brw->curbe.curbe_bo);
+      brw->curbe.curbe_bo = NULL;
+   }
 }
 
 
@@ -149,8 +158,6 @@ static void brw_new_batch( struct intel_context *intel )
 {
    struct brw_context *brw = brw_context(&intel->ctx);
 
-   brw->curbe.need_new_bo = GL_TRUE;
-
    /* Mark all context state as needing to be re-emitted.
     * This is probably not as severe as on 915, since almost all of our state
     * is just in referenced buffers.