From bb68c4eeb1aa718fcf61ffbfc6ee25de172452e6 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Thu, 1 Mar 2012 13:17:54 +0800 Subject: [PATCH] Fix the issue of vaGetImage()/vaPutImage() in multi-threads Signed-off-by: Xiang, Haihao (cherry picked from commit 0b60832061988c68e6a531e6852f02f6308d349c) --- src/i965_drv_video.c | 2 ++ src/i965_drv_video.h | 1 + src/i965_post_processing.c | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c index 81d8c77..7c7cb02 100644 --- a/src/i965_drv_video.c +++ b/src/i965_drv_video.c @@ -1907,6 +1907,7 @@ i965_Init(VADriverContextP ctx) return VA_STATUS_ERROR_UNKNOWN; _i965InitMutex(&i965->render_mutex); + _i965InitMutex(&i965->pp_mutex); return VA_STATUS_SUCCESS; } @@ -3122,6 +3123,7 @@ i965_Terminate(VADriverContextP ctx) if (i965->batch) intel_batchbuffer_free(i965->batch); + _i965DestroyMutex(&i965->pp_mutex); _i965DestroyMutex(&i965->render_mutex); if (i965_render_terminate(ctx) == False) diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h index caf8d98..1a0f97c 100644 --- a/src/i965_drv_video.h +++ b/src/i965_drv_video.h @@ -266,6 +266,7 @@ struct i965_driver_data struct hw_codec_info *codec_info; _I965Mutex render_mutex; + _I965Mutex pp_mutex; struct intel_batchbuffer *batch; struct i965_render_state render_state; void *pp_context; diff --git a/src/i965_post_processing.c b/src/i965_post_processing.c index 9a0e2e5..e4fa880 100644 --- a/src/i965_post_processing.c +++ b/src/i965_post_processing.c @@ -3546,6 +3546,8 @@ i965_post_processing( if (obj_surface->fourcc != VA_FOURCC('N', 'V', '1', '2')) return out_surface_id; + _i965LockMutex(&i965->pp_mutex); + if (flags & I965_PP_FLAG_DEINTERLACING) { status = i965_CreateSurfaces(ctx, obj_surface->orig_width, @@ -3611,6 +3613,8 @@ i965_post_processing( *has_done_scaling = 1; } + + _i965UnlockMutex(&i965->pp_mutex); } return out_surface_id; @@ -3697,6 +3701,8 @@ i965_image_processing(VADriverContextP ctx, if (HAS_PP(i965)) { int fourcc = pp_get_surface_fourcc(ctx, src_surface); + _i965LockMutex(&i965->pp_mutex); + switch (fourcc) { case VA_FOURCC('Y', 'V', '1', '2'): case VA_FOURCC('I', '4', '2', '0'): @@ -3721,6 +3727,8 @@ i965_image_processing(VADriverContextP ctx, status = VA_STATUS_ERROR_UNIMPLEMENTED; break; } + + _i965UnlockMutex(&i965->pp_mutex); } return status; -- 2.11.0