From: Xiang, Haihao Date: Sat, 2 Apr 2011 04:38:36 +0000 (+0800) Subject: release all BOs when terminating X-Git-Tag: libva-1.0.13~30^2~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5add274352951f001852815954c13c97d4e9f6b7;p=platform%2Fupstream%2Flibva.git release all BOs when terminating Signed-off-by: Xiang, Haihao --- diff --git a/i965_drv_video/gen6_mfc.c b/i965_drv_video/gen6_mfc.c index 81520ed..602d0d2 100644 --- a/i965_drv_video/gen6_mfc.c +++ b/i965_drv_video/gen6_mfc.c @@ -462,45 +462,37 @@ static void gen6_mfc_init(VADriverContextP ctx) bcs_state->mfc_indirect_pak_bse_object.bo = NULL; for (i = 0; i < NUM_MFC_DMV_BUFFERS; i++){ + dri_bo_unreference(bcs_state->direct_mv_buffers[i].bo); bcs_state->direct_mv_buffers[i].bo = NULL; - } - for (i = 0; i < MAX_MFC_REFERENCE_SURFACES; i++){ - bcs_state->reference_surfaces[i].surface_id = VA_INVALID_SURFACE; } - if ( bcs_state->intra_row_store_scratch_buffer.bo == 0) { - //bo = bcs_state->intra_row_store_scratch_buffer.bo; - //dri_bo_unreference(bo); - bo = dri_bo_alloc(i965->intel.bufmgr, - "Buffer", - 128 * 64, - 64); - assert(bo); - bcs_state->intra_row_store_scratch_buffer.bo = bo; + for (i = 0; i < MAX_MFC_REFERENCE_SURFACES; i++){ + bcs_state->reference_surfaces[i].surface_id = VA_INVALID_SURFACE; } - if ( bcs_state->deblocking_filter_row_store_scratch_buffer.bo == 0) { - //bo = bcs_state->deblocking_filter_row_store_scratch_buffer.bo; - //dri_bo_unreference(bo); - bo = dri_bo_alloc(i965->intel.bufmgr, - "Buffer", - 49152, /* 6 * 128 * 64 */ - 64); - assert(bo); - bcs_state->deblocking_filter_row_store_scratch_buffer.bo = bo; - } + dri_bo_unreference(bcs_state->intra_row_store_scratch_buffer.bo); + bo = dri_bo_alloc(i965->intel.bufmgr, + "Buffer", + 128 * 64, + 64); + assert(bo); + bcs_state->intra_row_store_scratch_buffer.bo = bo; - if ( bcs_state->bsd_mpc_row_store_scratch_buffer.bo == 0) { - //bo = bcs_state->bsd_mpc_row_store_scratch_buffer.bo; - //dri_bo_unreference(bo); - bo = dri_bo_alloc(i965->intel.bufmgr, - "Buffer", - 12288, /* 1.5 * 128 * 64 */ - 0x1000); - assert(bo); - bcs_state->bsd_mpc_row_store_scratch_buffer.bo = bo; - } + dri_bo_unreference(bcs_state->deblocking_filter_row_store_scratch_buffer.bo); + bo = dri_bo_alloc(i965->intel.bufmgr, + "Buffer", + 49152, /* 6 * 128 * 64 */ + 64); + assert(bo); + bcs_state->deblocking_filter_row_store_scratch_buffer.bo = bo; + dri_bo_unreference(bcs_state->bsd_mpc_row_store_scratch_buffer.bo); + bo = dri_bo_alloc(i965->intel.bufmgr, + "Buffer", + 12288, /* 1.5 * 128 * 64 */ + 0x1000); + assert(bo); + bcs_state->bsd_mpc_row_store_scratch_buffer.bo = bo; } void gen6_mfc_avc_pipeline_programing(VADriverContextP ctx, void *obj) diff --git a/i965_drv_video/i965_encoder.c b/i965_drv_video/i965_encoder.c index f5b48d6..cb21344 100644 --- a/i965_drv_video/i965_encoder.c +++ b/i965_drv_video/i965_encoder.c @@ -328,9 +328,12 @@ Bool i965_encoder_terminate(VADriverContextP ctx) { struct i965_driver_data *i965 = i965_driver_data(ctx); struct gen6_media_state *media_state = &i965->gen6_media_state; + struct gen6_mfc_bcs_state *bcs_state = &i965->gen6_mfc_bcs_state; int i; - gen6_vme_terminate(ctx); + if (IS_GEN6(i965->intel.device_id)) { + gen6_vme_terminate(ctx); + } for (i = 0; i < MAX_MEDIA_SURFACES_GEN6; i++) { dri_bo_unreference(media_state->surface_state[i].bo); @@ -352,5 +355,31 @@ Bool i965_encoder_terminate(VADriverContextP ctx) dri_bo_unreference(media_state->vme_state.bo); media_state->vme_state.bo = NULL; + dri_bo_unreference(bcs_state->post_deblocking_output.bo); + bcs_state->post_deblocking_output.bo = NULL; + + dri_bo_unreference(bcs_state->pre_deblocking_output.bo); + bcs_state->pre_deblocking_output.bo = NULL; + + dri_bo_unreference(bcs_state->uncompressed_picture_source.bo); + bcs_state->uncompressed_picture_source.bo = NULL; + + dri_bo_unreference(bcs_state->mfc_indirect_pak_bse_object.bo); + bcs_state->mfc_indirect_pak_bse_object.bo = NULL; + + for (i = 0; i < NUM_MFC_DMV_BUFFERS; i++){ + dri_bo_unreference(bcs_state->direct_mv_buffers[i].bo); + bcs_state->direct_mv_buffers[i].bo = NULL; + } + + dri_bo_unreference(bcs_state->intra_row_store_scratch_buffer.bo); + bcs_state->intra_row_store_scratch_buffer.bo = NULL; + + dri_bo_unreference(bcs_state->deblocking_filter_row_store_scratch_buffer.bo); + bcs_state->deblocking_filter_row_store_scratch_buffer.bo = NULL; + + dri_bo_unreference(bcs_state->bsd_mpc_row_store_scratch_buffer.bo); + bcs_state->bsd_mpc_row_store_scratch_buffer.bo = NULL; + return True; }