From d9572c8d11198f0624ac1aed44c41c0e5930098e Mon Sep 17 00:00:00 2001 From: Pengfei Qu Date: Thu, 22 Oct 2015 04:39:07 -0400 Subject: VP9 HWDec:add vp9 surface structure and related parameter Signed-off-by: Pengfei Qu Signed-off-by: Sirisha Muppavarapu Signed-off-by: peng.chen Reviewed-by: Zhao Yakui (cherry picked from commit f36ab3413f814c80f4df4f4570f4ef9a1168b624) --- src/i965_defines.h | 9 +++++++++ src/intel_media.h | 11 +++++++++++ src/intel_media_common.c | 24 ++++++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/src/i965_defines.h b/src/i965_defines.h index 65c0b11..9ea8a9f 100755 --- a/src/i965_defines.h +++ b/src/i965_defines.h @@ -437,6 +437,9 @@ #define HCP_PAK_OBJECT HCP(0x21) #define HCP_INSERT_PAK_OBJECT HCP(0x22) +#define HCP_VP9_SEGMENT_STATE HCP(0x32) +#define HCP_VP9_PIC_STATE HCP(0x30) + #define I965_DEPTHFORMAT_D32_FLOAT 1 #define BASE_ADDRESS_MODIFY (1 << 0) @@ -906,6 +909,12 @@ #define HCP_CODEC_HEVC 0 +#define HCP_CODEC_VP9 1 +#define HCP_VP9_KEY_FRAME 0 +#define HCP_VP9_INTER_FRAME 1 +#define HCP_VP9_PROFILE0 0 /* 8 bit 420 only */ +#define HCP_VP9_PROFILE2 2 /* 10 bits 420 only */ + #define HCP_CODEC_SELECT_DECODE 0 #define HCP_CODEC_SELECT_ENCODE 1 diff --git a/src/intel_media.h b/src/intel_media.h index 73a03c7..77afb5a 100644 --- a/src/intel_media.h +++ b/src/intel_media.h @@ -59,6 +59,17 @@ struct gen_hevc_surface dri_bo *motion_vector_temporal_bo; }; +typedef struct gen_vp9_surface GenVP9Surface; +struct gen_vp9_surface +{ + GenCodecSurface base; + uint16_t frame_width; + uint16_t frame_height; + dri_bo *motion_vector_temporal_bo; +}; + extern void gen_free_hevc_surface(void **data); +extern void gen_free_vp9_surface(void **data); + #endif /* INTEL_MEDIA_H */ diff --git a/src/intel_media_common.c b/src/intel_media_common.c index f0e1cae..5fe9fc5 100644 --- a/src/intel_media_common.c +++ b/src/intel_media_common.c @@ -107,3 +107,27 @@ gen_free_hevc_surface(void **data) pthread_mutex_unlock(&free_hevc_surface_lock); } + +static pthread_mutex_t free_vp9_surface_lock = PTHREAD_MUTEX_INITIALIZER; + +void gen_free_vp9_surface(void **data) +{ + GenVP9Surface *vp9_surface; + + pthread_mutex_lock(&free_vp9_surface_lock); + + vp9_surface = *data; + + if (!vp9_surface) { + pthread_mutex_unlock(&free_vp9_surface_lock); + return; + } + + dri_bo_unreference(vp9_surface->motion_vector_temporal_bo); + vp9_surface->motion_vector_temporal_bo = NULL; + + free(vp9_surface); + *data = NULL; + + pthread_mutex_unlock(&free_vp9_surface_lock); +} -- cgit v1.2.3