mirror of
https://github.com/mpv-player/mpv
synced 2025-02-21 23:36:58 +00:00
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 <va/va_compat.h> defined a macro to make it use the old signature.
This commit is contained in:
parent
4781f9e69a
commit
db2268d5b1
@ -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
|
||||
|
@ -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}
|
||||
},
|
||||
|
@ -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;
|
||||
|
@ -24,57 +24,6 @@
|
||||
#include <va/va.h>
|
||||
#include <va/va_x11.h>
|
||||
|
||||
/* 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 <va/va_compat.h>
|
||||
#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
|
||||
|
Loading…
Reference in New Issue
Block a user