From db2268d5b11bfd290251b4aac7045535803f4d96 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 8 Jul 2015 14:13:27 +0200 Subject: vaapi: drop compatibility crap and vo_vaapi deinterlacer Drop libva versions below 0.34.0. These are ancient, so I don't care. Drop the vo_vaapi deinterlacer as well. With 0.34.0, VPP is always available, and deinterlacing is done with vf_vavpp. The vaCreateSurfaces() function changes its signature - actually it did in 0.34.0 or so, and the defined a macro to make it use the old signature. --- video/filter/vf.c | 2 +- video/out/vo_vaapi.c | 46 +++++++++------------------------------------- video/vaapi.c | 12 +++++------- video/vaapi.h | 51 --------------------------------------------------- wscript | 2 +- 5 files changed, 16 insertions(+), 97 deletions(-) diff --git a/video/filter/vf.c b/video/filter/vf.c index 4f9f43f2e0..6b963e3117 100644 --- a/video/filter/vf.c +++ b/video/filter/vf.c @@ -101,7 +101,7 @@ static const vf_info_t *const filter_list[] = { #if HAVE_VAPOURSYNTH_CORE && HAVE_VAPOURSYNTH_LAZY &vf_info_vapoursynth_lazy, #endif -#if HAVE_VAAPI_VPP +#if HAVE_VAAPI &vf_info_vaapi, #endif #if HAVE_VDPAU diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c index 69097021fd..cf50e585a3 100644 --- a/video/out/vo_vaapi.c +++ b/video/out/vo_vaapi.c @@ -82,9 +82,6 @@ struct priv { int visible_surface; int scaling; int force_scaled_osd; - // with old libva versions only - int deint; - int deint_type; VAImageFormat osd_format; // corresponds to OSD_VA_FORMAT struct vaapi_osd_part osd_parts[MAX_OSD_PARTS]; @@ -207,7 +204,6 @@ static bool render_to_screen(struct priv *p, struct mp_image *mpi) surface = va_surface_id(p->black_surface); } - int fields = mpi ? mpi->fields : 0; if (surface == VA_INVALID_ID) return false; @@ -220,23 +216,19 @@ static bool render_to_screen(struct priv *p, struct mp_image *mpi) int flags = 0; if (p->osd_screen) flags |= VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD; - status = vaAssociateSubpicture2(p->display, - sp->id, &surface, 1, - sp->src_x, sp->src_y, - sp->src_w, sp->src_h, - sp->dst_x, sp->dst_y, - sp->dst_w, sp->dst_h, - flags); + status = vaAssociateSubpicture(p->display, + sp->id, &surface, 1, + sp->src_x, sp->src_y, + sp->src_w, sp->src_h, + sp->dst_x, sp->dst_y, + sp->dst_w, sp->dst_h, + flags); CHECK_VA_STATUS(p, "vaAssociateSubpicture()"); } } - int flags = va_get_colorspace_flag(p->image_params.colorspace) | p->scaling; - if (p->deint && (fields & MP_IMGFIELD_INTERLACED)) { - flags |= (fields & MP_IMGFIELD_TOP_FIRST) ? VA_BOTTOM_FIELD : VA_TOP_FIELD; - } else { - flags |= VA_FRAME_PICTURE; - } + int flags = va_get_colorspace_flag(p->image_params.colorspace) | + p->scaling | VA_FRAME_PICTURE; status = vaPutSurface(p->display, surface, p->vo->x11->window, @@ -524,16 +516,6 @@ static int control(struct vo *vo, uint32_t request, void *data) struct priv *p = vo->priv; switch (request) { - case VOCTRL_GET_DEINTERLACE: - if (!p->deint_type) - break; - *(int*)data = !!p->deint; - return VO_TRUE; - case VOCTRL_SET_DEINTERLACE: - if (!p->deint_type) - break; - p->deint = *(int*)data ? p->deint_type : 0; - return VO_TRUE; case VOCTRL_GET_HWDEC_INFO: { struct mp_hwdec_info **arg = data; *arg = &p->hwdec_info; @@ -684,23 +666,13 @@ const struct vo_driver video_out_vaapi = { .priv_size = sizeof(struct priv), .priv_defaults = &(const struct priv) { .scaling = VA_FILTER_SCALING_DEFAULT, - .deint = 0, -#if !HAVE_VAAPI_VPP - .deint_type = 2, -#endif }, .options = (const struct m_option[]) { -#if USE_VAAPI_SCALING OPT_CHOICE("scaling", scaling, 0, ({"default", VA_FILTER_SCALING_DEFAULT}, {"fast", VA_FILTER_SCALING_FAST}, {"hq", VA_FILTER_SCALING_HQ}, {"nla", VA_FILTER_SCALING_NL_ANAMORPHIC})), -#endif - OPT_CHOICE("deint", deint_type, 0, - ({"no", 0}, - {"first-field", 1}, - {"bob", 2})), OPT_FLAG("scaled-osd", force_scaled_osd, 0), {0} }, diff --git a/video/vaapi.c b/video/vaapi.c index d00d187eba..f907824f3b 100644 --- a/video/vaapi.c +++ b/video/vaapi.c @@ -36,13 +36,11 @@ bool check_va_status(struct mp_log *log, VAStatus status, const char *msg) int va_get_colorspace_flag(enum mp_csp csp) { -#if USE_VAAPI_COLORSPACE switch (csp) { case MP_CSP_BT_601: return VA_SRC_BT601; case MP_CSP_BT_709: return VA_SRC_BT709; case MP_CSP_SMPTE_240M: return VA_SRC_SMPTE_240; } -#endif return 0; } @@ -231,7 +229,7 @@ static struct mp_image *alloc_surface(struct mp_vaapi_ctx *ctx, int rt_format, VASurfaceID id = VA_INVALID_ID; VAStatus status; va_lock(ctx); - status = vaCreateSurfaces(ctx->display, w, h, rt_format, 1, &id); + status = vaCreateSurfaces(ctx->display, rt_format, w, h, &id, 1, NULL, 0); va_unlock(ctx); if (!CHECK_VA_STATUS(ctx, "vaCreateSurfaces()")) return NULL; @@ -368,10 +366,10 @@ int va_surface_upload(struct mp_image *va_dst, struct mp_image *sw_src) va_image_unmap(p->ctx, &p->image); va_lock(p->ctx); - VAStatus status = vaPutImage2(p->display, p->id, - p->image.image_id, - 0, 0, sw_src->w, sw_src->h, - 0, 0, sw_src->w, sw_src->h); + VAStatus status = vaPutImage(p->display, p->id, + p->image.image_id, + 0, 0, sw_src->w, sw_src->h, + 0, 0, sw_src->w, sw_src->h); va_unlock(p->ctx); if (!CHECK_VA_STATUS(p->ctx, "vaPutImage()")) return -1; diff --git a/video/vaapi.h b/video/vaapi.h index e3310bcee0..7ed61669f5 100644 --- a/video/vaapi.h +++ b/video/vaapi.h @@ -24,57 +24,6 @@ #include #include -/* Compatibility glue with VA-API >= 0.31 */ -#if defined VA_CHECK_VERSION -#if VA_CHECK_VERSION(0,31,0) -#define vaPutImage2 vaPutImage -#define vaAssociateSubpicture2 vaAssociateSubpicture -#endif -#endif - -/* Compatibility glue with VA-API >= 0.34 */ -#if VA_CHECK_VERSION(0,34,0) -#include -#endif - -/* Compatibility glue with upstream libva */ -#ifndef VA_SDS_VERSION -#define VA_SDS_VERSION 0 -#endif - -/* Compatibility glue with VA-API >= 0.30 */ -#ifndef VA_INVALID_ID -#define VA_INVALID_ID 0xffffffff -#endif -#ifndef VA_FOURCC -#define VA_FOURCC(ch0, ch1, ch2, ch3) \ - ((uint32_t)(uint8_t)(ch0) | \ - ((uint32_t)(uint8_t)(ch1) << 8) | \ - ((uint32_t)(uint8_t)(ch2) << 16) | \ - ((uint32_t)(uint8_t)(ch3) << 24 )) -#endif -#if defined VA_SRC_BT601 && defined VA_SRC_BT709 -# define USE_VAAPI_COLORSPACE 1 -#else -# define USE_VAAPI_COLORSPACE 0 -#endif - -/* Compatibility glue with VA-API >= 0.31.1 */ -#ifndef VA_SRC_SMPTE_240 -#define VA_SRC_SMPTE_240 0x00000040 -#endif -#if defined VA_FILTER_SCALING_MASK -# define USE_VAAPI_SCALING 1 -#else -# define USE_VAAPI_SCALING 0 -#endif - -#ifndef VA_FOURCC_YV12 -#define VA_FOURCC_YV12 0x32315659 -#endif -#ifndef VA_FOURCC_IYUV -#define VA_FOURCC_IYUV 0x56555949 -#endif #ifndef VA_FOURCC_I420 #define VA_FOURCC_I420 VA_FOURCC('I', '4', '2', '0') #endif diff --git a/wscript b/wscript index dbc575d620..1cad348231 100644 --- a/wscript +++ b/wscript @@ -627,7 +627,7 @@ video_output_features = [ 'desc': 'VAAPI acceleration', 'deps': [ 'x11', 'libdl' ], 'func': check_pkg_config( - 'libva', '>= 0.32.0', 'libva-x11', '>= 0.32.0'), + 'libva', '>= 0.34.0', 'libva-x11', '>= 0.34.0'), }, { 'name': '--vaapi-vpp', 'desc': 'VAAPI VPP', -- cgit v1.2.3