• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/intel-driver


Commit MetaInfo

Revisión321523682b52e1479db258a9e5cd207ee0a28521 (tree)
Tiempo2015-05-25 09:25:42
AutorGwenole Beauchesne <gb.devel@gmai...>
CommiterXiang, Haihao

Log Message

vpp: fix memory leak in DNDI code path.

The original current_out_surface was never released on exit. Main
reason for that is the legacy VPP framework that did not allow the
VADriverContextP handle to be passed down to the desired .finalize()
hook. Improved that to bring it on par with the VEBOX code path.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>

Cambiar Resumen

Diferencia incremental

--- a/src/gen8_post_processing.c
+++ b/src/gen8_post_processing.c
@@ -1386,7 +1386,8 @@ gen8_post_processing(
13861386 }
13871387
13881388 static void
1389-gen8_post_processing_context_finalize(struct i965_post_processing_context *pp_context)
1389+gen8_post_processing_context_finalize(VADriverContextP ctx,
1390+ struct i965_post_processing_context *pp_context)
13901391 {
13911392 dri_bo_unreference(pp_context->surface_state_binding_table.bo);
13921393 pp_context->surface_state_binding_table.bo = NULL;
--- a/src/i965_post_processing.c
+++ b/src/i965_post_processing.c
@@ -5272,7 +5272,8 @@ i965_image_processing(VADriverContextP ctx,
52725272 }
52735273
52745274 static void
5275-i965_post_processing_context_finalize(struct i965_post_processing_context *pp_context)
5275+i965_post_processing_context_finalize(VADriverContextP ctx,
5276+ struct i965_post_processing_context *pp_context)
52765277 {
52775278 int i;
52785279
@@ -5301,6 +5302,13 @@ i965_post_processing_context_finalize(struct i965_post_processing_context *pp_co
53015302 dri_bo_unreference(pp_context->pp_dndi_context.stmm_bo);
53025303 pp_context->pp_dndi_context.stmm_bo = NULL;
53035304
5305+ if (pp_context->pp_dndi_context.current_out_surface != VA_INVALID_ID) {
5306+ i965_DestroySurfaces(ctx,
5307+ &pp_context->pp_dndi_context.current_out_surface, 1);
5308+ pp_context->pp_dndi_context.current_out_surface = VA_INVALID_ID;
5309+ pp_context->pp_dndi_context.current_out_obj_surface = NULL;
5310+ }
5311+
53045312 dri_bo_unreference(pp_context->pp_dn_context.stmm_bo);
53055313 pp_context->pp_dn_context.stmm_bo = NULL;
53065314
@@ -5324,7 +5332,7 @@ i965_post_processing_terminate(VADriverContextP ctx)
53245332 struct i965_post_processing_context *pp_context = i965->pp_context;
53255333
53265334 if (pp_context) {
5327- pp_context->finalize(pp_context);
5335+ pp_context->finalize(ctx, pp_context);
53285336 free(pp_context);
53295337 }
53305338
@@ -5938,9 +5946,10 @@ error:
59385946 static void
59395947 i965_proc_context_destroy(void *hw_context)
59405948 {
5941- struct i965_proc_context *proc_context = (struct i965_proc_context *)hw_context;
5949+ struct i965_proc_context * const proc_context = hw_context;
5950+ VADriverContextP const ctx = proc_context->driver_context;
59425951
5943- i965_post_processing_context_finalize(&proc_context->pp_context);
5952+ i965_post_processing_context_finalize(ctx, &proc_context->pp_context);
59445953 intel_batchbuffer_free(proc_context->base.batch);
59455954 free(proc_context);
59465955 }
@@ -5955,6 +5964,7 @@ i965_proc_context_init(VADriverContextP ctx, struct object_config *obj_config)
59555964 proc_context->base.destroy = i965_proc_context_destroy;
59565965 proc_context->base.run = i965_proc_picture;
59575966 proc_context->base.batch = intel_batchbuffer_new(intel, I915_EXEC_RENDER, 0);
5967+ proc_context->driver_context = ctx;
59585968 i965->codec_info->post_processing_context_init(ctx, &proc_context->pp_context, proc_context->base.batch);
59595969
59605970 return (struct hw_context *)proc_context;
--- a/src/i965_post_processing.h
+++ b/src/i965_post_processing.h
@@ -542,12 +542,14 @@ struct i965_post_processing_context
542542 const VARectangle *dst_rect,
543543 int pp_index,
544544 void * filter_param);
545- void (*finalize)(struct i965_post_processing_context *pp_context);
545+ void (*finalize)(VADriverContextP ctx,
546+ struct i965_post_processing_context *pp_context);
546547 };
547548
548549 struct i965_proc_context
549550 {
550551 struct hw_context base;
552+ void *driver_context;
551553 struct i965_post_processing_context pp_context;
552554 };
553555