summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGautam <manamgautam@gmail.com>2012-10-31 16:47:52 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2012-10-31 22:04:07 +0800
commit6480bb397b1d74d05c0533069a9e650ed8a67207 (patch)
treeb5fa667d3a85e2c912e74500a56ce5db87bd75e8
parent3c506db67e84234319c0cfa37fee635ba1a5c2da (diff)
downloadvaapi-intel-driver-6480bb397b1d74d05c0533069a9e650ed8a67207.tar.gz
vaapi-intel-driver-6480bb397b1d74d05c0533069a9e650ed8a67207.tar.bz2
vaapi-intel-driver-6480bb397b1d74d05c0533069a9e650ed8a67207.zip
Fix thread issue with AVC private surafce
https://bugs.freedesktop.org/show_bug.cgi?id=55282 Signed-off-by: Gautam <manamgautam@gmail.com> Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
-rw-r--r--src/i965_decoder.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/i965_decoder.h b/src/i965_decoder.h
index 5e66118..5de8085 100644
--- a/src/i965_decoder.h
+++ b/src/i965_decoder.h
@@ -47,6 +47,8 @@ struct gen_buffer {
#if HAVE_GEN_AVC_SURFACE
+static pthread_mutex_t free_avc_surface_lock = PTHREAD_MUTEX_INITIALIZER;
+
typedef struct gen_avc_surface GenAvcSurface;
struct gen_avc_surface
{
@@ -58,10 +60,17 @@ struct gen_avc_surface
static void
gen_free_avc_surface(void **data)
{
- GenAvcSurface *avc_surface = *data;
+ GenAvcSurface *avc_surface;
+
+ pthread_mutex_lock(&free_avc_surface_lock);
+
+ avc_surface = *data;
- if (!avc_surface)
+ if (!avc_surface) {
+ pthread_mutex_unlock(&free_avc_surface_lock);
return;
+ }
+
dri_bo_unreference(avc_surface->dmv_top);
avc_surface->dmv_top = NULL;
@@ -70,6 +79,8 @@ gen_free_avc_surface(void **data)
free(avc_surface);
*data = NULL;
+
+ pthread_mutex_unlock(&free_avc_surface_lock);
}
#endif