diff -crB intel-driver-1.0.18/src/gen6_mfd.c intel-driver-1.0.18_patch/src/gen6_mfd.c *** intel-driver-1.0.18/src/gen6_mfd.c Mon May 28 23:22:14 2012 --- intel-driver-1.0.18_patch/src/gen6_mfd.c Fri Oct 12 12:30:28 2012 *************** *** 40,45 **** --- 40,47 ---- #include "gen6_mfd.h" + pthread_mutex_t free_avc_surface_lock; + static const uint32_t zigzag_direct[64] = { 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, *************** *** 170,179 **** static void gen6_mfd_free_avc_surface(void **data) { - struct gen6_avc_surface *gen6_avc_surface = *data; if (!gen6_avc_surface) ! return; dri_bo_unreference(gen6_avc_surface->dmv_top); gen6_avc_surface->dmv_top = NULL; --- 172,189 ---- static void gen6_mfd_free_avc_surface(void **data) { + struct gen6_avc_surface *gen6_avc_surface; + + pthread_mutex_lock(&free_avc_surface_lock); + + gen6_avc_surface = *data; if (!gen6_avc_surface) ! { ! pthread_mutex_unlock(&free_avc_surface_lock); ! return; ! } ! dri_bo_unreference(gen6_avc_surface->dmv_top); gen6_avc_surface->dmv_top = NULL; *************** *** 182,187 **** --- 192,200 ---- free(gen6_avc_surface); *data = NULL; + + pthread_mutex_unlock(&free_avc_surface_lock); + } static void