diff options
author | Zhao Yakui <yakui.zhao@intel.com> | 2012-10-31 16:47:59 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2012-10-31 22:04:07 +0800 |
commit | 3bd6f3b3611dd9a39a3075f82cf938fa08e22884 (patch) | |
tree | 1d4c4b5a5e9260e9e8406cd90fd9856679a1e948 | |
parent | 132e945297bb64baf7e34d2946900d818d112000 (diff) | |
download | vaapi-intel-driver-3bd6f3b3611dd9a39a3075f82cf938fa08e22884.tar.gz vaapi-intel-driver-3bd6f3b3611dd9a39a3075f82cf938fa08e22884.tar.bz2 vaapi-intel-driver-3bd6f3b3611dd9a39a3075f82cf938fa08e22884.zip |
Avoid the dup of gen_free_avc_surface during compile
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
-rwxr-xr-x | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/gen6_mfc_common.c | 4 | ||||
-rwxr-xr-x | src/gen6_mfd.c | 4 | ||||
-rw-r--r-- | src/gen75_mfd.c | 4 | ||||
-rwxr-xr-x | src/gen7_mfd.c | 4 | ||||
-rw-r--r-- | src/i965_avc_bsd.c | 4 | ||||
-rw-r--r-- | src/intel_media.h | 30 | ||||
-rw-r--r-- | src/intel_media_common.c | 58 |
8 files changed, 60 insertions, 49 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 69d101f..354b890 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -76,6 +76,7 @@ source_c = \ intel_driver.c \ intel_memman.c \ object_heap.c \ + intel_media_common.c \ $(NULL) source_h = \ diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c index 12ffeaa..4e23705 100644 --- a/src/gen6_mfc_common.c +++ b/src/gen6_mfc_common.c @@ -27,10 +27,6 @@ * */ -#ifndef HAVE_GEN_AVC_SURFACE -#define HAVE_GEN_AVC_SURFACE 1 -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/src/gen6_mfd.c b/src/gen6_mfd.c index 6a39ff1..1790053 100755 --- a/src/gen6_mfd.c +++ b/src/gen6_mfd.c @@ -26,10 +26,6 @@ * */ -#ifndef HAVE_GEN_AVC_SURFACE -#define HAVE_GEN_AVC_SURFACE 1 -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/src/gen75_mfd.c b/src/gen75_mfd.c index a0aa960..2b77f7b 100644 --- a/src/gen75_mfd.c +++ b/src/gen75_mfd.c @@ -27,10 +27,6 @@ * */ -#ifndef HAVE_GEN_AVC_SURFACE -#define HAVE_GEN_AVC_SURFACE 1 -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/src/gen7_mfd.c b/src/gen7_mfd.c index e4dfbb2..fe333ed 100755 --- a/src/gen7_mfd.c +++ b/src/gen7_mfd.c @@ -26,10 +26,6 @@ * */ -#ifndef HAVE_GEN_AVC_SURFACE -#define HAVE_GEN_AVC_SURFACE 1 -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/src/i965_avc_bsd.c b/src/i965_avc_bsd.c index 439498a..8921275 100644 --- a/src/i965_avc_bsd.c +++ b/src/i965_avc_bsd.c @@ -30,10 +30,6 @@ #include <string.h> #include <assert.h> -#ifndef HAVE_GEN_AVC_SURFACE -#define HAVE_GEN_AVC_SURFACE 1 -#endif - #include "intel_batchbuffer.h" #include "intel_driver.h" diff --git a/src/intel_media.h b/src/intel_media.h index 5493c60..ca1a78f 100644 --- a/src/intel_media.h +++ b/src/intel_media.h @@ -31,9 +31,7 @@ #include <va/va.h> #include <intel_bufmgr.h> -#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 @@ -43,32 +41,6 @@ struct gen_avc_surface int dmv_bottom_flag; }; -static void -gen_free_avc_surface(void **data) -{ - GenAvcSurface *avc_surface; - - pthread_mutex_lock(&free_avc_surface_lock); - - avc_surface = *data; - - if (!avc_surface) { - pthread_mutex_unlock(&free_avc_surface_lock); - return; - } - - - dri_bo_unreference(avc_surface->dmv_top); - avc_surface->dmv_top = NULL; - dri_bo_unreference(avc_surface->dmv_bottom); - avc_surface->dmv_bottom = NULL; - - free(avc_surface); - *data = NULL; - - pthread_mutex_unlock(&free_avc_surface_lock); -} - -#endif +extern void gen_free_avc_surface(void **data); #endif /* INTEL_MEDIA_H */ diff --git a/src/intel_media_common.c b/src/intel_media_common.c new file mode 100644 index 0000000..c90d893 --- /dev/null +++ b/src/intel_media_common.c @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2006-2012 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include "intel_driver.h" +#include "intel_media.h" + +static pthread_mutex_t free_avc_surface_lock = PTHREAD_MUTEX_INITIALIZER; + +void +gen_free_avc_surface(void **data) +{ + GenAvcSurface *avc_surface; + + pthread_mutex_lock(&free_avc_surface_lock); + + avc_surface = *data; + + if (!avc_surface) { + pthread_mutex_unlock(&free_avc_surface_lock); + return; + } + + + dri_bo_unreference(avc_surface->dmv_top); + avc_surface->dmv_top = NULL; + dri_bo_unreference(avc_surface->dmv_bottom); + avc_surface->dmv_bottom = NULL; + + free(avc_surface); + *data = NULL; + + pthread_mutex_unlock(&free_avc_surface_lock); +} |