[Libva] [PATCH libva-intel-driver] gen8_mfd: free surface used by JPEG decode

Sean V Kelley seanvk at posteo.de
Tue May 19 15:30:27 PDT 2015


Artie,

> On May 19, 2015, at 14:59, U. Artie Eoff <ullysses.a.eoff at intel.com> wrote:
> 
> This is a follow up to previous commit:
> 
> commit 8dda0650b55c467200c34ada127b5d9b54edea5c
> Author: Zhao Yakui <yakui.zhao at intel.com>
> Date:   Tue May 5 17:56:38 2015 +0800
> 


Please resubmit your patch, with you as author as you are accounting for the GEN8 case
of inadvertent WA enabling.  GEN7 changes are already merged.

Thanks,

Sean


>    Decode: Free the allocated internal surface used by JPEG to avoid memory leak
> 
> For GEN8, this code path is normally disabled by default.
> However, one can enable this code path by defining JPEG_WA
> during compilation.  In that case, we would enable the
> same memory leak.  Thus, apply the same fix in gen8_mfd to
> fix it.
> 
> Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>
> ---
> src/gen8_mfd.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
> 
> diff --git a/src/gen8_mfd.c b/src/gen8_mfd.c
> index 6618740..f045ca4 100644
> --- a/src/gen8_mfd.c
> +++ b/src/gen8_mfd.c
> @@ -3112,8 +3112,11 @@ out:
> static void
> gen8_mfd_context_destroy(void *hw_context)
> {
> +    VADriverContextP ctx;
>     struct gen7_mfd_context *gen7_mfd_context = (struct gen7_mfd_context *)hw_context;
> 
> +    ctx = (VADriverContextP)(gen7_mfd_context->driver_context);
> +
>     dri_bo_unreference(gen7_mfd_context->post_deblocking_output.bo);
>     gen7_mfd_context->post_deblocking_output.bo = NULL;
> 
> @@ -3140,6 +3143,13 @@ gen8_mfd_context_destroy(void *hw_context)
> 
>     dri_bo_unreference(gen7_mfd_context->jpeg_wa_slice_data_bo);
> 
> +    if (gen7_mfd_context->jpeg_wa_surface_id != VA_INVALID_SURFACE) {
> +        i965_DestroySurfaces(ctx,
> +                             &gen7_mfd_context->jpeg_wa_surface_id,
> +                             1);
> +        gen7_mfd_context->jpeg_wa_surface_object = NULL;
> +    }
> +
>     intel_batchbuffer_free(gen7_mfd_context->base.batch);
>     free(gen7_mfd_context);
> }
> @@ -3188,5 +3198,7 @@ gen8_dec_hw_context_init(VADriverContextP ctx, struct object_config *obj_config)
>     default:
>         break;
>     }
> +
> +    gen7_mfd_context->driver_context = ctx;
>     return (struct hw_context *)gen7_mfd_context;
> }
> -- 
> 1.9.3
> 
> _______________________________________________
> Libva mailing list
> Libva at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libva



More information about the Libva mailing list