hardware/intel/intel-driver
Revisión | 8dda0650b55c467200c34ada127b5d9b54edea5c (tree) |
---|---|
Tiempo | 2015-05-19 02:21:50 |
Autor | Zhao Yakui <yakui.zhao@inte...> |
Commiter | Sean V Kelley |
Decode: Free the allocated internal surface used by JPEG to avoid memory leak
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Sean V Kelley <seanvk@posteo.de>
Tested-by: Sean V Kelley <seanvk@posteo.de>
@@ -3189,8 +3189,11 @@ out: | ||
3189 | 3189 | static void |
3190 | 3190 | gen75_mfd_context_destroy(void *hw_context) |
3191 | 3191 | { |
3192 | + VADriverContextP ctx; | |
3192 | 3193 | struct gen7_mfd_context *gen7_mfd_context = (struct gen7_mfd_context *)hw_context; |
3193 | 3194 | |
3195 | + ctx = (VADriverContextP)(gen7_mfd_context->driver_context); | |
3196 | + | |
3194 | 3197 | dri_bo_unreference(gen7_mfd_context->post_deblocking_output.bo); |
3195 | 3198 | gen7_mfd_context->post_deblocking_output.bo = NULL; |
3196 | 3199 |
@@ -3214,6 +3217,13 @@ gen75_mfd_context_destroy(void *hw_context) | ||
3214 | 3217 | |
3215 | 3218 | dri_bo_unreference(gen7_mfd_context->jpeg_wa_slice_data_bo); |
3216 | 3219 | |
3220 | + if (gen7_mfd_context->jpeg_wa_surface_id != VA_INVALID_SURFACE) { | |
3221 | + i965_DestroySurfaces(ctx, | |
3222 | + &gen7_mfd_context->jpeg_wa_surface_id, | |
3223 | + 1); | |
3224 | + gen7_mfd_context->jpeg_wa_surface_object = NULL; | |
3225 | + } | |
3226 | + | |
3217 | 3227 | intel_batchbuffer_free(gen7_mfd_context->base.batch); |
3218 | 3228 | free(gen7_mfd_context); |
3219 | 3229 | } |
@@ -3263,5 +3273,7 @@ gen75_dec_hw_context_init(VADriverContextP ctx, struct object_config *obj_config | ||
3263 | 3273 | default: |
3264 | 3274 | break; |
3265 | 3275 | } |
3276 | + | |
3277 | + gen7_mfd_context->driver_context = ctx; | |
3266 | 3278 | return (struct hw_context *)gen7_mfd_context; |
3267 | 3279 | } |
@@ -2668,8 +2668,11 @@ out: | ||
2668 | 2668 | static void |
2669 | 2669 | gen7_mfd_context_destroy(void *hw_context) |
2670 | 2670 | { |
2671 | + VADriverContextP ctx; | |
2671 | 2672 | struct gen7_mfd_context *gen7_mfd_context = (struct gen7_mfd_context *)hw_context; |
2672 | 2673 | |
2674 | + ctx = (VADriverContextP)(gen7_mfd_context->driver_context); | |
2675 | + | |
2673 | 2676 | dri_bo_unreference(gen7_mfd_context->post_deblocking_output.bo); |
2674 | 2677 | gen7_mfd_context->post_deblocking_output.bo = NULL; |
2675 | 2678 |
@@ -2693,6 +2696,13 @@ gen7_mfd_context_destroy(void *hw_context) | ||
2693 | 2696 | |
2694 | 2697 | dri_bo_unreference(gen7_mfd_context->jpeg_wa_slice_data_bo); |
2695 | 2698 | |
2699 | + if (gen7_mfd_context->jpeg_wa_surface_id != VA_INVALID_SURFACE) { | |
2700 | + i965_DestroySurfaces(ctx, | |
2701 | + &gen7_mfd_context->jpeg_wa_surface_id, | |
2702 | + 1); | |
2703 | + gen7_mfd_context->jpeg_wa_surface_object = NULL; | |
2704 | + } | |
2705 | + | |
2696 | 2706 | intel_batchbuffer_free(gen7_mfd_context->base.batch); |
2697 | 2707 | free(gen7_mfd_context); |
2698 | 2708 | } |
@@ -2741,5 +2751,7 @@ gen7_dec_hw_context_init(VADriverContextP ctx, struct object_config *obj_config) | ||
2741 | 2751 | default: |
2742 | 2752 | break; |
2743 | 2753 | } |
2754 | + | |
2755 | + gen7_mfd_context->driver_context = ctx; | |
2744 | 2756 | return (struct hw_context *)gen7_mfd_context; |
2745 | 2757 | } |
@@ -93,6 +93,8 @@ struct gen7_mfd_context | ||
93 | 93 | dri_bo *jpeg_wa_slice_data_bo; |
94 | 94 | |
95 | 95 | int wa_mpeg2_slice_vertical_position; |
96 | + | |
97 | + void *driver_context; | |
96 | 98 | }; |
97 | 99 | |
98 | 100 | #endif /* _GEN7_MFD_H_ */ |